BOSS 6.6.4.p01
BESIII Offline Software System
Loading...
Searching...
No Matches
EmcSelBhaEvent Class Reference

#include <EmcSelBhaEvent.h>

+ Inheritance diagram for EmcSelBhaEvent:

Public Types

enum  { m_oneProng =1 , m_twoProng =2 }
 

Public Member Functions

 EmcSelBhaEvent (const std::string &name, ISvcLocator *pSvcLocator)
 
 ~EmcSelBhaEvent ()
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 
bool passed ()
 
void setPassed (bool passed)
 
int selectedType () const
 
int selectedTrkID1 () const
 
int selectedTrkID2 () const
 
int index (int theta, int phi) const
 
void initGeom ()
 
StatusCode SelectBhabha ()
 
void FillBhabha ()
 
void CollectBhabha ()
 
void OutputMV ()
 
double LAT (EmcShower *theShower)
 
double findPhiDiff (double phi1, double phi2)
 
void readCorFun ()
 
void readEsigma ()
 
void readDepEneFun ()
 
void readSigmaExp ()
 
void readRawPeakIxtal ()
 
double Angle2ClosestShower (int ShowerID)
 

Detailed Description

Definition at line 55 of file EmcSelBhaEvent.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
m_oneProng 
m_twoProng 

Definition at line 60 of file EmcSelBhaEvent.h.

Constructor & Destructor Documentation

◆ EmcSelBhaEvent()

EmcSelBhaEvent::EmcSelBhaEvent ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 80 of file EmcSelBhaEvent.cxx.

81 :Algorithm(name, pSvcLocator),
82 m_vr0cut(1.0),
83 m_vz0cut(5.0),
84 m_lowEnergyShowerCut(0.1),
85 m_highEnergyShowerCut(0.5),
86 m_matchThetaCut(0.2),
87 m_matchPhiCut(0.2),
88 m_highMomentumCut(0.5),
89 m_EoPMaxCut(1.3),
90 m_EoPMinCut(0.6),
91 m_minAngShEnergyCut(0.2),
92 m_minAngCut(0.3),
93 m_acolliCut(0.03),
94 m_eNormCut(0.5),
95 m_pNormCut(0.5),
96 m_oneProngMomentumCut(1.2),
97
98 m_digiRangeCut(6),
99 m_ShEneThreshCut(0.02),
100 m_ShEneLeptonCut(1.),
101 m_minNrXtalsShowerCut(10),
102 m_maxNrXtalsShowerCut(70),
103 m_phiDiffMinCut(0.05),
104 m_phiDiffMaxCut(0.2),
105 m_nrShThreshCut(20),
106 m_thetaDiffCut(0.04),
107 m_LATCut(0.8),
108
109 m_showersAccepted(0),
110 //--------------------
111 m_writeMVToFile(true),
112 m_fileExt(""),
113 m_inputFileDir("../InputData/"),
114 m_fileDir("/ihepbatch/besdata/public/liucx/Calib/"),
115 m_nXtals(6240),
116 m_sigmaCut(1.),
117 m_beamEnergy(1.843),
118 m_MsgFlag(0)
119
120{
121
122 // Declare the properties
123
124
125 declareProperty ("Vr0cut", m_vr0cut); // suggest cut: |z0|<5cm && r0<1cm
126 declareProperty ("Vz0cut", m_vz0cut);
127
128 declareProperty ("lowEnergyShowerCut", m_lowEnergyShowerCut);
129 declareProperty ("highEnergyShowerCut", m_highEnergyShowerCut);
130 declareProperty ("matchThetaCut", m_matchThetaCut);
131 declareProperty ("matchPhiCut", m_matchPhiCut);
132
133 declareProperty ("highMomentumCut", m_highMomentumCut);
134 declareProperty ("EoPMaxCut", m_EoPMaxCut);
135 declareProperty ("EoPMinCut", m_EoPMinCut);
136 declareProperty ("minAngShEnergyCut", m_minAngShEnergyCut);
137 declareProperty ("minAngCut", m_minAngCut);
138 declareProperty ("acolliCut", m_acolliCut);
139 declareProperty ("eNormCut", m_eNormCut);
140 declareProperty ("pNormCut", m_pNormCut);
141 declareProperty ("oneProngMomentumCut", m_oneProngMomentumCut);
142
143 // *
144
145 declareProperty("digiRangeCut", m_digiRangeCut);
146
147 declareProperty("ShEneThreshCut", m_ShEneThreshCut);
148 declareProperty("ShEneLeptonCut", m_ShEneLeptonCut);
149
150 declareProperty("minNrXtalsShowerCut", m_minNrXtalsShowerCut);
151 declareProperty("maxNrXtalsShowerCut", m_maxNrXtalsShowerCut);
152 declareProperty("phiDiffMinCut", m_phiDiffMinCut);
153 declareProperty("phiDiffMaxCut", m_phiDiffMaxCut);
154 declareProperty("nrShThreshCut", m_nrShThreshCut);
155 declareProperty("thetaDiffCut", m_thetaDiffCut);
156 declareProperty("LATCut", m_LATCut);
157
158 //--------------------
159 declareProperty("writeMVToFile", m_writeMVToFile);
160 declareProperty("fileExt", m_fileExt);
161 declareProperty("fileDir", m_fileDir);
162 declareProperty("inputFileDir", m_inputFileDir);
163 declareProperty("sigmaCut", m_sigmaCut);
164 declareProperty("ReadBeamEFromDB", m_ReadBeamEFromDB = false );
165
166 declareProperty("beamEnergy", m_beamEnergy);
167
168 declareProperty("MsgFlag", m_MsgFlag);
169
170
171 int j = 0;
172 m_index = new int*[56];
173 for (j=0;j<56;j++ ) {
174 m_index[j] = new int[120];
175 for ( int k=0; k<120; k++) {
176 m_index[j][k]=-1;
177 }
178 }
179
180 m_iGeoSvc=0;
181
182 for (int i=0; i<6240;i++)
183 {
184 m_inputConst[i] = 1.0;
185 }
186
187 m_irun=0;
188}

◆ ~EmcSelBhaEvent()

EmcSelBhaEvent::~EmcSelBhaEvent ( )

Definition at line 193 of file EmcSelBhaEvent.cxx.

193 {
194
195 if ( m_index != 0 ) {
196 for (int i =0; i<56; i++ )
197 delete[] m_index[i];
198 delete[] m_index;
199 m_index = 0;
200 }
201
202
203}

Member Function Documentation

◆ Angle2ClosestShower()

double EmcSelBhaEvent::Angle2ClosestShower ( int  ShowerID)

Definition at line 1544 of file EmcSelBhaEvent.cxx.

