BesEmcTrig Class Reference

#include <BesEmcTrig.h>

List of all members.

Public Member Functions

 BesEmcTrig ()
 ~BesEmcTrig ()
void startEmcTrig ()

Private Attributes

EmcESumm_EmcESum
EmcCCountm_EmcCCount
bool BClus_Phi
bool EClus_Phi
bool Clus_Z
bool BClusBB
bool EClusBB
bool BL_BBLK
bool BL_Z
bool Diff_E
bool Diff_B
bool BL_EBLK
bool Etot_L
bool Etot_M
bool BEtot_H
bool EEtot_H
bool NClus1
bool NClus2
bool NBClus1
bool NEClus1
BesGlobalTrigSvcm_pIBGT
IBesGlobalTrigSvcm_tmpSvc


Detailed Description

Definition at line 11 of file BesEmcTrig.h.


Constructor & Destructor Documentation

BesEmcTrig::BesEmcTrig (  ) 

Definition at line 28 of file BesEmcTrig.cxx.

References m_EmcCCount, and m_EmcESum.

00029 {
00030   m_EmcESum = new EmcESum();
00031   m_EmcCCount = new EmcCCount();
00032 //  cout<<"BesEmcTrig output "<<endl;
00033 }

BesEmcTrig::~BesEmcTrig (  ) 

Definition at line 34 of file BesEmcTrig.cxx.

References m_EmcCCount, and m_EmcESum.

00035 {
00036   if(m_EmcESum) delete m_EmcESum;
00037   if(m_EmcCCount) delete m_EmcCCount;
00038 }


Member Function Documentation

void BesEmcTrig::startEmcTrig (  ) 

Definition at line 39 of file BesEmcTrig.cxx.

References abs, BClus_Phi, BClusBB, BEtot_H, BL_BBLK, BL_EBLK, BL_Z, Clus_Z, Diff_B, Diff_E, EClus_Phi, EClusBB, EEtot_H, Etot_L, Etot_M, EmcESum::getBBLKE(), EmcCCount::getBClusterId(), EmcCCount::getBClusterPhi(), EmcESum::getBTotE(), EmcCCount::getClusterId(), EmcCCount::getEClus_Z(), EmcCCount::getEEClusterPhi(), EmcESum::getEETotE(), BesGlobalTrigSvc::getEmcNbCluster(), BesGlobalTrigSvc::getEmcNeeCluster(), BesGlobalTrigSvc::getEmcNweCluster(), EmcESum::getESum(), EmcESum::getETotE(), BesGlobalTrigSvc::getL1BLK_GATE(), BesGlobalTrigSvc::getL1EBL_EC(), BesGlobalTrigSvc::getL1EBL_Z(), BesGlobalTrigSvc::getL1EDIFF_BR(), BesGlobalTrigSvc::getL1EDIFF_EC(), BesGlobalTrigSvc::getL1ETOT_BR(), BesGlobalTrigSvc::getL1ETOT_EC(), BesGlobalTrigSvc::getL1ETOT_L(), BesGlobalTrigSvc::getL1ETOT_M(), EmcESum::getLBTotE(), EmcESum::getLTotE(), EmcESum::getRBTotE(), EmcESum::getRTotE(), EmcESum::getTotE(), EmcCCount::getWClus_Z(), EmcCCount::getWEClusterPhi(), EmcESum::getWETotE(), genRecEmupikp::i, ganga-rec::j, TrigConf::L1BLK_GATE, TrigConf::L1EBL_EC, TrigConf::L1EBL_Z, TrigConf::L1EDIFF_BR, TrigConf::L1EDIFF_EC, TrigConf::L1ETOT_BR, TrigConf::L1ETOT_EC, TrigConf::L1ETOT_L, TrigConf::L1ETOT_M, m_EmcCCount, m_EmcESum, m_pIBGT, m_tmpSvc, NBClus1, NClus1, NClus2, NEClus1, BesGlobalTrigSvc::setBClus_PHI(), BesGlobalTrigSvc::setBClusBB(), BesGlobalTrigSvc::setBEtot_H(), BesGlobalTrigSvc::setBL_BBLK(), BesGlobalTrigSvc::setBL_EBLK(), BesGlobalTrigSvc::setBL_Z(), BesGlobalTrigSvc::setClus_Z(), BesGlobalTrigSvc::setDiff_B(), BesGlobalTrigSvc::setDiff_E(), BesGlobalTrigSvc::setEClus_PHI(), BesGlobalTrigSvc::setEClusBB(), BesGlobalTrigSvc::setEEtot_H(), BesGlobalTrigSvc::setEtot_L(), BesGlobalTrigSvc::setEtot_M(), BesGlobalTrigSvc::setNBClus1(), BesGlobalTrigSvc::setNClus1(), BesGlobalTrigSvc::setNClus2(), BesGlobalTrigSvc::setNEClus1(), TrigConf::TCPHINO_B, TrigConf::TCPHINO_E, and TrigConf::TCTHETANO_B.

