BesTofTrig Class Reference

#include <BesTofTrig.h>

List of all members.

Public Member Functions

 BesTofTrig ()
 ~BesTofTrig ()
void startTofTrig ()
std::vector< int > & GetbHitpos ()
std::vector< int > & GetecapHitpos ()
std::vector< int > & GetwcapHitpos ()

Private Attributes

TofHitCountm_TofHitCount
bool NBTOF1
bool NBTOF2
bool NETOF1
bool NETOF2
bool NTOF1
bool TBB
bool ETBB
std::vector< int > bHitpos
std::vector< int > ecapHitpos
std::vector< int > wcapHitpos
BesGlobalTrigSvcm_pIBGT
IBesGlobalTrigSvcm_tmpSvc


Detailed Description

Definition at line 11 of file BesTofTrig.h.


Constructor & Destructor Documentation

BesTofTrig::BesTofTrig (  ) 

Definition at line 26 of file BesTofTrig.cxx.

References TofHitCount::get_Tof(), and m_TofHitCount.

00027 {
00028   m_TofHitCount = TofHitCount::get_Tof();
00029 }

BesTofTrig::~BesTofTrig (  ) 

Definition at line 30 of file BesTofTrig.cxx.

00031 {
00032 }


Member Function Documentation

std::vector<int>& BesTofTrig::GetbHitpos (  )  [inline]

Definition at line 17 of file BesTofTrig.h.

References bHitpos.

00017 { return bHitpos; }

std::vector<int>& BesTofTrig::GetecapHitpos (  )  [inline]

Definition at line 18 of file BesTofTrig.h.

References ecapHitpos.

00018 { return ecapHitpos; }

std::vector<int>& BesTofTrig::GetwcapHitpos (  )  [inline]

Definition at line 19 of file BesTofTrig.h.

References wcapHitpos.

00019 { return wcapHitpos; }

void BesTofTrig::startTofTrig (  ) 

Definition at line 33 of file BesTofTrig.cxx.

References bHitpos, ecapHitpos, ETBB, TofHitCount::GetbarrelHit1(), TofHitCount::GetbarrelHit2(), TofHitCount::GetecapHit(), BesGlobalTrigSvc::getTofLayerControl(), TofHitCount::GetwcapHit(), genRecEmupikp::i, iter(), m_pIBGT, m_tmpSvc, m_TofHitCount, NBTOF1, NBTOF2, NETOF1, NETOF2, NTOF1, BesGlobalTrigSvc::setBTofBB(), BesGlobalTrigSvc::setBTofHitMap(), BesGlobalTrigSvc::setETofBB(), BesGlobalTrigSvc::setETofHitMap(), BesGlobalTrigSvc::setNBTof1(), BesGlobalTrigSvc::setNBTof2(), BesGlobalTrigSvc::setNETof1(), BesGlobalTrigSvc::setNETof2(), BesGlobalTrigSvc::setNTof1(), BesGlobalTrigSvc::setTofHitPos(), TBB, and wcapHitpos.

Referenced by BesGlobalTrigSvc::startTofTrig().