1544 {
1545
1546 double minDist=999;
1547
1548 SmartDataPtr<EvtRecEvent> evtRecEvent(eventSvc(), EventModel::EvtRec::EvtRecEvent);
1549 SmartDataPtr<EvtRecTrackCol> evtRecTrkCol(eventSvc(), EventModel::EvtRec::EvtRecTrackCol);
1550
1551 EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + ShowerID;
1552
1553 RecEmcShower *theShower = (*itTrk)->emcShower();
1554 HepLorentzVector theShowerVec(1,1,1,1);
1555 theShowerVec.setTheta(theShower->theta());
1556 theShowerVec.setPhi(theShower->phi());
1557 theShowerVec.setRho(theShower->energy());
1558 theShowerVec.setE(theShower->energy());
1559
1560 for(int j = 0; j < evtRecEvent->totalTracks(); j++){
1561 EvtRecTrackIterator jtTrk=evtRecTrkCol->begin() + j;
1562
1563 if(!(*jtTrk)->isEmcShowerValid()) continue;
1564 if (ShowerID == (*jtTrk)->trackId()) continue;
1565
1566 RecEmcShower *aShower = (*jtTrk)->emcShower();
1567
1568 if (aShower->energy() > m_minAngShEnergyCut ){
1569
1570 HepLorentzVector aShowerVec(1,1,1,1);
1571 aShowerVec.setTheta(aShower->theta());
1572 aShowerVec.setPhi(aShower->phi());
1573 aShowerVec.setRho(aShower->energy());
1574 aShowerVec.setE(aShower->energy());
1575
1576 double dist = theShowerVec.angle(aShowerVec);
1577
1578 if ( dist < minDist )
1579 minDist = dist;
1580
1581 }
1582
1583 }
1584
1585 return minDist;
1586}
EvtRecTrackCol::iterator EvtRecTrackIterator
Definition: EvtRecTrack.h:111
double theta() const
Definition: DstEmcShower.h:38
double phi() const
Definition: DstEmcShower.h:39
double energy() const
Definition: DstEmcShower.h:45
_EXTERN_ std::string EvtRecEvent
Definition: EventModel.h:111
_EXTERN_ std::string EvtRecTrackCol
Definition: EventModel.h:112

◆ CollectBhabha()

void EmcSelBhaEvent::CollectBhabha ( )

Definition at line 882 of file EmcSelBhaEvent.cxx.

882 {
883
884 MsgStream log(msgSvc(), name());
885
886 //check if the Bhabhas were found
887 if ( 0 != myBhaEvt->positron()->found() ||
888 0 != myBhaEvt->electron()->found() ) {
889
890 m_taken++;
891 //fill the EmcBhabhas
892 double calibEnergy=0.;
893 double energyError=0.;
894
895 //------------- electron found --------------------------------------
896 if (myBhaEvt->electron()->found() ) {
897 /*
898 int ixtalIndex = index(myBhaEvt->electron()->thetaIndex(),
899 myBhaEvt->electron()->phiIndex());
900 calibEnergy = m_eMcPeak[ixtalIndex];
901 */
902
903 unsigned int module, ntheta, nphi;
904 if ( myBhaEvt->electron()->thetaIndex()<=5) {
905 module=0;
906 ntheta=myBhaEvt->electron()->thetaIndex();
907
908 } else if ( myBhaEvt->electron()->thetaIndex()>=50){
909 module=2;
910 ntheta=55-myBhaEvt->electron()->thetaIndex();
911
912 } else {
913 module=1;
914 ntheta=myBhaEvt->electron()->thetaIndex()-6;
915 }
916 nphi=myBhaEvt->electron()->phiIndex();
917
918
919 RecEmcID shId= EmcID::crystal_id(module,ntheta,nphi);
920 HepPoint3D SeedPos(0,0,0);
921 SeedPos=m_iGeoSvc->GetCFrontCenter(shId);
922
923 calibEnergy = myBhaEvt->
924 getDepoMCShowerEnergy_lab(SeedPos.theta(),
925 SeedPos.phi(),
926 myBhaEvt->electron()->thetaIndex(),
927 myBhaEvt->electron()->phiIndex(),
928 m_corFun[myBhaEvt->electron()->thetaIndex()],
929 m_beamEnergy);
930
931 /*
932 calibEnergy = myBhaEvt->
933 getDepoMCShowerEnergy(myBhaEvt->electron()->thetaIndex(),
934 myBhaEvt->electron()->phiIndex(),
935 m_corFun[myBhaEvt->electron()->thetaIndex()],
936 m_beamEnergy);
937 */
938
939 if ( calibEnergy > 0 ) {
940
941 energyError = myBhaEvt->
942 getErrorDepoMCShowerEnergy(myBhaEvt->electron()->thetaIndex(),
943 myBhaEvt->electron()->phiIndex(),
944 m_eSigma[myBhaEvt->electron()->thetaIndex()]);
945
946 } else
947 log << MSG::WARNING << " Did not find MC deposited cluster energy "
948 <<" for this cluster: thetaInd: "
949 << myBhaEvt->electron()->thetaIndex()
950 << " phiInd: "
951 << myBhaEvt->electron()->phiIndex()
952 << endl
953 << "Will not use this cluster for the Emc "
954 << "Bhabha calibration !"
955 << endreq;
956
957 //set all that stuff in an EmcBhabha
958 myBhaEvt->setElectron()->setErrorOnCalibEnergy(energyError);
959 myBhaEvt->setElectron()->setCalibEnergy(calibEnergy);
960
961 //myBhaEvt->electron()->print();
962
963 } else
964 log << MSG::INFO<< name()
965 << ": Electron was not selected ! "
966 << endreq;
967
968 calibEnergy=0.;
969 energyError=0.;
970
971 //---------------- positron found ----------------------------------
972 if (myBhaEvt->positron()->found() ) {
973 /*
974 int ixtalIndex = index(myBhaEvt->positron()->thetaIndex(),
975 myBhaEvt->positron()->phiIndex());
976 calibEnergy = m_eMcPeak[ixtalIndex];
977 */
978
979 unsigned int module, ntheta, nphi;
980 if ( myBhaEvt->positron()->thetaIndex()<=5) {
981 module=0;
982 ntheta=myBhaEvt->positron()->thetaIndex();
983
984 } else if ( myBhaEvt->positron()->thetaIndex()>=50){
985 module=2;
986 ntheta=55-myBhaEvt->positron()->thetaIndex();
987
988 } else {
989 module=1;
990 ntheta=myBhaEvt->positron()->thetaIndex()-6;
991 }
992 nphi=myBhaEvt->positron()->phiIndex();
993
994
995 RecEmcID shId= EmcID::crystal_id(module,ntheta,nphi);
996 HepPoint3D SeedPos(0,0,0);
997 SeedPos=m_iGeoSvc->GetCFrontCenter(shId);
998
999 calibEnergy = myBhaEvt->
1000 getDepoMCShowerEnergy_lab(SeedPos.theta(),
1001 SeedPos.phi(),
1002 myBhaEvt->positron()->thetaIndex(),
1003 myBhaEvt->positron()->phiIndex(),
1004 m_corFun[myBhaEvt->positron()->thetaIndex()],
1005 m_beamEnergy);
1006
1007 /*
1008 calibEnergy = myBhaEvt->
1009 getDepoMCShowerEnergy(myBhaEvt->positron()->thetaIndex(),
1010 myBhaEvt->positron()->phiIndex(),
1011 m_corFun[myBhaEvt->positron()->thetaIndex()],
1012 m_beamEnergy);
1013 */
1014
1015 if ( calibEnergy > 0. ) {
1016
1017 energyError = myBhaEvt->
1018 getErrorDepoMCShowerEnergy(myBhaEvt->positron()->thetaIndex(),
1019 myBhaEvt->positron()->phiIndex(),
1020 m_eSigma[myBhaEvt->positron()->thetaIndex()]);
1021
1022 } else
1023 log << MSG::WARNING << " Did not find MC deposited cluster energy "
1024 << "for this cluster: thetaInd: "
1025 << myBhaEvt->positron()->thetaIndex()
1026 << " phiInd: "
1027 << myBhaEvt->positron()->phiIndex()
1028 << endl
1029 << "Will not use this cluster for the Emc "
1030 << "Bhabha calibration !"
1031 << endreq;
1032
1033
1034 //set all that stuff in an EmcBhabha
1035 myBhaEvt->setPositron()->setErrorOnCalibEnergy(energyError);
1036 myBhaEvt->setPositron()->setCalibEnergy(calibEnergy);
1037
1038 //myBhaEvt->positron()->print();
1039
1040 } else
1041 log << MSG::INFO << name()
1042 << ": Positron was not selected ! "
1043 << endreq;
1044
1045 //calculate elements of Matrix M and vector R from Bhabha event,
1046 //M is in SLAP triad format
1047 fillMatrix();
1048
1049 } else {
1050 log << MSG::WARNING << " No Bhabha data for calibration found in event !"
1051 << endreq;
1052
1053 }
1054
1055}
IMessageSvc * msgSvc()
EmcBhabha * setElectron()
EmcBhabha * positron() const
EmcBhabha * setPositron()
EmcBhabha * electron() const
void setCalibEnergy(double energy)
Definition: EmcBhabha.h:90
const bool & found()
Definition: EmcBhabha.h:43
void setErrorOnCalibEnergy(double error)
Definition: EmcBhabha.h:91
const unsigned int & thetaIndex() const
Definition: EmcBhabha.h:73
const unsigned int & phiIndex() const
Definition: EmcBhabha.h:78
static Identifier crystal_id(const unsigned int barrel_ec, const unsigned int theta_module, const unsigned int phi_module)
For a single crystal.
Definition: EmcID.cxx:71
virtual HepPoint3D GetCFrontCenter(const Identifier &id) const =0

