CGEM BOSS 6.6.5.g
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 ()
 
StatusCode SelectFillBhabha ()
 
void FillBhabha ()
 
void CollectBhabha ()
 
void OutputMV ()
 
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_selMethod("Ixtal"),
116 m_nXtals(6240),
117 m_sigmaCut(1.),
118 m_beamEnergy(1.843),
119 m_MsgFlag(0)
120
121{
122
123 // Declare the properties
124
125
126 declareProperty ("Vr0cut", m_vr0cut); // suggest cut: |z0|<5cm && r0<1cm
127 declareProperty ("Vz0cut", m_vz0cut);
128
129 declareProperty ("lowEnergyShowerCut", m_lowEnergyShowerCut);
130 declareProperty ("highEnergyShowerCut", m_highEnergyShowerCut);
131 declareProperty ("matchThetaCut", m_matchThetaCut);
132 declareProperty ("matchPhiCut", m_matchPhiCut);
133
134 declareProperty ("highMomentumCut", m_highMomentumCut);
135 declareProperty ("EoPMaxCut", m_EoPMaxCut);
136 declareProperty ("EoPMinCut", m_EoPMinCut);
137 declareProperty ("minAngShEnergyCut", m_minAngShEnergyCut);
138 declareProperty ("minAngCut", m_minAngCut);
139 declareProperty ("acolliCut", m_acolliCut);
140 declareProperty ("eNormCut", m_eNormCut);
141 declareProperty ("pNormCut", m_pNormCut);
142 declareProperty ("oneProngMomentumCut", m_oneProngMomentumCut);
143
144 // *
145
146 declareProperty("digiRangeCut", m_digiRangeCut);
147
148 declareProperty("ShEneThreshCut", m_ShEneThreshCut);
149 declareProperty("ShEneLeptonCut", m_ShEneLeptonCut);
150
151 declareProperty("minNrXtalsShowerCut", m_minNrXtalsShowerCut);
152 declareProperty("maxNrXtalsShowerCut", m_maxNrXtalsShowerCut);
153 declareProperty("phiDiffMinCut", m_phiDiffMinCut);
154 declareProperty("phiDiffMaxCut", m_phiDiffMaxCut);
155 declareProperty("nrShThreshCut", m_nrShThreshCut);
156 declareProperty("thetaDiffCut", m_thetaDiffCut);
157 declareProperty("LATCut", m_LATCut);
158
159 //--------------------
160 declareProperty("writeMVToFile", m_writeMVToFile);
161 declareProperty("fileExt", m_fileExt);
162 declareProperty("fileDir", m_fileDir);
163 declareProperty("inputFileDir", m_inputFileDir);
164 declareProperty("selMethod",m_selMethod);
165 declareProperty("sigmaCut", m_sigmaCut);
166 declareProperty("ReadBeamEFromDB", m_ReadBeamEFromDB = false );
167
168 declareProperty("beamEnergy", m_beamEnergy);
169 declareProperty("elecSaturation", m_elecSaturation = false );
170
171 declareProperty("MsgFlag", m_MsgFlag);
172
173
174 int j = 0;
175 m_index = new int*[56];
176 for (j=0;j<56;j++ ) {
177 m_index[j] = new int[120];
178 for ( int k=0; k<120; k++) {
179 m_index[j][k]=-1;
180 }
181 }
182
183 m_iGeoSvc=0;
184
185 for (int i=0; i<6240;i++)
186 {
187 m_inputConst[i] = 1.0;
188 }
189
190 m_irun=0;
191}

◆ ~EmcSelBhaEvent()

EmcSelBhaEvent::~EmcSelBhaEvent ( )

Definition at line 196 of file EmcSelBhaEvent.cxx.

196 {
197
198 if ( m_index != 0 ) {
199 for (int i =0; i<56; i++ )
200 delete[] m_index[i];
201 delete[] m_index;
202 m_index = 0;
203 }
204
205 ///////////
206 for (int j=0;j<6240;j++ ) {
207 m_measure[j]=-1;
208 }
209}

Member Function Documentation

◆ Angle2ClosestShower()

double EmcSelBhaEvent::Angle2ClosestShower ( int  ShowerID)

Definition at line 1556 of file EmcSelBhaEvent.cxx.

1556 {
1557
1558 double minDist=999;
1559
1560 SmartDataPtr<EvtRecEvent> evtRecEvent(eventSvc(), EventModel::EvtRec::EvtRecEvent);
1561 SmartDataPtr<EvtRecTrackCol> evtRecTrkCol(eventSvc(), EventModel::EvtRec::EvtRecTrackCol);
1562
1563 EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + ShowerID;
1564
1565 RecEmcShower *theShower = (*itTrk)->emcShower();
1566 HepLorentzVector theShowerVec(1,1,1,1);
1567 theShowerVec.setTheta(theShower->theta());
1568 theShowerVec.setPhi(theShower->phi());
1569 theShowerVec.setRho(theShower->energy());
1570 theShowerVec.setE(theShower->energy());
1571
1572 for(int j = 0; j < evtRecEvent->totalTracks(); j++){
1573 EvtRecTrackIterator jtTrk=evtRecTrkCol->begin() + j;
1574
1575 if(!(*jtTrk)->isEmcShowerValid()) continue;
1576 if (ShowerID == (*jtTrk)->trackId()) continue;
1577
1578 RecEmcShower *aShower = (*jtTrk)->emcShower();
1579
1580 if (aShower->energy() > m_minAngShEnergyCut ){
1581
1582 HepLorentzVector aShowerVec(1,1,1,1);
1583 aShowerVec.setTheta(aShower->theta());
1584 aShowerVec.setPhi(aShower->phi());
1585 aShowerVec.setRho(aShower->energy());
1586 aShowerVec.setE(aShower->energy());
1587
1588 double dist = theShowerVec.angle(aShowerVec);
1589
1590 if ( dist < minDist )
1591 minDist = dist;
1592
1593 }
1594
1595 }
1596
1597 return minDist;
1598}
EvtRecTrackCol::iterator EvtRecTrackIterator
Definition: EvtRecTrack.h:131
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:134
_EXTERN_ std::string EvtRecTrackCol
Definition: EventModel.h:135

◆ CollectBhabha()

void EmcSelBhaEvent::CollectBhabha ( )

Definition at line 872 of file EmcSelBhaEvent.cxx.

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

297 {
298
299 MsgStream log(msgSvc(), name());
300 log << MSG::DEBUG << "in execute()" << endreq;
301
302 //create the object that store the needed data of the Bhabha event
303
304 int event, run;
305
306 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
307
308 run=eventHeader->runNumber();
309 event=eventHeader->eventNumber();
310 //cout<<"---------"<<event<<".........."<<run<<endl;
311 m_events++;
312 m_run = run;
313
314
315 //////////////////
316 // get beam energy
317 //////////////////
318 if(m_ReadBeamEFromDB&&m_irun!=run){
319 m_irun=run;
320 m_BeamEnergySvc ->getBeamEnergyInfo();
321 if(m_BeamEnergySvc->isRunValid())
322 m_beamEnergy=m_BeamEnergySvc->getbeamE();
323 // if(m_readDb.isRunValid(m_irun))
324 // m_beamEnergy=m_readDb.getbeamE(m_irun);
325 //if(m_BeamEnergySvc->isRunValid())
326 // m_beamEnergy=m_BeamEnergySvc->getbeamE();
327 cout<< "beamEnergy="<< m_beamEnergy<<endl;
328 double the=0.011;
329 double phi=0;
330 HepLorentzVector ptrk;
331 ptrk.setPx(m_beamEnergy*sin(the)*cos(phi));
332 ptrk.setPy(m_beamEnergy*sin(the)*sin(phi));
333 ptrk.setPz(m_beamEnergy*cos(the));
334 ptrk.setE(m_beamEnergy);
335
336 ptrk=ptrk.boost(-0.011,0,0);
337
338 cout<< "beamEnergy="<< m_beamEnergy<<" cms "<<ptrk.e()<<" ratio="<< (m_beamEnergy-ptrk.e())/ptrk.e()<<endl;
339 m_beamEnergy=ptrk.e();
340 }
341
342 ////////////
343 // int mmea=0;
344
345 for (int j=0;j<6240;j++ ) {
346 m_measure[j]=-1;
347 }
348
349 if (m_elecSaturation==true)
350 {
351
352 ///////////////////////////find Measure/////////////
353 SmartDataPtr<EmcDigiCol> emcDigiCol(eventSvc(),"/Event/Digi/EmcDigiCol");
354 if (!emcDigiCol) {
355 log << MSG::FATAL << "Could not find EMC digi" << endreq;
356 return( StatusCode::FAILURE);
357 }
358
359 EmcDigiCol::iterator iter3;
360 for (iter3=emcDigiCol->begin();iter3!= emcDigiCol->end();iter3++) {
361 RecEmcID id((*(iter3))->identify());
362 //cout<<id<<endl;
363
364 unsigned int npart,ntheta,nphi;
365 npart = EmcID::barrel_ec(id);
366 ntheta = EmcID::theta_module(id);
367 nphi = EmcID::phi_module(id);
368
369 unsigned int newthetaInd;
370 if (npart==0) newthetaInd = ntheta;
371 if (npart==1) newthetaInd = ntheta + 6;
372 if (npart==2) newthetaInd = 55 - ntheta;
373
374 int ixtal= index(newthetaInd,nphi);
375 m_measure[ixtal]=(*iter3)->getMeasure();
376 //if ((*iter3)->getMeasure()==3) mmea=9;
377
378 }
379 }
380
381 ////////////
382
383 myBhaEvt = new EmcBhabhaEvent();
384
385 //Select Bhabha
386 SelectBhabha();
387 if(m_selectedType == BhabhaType::OneProng) m_OneProng++;
388 //number of events with TwoProngMatched
389 if(m_selectedType == BhabhaType::TwoProngMatched) m_TwoProngMatched++;
390 //number of events with TwoProngOneMatched
391 if(m_selectedType == BhabhaType::TwoProngOneMatched) m_TwoProngOneMatched++;
392
393 if(m_selectedType == BhabhaType::Nothing){
394 m_Nothing++;
395 }
396
397 //retreive shower list of event
398
399 if (m_selectedType == BhabhaType::TwoProngMatched) {
400 FillBhabha();
401
402 //collect bhabha event for digi-calibration of EMC
403 //and fill matrix and vector of system of linear equations
405 }
406
407 delete myBhaEvt;
408 myBhaEvt=0;
409
410 return StatusCode::SUCCESS;
411}
double sin(const BesAngle a)
Definition: BesAngle.h:210
double cos(const BesAngle a)
Definition: BesAngle.h:213
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
StatusCode SelectBhabha()
int index(int theta, int phi) const
virtual bool isRunValid()=0
virtual double getbeamE()=0
virtual void getBeamEnergyInfo()=0

◆ FillBhabha()

void EmcSelBhaEvent::FillBhabha ( )

Definition at line 612 of file EmcSelBhaEvent.cxx.

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

414 {
415
416 MsgStream log(msgSvc(), name());
417
418 log << MSG::INFO << "in finalize()" << endreq;
419
420 //output the data of Matrix and vector to files
421 OutputMV();
422 /*
423 for (int i=1000; i < 1500; i++) {
424 int xtalIndex=myCalibData->xtalInd(i);
425
426 int nhitxtal=myCalibData->xtalHitsDir(xtalIndex);
427 cout<<"ixtal, Nhitdir="<< xtalIndex<<" "<<nhitxtal<<endl;
428
429 }
430 */
431 if ( m_writeMVToFile ) {
432 delete myCalibData;
433 myCalibData = 0;
434 }
435
436 cout<<"Event="<<m_events<<endl;
437
438 cout<<"m_Nothing ="<<m_Nothing <<endl;
439 cout<<"m_OneProng="<<m_OneProng<<endl;
440
441 cout<<"m_TwoProngMatched="<<m_TwoProngMatched<<endl;
442
443 cout<<"m_TwoProngOneMatched="<<m_TwoProngOneMatched<<endl;
444
445 cout<<"m_showersAccepted="<<m_showersAccepted<<endl;
446
447 return StatusCode::SUCCESS;
448}

◆ findPhiDiff()

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

Definition at line 1441 of file EmcSelBhaEvent.cxx.

1442{
1443 double diff;
1444 diff = phi1 - phi2; //rad
1445
1446 while( diff> pi ) diff -= twopi;
1447 while( diff< -pi ) diff += twopi;
1448
1449 return diff;
1450}
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); }

Referenced by execute().

◆ initGeom()

void EmcSelBhaEvent::initGeom ( )

Definition at line 1311 of file EmcSelBhaEvent.cxx.

1311 {
1312
1313 MsgStream log(msgSvc(), name());
1314
1315 int numberOfXtalsRing;
1316
1317 EmcStructure* theEmcStruc=new EmcStructure() ;
1318 theEmcStruc->setEmcStruc();
1319
1320 //number Of Theta Rings
1321 int nrOfTheRings = theEmcStruc->getNumberOfTheRings();
1322
1323 m_nXtals = theEmcStruc->getNumberOfXtals();
1324
1325 //init geometry
1326 for ( int the = theEmcStruc->startingTheta(); the< nrOfTheRings; the++) {
1327
1328 numberOfXtalsRing = theEmcStruc->crystalsInRing((unsigned int) the );
1329
1330 for ( int phi=0; phi < numberOfXtalsRing; phi++) {
1331
1332 m_index[the][phi] = theEmcStruc->getIndex( (unsigned int)the , (unsigned int)phi);
1333
1334 }
1335
1336 }
1337
1338 log << MSG::INFO << " Emc geometry for Bhabha calibration initialized !! "
1339 << endl
1340 << "Number of Xtals: " << m_nXtals << endreq;
1341 delete theEmcStruc;
1342
1343
1344
1345}
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 211 of file EmcSelBhaEvent.cxx.

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

◆ OutputMV()

void EmcSelBhaEvent::OutputMV ( )

Definition at line 1349 of file EmcSelBhaEvent.cxx.

1349 {
1350
1351 MsgStream log(msgSvc(), name());
1352
1353 //check this first because I sometimes got two endJob transitions
1354 if ( myCalibData != 0 )
1355
1356 //if set write the matrix and vector to a file
1357 if ( m_writeMVToFile ) {
1358
1359 int count;
1360 char cnum[10];
1361 if (m_run<0){
1362 count = sprintf(cnum,"MC%d",-m_run);
1363 }
1364 if (m_run>=0){
1365 count = sprintf(cnum,"%d",m_run);
1366 }
1367
1368 std::string runnum="";
1369 runnum.append(cnum);
1370
1371 ofstream runnumberOut;
1372 std::string runnumberFile = m_fileDir;
1373 runnumberFile += m_fileExt;
1374 runnumberFile +="runnumbers.dat";
1375 runnumberOut.open(runnumberFile.c_str(),ios::out|ios::app);
1376
1377 ifstream runnumberIn;
1378 runnumberIn.open(runnumberFile.c_str());
1379 bool status=false;
1380 while( !runnumberIn.eof() ) {
1381
1382 std::string num;
1383 runnumberIn >> num;
1384 if (runnum==num) {
1385 status=true;
1386 log << MSG::INFO<< " the runnumber: "<<runnum
1387 <<" exists in the file runnumbers.dat" <<endreq;
1388 break;
1389 }else{
1390 status=false;
1391 log << MSG::INFO<< " the runnumber: "<<runnum
1392 <<" does not exist in the file runnumbers.dat" <<endreq;
1393 }
1394 }
1395 runnumberIn.close();
1396
1397 ofstream vectorOut;
1398 std::string vectorFile = m_fileDir;
1399 vectorFile += m_fileExt;
1400 vectorFile += runnum;
1401 vectorFile += "CalibVector.dat";
1402 vectorOut.open(vectorFile.c_str());
1403
1404 ofstream matrixOut;
1405 std::string matrixFile = m_fileDir;
1406 matrixFile += m_fileExt;
1407 matrixFile += runnum;
1408 matrixFile += "CalibMatrix.dat";
1409 matrixOut.open(matrixFile.c_str());
1410
1411 if ( vectorOut.good() && matrixOut.good() &&runnumberOut.good()) {
1412
1413 myCalibData->writeOut(matrixOut, vectorOut);
1414
1415 log << MSG::INFO<< " Wrote files "
1416 << (vectorFile) << " and "
1417 << (matrixFile) <<endreq;
1418
1419
1420 if ( !status ) {
1421 runnumberOut<<runnum<<"\n";
1422 log << MSG::INFO<< "Wrote files "<<runnumberFile<< endreq;
1423 }
1424
1425 } else
1426 log << MSG::WARNING << " Could not open vector and/or matrix file !"
1427 << endl
1428 << "matrix file : " << matrixFile << endl
1429 << "vector file : " << vectorFile
1430 << endreq;
1431
1432 vectorOut.close();
1433 matrixOut.close();
1434 runnumberOut.close();
1435 }
1436
1437}
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 1454 of file EmcSelBhaEvent.cxx.

1454 {
1455
1456 ifstream corFunIn;
1457 std::string corFunFile = m_inputFileDir;
1458 corFunFile += m_fileExt;
1459 corFunFile += "cor.conf";
1460 corFunIn.open(corFunFile.c_str());
1461 for(int i=0;i<56;i++) {
1462 corFunIn>>m_corFun[i];
1463
1464 cout<<"energy corFun="<<m_corFun[i]<<endl;
1465 }
1466 corFunIn.close();
1467}

Referenced by initialize().

◆ readDepEneFun()

void EmcSelBhaEvent::readDepEneFun ( )

Definition at line 1485 of file EmcSelBhaEvent.cxx.

1485 {
1486
1487 ifstream EDepEneIn;
1488 std::string EDepEneFile = m_inputFileDir;
1489 EDepEneFile += m_fileExt;
1490 EDepEneFile += "peakI.conf";
1491 EDepEneIn.open(EDepEneFile.c_str());
1492 for(int i=0;i<56;i++) {
1493 EDepEneIn>>m_eDepEne[i];
1494 //m_eDepEne[i]=m_eDepEne[i]-0.020;
1495 //m_eDepEne[i]=m_eDepEne[i]/1.843*m_beamEnergy;
1496 cout<<"DepEne="<<m_eDepEne[i]<<endl;
1497 }
1498 EDepEneIn.close();
1499
1500}

Referenced by initialize().

◆ readEsigma()

void EmcSelBhaEvent::readEsigma ( )

Definition at line 1470 of file EmcSelBhaEvent.cxx.

1470 {
1471
1472 ifstream EsigmaIn;
1473 std::string EsigmaFile = m_inputFileDir;
1474 EsigmaFile += m_fileExt;
1475 EsigmaFile += "sigma.conf";
1476 EsigmaIn.open(EsigmaFile.c_str());
1477 for(int i=0;i<56;i++) {
1478 EsigmaIn>>m_eSigma[i];
1479 cout<<"Sigma="<<m_eSigma[i]<<endl;
1480 }
1481 EsigmaIn.close();
1482}

Referenced by initialize().

◆ readRawPeakIxtal()

void EmcSelBhaEvent::readRawPeakIxtal ( )

Definition at line 1519 of file EmcSelBhaEvent.cxx.

1519 {
1520
1521
1522 ifstream EIn;
1523 std::string EFile = m_inputFileDir;
1524 EFile += m_fileExt;
1525 EFile += "findpeak.conf";
1526 EIn.open(EFile.c_str());
1527
1528 double Peak[6240];
1529 int ixtal;
1530 for(int i=0;i<6240;i++) {
1531 EIn>>ixtal>>Peak[i];
1532 m_eRawPeak[ixtal]=Peak[i];
1533 }
1534 EIn.close();
1535
1536 /*
1537 ifstream EIn1;
1538 std::string EFile1 = m_inputFileDir;
1539 EFile1 += m_fileExt;
1540 EFile1 += "findpeak-mc.conf";
1541 EIn1.open(EFile1.c_str());
1542
1543 double Peak1[6240];
1544 int ixtal1;
1545 for(int i=0;i<6240;i++) {
1546 EIn1>>ixtal1>>Peak1[i];
1547 m_eMcPeak[ixtal1]=Peak1[i];
1548 }
1549 EIn1.close();
1550 */
1551}

Referenced by initialize().

◆ readSigmaExp()

void EmcSelBhaEvent::readSigmaExp ( )

Definition at line 1503 of file EmcSelBhaEvent.cxx.

1503 {
1504 ifstream ESigmaExpIn;
1505 std::string ESigmaExpFile = m_inputFileDir;
1506 ESigmaExpFile += m_fileExt;
1507 ESigmaExpFile += "sigmaI.conf";
1508 ESigmaExpIn.open(ESigmaExpFile.c_str());
1509 for(int i=0;i<56;i++) {
1510 ESigmaExpIn>>m_eSigmaExp[i];
1511 cout<<"SigmaExp="<<m_eSigmaExp[i]<<endl;
1512 }
1513 ESigmaExpIn.close();
1514
1515
1516}

Referenced by initialize().

◆ SelectBhabha()

StatusCode EmcSelBhaEvent::SelectBhabha ( )

Definition at line 493 of file EmcSelBhaEvent.cxx.

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

◆ SelectFillBhabha()

StatusCode EmcSelBhaEvent::SelectFillBhabha ( )

◆ 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: