BOSS 7.1.1
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 ()
 
void readDataAndMCIxtal ()
 
double Angle2ClosestShower (int ShowerID)
 

Detailed Description

Definition at line 57 of file EmcSelBhaEvent.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
m_oneProng 
m_twoProng 

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

◆ ~EmcSelBhaEvent()

EmcSelBhaEvent::~EmcSelBhaEvent ( )

Definition at line 203 of file EmcSelBhaEvent.cxx.

203 {
204
205 if ( m_index != 0 ) {
206 for (int i =0; i<56; i++ )
207 delete[] m_index[i];
208 delete[] m_index;
209 m_index = 0;
210 }
211
212 ///////////
213 for (int j=0;j<6240;j++ ) {
214 m_measure[j]=-1;
215 }
216}

Member Function Documentation

◆ Angle2ClosestShower()

double EmcSelBhaEvent::Angle2ClosestShower ( int ShowerID)

Definition at line 1687 of file EmcSelBhaEvent.cxx.

1687 {
1688
1689 double minDist=999;
1690
1691 SmartDataPtr<EvtRecEvent> evtRecEvent(eventSvc(), EventModel::EvtRec::EvtRecEvent);
1692 SmartDataPtr<EvtRecTrackCol> evtRecTrkCol(eventSvc(), EventModel::EvtRec::EvtRecTrackCol);
1693
1694 EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + ShowerID;
1695
1696 RecEmcShower *theShower = (*itTrk)->emcShower();
1697 HepLorentzVector theShowerVec(1,1,1,1);
1698 theShowerVec.setTheta(theShower->theta());
1699 theShowerVec.setPhi(theShower->phi());
1700 theShowerVec.setRho(theShower->energy());
1701 theShowerVec.setE(theShower->energy());
1702
1703 for(int j = 0; j < evtRecEvent->totalTracks(); j++){
1704 EvtRecTrackIterator jtTrk=evtRecTrkCol->begin() + j;
1705
1706 if(!(*jtTrk)->isEmcShowerValid()) continue;
1707 if (ShowerID == (*jtTrk)->trackId()) continue;
1708
1709 RecEmcShower *aShower = (*jtTrk)->emcShower();
1710
1711 if (aShower->energy() > m_minAngShEnergyCut ){
1712
1713 HepLorentzVector aShowerVec(1,1,1,1);
1714 aShowerVec.setTheta(aShower->theta());
1715 aShowerVec.setPhi(aShower->phi());
1716 aShowerVec.setRho(aShower->energy());
1717 aShowerVec.setE(aShower->energy());
1718
1719 double dist = theShowerVec.angle(aShowerVec);
1720
1721 if ( dist < minDist )
1722 minDist = dist;
1723
1724 }
1725
1726 }
1727
1728 return minDist;
1729}
EvtRecTrackCol::iterator EvtRecTrackIterator
double theta() const
double phi() const
double energy() const
_EXTERN_ std::string EvtRecEvent
Definition EventModel.h:116
_EXTERN_ std::string EvtRecTrackCol
Definition EventModel.h:117

◆ CollectBhabha()

void EmcSelBhaEvent::CollectBhabha ( )

Definition at line 906 of file EmcSelBhaEvent.cxx.