00034 {
00035 
00036   ISvcLocator* svcLocator = Gaudi::svcLocator();
00037   StatusCode sc = svcLocator->service("BesGlobalTrigSvc", m_tmpSvc);
00038   m_pIBGT = dynamic_cast<BesGlobalTrigSvc* >(m_tmpSvc);
00039 
00040   //reset hit counter
00041   int barHitCount = 0;
00042   int endHitCount = 0;
00043   
00044   NBTOF1 = false;
00045   NBTOF2 = false;
00046   NETOF1 = false;
00047   NETOF2 = false;
00048   NTOF1 = false;
00049  
00050   TBB = false;
00051   ETBB = false;
00052   
00053   bHitpos.clear();
00054   ecapHitpos.clear();
00055   wcapHitpos.clear();
00056   
00057   if(!m_TofHitCount) std::cerr<<"can not get TofHitCount pointer"<<std::endl;
00058   
00059   std::vector<int> barHitmap;
00060   std::vector<int> endHitmap;
00061   std::vector<int> barHitId1;
00062   std::vector<int> barHitId2;
00063   std::vector<int> ecapHitId;
00064   std::vector<int> wcapHitId;
00065   std::vector<int>::iterator iter;
00066   
00067   barHitmap.clear();
00068   endHitmap.clear();
00069   barHitId1.clear();
00070   barHitId2.clear();
00071   ecapHitId.clear();
00072   wcapHitId.clear();
00073 
00074   barHitId1 = m_TofHitCount->GetbarrelHit1();
00075   barHitId2 = m_TofHitCount->GetbarrelHit2();
00076   ecapHitId = m_TofHitCount->GetecapHit();
00077   wcapHitId = m_TofHitCount->GetwcapHit();
00078   
00079   for(unsigned int btofId = 0; btofId < barHitId1.size(); btofId++) barHitmap.push_back(barHitId1[btofId]);
00080   for(unsigned int btofId = 0; btofId < barHitId2.size(); btofId++) barHitmap.push_back(88+barHitId2[btofId]);
00081   for(unsigned int etofId = 0; etofId < ecapHitId.size(); etofId++) endHitmap.push_back(ecapHitId[etofId]);
00082   for(unsigned int etofId = 0; etofId < wcapHitId.size(); etofId++) endHitmap.push_back(48+wcapHitId[etofId]);
00083   //two layer tof in barrel is "or" logic
00084   // -------------------------
00085   // ... |   |   |j+1| j | ...    outer layer
00086   // -------------------------
00087   // ---------------------------
00088   //   ... |   |   | i |   | ...  inner layer
00089   // ---------------------------
00090   // M_i = M_i || M_j || M_j+1
00091   int scinNo;
00092   for(int btofId = 0; btofId < 88; btofId++) {
00093     if(m_pIBGT->getTofLayerControl() == 1) {
00094       if((find(barHitId1.begin(),barHitId1.end(),btofId)!=barHitId1.end()) ) { 
00095          bHitpos.push_back(btofId);
00096       }
00097     }
00098     if(m_pIBGT->getTofLayerControl() == 2) {
00099       if(btofId != 87) {
00100         if((find(barHitId1.begin(),barHitId1.end(),btofId)!=barHitId1.end()) || 
00101            (find(barHitId2.begin(),barHitId2.end(),btofId)!=barHitId2.end()) ||
00102            (find(barHitId2.begin(),barHitId2.end(),btofId+1)!=barHitId2.end()) ) {
00103            bHitpos.push_back(btofId);
00104         }
00105       }
00106       if(btofId == 87) {
00107         if((find(barHitId1.begin(),barHitId1.end(),btofId)!=barHitId1.end()) || 
00108            (find(barHitId2.begin(),barHitId2.end(),btofId)!=barHitId2.end()) ||
00109            (find(barHitId2.begin(),barHitId2.end(),0)!=barHitId2.end()) ) {
00110            bHitpos.push_back(btofId);
00111         }
00112       }
00113     }
00114   }
00115   //hit position in end caps
00116   for(iter=ecapHitId.begin();iter!=ecapHitId.end();iter++)
00117   {
00118     scinNo = (int) (*iter)/2;
00119     if(find(ecapHitpos.begin(),ecapHitpos.end(),scinNo)==ecapHitpos.end())
00120     {
00121       ecapHitpos.push_back(scinNo);
00122     }
00123   }
00124 
00125   for(iter=wcapHitId.begin();iter!=wcapHitId.end();iter++)
00126   {
00127     scinNo = (int)*iter/2;
00128     if(find(wcapHitpos.begin(),wcapHitpos.end(),scinNo)==wcapHitpos.end())
00129     {
00130       wcapHitpos.push_back(scinNo);
00131     }
00132   }
00133 
00134   //Counting the hit number only for NBTOF1, NBTOF2, NETOF1, NETOF1 trigger conditions. Combine contiguous hits as one hit
00135   //barrel
00136   for(int btofId = 0; btofId < 88; btofId++) {
00137     if(btofId == 0) {
00138       if((find(bHitpos.begin(),bHitpos.end(),btofId) != bHitpos.end()) &&
00139          (find(bHitpos.begin(),bHitpos.end(),87) == bHitpos.end())) {
00140         barHitCount++;
00141       }
00142     }
00143     else {
00144       if((find(bHitpos.begin(),bHitpos.end(),btofId) != bHitpos.end()) &&
00145          (find(bHitpos.begin(),bHitpos.end(),btofId-1) == bHitpos.end())) {
00146         barHitCount++;
00147       }
00148     }
00149   }
00150   //endcaps
00151   for(int etofId = 0; etofId < 48; etofId++) {
00152     if(etofId == 0) {
00153       if((find(wcapHitId.begin(),wcapHitId.end(),etofId) != wcapHitId.end()) &&
00154          (find(wcapHitId.begin(),wcapHitId.end(),47) == wcapHitId.end())) {
00155         endHitCount++;
00156       }
00157       if((find(ecapHitId.begin(),ecapHitId.end(),etofId) != ecapHitId.end()) &&
00158          (find(ecapHitId.begin(),ecapHitId.end(),47) == ecapHitId.end())) {
00159         endHitCount++;
00160       }
00161     }
00162     else {
00163       if((find(wcapHitId.begin(),wcapHitId.end(),etofId) != wcapHitId.end()) &&
00164          (find(wcapHitId.begin(),wcapHitId.end(),etofId-1) == wcapHitId.end())) {
00165         endHitCount++;
00166       }
00167       if((find(ecapHitId.begin(),ecapHitId.end(),etofId) != ecapHitId.end()) &&
00168          (find(ecapHitId.begin(),ecapHitId.end(),etofId-1) == ecapHitId.end())) {
00169         endHitCount++;
00170       }
00171     }
00172   }
00173   
00174   if(barHitCount>=1) NBTOF1 = true;
00175   if(barHitCount>=2) NBTOF2 = true;
00176   if(endHitCount>=1) NETOF1 = true;
00177   if(endHitCount>=2) NETOF2 = true;
00178   if((NBTOF1 == true) || (NETOF1 == true)) NTOF1 = true;
00179   
00180   for(iter=bHitpos.begin();iter!=bHitpos.end();iter++)
00181   {
00182     scinNo = *iter;
00183     for(int i=0;i<13;i++)
00184     {
00185       if(scinNo+38+i<88)
00186       {
00187         if(find(bHitpos.begin(),bHitpos.end(),scinNo+38+i)!=bHitpos.end()) TBB = true;
00188       }
00189       if(scinNo+38+i>=88)
00190       {
00191         if(find(bHitpos.begin(),bHitpos.end(),scinNo+38+i-88)!=bHitpos.end()) TBB = true;
00192       }
00193     }
00194   }
00195   for(iter=wcapHitId.begin();iter!=wcapHitId.end();iter++)
00196   {
00197     scinNo = *iter;
00198     for(int i=0;i<9;i++)
00199     {
00200       if(scinNo+20+i<48)
00201       {
00202         if(find(ecapHitId.begin(),ecapHitId.end(),scinNo+20+i)!=ecapHitId.end()) ETBB = true;
00203       }
00204       if(scinNo+20+i>=48)
00205       {
00206         if(find(ecapHitId.begin(),ecapHitId.end(),scinNo+20+i-48)!=ecapHitId.end()) ETBB = true;
00207       }
00208     }
00209   }
00210   map<int,vector<int>,greater<int> > mHitId;
00211   mHitId.clear();
00212   typedef pair<int, vector<int> > vpair;
00213 /*
00214   std::vector<int> bhitmap;
00215   bhitmap.clear();
00216   for(int id = 0; id < barHitId1.size(); id++) {
00217     bhitmap.push_back(barHitId1[id]);
00218   }
00219   for(int id = 0; id < barHitId2.size(); id++) {
00220     bhitmap.push_back(88+barHitId2[id]);
00221   }
00222 */
00223   mHitId.insert(vpair(0,ecapHitpos));
00224   mHitId.insert(vpair(1,bHitpos));
00225   mHitId.insert(vpair(2,wcapHitpos));
00226 
00227   m_pIBGT->setNBTof1(NBTOF1);
00228   m_pIBGT->setNBTof2(NBTOF2);
00229   m_pIBGT->setNETof1(NETOF1);
00230   m_pIBGT->setNETof2(NETOF2);
00231   m_pIBGT->setNTof1(NTOF1);
00232   m_pIBGT->setBTofBB(TBB);
00233   m_pIBGT->setETofBB(ETBB);
00234   m_pIBGT->setTofHitPos(mHitId);
00235   m_pIBGT->setBTofHitMap(barHitmap);
00236   m_pIBGT->setETofHitMap(endHitmap);
00237 }