Referenced by BesGlobalTrigSvc::startEmcTrig().

00040 {
00041         m_EmcESum->getESum();
00042         m_EmcCCount->getClusterId();
00043         //reset values
00044         NClus1 = false;
00045         NClus2 = false;
00046         NBClus1 = false;
00047         NEClus1 = false;
00048 
00049         BClus_Phi = false;
00050         EClus_Phi = false;
00051         EClusBB = false;
00052         BClusBB = false;
00053         Clus_Z = false;
00054         BL_BBLK = false;
00055         
00056         Etot_L = false;
00057         Etot_M = false;
00058         BEtot_H = false;
00059         EEtot_H = false;
00060         
00061         BL_Z = false;
00062         Diff_E = false;
00063         Diff_B = false;
00064         //BL_BEMC = false; //not used
00065         BL_EBLK = false;
00066         
00067         ISvcLocator* svcLocator = Gaudi::svcLocator();
00068         StatusCode sc = svcLocator->service("BesGlobalTrigSvc", m_tmpSvc);
00069         m_pIBGT = dynamic_cast<BesGlobalTrigSvc* >(m_tmpSvc);
00070 
00071         //set cluster number trigger conditions including barrel and endcaps
00072         int nbcluster = 0, necluster = 0;
00073         nbcluster = m_pIBGT->getEmcNbCluster();
00074         necluster = m_pIBGT->getEmcNweCluster() + m_pIBGT->getEmcNeeCluster();
00075         if((nbcluster + necluster)>=1) NClus1 = true;
00076         if((nbcluster + necluster)>=2) NClus2 = true;
00077         if(nbcluster >= 1) NBClus1 = true;
00078         if(necluster >= 1) NEClus1 = true;
00079 
00080         double L1ETOT_L = double (m_pIBGT->getL1ETOT_L());
00081         double L1ETOT_M = double (m_pIBGT->getL1ETOT_M());
00082         double L1EDIFF_BR = double (m_pIBGT->getL1EDIFF_BR());
00083         double L1EDIFF_EC = double (m_pIBGT->getL1EDIFF_EC());
00084         //middle energy threshold neut_a used
00085         /*for(int i = 0; ; i++) {
00086           double theshold = RandGauss::shoot(m_pIBGT->getL1ETOT_M_Peak(),m_pIBGT->getL1ETOT_M_Sigma());
00087           if(theshold < m_pIBGT->getL1ETOT_M_Peak()) {
00088             L1ETOT_M = theshold;
00089             break;
00090           }
00091         }
00092         for(int i = 0; ; i++) {
00093           double theshold = RandGauss::shoot(m_pIBGT->getL1ETOT_L_Peak(),m_pIBGT->getL1ETOT_L_Sigma());
00094           if(theshold < m_pIBGT->getL1ETOT_L_Peak()) {
00095             L1ETOT_L = theshold;
00096             break;
00097           }
00098         }*/
00099         
00100         if((m_EmcESum->getTotE() > L1ETOT_M) ) Etot_M = true;
00101         //low energy threshold(charge channel used)
00102         if((m_EmcESum->getTotE() > L1ETOT_L) ) Etot_L = true;
00103         //energy balance check for reserved in barrel 
00104         if((std::abs(m_EmcESum->getLBTotE() - m_EmcESum->getRBTotE())<L1EDIFF_BR))
00105         Diff_B = true;
00106         //energy balance check for babar of endcap      
00107         if((std::abs(m_EmcESum->getWETotE() - m_EmcESum->getEETotE())<L1EDIFF_EC))
00108         Diff_E = true;
00109         //High energy threshold in barrel
00110         double L1ETOT_BR = double (m_pIBGT->getL1ETOT_BR());
00111         double L1ETOT_EC = double (m_pIBGT->getL1ETOT_EC());
00112         /*for(int i = 0; ; i++) {
00113           double theshold = RandGauss::shoot(m_pIBGT->getL1ETOT_BR_Peak(),m_pIBGT->getL1ETOT_BR_Sigma());
00114           if( theshold < m_pIBGT->getL1ETOT_BR_Peak()) {
00115             L1ETOT_BR = theshold;
00116             break;
00117           }
00118         }
00119         for(int i = 0; ; i++) {
00120           double theshold = RandGauss::shoot(m_pIBGT->getL1ETOT_EC_Peak(),m_pIBGT->getL1ETOT_EC_Sigma());
00121           if(theshold < m_pIBGT->getL1ETOT_EC_Peak()) {
00122             L1ETOT_EC = theshold;
00123             break;
00124           }
00125         }*/
00126         if((m_EmcESum->getBTotE()>L1ETOT_BR)) BEtot_H = true;
00127         //High energy threshold(for babar trigger condition) 
00128         if((m_EmcESum->getETotE()>L1ETOT_EC)) EEtot_H = true;
00129         //energy balance check for reserved in barrel
00130         //double L1EBL_BR = m_pIBGT->getL1EBL_BR();
00131         //if(m_EmcESum->GetLBTotE() > L1EBL_BR && m_EmcESum->GetRBTotE() > L1EBL_BR)
00132         //BL_BEMC = true;
00133         //energy balance check for babar of endcap
00134         double L1EBL_EC = double (m_pIBGT->getL1EBL_EC());
00135         if((m_EmcESum->getWETotE()>L1EBL_EC && m_EmcESum->getEETotE()>L1EBL_EC))
00136         BL_EBLK = true;
00137 
00138         //check balance condition of block energy for babar trigger 
00139         double energy0 = m_EmcESum->getBBLKE(0);
00140         double energy1 = m_EmcESum->getBBLKE(1);
00141         double energy2 = m_EmcESum->getBBLKE(2);
00142         double energy3 = m_EmcESum->getBBLKE(3);
00143         double energy4 = m_EmcESum->getBBLKE(4);
00144         double energy5 = m_EmcESum->getBBLKE(5);
00145         double energy9 = m_EmcESum->getBBLKE(9);
00146         double energy10 = m_EmcESum->getBBLKE(10);
00147         double energy6 = m_EmcESum->getBBLKE(6);
00148         double energy11 = m_EmcESum->getBBLKE(11);
00149         double energy7 = m_EmcESum->getBBLKE(7);
00150         double energy8 = m_EmcESum->getBBLKE(8);
00151         double L1BLK_GATE = double (m_pIBGT->getL1BLK_GATE());
00152         if((energy0+energy1)>L1BLK_GATE && (energy9+energy10)>L1BLK_GATE)
00153           BL_BBLK = true;
00154         if((energy1+energy2)>L1BLK_GATE && (energy10+energy11)>L1BLK_GATE)
00155           BL_BBLK = true;
00156         if((energy2+energy3)>L1BLK_GATE && (energy11+energy6)>L1BLK_GATE)
00157           BL_BBLK = true;
00158         if((energy3+energy4)>L1BLK_GATE && (energy6+energy7)>L1BLK_GATE)
00159           BL_BBLK = true;
00160         if((energy4+energy5)>L1BLK_GATE && (energy7+energy8)>L1BLK_GATE)
00161           BL_BBLK = true;
00162         if((energy5+energy0)>L1BLK_GATE && (energy8+energy9)>L1BLK_GATE)
00163           BL_BBLK = true;
00164         //double WEenergy1 = m_EmcESum->getWEBLKE(0);
00165         //double WEenergy2 = m_EmcESum->getWEBLKE(1);
00166         //double EEenergy1 = m_EmcESum->getEEBLKE(0);
00167         //double EEenergy2 = m_EmcESum->getEEBLKE(1);
00168         //if(((WEenergy1>L1BLK_GATE || WEenergy2>L1BLK_GATE) && (EEenergy1>L1BLK_GATE || EEenergy2>L1BLK_GATE)) ) BL_BBLK = true;
00169 
00170         //check cluster balance in phi of barral
00171         for(int j =0;j<TrigConf::TCPHINO_B;j++)
00172         {
00173           int bphi = m_EmcCCount->getBClusterPhi(j);
00174           if(bphi==0) continue;
00175           if(bphi==1)
00176           {
00177             int NCluster = 0;
00178             for(int k =0;k<15;k++)
00179             {
00180               if((8+k+j)<TrigConf::TCPHINO_B)      
00181                 NCluster+=m_EmcCCount->getBClusterPhi(8+k+j);
00182               else
00183                 NCluster+=m_EmcCCount->getBClusterPhi(8+k+j-TrigConf::TCPHINO_B);
00184               if(NCluster>=1)
00185               {
00186                 BClus_Phi = true;
00187                 break;
00188                }
00189             }
00190             if(BClus_Phi == true)
00191               break;
00192           }
00193         }
00194                 
00195         //check cluster balance in phi of endcap.
00196         for(int j = 0;j<TrigConf::TCPHINO_E/2;j++)
00197         {
00198           int wephi = m_EmcCCount->getWEClusterPhi(j);
00199           if(wephi == 0)  continue;
00200           if(wephi == 1)
00201           {
00202             int NCluster = 0;
00203             for(int k=0;k<7;k++)
00204             {
00205               if((j+5+k)<TrigConf::TCPHINO_E/2)
00206                 NCluster+= m_EmcCCount->getEEClusterPhi(j+5+k);
00207               else 
00208                 NCluster+= m_EmcCCount->getEEClusterPhi(j+5+k-TrigConf::TCPHINO_E/2);
00209               if(NCluster>=1)
00210               {
00211                 EClus_Phi = true;
00212                 break;
00213               }
00214             }
00215             if(EClus_Phi == true)
00216               break;
00217           }
00218         }
00219 
00220         //check barrel cluster balance in theta and phi for babar trigger
00221         for(int i=0;i<TrigConf::TCTHETANO_B;i++)
00222           for(int j=0;j<TrigConf::TCPHINO_B;j++)
00223           {
00224             int BClusId = m_EmcCCount->getBClusterId(i,j);
00225             int NCluster = 0;
00226             if(BClusId==0) continue;
00227             else
00228             {
00229               if(i>0&&i<(TrigConf::TCTHETANO_B-1))
00230               {
00231                 for(int k=0;k<5;k++)
00232                 {
00233                   if(j+13+k<TrigConf::TCPHINO_B) 
00234                   {
00235                     NCluster+= m_EmcCCount->getBClusterId((TrigConf::TCTHETANO_B-1)-i,j+13+k);
00236                     NCluster+= m_EmcCCount->getBClusterId((TrigConf::TCTHETANO_B-1)-i+1,j+13+k);
00237                     NCluster+= m_EmcCCount->getBClusterId((TrigConf::TCTHETANO_B-1)-i-1,j+13+k);
00238                   }
00239                   else
00240                   {
00241                     NCluster+= m_EmcCCount->getBClusterId((TrigConf::TCTHETANO_B-1)-i,j+13+k-TrigConf::TCPHINO_B);
00242                     NCluster+= m_EmcCCount->getBClusterId((TrigConf::TCTHETANO_B-1)-i+1,j+13+k-TrigConf::TCPHINO_B);
00243                     NCluster+= m_EmcCCount->getBClusterId((TrigConf::TCTHETANO_B-1)-i-1,j+13+k-TrigConf::TCPHINO_B);
00244                   }
00245                 }
00246                 if(NCluster>0) { BClusBB = true; break; }
00247               }
00248               if(i==0) 
00249               {
00250                 for(int k=0;k<5;k++)
00251                 {
00252                   if(j+13+k<TrigConf::TCPHINO_B)                                      
00253                   {                                                  
00254                     NCluster+= m_EmcCCount->getBClusterId((TrigConf::TCTHETANO_B-1),j+13+k);
00255                     NCluster+= m_EmcCCount->getBClusterId((TrigConf::TCTHETANO_B-2),j+13+k);
00256                   }                                                  
00257                   else                                               
00258                   {                                                  
00259                     NCluster+= m_EmcCCount->getBClusterId((TrigConf::TCTHETANO_B-2),j+13+k-TrigConf::TCPHINO_B);
00260                     NCluster+= m_EmcCCount->getBClusterId((TrigConf::TCTHETANO_B-1),j+13+k-TrigConf::TCPHINO_B);
00261                   }                                                  
00262                 }
00263                 if(NCluster>0) { BClusBB = true; break; }
00264               }
00265               if(i==(TrigConf::TCTHETANO_B-1)) 
00266               {
00267                 for(int k=0;k<5;k++)
00268                 {
00269                   if(j+13+k<TrigConf::TCPHINO_B)                                      
00270                   {                                                  
00271                     NCluster+= m_EmcCCount->getBClusterId(0,j+13+k);
00272                     NCluster+= m_EmcCCount->getBClusterId(1,j+13+k);
00273                   }                                                  
00274                   else                                               
00275                   {                                                  
00276                     NCluster+= m_EmcCCount->getBClusterId(0,j+13+k-TrigConf::TCPHINO_B);
00277                     NCluster+= m_EmcCCount->getBClusterId(1,j+13+k-TrigConf::TCPHINO_B);
00278                   }                                                  
00279                 }
00280                 if(NCluster>0) { BClusBB = true; break; }
00281               }
00282             }
00283           }
00284         //check endcap cluster balance in phi for babar trigger
00285         for(int j = 0;j<TrigConf::TCPHINO_E/2;j++)
00286         {
00287           int NCluster = 0; 
00288           int EClusId = m_EmcCCount->getWEClusterPhi(j);
00289           
00290           if(EClusId == 0)  continue;
00291           else 
00292           {
00293             
00294             for(int k=0;k<3;k++)
00295             {
00296               if((j+7+k)<TrigConf::TCPHINO_E/2)
00297                 NCluster+= m_EmcCCount->getEEClusterPhi(j+7+k);
00298               else 
00299                 NCluster+= m_EmcCCount->getEEClusterPhi(j+7+k-TrigConf::TCPHINO_E/2);
00300               if(NCluster>=1)
00301               {
00302                 EClusBB = true;
00303                 break;
00304               }
00305             }
00306             if(EClusBB == true)
00307               break;
00308           }
00309         }
00310         //z energy balance (B+E)
00311         double L1EBL_Z = double (m_pIBGT->getL1EBL_Z());
00312         /*for(int i = 0; ; i++) {
00313           double theshold = RandGauss::shoot(m_pIBGT->getL1EBL_Z_Peak(),m_pIBGT->getL1EBL_Z_Sigma());
00314           if(theshold < m_pIBGT->getL1EBL_Z_Peak()) {
00315             L1EBL_Z = theshold;
00316             break;
00317           }
00318         }*/
00319         if((m_EmcESum->getRTotE()>=L1EBL_Z && m_EmcESum->getLTotE()>=L1EBL_Z))
00320         BL_Z = true;
00321 //      cout<<"RTotE and LTotE are "<<m_EmcESum->GetRTotE()<<" "<<m_EmcESum->GetLTotE()<<endl;
00322 //
00323         //z cluster balance (if one cluster is found in each side ,return true)
00324         if(m_EmcCCount->getEClus_Z()&&m_EmcCCount->getWClus_Z())
00325         Clus_Z = true;
00326 
00327         //set trigger conditions in service
00328 
00329         m_pIBGT->setNClus1(NClus1);
00330         m_pIBGT->setNClus2(NClus2);
00331         m_pIBGT->setNBClus1(NBClus1);
00332         m_pIBGT->setNEClus1(NEClus1);
00333 
00334         m_pIBGT->setBClusBB(BClusBB);
00335         m_pIBGT->setEClusBB(EClusBB);
00336         m_pIBGT->setClus_Z(Clus_Z);
00337         m_pIBGT->setBClus_PHI(BClus_Phi);
00338         m_pIBGT->setEClus_PHI(EClus_Phi);
00339         m_pIBGT->setBEtot_H(BEtot_H);
00340         m_pIBGT->setEEtot_H(EEtot_H);
00341         m_pIBGT->setEtot_L(Etot_L);
00342         m_pIBGT->setEtot_M(Etot_M);
00343         m_pIBGT->setBL_Z(BL_Z);
00344         m_pIBGT->setDiff_B(Diff_B);
00345         m_pIBGT->setDiff_E(Diff_E);
00346         m_pIBGT->setBL_BBLK(BL_BBLK);
00347         m_pIBGT->setBL_EBLK(BL_EBLK);
00348 }


Member Data Documentation

bool BesEmcTrig::BClus_Phi [private]

Definition at line 23 of file BesEmcTrig.h.

Referenced by startEmcTrig().

bool BesEmcTrig::BClusBB [private]

Definition at line 23 of file BesEmcTrig.h.

Referenced by startEmcTrig().

bool BesEmcTrig::BEtot_H [private]

Definition at line 25 of file BesEmcTrig.h.

Referenced by startEmcTrig().

bool BesEmcTrig::BL_BBLK [private]

Definition at line 23 of file BesEmcTrig.h.

Referenced by startEmcTrig().

bool BesEmcTrig::BL_EBLK [private]

Definition at line 24 of file BesEmcTrig.h.

Referenced by startEmcTrig().

bool BesEmcTrig::BL_Z [private]

Definition at line 24 of file BesEmcTrig.h.

Referenced by startEmcTrig().

bool BesEmcTrig::Clus_Z [private]

Definition at line 23 of file BesEmcTrig.h.

Referenced by startEmcTrig().

bool BesEmcTrig::Diff_B [private]

Definition at line 24 of file BesEmcTrig.h.

Referenced by startEmcTrig().

bool BesEmcTrig::Diff_E [private]

Definition at line 24 of file BesEmcTrig.h.

Referenced by startEmcTrig().