906 {
907
908 MsgStream log(msgSvc(), name());
909
910 //check if the Bhabhas were found
911 if ( 0 != myBhaEvt->positron()->found() ||
912 0 != myBhaEvt->electron()->found() ) {
913
914 m_taken++;
915 //fill the EmcBhabhas
916 double calibEnergy=0.;
917 double energyError=0.;
918
919 //------------- electron found --------------------------------------
920 if (myBhaEvt->electron()->found() ) {
921 /*
922 int ixtalIndex = index(myBhaEvt->electron()->thetaIndex(),
923 myBhaEvt->electron()->phiIndex());
924 calibEnergy = m_eMcPeak[ixtalIndex];
925 */
926
927 unsigned int module, ntheta, nphi;
928 if ( myBhaEvt->electron()->thetaIndex()<=5) {
929 module=0;
930 ntheta=myBhaEvt->electron()->thetaIndex();
931
932 } else if ( myBhaEvt->electron()->thetaIndex()>=50){
933 module=2;
934 ntheta=55-myBhaEvt->electron()->thetaIndex();
935
936 } else {
937 module=1;
938 ntheta=myBhaEvt->electron()->thetaIndex()-6;
939 }
940 nphi=myBhaEvt->electron()->phiIndex();
941
942
943 RecEmcID shId= EmcID::crystal_id(module,ntheta,nphi);
944 HepPoint3D SeedPos(0,0,0);
945 SeedPos=m_iGeoSvc->GetCFrontCenter(shId);
946 /*
947 calibEnergy = myBhaEvt->
948 getDepoMCShowerEnergy_lab(myBhaEvt->electron()->theta(),
949 myBhaEvt->electron()->phi(),
950 myBhaEvt->electron()->thetaIndex(),
951 myBhaEvt->electron()->phiIndex(),
952 m_corFun[myBhaEvt->electron()->thetaIndex()],
953 m_beamEnergy);
954 */
955 calibEnergy = myBhaEvt->
956 getDepoMCShowerEnergy_lab(SeedPos.theta(),
957 SeedPos.phi(),
958 myBhaEvt->electron()->thetaIndex(),
959 myBhaEvt->electron()->phiIndex(),
960 m_corFun[myBhaEvt->electron()->thetaIndex()],
961 m_beamEnergy);
962
963 if (m_selMethod=="DataMCIxtal"){
964 calibEnergy = myBhaEvt->
965 getDepoMCShowerEnergy_lab(SeedPos.theta(),
966 SeedPos.phi(),
967 myBhaEvt->electron()->thetaIndex(),
968 myBhaEvt->electron()->phiIndex(),
969 m_eMeanMC[index(myBhaEvt->electron()->thetaIndex(),myBhaEvt->electron()->phiIndex())],
970 m_beamEnergy);
971 }
972 /*
973 calibEnergy = myBhaEvt->
974 getDepoMCShowerEnergy(myBhaEvt->electron()->thetaIndex(),
975 myBhaEvt->electron()->phiIndex(),
976 m_corFun[myBhaEvt->electron()->thetaIndex()],
977 m_beamEnergy);
978 */
979
980 if ( calibEnergy > 0 ) {
981
982 energyError = myBhaEvt->
983 getErrorDepoMCShowerEnergy(myBhaEvt->electron()->thetaIndex(),
984 myBhaEvt->electron()->phiIndex(),
985 m_eSigma[myBhaEvt->electron()->thetaIndex()]*m_beamEnergy/100.);
986 if (m_selMethod=="DataMCIxtal"){
987 energyError = m_eRmsMC[index(myBhaEvt->electron()->thetaIndex(),myBhaEvt->electron()->phiIndex())]*m_beamEnergy;
988 }
989
990 } else
991 log << MSG::WARNING << " Did not find MC deposited cluster energy "
992 <<" for this cluster: thetaInd: "
993 << myBhaEvt->electron()->thetaIndex()
994 << " phiInd: "
995 << myBhaEvt->electron()->phiIndex()
996 << endl
997 << "Will not use this cluster for the Emc "
998 << "Bhabha calibration !"
999 << endreq;
1000
1001 //set all that stuff in an EmcBhabha
1002 myBhaEvt->setElectron()->setErrorOnCalibEnergy(energyError);
1003 myBhaEvt->setElectron()->setCalibEnergy(calibEnergy);
1004
1005 //myBhaEvt->electron()->print();
1006
1007 } else
1008 log << MSG::INFO<< name()
1009 << ": Electron was not selected ! "
1010 << endreq;
1011
1012 calibEnergy=0.;
1013 energyError=0.;
1014
1015 //---------------- positron found ----------------------------------
1016 if (myBhaEvt->positron()->found() ) {
1017 /*
1018 int ixtalIndex = index(myBhaEvt->positron()->thetaIndex(),
1019 myBhaEvt->positron()->phiIndex());
1020 calibEnergy = m_eMcPeak[ixtalIndex];
1021 */
1022
1023 unsigned int module, ntheta, nphi;
1024 if ( myBhaEvt->positron()->thetaIndex()<=5) {
1025 module=0;
1026 ntheta=myBhaEvt->positron()->thetaIndex();
1027
1028 } else if ( myBhaEvt->positron()->thetaIndex()>=50){
1029 module=2;
1030 ntheta=55-myBhaEvt->positron()->thetaIndex();
1031
1032 } else {
1033 module=1;
1034 ntheta=myBhaEvt->positron()->thetaIndex()-6;
1035 }
1036 nphi=myBhaEvt->positron()->phiIndex();
1037
1038
1039 RecEmcID shId= EmcID::crystal_id(module,ntheta,nphi);
1040 HepPoint3D SeedPos(0,0,0);
1041 SeedPos=m_iGeoSvc->GetCFrontCenter(shId);
1042 /*
1043 calibEnergy = myBhaEvt->
1044 getDepoMCShowerEnergy_lab(myBhaEvt->positron()->theta(),
1045 myBhaEvt->positron()->phi(),
1046 myBhaEvt->positron()->thetaIndex(),
1047 myBhaEvt->positron()->phiIndex(),
1048 m_corFun[myBhaEvt->positron()->thetaIndex()],
1049 m_beamEnergy);
1050 */
1051 calibEnergy = myBhaEvt->
1052 getDepoMCShowerEnergy_lab(SeedPos.theta(),
1053 SeedPos.phi(),
1054 myBhaEvt->positron()->thetaIndex(),
1055 myBhaEvt->positron()->phiIndex(),
1056 m_corFun[myBhaEvt->positron()->thetaIndex()],
1057 m_beamEnergy);
1058
1059 if (m_selMethod=="DataMCIxtal"){
1060 calibEnergy = myBhaEvt->
1061 getDepoMCShowerEnergy_lab(SeedPos.theta(),
1062 SeedPos.phi(),
1063 myBhaEvt->positron()->thetaIndex(),
1064 myBhaEvt->positron()->phiIndex(),
1065 m_eMeanMC[index(myBhaEvt->positron()->thetaIndex(),myBhaEvt->positron()->phiIndex())],
1066 m_beamEnergy);
1067 }
1068
1069 /*
1070 calibEnergy = myBhaEvt->
1071 getDepoMCShowerEnergy(myBhaEvt->positron()->thetaIndex(),
1072 myBhaEvt->positron()->phiIndex(),
1073 m_corFun[myBhaEvt->positron()->thetaIndex()],
1074 m_beamEnergy);
1075 */
1076
1077 if ( calibEnergy > 0. ) {
1078
1079 energyError = myBhaEvt->
1080 getErrorDepoMCShowerEnergy(myBhaEvt->positron()->thetaIndex(),
1081 myBhaEvt->positron()->phiIndex(),
1082 m_eSigma[myBhaEvt->positron()->thetaIndex()]*m_beamEnergy/100.);
1083
1084 if (m_selMethod=="DataMCIxtal"){
1085 energyError = m_eRmsMC[index(myBhaEvt->electron()->thetaIndex(),myBhaEvt->electron()->phiIndex())]*m_beamEnergy;
1086 }
1087
1088 } else
1089 log << MSG::WARNING << " Did not find MC deposited cluster energy "
1090 << "for this cluster: thetaInd: "
1091 << myBhaEvt->positron()->thetaIndex()
1092 << " phiInd: "
1093 << myBhaEvt->positron()->phiIndex()
1094 << endl
1095 << "Will not use this cluster for the Emc "
1096 << "Bhabha calibration !"
1097 << endreq;
1098
1099
1100 //set all that stuff in an EmcBhabha
1101 myBhaEvt->setPositron()->setErrorOnCalibEnergy(energyError);
1102 myBhaEvt->setPositron()->setCalibEnergy(calibEnergy);
1103
1104 //myBhaEvt->positron()->print();
1105
1106 } else
1107 log << MSG::INFO << name()
1108 << ": Positron was not selected ! "
1109 << endreq;
1110
1111 //calculate elements of Matrix M and vector R from Bhabha event,
1112 //M is in SLAP triad format
1113 fillMatrix();
1114
1115 } else {
1116 log << MSG::WARNING << " No Bhabha data for calibration found in event !"
1117 << endreq;
1118
1119 }
1120
1121}
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
int index(int theta, int phi) const
virtual HepPoint3D GetCFrontCenter(const Identifier &id) const =0