Member Data Documentation

std::vector<int> BesTofTrig::bHitpos [private]

Definition at line 24 of file BesTofTrig.h.

Referenced by GetbHitpos(), and startTofTrig().

std::vector<int> BesTofTrig::ecapHitpos [private]

Definition at line 25 of file BesTofTrig.h.

Referenced by GetecapHitpos(), and startTofTrig().

bool BesTofTrig::ETBB [private]

Definition at line 23 of file BesTofTrig.h.

Referenced by startTofTrig().

BesGlobalTrigSvc* BesTofTrig::m_pIBGT [private]

Definition at line 28 of file BesTofTrig.h.

Referenced by startTofTrig().

IBesGlobalTrigSvc* BesTofTrig::m_tmpSvc [private]

Definition at line 29 of file BesTofTrig.h.

Referenced by startTofTrig().

TofHitCount* BesTofTrig::m_TofHitCount [private]

Definition at line 21 of file BesTofTrig.h.

Referenced by BesTofTrig(), and startTofTrig().

bool BesTofTrig::NBTOF1 [private]

Definition at line 22 of file BesTofTrig.h.

Referenced by startTofTrig().

bool BesTofTrig::NBTOF2 [private]

Definition at line 22 of file BesTofTrig.h.

Referenced by startTofTrig().

bool BesTofTrig::NETOF1 [private]

Definition at line 22 of file BesTofTrig.h.

Referenced by startTofTrig().

bool BesTofTrig::NETOF2 [private]

Definition at line 22 of file BesTofTrig.h.

Referenced by startTofTrig().

bool BesTofTrig::NTOF1 [private]

Definition at line 22 of file BesTofTrig.h.

Referenced by startTofTrig().

bool BesTofTrig::TBB [private]

Definition at line 23 of file BesTofTrig.h.

Referenced by startTofTrig().

std::vector<int> BesTofTrig::wcapHitpos [private]

Definition at line 26 of file BesTofTrig.h.

Referenced by GetwcapHitpos(), and startTofTrig().


Generated on Tue Nov 29 23:17:36 2016 for BOSS_7.0.2 by  doxygen 1.4.7