Referenced by execute().

◆ execute()

StatusCode EmcSelBhaEvent::execute ( )

Definition at line 294 of file EmcSelBhaEvent.cxx.

294 {
295
296 MsgStream log(msgSvc(), name());
297 log << MSG::DEBUG << "in execute()" << endreq;
298
299 //create the object that store the needed data of the Bhabha event
300
301 int event, run;
302
303 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
304
305 run=eventHeader->runNumber();
306 event=eventHeader->eventNumber();
307 //cout<<"---------"<<event<<".........."<<run<<endl;
308 m_events++;
309 m_run = run;
310
311
312 //////////////////
313 // get beam energy
314 //////////////////
315 if(m_ReadBeamEFromDB&&m_irun!=run){
316 m_irun=run;
317 if(m_readDb.isRunValid(m_irun))
318 m_beamEnergy=m_readDb.getbeamE(m_irun);
319 // cout<< "beamEnergy="<< m_beamEnergy<<endl;
320 double the=0.011;
321 double phi=0;
322 HepLorentzVector ptrk;
323 ptrk.setPx(m_beamEnergy*sin(the)*cos(phi));
324 ptrk.setPy(m_beamEnergy*sin(the)*sin(phi));
325 ptrk.setPz(m_beamEnergy*cos(the));
326 ptrk.setE(m_beamEnergy);
327
328 ptrk=ptrk.boost(-0.011,0,0);
329
330 cout<< "beamEnergy="<< m_beamEnergy<<" cms "<<ptrk.e()<<" ratio="<< (m_beamEnergy-ptrk.e())/ptrk.e()<<endl;
331 m_beamEnergy=ptrk.e();
332 }
333
334 ////////////
335
336 myBhaEvt = new EmcBhabhaEvent();
337
338 //Select Bhabha
339 SelectBhabha();
340 if(m_selectedType == BhabhaType::OneProng) m_OneProng++;
341 //number of events with TwoProngMatched
342 if(m_selectedType == BhabhaType::TwoProngMatched) m_TwoProngMatched++;
343 //number of events with TwoProngOneMatched
344 if(m_selectedType == BhabhaType::TwoProngOneMatched) m_TwoProngOneMatched++;
345
346 if(m_selectedType == BhabhaType::Nothing){
347 m_Nothing++;
348 }
349
350 //retreive shower list of event
351
352 if (m_selectedType == BhabhaType::TwoProngMatched) {
353 FillBhabha();
354
355 //collect bhabha event for digi-calibration of EMC
356 //and fill matrix and vector of system of linear equations
358 }
359
360 delete myBhaEvt;
361 myBhaEvt=0;
362
363 return StatusCode::SUCCESS;
364}
double sin(const BesAngle a)
Definition: BesAngle.h:210
double cos(const BesAngle a)
Definition: BesAngle.h:213
StatusCode SelectBhabha()

◆ FillBhabha()

void EmcSelBhaEvent::FillBhabha ( )

Definition at line 622 of file EmcSelBhaEvent.cxx.

622 {
623
624 MsgStream log(msgSvc(), name());
625
626 SmartDataPtr<EvtRecEvent> evtRecEvent(eventSvc(), EventModel::EvtRec::EvtRecEvent);
627 SmartDataPtr<EvtRecTrackCol> evtRecTrkCol(eventSvc(), EventModel::EvtRec::EvtRecTrackCol);
628
629 EvtRecTrackIterator itTrk1 = evtRecTrkCol->begin() + m_selectedTrkID1;
630
631 RecEmcShower *theShower1 = (*itTrk1)->emcShower();
632 //RecMdcTrack *theMdcTrk1 = (*itTrk1)->mdcTrack();
633
634 EvtRecTrackIterator itTrk2 = evtRecTrkCol->begin() + m_selectedTrkID2;
635
636 RecEmcShower *theShower2 = (*itTrk2)->emcShower();
637 //RecMdcTrack *theMdcTrk2 = (*itTrk2)->mdcTrack();
639 RecEmcShower *theShower;
640
641
642 // * * * * * * * * * * * * * * * * * * * * * * * * * ** * ** *
643 //loop all showers of an event set EmcShower and EmcShDigi
644
645 EmcShower* aShower =new EmcShower();
646
647 double ene,theta,phi,eseed;
648 double showerX,showerY,showerZ;
649 long int thetaIndex,phiIndex,numberOfDigis;
650
651 RecEmcID showerId;
652 unsigned int showerModule;
653
654 HepPoint3D showerPosition(0,0,0);
655
656 if ( ! m_showerList.empty()) m_showerList.clear();
657
658 for (int ish=0; ish<2; ish++){
659
660 if (ish==0) {
661 itTrk= itTrk1;
662 theShower=theShower1;
663 }
664 if (ish==1) {
665 itTrk= itTrk2;
666 theShower=theShower2;
667 }
668 //ene=theShower->energy(); //corrected shower energy unit GeV
669 ene=theShower->e5x5(); //uncorrected 5x5 energy unit GeV
670 eseed=theShower->eSeed(); //unit GeV
671
672
673 /////////////////
674 /*
675 RecExtTrack *extTrk = (*itTrk)->extTrack();
676
677 Hep3Vector extpos = extTrk->emcPosition();
678
679 cout<<"Extpos="<<extpos<<endl;
680
681
682 RecEmcShower *theShower = (*itTrk)->emcShower();
683
684 Hep3Vector emcpos(theShower->x(), theShower->y(), theShower->z());
685
686 cout<<"emcpos="<<emcpos<<endl;
687
688 RecEmcID shId= theShower->getShowerId();
689 unsigned int nprt= EmcID::barrel_ec(shId);
690 //RecEmcID cellId= theShower->cellId();
691 HepPoint3D SeedPos(0,0,0);
692 SeedPos=m_iGeoSvc->GetCFrontCenter(shId);
693 cout<<"SeedPos="<<SeedPos<<endl;
694 */
695 //////////////////
696
697 showerPosition = theShower->position();
698 theta = theShower->theta();
699 phi= theShower->phi();
700 showerX=theShower->x();
701 showerY=theShower->y();
702 showerZ=theShower->z();
703
704 showerId = theShower->getShowerId();
705 showerModule = EmcID::barrel_ec(showerId);
706
707 //The theta number is defined by Endcap_east(0-5),Barrel(0-43),Endcap_west(0-5)
708 //module is defined by Endcap_east(0),Barrel(1),Endcap_west(2)
709
710 thetaIndex=EmcID::theta_module(showerId);
711
712 phiIndex=EmcID::phi_module(showerId);
713
714 //cout<<thetaIndex<<" "<<phiIndex<<endl;
715 //-------------------
716
717 EmcShDigi* aShDigi= new EmcShDigi();
719 list<EmcShDigi> shDigiList;
720 RecEmcID cellId;
721 unsigned int module;
722 double digiEne, time, fraction, digiTheta, digiPhi;
723 double digiX, digiY, digiZ;
724 long int digiThetaIndex,digiPhiIndex;
725 HepPoint3D digiPos(0,0,0);
726
727 RecEmcFractionMap::const_iterator ciFractionMap;
728
729 if ( ! shDigiList.empty()) shDigiList.clear();
730
731 for(ciFractionMap=theShower->getFractionMap5x5().begin();
732 ciFractionMap!=theShower->getFractionMap5x5().end();
733 ciFractionMap++){
734
735 digiEne = ciFractionMap->second.getEnergy(); //digit energy unit GeV
736
737 time = ciFractionMap->second.getTime();
738 fraction = ciFractionMap->second.getFraction();
739
740 cellId=ciFractionMap->second.getCellId();
741
742 digiPos=m_iGeoSvc->GetCFrontCenter(cellId);
743 digiTheta = digiPos.theta();
744 digiPhi = digiPos.phi();
745 digiX = digiPos.x();
746 digiY = digiPos.y();
747 digiZ = digiPos.z();
748
749 module=EmcID::barrel_ec(cellId);
750 //The theta number is defined by Endcap_east(0-5),Barrel(0-43),Endcap_west(0-5)
751 //module is defined by Endcap_east(0),Barrel(1),Endcap_west(2)
752
753 digiThetaIndex=EmcID::theta_module(cellId);
754
755 digiPhiIndex = EmcID::phi_module(cellId);
756
757 //set EmcShDigi
758 aShDigi->setEnergy(digiEne);
759 aShDigi->setTheta(digiTheta);
760 aShDigi->setPhi(digiPhi);
761 aShDigi->setModule(module);
762 aShDigi->setThetaIndex(digiThetaIndex);
763 aShDigi->setPhiIndex(digiPhiIndex);
764 aShDigi->setTime(time);
765 aShDigi->setFraction(fraction);
766 aShDigi->setWhere(digiPos);
767 aShDigi->setY(digiX);
768 aShDigi->setY(digiY);
769 aShDigi->setZ(digiZ);
770
771 shDigiList.push_back(*aShDigi);
772
773 }
774 shDigiList.sort(); //sort energy from small to large
775
776 numberOfDigis = shDigiList.size();
777
778 maxima = *(--shDigiList.end());
779 //cout<<"maxima="<<maxima.energy()<<endl;
780 //cout<<maxima.thetaIndex()<<" max "<<maxima.phiIndex()<<endl;
781 //set EmcShower
782 aShower->setEnergy(ene);
783 aShower->setTheta(theta);
784 aShower->setPhi(phi);
785 aShower->setModule(showerModule);
786 aShower->setThetaIndex(thetaIndex);
787 aShower->setPhiIndex(phiIndex);
788 aShower->setNumberOfDigis(numberOfDigis);
789 aShower->setDigiList(shDigiList);
790 aShower->setMaxima(maxima);
791 aShower->setWhere(showerPosition);
792 aShower->setX(showerX);
793 aShower->setY(showerY);
794 aShower->setZ(showerZ);
795 m_showerList.push_back(*aShower);
796 delete aShDigi;
797
798 }
799 //m_showerList.sort(); //sort energy from small to large
800
801 delete aShower;
802
803 ///////////////
804
805 if (m_showerList.size() == 2) {
806 //iterator for the bump list
807 list<EmcShower>::const_iterator iter_Sh;
808 int itrk=0;
809 for (iter_Sh = m_showerList.begin();
810 iter_Sh != m_showerList.end(); iter_Sh++) {
811
812 itrk++;
813 EmcShower shower;
814 shower = EmcShower::EmcShower();
815 double theta = iter_Sh->theta();
816 shower = *iter_Sh;
817
818 //fill the Bhabha event
819 // if ( (itrk==1&&theMdcTrk1->charge()>0)
820 // ||(itrk==2&&theMdcTrk2->charge()>0) ){
821 if (itrk==1){
822 //set properties
823 myBhaEvt->setPositron()->setShower(shower);
824 myBhaEvt->setPositron()->setTheta(shower.theta());
825 myBhaEvt->setPositron()->setPhi(shower.phi());
826 unsigned int newthetaInd ;
827 //The thetaIndex is defined by Endcap_east(0-5),Barrel(6-49),Endcap_west(50-55)
828 //in Emc Bhabha Calibration
829 if (shower.module()==0) newthetaInd = shower.thetaIndex();
830 if (shower.module()==1) newthetaInd = shower.thetaIndex() + 6;
831 if (shower.module()==2) newthetaInd = 55 - shower.thetaIndex();
832
833 myBhaEvt->setPositron()->setThetaIndex(newthetaInd);
834
835 unsigned int newphiInd=shower.phiIndex();
836 myBhaEvt->setPositron()->setPhiIndex(newphiInd);
837 myBhaEvt->setPositron()->setFound(true);
838
839
840 log << MSG::INFO << name() << ": Positron: theta,phi energy "
841 << myBhaEvt->positron()->theta() << ","
842 << myBhaEvt->positron()->shower().phi() << " "
843 << myBhaEvt->positron()->shower().energy()
844 << endreq;
845
846
847 }
848
849 //if ( (itrk==1&&theMdcTrk1->charge()<0)
850 // ||(itrk==2&&theMdcTrk2->charge()<0) ){
851 if (itrk==2){
852 //set properties including vertex corrected theta
853 myBhaEvt->setElectron()->setShower(shower);
854 myBhaEvt->setElectron()->setTheta(shower.theta());
855 myBhaEvt->setElectron()->setPhi(shower.phi());
856 unsigned int newthetaInd;
857 //The thetaIndex is defined by Endcap_east(0-5),Barrel(6-49),Endcap_west(50-55)
858 //in Emc Bhabha Calibration
859 if (shower.module()==0) newthetaInd = shower.thetaIndex();
860 if (shower.module()==1) newthetaInd = shower.thetaIndex() + 6;
861 if (shower.module()==2) newthetaInd = 55 - shower.thetaIndex();
862
863 myBhaEvt->setElectron()->setThetaIndex(newthetaInd);
864 unsigned int newphiInd=shower.phiIndex();
865 myBhaEvt->setElectron()->setPhiIndex(newphiInd);
866 myBhaEvt->setElectron()->setFound(true);
867
868 log << MSG::INFO << name() << ": Electron: theta,phi energy "
869 << myBhaEvt->electron()->theta() << ","
870 << myBhaEvt->electron()->shower().phi() << " "
871 << myBhaEvt->electron()->shower().energy()
872 << endreq;
873
874 }
875 }
876 }
877
878
879}
Double_t time
HepPoint3D position() const
Definition: DstEmcShower.h:34
double eSeed() const
Definition: DstEmcShower.h:47
double x() const
Definition: DstEmcShower.h:35
double e5x5() const
Definition: DstEmcShower.h:49
double z() const
Definition: DstEmcShower.h:37
double y() const
Definition: DstEmcShower.h:36
const double & theta() const
Definition: EmcBhabha.h:59
void setPhiIndex(unsigned int phiIndex)
Definition: EmcBhabha.h:96
void setPhi(double phi)
Definition: EmcBhabha.h:94
EmcShower shower() const
Definition: EmcBhabha.h:55
void setShower(EmcShower aShower)
Definition: EmcBhabha.h:92
void setTheta(double theta)
Definition: EmcBhabha.h:93
void setFound(bool what)
Definition: EmcBhabha.h:89
void setThetaIndex(unsigned int thetaIndex)
Definition: EmcBhabha.h:95
static unsigned int barrel_ec(const Identifier &id)
Values of different levels (failure returns 0)
Definition: EmcID.cxx:38
static unsigned int theta_module(const Identifier &id)
Definition: EmcID.cxx:43
static unsigned int phi_module(const Identifier &id)
Definition: EmcID.cxx:48
void setWhere(HepPoint3D where)
Definition: EmcShDigi.h:52
void setZ(double z)
Definition: EmcShDigi.h:55
void setTheta(double theta)
Definition: EmcShDigi.h:45
void setY(double y)
Definition: EmcShDigi.h:54
void setModule(unsigned int module)
Definition: EmcShDigi.h:47
void setEnergy(double energy)
Definition: EmcShDigi.h:44
void setPhi(double phi)
Definition: EmcShDigi.h:46
void setFraction(double fraction)
Definition: EmcShDigi.h:51
void setTime(double time)
Definition: EmcShDigi.h:50
void setPhiIndex(unsigned int phiIndex)
Definition: EmcShDigi.h:49
void setThetaIndex(unsigned int thetaIndex)
Definition: EmcShDigi.h:48
void setPhi(double phi)
Definition: EmcShower.h:57
const unsigned int & thetaIndex() const
Definition: EmcShower.h:42
void setEnergy(double energy)
Definition: EmcShower.h:55
const double & theta() const
Definition: EmcShower.h:39
void setTheta(double theta)
Definition: EmcShower.h:56
const double & energy() const
Definition: EmcShower.h:38
void setDigiList(std::list< EmcShDigi > digiList)
Definition: EmcShower.h:62
void setPhiIndex(unsigned int phiIndex)
Definition: EmcShower.h:60
void setX(double x)
Definition: EmcShower.h:65
const double & phi() const
Definition: EmcShower.h:40
void setY(double y)
Definition: EmcShower.h:66
void setThetaIndex(unsigned int thetaIndex)
Definition: EmcShower.h:59
void setZ(double z)
Definition: EmcShower.h:67
void setMaxima(EmcShDigi maxima)
Definition: EmcShower.h:63
const unsigned int & phiIndex() const
Definition: EmcShower.h:43
void setWhere(HepPoint3D where)
Definition: EmcShower.h:64
void setNumberOfDigis(long int numberOfDigis)
Definition: EmcShower.h:61
const unsigned int & module() const
Definition: EmcShower.h:41
void setModule(unsigned int module)
Definition: EmcShower.h:58
RecEmcFractionMap getFractionMap5x5() const
RecEmcID getShowerId() const
Definition: RecEmcShower.h:55

Referenced by execute().

◆ finalize()

StatusCode EmcSelBhaEvent::finalize ( )

Definition at line 367 of file EmcSelBhaEvent.cxx.

367 {
368
369 MsgStream log(msgSvc(), name());
370
371 log << MSG::INFO << "in finalize()" << endreq;
372
373 //output the data of Matrix and vector to files
374 OutputMV();
375 /*
376 for (int i=1000; i < 1500; i++) {
377 int xtalIndex=myCalibData->xtalInd(i);
378
379 int nhitxtal=myCalibData->xtalHitsDir(xtalIndex);
380 cout<<"ixtal, Nhitdir="<< xtalIndex<<" "<<nhitxtal<<endl;
381
382 }
383 */
384 if ( m_writeMVToFile ) {
385 delete myCalibData;
386 myCalibData = 0;
387 }
388
389 cout<<"Event="<<m_events<<endl;
390
391 cout<<"m_Nothing ="<<m_Nothing <<endl;
392 cout<<"m_OneProng="<<m_OneProng<<endl;
393
394 cout<<"m_TwoProngMatched="<<m_TwoProngMatched<<endl;
395
396 cout<<"m_TwoProngOneMatched="<<m_TwoProngOneMatched<<endl;
397
398 cout<<"m_showersAccepted="<<m_showersAccepted<<endl;
399
400 return StatusCode::SUCCESS;
401}