bool BesEmcTrig::EClus_Phi [private]

Definition at line 23 of file BesEmcTrig.h.

Referenced by startEmcTrig().

bool BesEmcTrig::EClusBB [private]

Definition at line 23 of file BesEmcTrig.h.

Referenced by startEmcTrig().

bool BesEmcTrig::EEtot_H [private]

Definition at line 25 of file BesEmcTrig.h.

Referenced by startEmcTrig().

bool BesEmcTrig::Etot_L [private]

Definition at line 25 of file BesEmcTrig.h.

Referenced by startEmcTrig().

bool BesEmcTrig::Etot_M [private]

Definition at line 25 of file BesEmcTrig.h.

Referenced by startEmcTrig().

EmcCCount* BesEmcTrig::m_EmcCCount [private]

Definition at line 21 of file BesEmcTrig.h.

Referenced by BesEmcTrig(), startEmcTrig(), and ~BesEmcTrig().

EmcESum* BesEmcTrig::m_EmcESum [private]

Definition at line 20 of file BesEmcTrig.h.

Referenced by BesEmcTrig(), startEmcTrig(), and ~BesEmcTrig().

BesGlobalTrigSvc* BesEmcTrig::m_pIBGT [private]

Definition at line 28 of file BesEmcTrig.h.

Referenced by startEmcTrig().

IBesGlobalTrigSvc* BesEmcTrig::m_tmpSvc [private]

Definition at line 29 of file BesEmcTrig.h.

Referenced by startEmcTrig().

bool BesEmcTrig::NBClus1 [private]

Definition at line 26 of file BesEmcTrig.h.

Referenced by startEmcTrig().

bool BesEmcTrig::NClus1 [private]

Definition at line 26 of file BesEmcTrig.h.

Referenced by startEmcTrig().

bool BesEmcTrig::NClus2 [private]

Definition at line 26 of file BesEmcTrig.h.

Referenced by startEmcTrig().

bool BesEmcTrig::NEClus1 [private]

Definition at line 26 of file BesEmcTrig.h.

Referenced by startEmcTrig().


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