Referenced by execute().

◆ execute()

StatusCode EmcSelBhaEvent::execute ( )

Definition at line 305 of file EmcSelBhaEvent.cxx.

305 {
306
307 MsgStream log(msgSvc(), name());
308 log << MSG::DEBUG << "in execute()" << endreq;
309
310 //create the object that store the needed data of the Bhabha event
311
312 int event, run;
313
314 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
315
316 run=eventHeader->runNumber();
317 event=eventHeader->eventNumber();
318 //cout<<"---------"<<event<<".........."<<run<<endl;
319 m_events++;
320 m_run = run;
321
322
323 //////////////////
324 // get beam energy
325 //////////////////
326 if(m_ReadBeamEFromDB&&m_irun!=run){
327 m_irun=run;
328 m_BeamEnergySvc ->getBeamEnergyInfo();
329 if(m_BeamEnergySvc->isRunValid())
330 m_beamEnergy=m_BeamEnergySvc->getbeamE();
331 // if(m_readDb.isRunValid(m_irun))
332 // m_beamEnergy=m_readDb.getbeamE(m_irun);
333 //if(m_BeamEnergySvc->isRunValid())
334 // m_beamEnergy=m_BeamEnergySvc->getbeamE();
335 cout<< "beamEnergy="<< m_beamEnergy<<endl;
336 m_beamEnergy=m_beamEnergy-m_dbeam;
337
338 double the=0.011;
339 double phi=0;
340 HepLorentzVector ptrk;
341 ptrk.setPx(m_beamEnergy*sin(the)*cos(phi));
342 ptrk.setPy(m_beamEnergy*sin(the)*sin(phi));
343 ptrk.setPz(m_beamEnergy*cos(the));
344 ptrk.setE(m_beamEnergy);
345
346 ptrk=ptrk.boost(-0.011,0,0);
347
348 cout<< "beamEnergy="<< m_beamEnergy<<" cms "<<ptrk.e()<<" ratio="<< (m_beamEnergy-ptrk.e())/ptrk.e()<<endl;
349 m_beamEnergy=ptrk.e();
350 }
351
352
353 if(m_useBeamDetectorEnergy){
354
355
356 IScanEnergySvc* m_ScanEnergySvc=0;
357 StatusCode scScan;
358 scScan = Gaudi::svcLocator()->service("ScanEnergySvc", m_ScanEnergySvc);
359 if( scScan != StatusCode::SUCCESS){
360 cout << "can not use ScanEnergySvc" << endreq;
361 }
362 else {
363
364 std::cout << "Test ScanEnergySvc getScanEnergy= "
365 << m_ScanEnergySvc -> getScanEnergy()
366 << std::endl;
367 m_beamEnergy= m_ScanEnergySvc -> getScanEnergy()/2.0/1000.;
368 cout<< "ScanbeamEnergy="<< m_beamEnergy<<endl;
369 }
370 }
371
372
373
374
375
376 ////////////
377 // int mmea=0;
378
379 for (int j=0;j<6240;j++ ) {
380 m_measure[j]=-1;
381 }
382
383 if (m_elecSaturation==true)
384 {
385
386 ///////////////////////////find Measure/////////////
387 SmartDataPtr<EmcDigiCol> emcDigiCol(eventSvc(),"/Event/Digi/EmcDigiCol");
388 if (!emcDigiCol) {
389 log << MSG::FATAL << "Could not find EMC digi" << endreq;
390 return( StatusCode::FAILURE);
391 }
392
393 EmcDigiCol::iterator iter3;
394 for (iter3=emcDigiCol->begin();iter3!= emcDigiCol->end();iter3++) {
395 RecEmcID id((*(iter3))->identify());
396 //cout<<id<<endl;
397
398 unsigned int npart,ntheta,nphi;
399 npart = EmcID::barrel_ec(id);
400 ntheta = EmcID::theta_module(id);
401 nphi = EmcID::phi_module(id);
402
403 unsigned int newthetaInd;
404 if (npart==0) newthetaInd = ntheta;
405 if (npart==1) newthetaInd = ntheta + 6;
406 if (npart==2) newthetaInd = 55 - ntheta;
407
408 int ixtal= index(newthetaInd,nphi);
409 m_measure[ixtal]=(*iter3)->getMeasure();
410 //if ((*iter3)->getMeasure()==3) mmea=9;
411
412 }
413 }
414
415 ////////////
416
417 myBhaEvt = new EmcBhabhaEvent();
418
419 //Select Bhabha
420 SelectBhabha();
421 if(m_selectedType == BhabhaType::OneProng) m_OneProng++;
422 //number of events with TwoProngMatched
423 if(m_selectedType == BhabhaType::TwoProngMatched) m_TwoProngMatched++;
424 //number of events with TwoProngOneMatched
425 if(m_selectedType == BhabhaType::TwoProngOneMatched) m_TwoProngOneMatched++;
426
427 if(m_selectedType == BhabhaType::Nothing){
428 m_Nothing++;
429 }
430
431 //retreive shower list of event
432
433 if (m_selectedType == BhabhaType::TwoProngMatched) {
434 FillBhabha();
435
436 //collect bhabha event for digi-calibration of EMC
437 //and fill matrix and vector of system of linear equations
439 }
440
441 delete myBhaEvt;
442 myBhaEvt=0;
443
444 return StatusCode::SUCCESS;
445}
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()
virtual bool isRunValid()=0
virtual double getbeamE()=0
virtual void getBeamEnergyInfo()=0
float ptrk

◆ FillBhabha()

void EmcSelBhaEvent::FillBhabha ( )

Definition at line 646 of file EmcSelBhaEvent.cxx.

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

Referenced by execute().

◆ finalize()

StatusCode EmcSelBhaEvent::finalize ( )

Definition at line 448 of file EmcSelBhaEvent.cxx.

448 {
449
450 MsgStream log(msgSvc(), name());
451
452 log << MSG::INFO << "in finalize()" << endreq;
453
454 //output the data of Matrix and vector to files
455 OutputMV();
456 /*
457 for (int i=1000; i < 1500; i++) {
458 int xtalIndex=myCalibData->xtalInd(i);
459
460 int nhitxtal=myCalibData->xtalHitsDir(xtalIndex);
461 cout<<"ixtal, Nhitdir="<< xtalIndex<<" "<<nhitxtal<<endl;
462
463 }
464 */
465 if ( m_writeMVToFile ) {
466 delete myCalibData;
467 myCalibData = 0;
468 }
469
470 cout<<"Event="<<m_events<<endl;
471
472 cout<<"m_Nothing ="<<m_Nothing <<endl;
473 cout<<"m_OneProng="<<m_OneProng<<endl;
474
475 cout<<"m_TwoProngMatched="<<m_TwoProngMatched<<endl;
476
477 cout<<"m_TwoProngOneMatched="<<m_TwoProngOneMatched<<endl;
478
479 cout<<"m_showersAccepted="<<m_showersAccepted<<endl;
480
481 return StatusCode::SUCCESS;
482}

◆ findPhiDiff()

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

Definition at line 1511 of file EmcSelBhaEvent.cxx.

1512{
1513 double diff;
1514 diff = phi1 - phi2; //rad
1515
1516 while( diff> pi ) diff -= twopi;
1517 while( diff< -pi ) diff += twopi;
1518
1519 return diff;
1520}
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 97 of file EmcSelBhaEvent.h.

97 {
98 int val = ((m_index)[theta][phi]);
99 return (val); }

Referenced by CollectBhabha(), and execute().

◆ initGeom()

void EmcSelBhaEvent::initGeom ( )

Definition at line 1381 of file EmcSelBhaEvent.cxx.

1381 {
1382
1383 MsgStream log(msgSvc(), name());
1384
1385 int numberOfXtalsRing;
1386
1387 EmcStructure* theEmcStruc=new EmcStructure() ;
1388 theEmcStruc->setEmcStruc();
1389
1390 //number Of Theta Rings
1391 int nrOfTheRings = theEmcStruc->getNumberOfTheRings();
1392
1393 m_nXtals = theEmcStruc->getNumberOfXtals();
1394
1395 //init geometry
1396 for ( int the = theEmcStruc->startingTheta(); the< nrOfTheRings; the++) {
1397
1398 numberOfXtalsRing = theEmcStruc->crystalsInRing((unsigned int) the );
1399
1400 for ( int phi=0; phi < numberOfXtalsRing; phi++) {
1401
1402 m_index[the][phi] = theEmcStruc->getIndex( (unsigned int)the , (unsigned int)phi);
1403
1404 }
1405
1406 }
1407
1408 log << MSG::INFO << " Emc geometry for Bhabha calibration initialized !! "
1409 << endl
1410 << "Number of Xtals: " << m_nXtals << endreq;
1411 delete theEmcStruc;
1412
1413
1414
1415}
long getIndex(unsigned int thetaIndex, unsigned int phiIndex) const
unsigned int getNumberOfTheRings()
unsigned int startingTheta()
unsigned int crystalsInRing(unsigned int theta) const
unsigned int getNumberOfXtals()

Referenced by initialize().

◆ initialize()

StatusCode EmcSelBhaEvent::initialize ( )

Definition at line 218 of file EmcSelBhaEvent.cxx.

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

◆ OutputMV()

void EmcSelBhaEvent::OutputMV ( )

Definition at line 1419 of file EmcSelBhaEvent.cxx.

1419 {
1420
1421 MsgStream log(msgSvc(), name());
1422
1423 //check this first because I sometimes got two endJob transitions
1424 if ( myCalibData != 0 )
1425
1426 //if set write the matrix and vector to a file
1427 if ( m_writeMVToFile ) {
1428
1429 int count;
1430 char cnum[20];
1431 if (m_run<0){
1432 count = sprintf(cnum,"MC%d_%i",-m_run,m_Num);
1433 }
1434 if (m_run>=0){
1435 count = sprintf(cnum,"%d_%i",m_run,m_fileNum);
1436 }
1437
1438 std::string runnum="";
1439 runnum.append(cnum);
1440
1441 ofstream runnumberOut;
1442 std::string runnumberFile = m_fileDir;
1443 runnumberFile += m_fileExt;
1444 runnumberFile +="runnumbers.dat";
1445 runnumberOut.open(runnumberFile.c_str(),ios::out|ios::app);
1446
1447 ifstream runnumberIn;
1448 runnumberIn.open(runnumberFile.c_str());
1449 bool status=false;
1450 while( !runnumberIn.eof() ) {
1451
1452 std::string num;
1453 runnumberIn >> num;
1454 if (runnum==num) {
1455 status=true;
1456 log << MSG::INFO<< " the runnumber: "<<runnum
1457 <<" exists in the file runnumbers.dat" <<endreq;
1458 break;
1459 }else{
1460 status=false;
1461 log << MSG::INFO<< " the runnumber: "<<runnum
1462 <<" does not exist in the file runnumbers.dat" <<endreq;
1463 }
1464 }
1465 runnumberIn.close();
1466
1467 ofstream vectorOut;
1468 std::string vectorFile = m_fileDir;
1469 vectorFile += m_fileExt;
1470 vectorFile += runnum;
1471 vectorFile += "CalibVector.dat";
1472 vectorOut.open(vectorFile.c_str());
1473
1474 ofstream matrixOut;
1475 std::string matrixFile = m_fileDir;
1476 matrixFile += m_fileExt;
1477 matrixFile += runnum;
1478 matrixFile += "CalibMatrix.dat";
1479 matrixOut.open(matrixFile.c_str());
1480
1481 if ( vectorOut.good() && matrixOut.good() &&runnumberOut.good()) {
1482
1483 myCalibData->writeOut(matrixOut, vectorOut);
1484
1485 log << MSG::INFO<< " Wrote files "
1486 << (vectorFile) << " and "
1487 << (matrixFile) <<endreq;
1488
1489
1490 if ( !status ) {
1491 runnumberOut<<runnum<<"\n";
1492 log << MSG::INFO<< "Wrote files "<<runnumberFile<< endreq;
1493 }
1494
1495 } else
1496 log << MSG::WARNING << " Could not open vector and/or matrix file !"
1497 << endl
1498 << "matrix file : " << matrixFile << endl
1499 << "vector file : " << vectorFile
1500 << endreq;
1501
1502 vectorOut.close();
1503 matrixOut.close();
1504 runnumberOut.close();
1505 }
1506
1507}
sprintf(cut,"kal_costheta0_em>-0.93&&kal_costheta0_em<0.93&&kal_pxy0_em>=0.05+%d*0.1&&kal_pxy0_em<0.15+%d*0.1&&NGch>=2", j, j)
DOUBLE_PRECISION count[3]
void writeOut(ostream &OutM, ostream &outV)

Referenced by finalize().

◆ passed()

bool EmcSelBhaEvent::passed ( )
inline

Definition at line 77 of file EmcSelBhaEvent.h.

77{ return m_passed;}

Referenced by setPassed().

◆ readCorFun()

void EmcSelBhaEvent::readCorFun ( )

Definition at line 1524 of file EmcSelBhaEvent.cxx.

1524 {
1525
1526 ifstream corFunIn;
1527 std::string corFunFile = m_inputFileDir;
1528 corFunFile += m_fileExt;
1529 corFunFile += "cor.conf";
1530 corFunIn.open(corFunFile.c_str());
1531 for(int i=0;i<56;i++) {
1532 corFunIn>>m_corFun[i];
1533
1534 cout<<"energy corFun="<<m_corFun[i]<<endl;
1535 }
1536 corFunIn.close();
1537}

Referenced by initialize().

◆ readDataAndMCIxtal()

void EmcSelBhaEvent::readDataAndMCIxtal ( )

Definition at line 1625 of file EmcSelBhaEvent.cxx.

1625 {
1626 //read mean of e5x5cms
1627 ifstream EIn;
1628 std::string EFile = m_inputFileDir;
1629 EFile += m_fileExt;
1630 EFile += "X4680-meaNo3-e5x5cmsCut0.7-2mc.conf";
1631 EIn.open(EFile.c_str());
1632
1633 double MeanData[6240],MeanMC[6240];
1634 double RmsData[6240],RmsMC[6240];
1635 int ixtal;
1636 for(int i=0;i<6240;i++) {
1637 EIn>>ixtal>>MeanData[i]>>MeanMC[i]>>RmsData[i]>>RmsMC[i];
1638 m_eMeanData[ixtal]=MeanData[i];
1639 m_eMeanMC[ixtal]=MeanMC[i];
1640 //m_eRmsData[ixtal]=RmsData[i];
1641 //m_eRmsMC[ixtal]=RmsMC[i];
1642 }
1643 EIn.close();
1644
1645
1646 /////////////////// read peak of e5x5cms
1647
1648 ifstream EIn1,EIn2,EIn3,EIn4;
1649
1650 std::string EFile1 = m_inputFileDir;
1651 std::string EFile2 = m_inputFileDir;
1652 std::string EFile3 = m_inputFileDir;
1653 std::string EFile4 = m_inputFileDir;
1654
1655 EFile1 += "findpeak-all-IV.conf";
1656 EFile2 += "findrms-all-IV.conf";
1657 EFile3 += "peakIxtalMC.conf";
1658 EFile4 += "findrms-all-MC.conf";
1659
1660 EIn1.open(EFile1.c_str());
1661 EIn2.open(EFile2.c_str());
1662 EIn3.open(EFile3.c_str());
1663 EIn4.open(EFile4.c_str());
1664
1665 //double MeanData[6240],MeanMC[6240];
1666 //double RmsData[6240],RmsMC[6240];
1667 int ixtal1,ixtal2,ixtal3,ixtal4;
1668 for(int i=0;i<6240;i++) {
1669 EIn1>>ixtal1>>MeanData[i];
1670 EIn2>>ixtal2>>RmsData[i];
1671 EIn3>>ixtal3>>MeanMC[i];
1672 EIn4>>ixtal4>>RmsMC[i];
1673 //m_eMeanData[ixtal1]=MeanData[i];
1674 m_eRmsData[ixtal2]=RmsData[i];
1675 //m_eMeanMC[ixtal3]=MeanMC[i];
1676 m_eRmsMC[ixtal4]=RmsMC[i];
1677 // cout<<"..........."<< m_eMeanData[ixtal1]<<"\t"<<m_eRmsData[ixtal2]<<"\t"<<m_eMeanMC[ixtal3]<<"\t"<<m_eRmsMC[ixtal4]<<endl;
1678 }
1679
1680 EIn1.close();
1681 EIn2.close();
1682 EIn3.close();
1683 EIn4.close();
1684}

Referenced by initialize().

◆ readDepEneFun()

void EmcSelBhaEvent::readDepEneFun ( )

Definition at line 1556 of file EmcSelBhaEvent.cxx.

1556 {
1557
1558 ifstream EDepEneIn;
1559 std::string EDepEneFile = m_inputFileDir;
1560 EDepEneFile += m_fileExt;
1561 EDepEneFile += "peakI.conf";
1562 EDepEneIn.open(EDepEneFile.c_str());
1563 for(int i=0;i<56;i++) {
1564 EDepEneIn>>m_eDepEne[i];
1565 //m_eDepEne[i]=m_eDepEne[i]-0.020;
1566 //m_eDepEne[i]=m_eDepEne[i]/1.843*m_beamEnergy;
1567 cout<<"DepEne="<<m_eDepEne[i]<<endl;
1568 }
1569 EDepEneIn.close();
1570
1571}

Referenced by initialize().

◆ readEsigma()

void EmcSelBhaEvent::readEsigma ( )

Definition at line 1540 of file EmcSelBhaEvent.cxx.

1540 {
1541
1542 ifstream EsigmaIn;
1543 std::string EsigmaFile = m_inputFileDir;
1544 EsigmaFile += m_fileExt;
1545 EsigmaFile += "sigma.conf";
1546 EsigmaIn.open(EsigmaFile.c_str());
1547 for(int i=0;i<56;i++) {
1548 EsigmaIn>>m_eSigma[i];
1549
1550 cout<<"Sigma="<<m_eSigma[i]<<endl;
1551 }
1552 EsigmaIn.close();
1553}

Referenced by initialize().

◆ readRawPeakIxtal()

void EmcSelBhaEvent::readRawPeakIxtal ( )

Definition at line 1590 of file EmcSelBhaEvent.cxx.

1590 {
1591
1592
1593 ifstream EIn;
1594 std::string EFile = m_inputFileDir;
1595 EFile += m_fileExt;
1596 EFile += "findpeak.conf";
1597 EIn.open(EFile.c_str());
1598
1599 double Peak[6240];
1600 int ixtal;
1601 for(int i=0;i<6240;i++) {
1602 EIn>>ixtal>>Peak[i];
1603 m_eRawPeak[ixtal]=Peak[i];
1604 }
1605 EIn.close();
1606
1607 /*
1608 ifstream EIn1;
1609 std::string EFile1 = m_inputFileDir;
1610 EFile1 += m_fileExt;
1611 EFile1 += "findpeak-mc.conf";
1612 EIn1.open(EFile1.c_str());
1613
1614 double Peak1[6240];
1615 int ixtal1;
1616 for(int i=0;i<6240;i++) {
1617 EIn1>>ixtal1>>Peak1[i];
1618 m_eMcPeak[ixtal1]=Peak1[i];
1619 }
1620 EIn1.close();
1621 */
1622}

Referenced by initialize().

◆ readSigmaExp()

void EmcSelBhaEvent::readSigmaExp ( )

Definition at line 1574 of file EmcSelBhaEvent.cxx.

1574 {
1575 ifstream ESigmaExpIn;
1576 std::string ESigmaExpFile = m_inputFileDir;
1577 ESigmaExpFile += m_fileExt;
1578 ESigmaExpFile += "sigmaI.conf";
1579 ESigmaExpIn.open(ESigmaExpFile.c_str());
1580 for(int i=0;i<56;i++) {
1581 ESigmaExpIn>>m_eSigmaExp[i];
1582 cout<<"SigmaExp="<<m_eSigmaExp[i]<<endl;
1583 }
1584 ESigmaExpIn.close();
1585
1586
1587}

Referenced by initialize().

◆ SelectBhabha()

StatusCode EmcSelBhaEvent::SelectBhabha ( )

Definition at line 527 of file EmcSelBhaEvent.cxx.

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

Referenced by execute().

◆ selectedTrkID1()

int EmcSelBhaEvent::selectedTrkID1 ( ) const
inline

Definition at line 85 of file EmcSelBhaEvent.h.

86 {
87 return m_selectedTrkID1;
88 }

◆ selectedTrkID2()

int EmcSelBhaEvent::selectedTrkID2 ( ) const
inline

Definition at line 90 of file EmcSelBhaEvent.h.

91 {
92 return m_selectedTrkID2;
93 }

◆ selectedType()

int EmcSelBhaEvent::selectedType ( ) const
inline

Definition at line 80 of file EmcSelBhaEvent.h.

81 {
82 return m_selectedType;
83 }

◆ SelectFillBhabha()

StatusCode EmcSelBhaEvent::SelectFillBhabha ( )

◆ setPassed()

void EmcSelBhaEvent::setPassed ( bool passed)
inline

Definition at line 78 of file EmcSelBhaEvent.h.

78{ m_passed = passed;}

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