◆ findPhiDiff()

double EmcSelBhaEvent::findPhiDiff ( double  phi1,
double  phi2 
)

Definition at line 1429 of file EmcSelBhaEvent.cxx.

1430{
1431 double diff;
1432 diff = phi1 - phi2; //rad
1433
1434 while( diff> pi ) diff -= twopi;
1435 while( diff< -pi ) diff += twopi;
1436
1437 return diff;
1438}
Double_t phi2
Double_t phi1
const float pi
Definition: vector3.h:133

◆ index()

int EmcSelBhaEvent::index ( int  theta,
int  phi 
) const
inline

Definition at line 95 of file EmcSelBhaEvent.h.

95 {
96 int val = ((m_index)[theta][phi]);
97 return (val); }

◆ initGeom()

void EmcSelBhaEvent::initGeom ( )

Definition at line 1299 of file EmcSelBhaEvent.cxx.

1299 {
1300
1301 MsgStream log(msgSvc(), name());
1302
1303 int numberOfXtalsRing;
1304
1305 EmcStructure* theEmcStruc=new EmcStructure() ;
1306 theEmcStruc->setEmcStruc();
1307
1308 //number Of Theta Rings
1309 int nrOfTheRings = theEmcStruc->getNumberOfTheRings();
1310
1311 m_nXtals = theEmcStruc->getNumberOfXtals();
1312
1313 //init geometry
1314 for ( int the = theEmcStruc->startingTheta(); the< nrOfTheRings; the++) {
1315
1316 numberOfXtalsRing = theEmcStruc->crystalsInRing((unsigned int) the );
1317
1318 for ( int phi=0; phi < numberOfXtalsRing; phi++) {
1319
1320 m_index[the][phi] = theEmcStruc->getIndex( (unsigned int)the , (unsigned int)phi);
1321
1322 }
1323
1324 }
1325
1326 log << MSG::INFO << " Emc geometry for Bhabha calibration initialized !! "
1327 << endl
1328 << "Number of Xtals: " << m_nXtals << endreq;
1329 delete theEmcStruc;
1330
1331
1332
1333}
void setEmcStruc()
long getIndex(unsigned int thetaIndex, unsigned int phiIndex) const
unsigned int getNumberOfTheRings()
unsigned int startingTheta()
Definition: EmcStructure.h:26
unsigned int crystalsInRing(unsigned int theta) const
unsigned int getNumberOfXtals()

Referenced by initialize().

◆ initialize()

StatusCode EmcSelBhaEvent::initialize ( )

Definition at line 205 of file EmcSelBhaEvent.cxx.

205 {
206
207 MsgStream log(msgSvc(), name());
208 log << MSG::INFO << "in initialize()" << endreq;
209
210 //---------------------------------------<<<<<<<<<<
211 m_showersAccepted=0;
212 m_events=0;
213 m_Nothing=0;
214 m_OneProng=0;
215 //number of events with TwoProngMatched
216 m_TwoProngMatched=0;
217 //number of events with TwoProngOneMatched
218 m_TwoProngOneMatched=0;
219
220 //--------------------------------------->>>>>>>>>>>
221 //initialize Emc geometry to convert between index <=> theta,phi
222 initGeom();
223
224 //create the object that holds the calibration data
225 if ( m_writeMVToFile )
226 myCalibData = new EmcBhaCalibData(m_nXtals,m_MsgFlag);
227 else
228 myCalibData = 0;
229
230 //get EmcRecGeoSvc
231
232 ISvcLocator* svcLocator = Gaudi::svcLocator();
233 StatusCode sc = svcLocator->service("EmcRecGeoSvc",m_iGeoSvc);
234 if(sc!=StatusCode::SUCCESS) {
235 cout<<"Error: Can't get EmcRecGeoSvc"<<endl;
236 }
237
238 /*
239 // use EmcCalibConstSvc
240 StatusCode scCalib;
241 scCalib = Gaudi::svcLocator() -> service("EmcCalibConstSvc", m_emcCalibConstSvc);
242 if( scCalib != StatusCode::SUCCESS){
243 log << MSG::ERROR << "can not use EmcCalibConstSvc" << endreq;
244 }
245 else {
246 std::cout << "Test EmcCalibConstSvc DigiCalibConst(0)= "
247 << m_emcCalibConstSvc -> getDigiCalibConst(0) << std::endl;
248 }
249 */
250
251 StatusCode scBeamEnergy;
252 scBeamEnergy = Gaudi::svcLocator() -> service("BeamEnergySvc", m_BeamEnergySvc);
253
254 if( scBeamEnergy != StatusCode::SUCCESS){
255 log << MSG::ERROR << "can not use BeamEnergySvc" << endreq;
256 }
257 else {
258 std::cout << "Test BeamEnergySvc "
259 << m_BeamEnergySvc -> getbeamE(14112) << std::endl;
260 }
261
262
263 // read correction function from the file of 'cor.conf'
264 //from MC Bhabha data,
265 // expected depostion energy for bhabha calibration at cms. system
266 //it is as a function of thetaID(0-55)
267 readCorFun();
268 // read Esigma(Itheta)
269 //from MC Bhabha data,
270 //it is as a function of thetaID(0-55) from the file of 'sigma.conf'
271 readEsigma();
272
273 //read peak of bhabha rawdata before bhabha calibration,
274 //it is as a function of thetaID(0-55) from the file of "peakI.conf"
276
277 //read sigma of bhabha rawdata before bhabha calibration,
278 //it is as a function of thetaID(0-55) from the file of "sigmaI.conf"
279 readSigmaExp();
281
282 /*
283 ofstream out;
284 out.open("expectedE.conf");
285 for(int i=0; i<6240;i++){
286 out<<i<<"\t"<<expectedEnergy(i)<<endl;
287 }
288 out.close();
289 */
290 return StatusCode::SUCCESS;
291}

◆ LAT()

double EmcSelBhaEvent::LAT ( EmcShower theShower)

Definition at line 445 of file EmcSelBhaEvent.cxx.

445 {
446
447 /*double value = 0.;
448
449 //find the largest digis
450 double ene1=0, ene2=0;
451
452 list<EmcShDigi>::const_iterator digi, digi1=0,digi2 = 0;
453
454 //find the two digis with the largest energy
455 for ( digi = theShower->digiList().begin();
456 digi != theShower->digiList().end(); digi++) {
457
458 if (digi->energy() > ene1) {
459
460 digi2 = digi1;
461 ene2 = ene1;
462 digi1 = digi;
463 ene1 = digi->energy();
464
465 } else
466
467 if (digi->energy() > ene2) {
468 digi2 = digi;
469 ene2 = digi->energy();
470 }
471 }
472
473 //now calculate LAT
474 for ( digi = theShower->digiList().begin();
475 digi != theShower->digiList().end(); digi++) {
476
477 if ( digi != digi1 && digi != digi2) {
478
479 Hep3Vector shower_pos(theShower->where().x(),
480 theShower->where().y(),
481 theShower->where().z());
482 Hep3Vector digi_pos(digi->where().x(),
483 digi->where().y(),
484 digi->where().z());
485 Hep3Vector r = digi_pos - shower_pos;
486
487 shower_pos *= 1.0/shower_pos.mag();
488 r = r - ((r.dot(shower_pos)) *
489 ( shower_pos ) );
490 value+=(r.mag()*r.mag())*digi->energy();
491 }
492 }
493
494 value /= ((value +
495 25.0*(digi1->energy() + digi2->energy()) ));
496
497 return value;
498 */
499}

◆ OutputMV()

void EmcSelBhaEvent::OutputMV ( )

Definition at line 1337 of file EmcSelBhaEvent.cxx.

1337 {
1338
1339 MsgStream log(msgSvc(), name());
1340
1341 //check this first because I sometimes got two endJob transitions
1342 if ( myCalibData != 0 )
1343
1344 //if set write the matrix and vector to a file
1345 if ( m_writeMVToFile ) {
1346
1347 int count;
1348 char cnum[10];
1349 if (m_run<0){
1350 count = sprintf(cnum,"MC%d",-m_run);
1351 }
1352 if (m_run>=0){
1353 count = sprintf(cnum,"%d",m_run);
1354 }
1355
1356 std::string runnum="";
1357 runnum.append(cnum);
1358
1359 ofstream runnumberOut;
1360 std::string runnumberFile = m_fileDir;
1361 runnumberFile += m_fileExt;
1362 runnumberFile +="runnumbers.dat";
1363 runnumberOut.open(runnumberFile.c_str(),ios::out|ios::app);
1364
1365 ifstream runnumberIn;
1366 runnumberIn.open(runnumberFile.c_str());
1367 bool status=false;
1368 while( !runnumberIn.eof() ) {
1369
1370 std::string num;
1371 runnumberIn >> num;
1372 if (runnum==num) {
1373 status=true;
1374 log << MSG::INFO<< " the runnumber: "<<runnum
1375 <<" exists in the file runnumbers.dat" <<endreq;
1376 break;
1377 }else{
1378 status=false;
1379 log << MSG::INFO<< " the runnumber: "<<runnum
1380 <<" does not exist in the file runnumbers.dat" <<endreq;
1381 }
1382 }
1383 runnumberIn.close();
1384
1385 ofstream vectorOut;
1386 std::string vectorFile = m_fileDir;
1387 vectorFile += m_fileExt;
1388 vectorFile += runnum;
1389 vectorFile += "CalibVector.dat";
1390 vectorOut.open(vectorFile.c_str());
1391
1392 ofstream matrixOut;
1393 std::string matrixFile = m_fileDir;
1394 matrixFile += m_fileExt;
1395 matrixFile += runnum;
1396 matrixFile += "CalibMatrix.dat";
1397 matrixOut.open(matrixFile.c_str());
1398
1399 if ( vectorOut.good() && matrixOut.good() &&runnumberOut.good()) {
1400
1401 myCalibData->writeOut(matrixOut, vectorOut);
1402
1403 log << MSG::INFO<< " Wrote files "
1404 << (vectorFile) << " and "
1405 << (matrixFile) <<endreq;
1406
1407
1408 if ( !status ) {
1409 runnumberOut<<runnum<<"\n";
1410 log << MSG::INFO<< "Wrote files "<<runnumberFile<< endreq;
1411 }
1412
1413 } else
1414 log << MSG::WARNING << " Could not open vector and/or matrix file !"
1415 << endl
1416 << "matrix file : " << matrixFile << endl
1417 << "vector file : " << vectorFile
1418 << endreq;
1419
1420 vectorOut.close();
1421 matrixOut.close();
1422 runnumberOut.close();
1423 }
1424
1425}
void writeOut(ostream &OutM, ostream &outV)
std::ifstream ifstream
Definition: bpkt_streams.h:44
std::ofstream ofstream
Definition: bpkt_streams.h:42
uint32_t count(const node_t &list)
Definition: node.cxx:42
int num[96]
Definition: ranlxd.c:373

Referenced by finalize().

◆ passed()

bool EmcSelBhaEvent::passed ( )
inline

Definition at line 75 of file EmcSelBhaEvent.h.

75{ return m_passed;}

Referenced by setPassed().

◆ readCorFun()

void EmcSelBhaEvent::readCorFun ( )

Definition at line 1442 of file EmcSelBhaEvent.cxx.

1442 {
1443
1444 ifstream corFunIn;
1445 std::string corFunFile = m_inputFileDir;
1446 corFunFile += m_fileExt;
1447 corFunFile += "cor.conf";
1448 corFunIn.open(corFunFile.c_str());
1449 for(int i=0;i<56;i++) {
1450 corFunIn>>m_corFun[i];
1451
1452 cout<<"energy corFun="<<m_corFun[i]<<endl;
1453 }
1454 corFunIn.close();
1455}

Referenced by initialize().

◆ readDepEneFun()

void EmcSelBhaEvent::readDepEneFun ( )

Definition at line 1473 of file EmcSelBhaEvent.cxx.

1473 {
1474
1475 ifstream EDepEneIn;
1476 std::string EDepEneFile = m_inputFileDir;
1477 EDepEneFile += m_fileExt;
1478 EDepEneFile += "peakI.conf";
1479 EDepEneIn.open(EDepEneFile.c_str());
1480 for(int i=0;i<56;i++) {
1481 EDepEneIn>>m_eDepEne[i];
1482 //m_eDepEne[i]=m_eDepEne[i]-0.020;
1483 //m_eDepEne[i]=m_eDepEne[i]/1.843*m_beamEnergy;
1484 cout<<"DepEne="<<m_eDepEne[i]<<endl;
1485 }
1486 EDepEneIn.close();
1487
1488}

Referenced by initialize().

◆ readEsigma()

void EmcSelBhaEvent::readEsigma ( )

Definition at line 1458 of file EmcSelBhaEvent.cxx.

1458 {
1459
1460 ifstream EsigmaIn;
1461 std::string EsigmaFile = m_inputFileDir;
1462 EsigmaFile += m_fileExt;
1463 EsigmaFile += "sigma.conf";
1464 EsigmaIn.open(EsigmaFile.c_str());
1465 for(int i=0;i<56;i++) {
1466 EsigmaIn>>m_eSigma[i];
1467 cout<<"Sigma="<<m_eSigma[i]<<endl;
1468 }
1469 EsigmaIn.close();
1470}

Referenced by initialize().

◆ readRawPeakIxtal()

void EmcSelBhaEvent::readRawPeakIxtal ( )

Definition at line 1507 of file EmcSelBhaEvent.cxx.

1507 {
1508
1509
1510 ifstream EIn;
1511 std::string EFile = m_inputFileDir;
1512 EFile += m_fileExt;
1513 EFile += "findpeak.conf";
1514 EIn.open(EFile.c_str());
1515
1516 double Peak[6240];
1517 int ixtal;
1518 for(int i=0;i<6240;i++) {
1519 EIn>>ixtal>>Peak[i];
1520 m_eRawPeak[ixtal]=Peak[i];
1521 }
1522 EIn.close();
1523
1524 /*
1525 ifstream EIn1;
1526 std::string EFile1 = m_inputFileDir;
1527 EFile1 += m_fileExt;
1528 EFile1 += "findpeak-mc.conf";
1529 EIn1.open(EFile1.c_str());
1530
1531 double Peak1[6240];
1532 int ixtal1;
1533 for(int i=0;i<6240;i++) {
1534 EIn1>>ixtal1>>Peak1[i];
1535 m_eMcPeak[ixtal1]=Peak1[i];
1536 }
1537 EIn1.close();
1538 */
1539}

Referenced by initialize().

◆ readSigmaExp()

void EmcSelBhaEvent::readSigmaExp ( )

Definition at line 1491 of file EmcSelBhaEvent.cxx.

1491 {
1492 ifstream ESigmaExpIn;
1493 std::string ESigmaExpFile = m_inputFileDir;
1494 ESigmaExpFile += m_fileExt;
1495 ESigmaExpFile += "sigmaI.conf";
1496 ESigmaExpIn.open(ESigmaExpFile.c_str());
1497 for(int i=0;i<56;i++) {
1498 ESigmaExpIn>>m_eSigmaExp[i];
1499 cout<<"SigmaExp="<<m_eSigmaExp[i]<<endl;
1500 }
1501 ESigmaExpIn.close();
1502
1503
1504}

Referenced by initialize().

◆ SelectBhabha()

StatusCode EmcSelBhaEvent::SelectBhabha ( )

Definition at line 503 of file EmcSelBhaEvent.cxx.

503 {
504
505 MsgStream log(msgSvc(), name());
506
507 SmartDataPtr<EvtRecEvent> evtRecEvent(eventSvc(), EventModel::EvtRec::EvtRecEvent);
508
509 SmartDataPtr<EvtRecTrackCol> evtRecTrkCol(eventSvc(), EventModel::EvtRec::EvtRecTrackCol);
510
511 m_selectedType = BhabhaType::Nothing;
512 m_events++;
513
514 /*
515 Vint iGood;
516 iGood.clear();
517 int nCharge = 0;
518 int numberOfTrack = 0;
519
520 //the accumulated event information
521 double totalEnergy = 0.;
522 int numberOfShowers = 0;
523 int numberOfShowersWithTrack = 0;
524 bool secondUnMTrackFound=false;
525 float eNorm = 0.;
526 float pNorm = 0.;
527 float acolli_min = 999.;
528 double minAngFirstSh = 999., minAngSecondSh = 999.;
529 float theFirstTracksTheta = 0;
530 float theFirstTracksMomentum = 0;
531
532 //the selection candidates
533 RecMdcTrack *theFirstTrack = 0;
534 RecMdcTrack *theSecondTrack = 0;
535 RecMdcTrack *theKeptTrack = 0;
536 RecEmcShower *theFirstShower = 0;
537
538 RecEmcShower *theSecondShower = 0;
539 RecEmcShower *theKeptShower = 0;
540 double keptTheta = 0.;
541 int theFirstShID = 9999;
542 int theSecondShID = 9999;
543 int theKeptShID = 9999;
544 int theTrkID = 9999;
545 */
546
547 Vint iGam;
548 iGam.clear();
549
550 //double ene5x5,theta,phi,eseed;
551 //double showerX,showerY,showerZ;
552 //long int thetaIndex,phiIndex;
553 //HepPoint3D showerPosition(0,0,0);
554 // RecEmcID showerId;
555 //unsigned int npart;
556
557 for(int i = 0; i < evtRecEvent->totalTracks(); i++){
558
559 if(i>=evtRecTrkCol->size()) break;
560
561 EvtRecTrackIterator itTrk=evtRecTrkCol->begin() + i;
562
563 if((*itTrk)->isEmcShowerValid()) {
564
565
566 RecEmcShower *theShower = (*itTrk)->emcShower();
567 int TrkID = (*itTrk)->trackId();
568 double Shower5x5=theShower->e5x5();
569
570 /*
571 ene5x5=theShower->e5x5(); //uncorrected 5x5 energy unit GeV
572 eseed=theShower->eSeed(); //unit GeV
573
574 showerPosition = theShower->position();
575 theta = theShower->theta();
576 phi= theShower->phi();
577 showerX=theShower->x();
578 showerY=theShower->y();
579 showerZ=theShower->z();
580
581 showerId = theShower->getShowerId();
582
583 npart = EmcID::barrel_ec(showerId);
584
585 //The theta number is defined by Endcap_east(0-5),Barrel(0-43),Endcap_west(0-5)
586 //module is defined by Endcap_east(0),Barrel(1),Endcap_west(2)
587
588 thetaIndex=EmcID::theta_module(showerId);
589
590 phiIndex=EmcID::phi_module(showerId);
591 */
592
593 if (Shower5x5>1.1){
594
595 iGam.push_back( TrkID );
596
597
598 }
599
600 }
601 }
602 int nGam = iGam.size();
603 log << MSG::DEBUG << "num Good Photon " << nGam << " , " <<evtRecEvent->totalNeutral() <<endreq;
604
605
606 if (nGam==2) {
607
608 m_selectedType = BhabhaType::TwoProngMatched;
609 m_selectedTrkID1 =iGam[0];
610 m_selectedTrkID2 = iGam[1];
611
612 }
613
614
615 return StatusCode::SUCCESS;
616
617}
std::vector< int > Vint
Definition: Gam4pikp.cxx:52
int trackId() const
Definition: DstEmcShower.h:29

Referenced by execute().

◆ selectedTrkID1()

int EmcSelBhaEvent::selectedTrkID1 ( ) const
inline

Definition at line 83 of file EmcSelBhaEvent.h.

84 {
85 return m_selectedTrkID1;
86 }

◆ selectedTrkID2()

int EmcSelBhaEvent::selectedTrkID2 ( ) const
inline

Definition at line 88 of file EmcSelBhaEvent.h.

89 {
90 return m_selectedTrkID2;
91 }

◆ selectedType()

int EmcSelBhaEvent::selectedType ( ) const
inline

Definition at line 78 of file EmcSelBhaEvent.h.

79 {
80 return m_selectedType;
81 }

◆ setPassed()

void EmcSelBhaEvent::setPassed ( bool  passed)
inline

Definition at line 76 of file EmcSelBhaEvent.h.

76{ m_passed = passed;}

The documentation for this class was generated from the following files: