BOSS 8.0.0
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 ()
void 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 54 of file EmcSelBhaEvent.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
m_oneProng 
m_twoProng 

Definition at line 58 of file EmcSelBhaEvent.h.

Constructor & Destructor Documentation

◆ EmcSelBhaEvent()

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

Definition at line 75 of file EmcSelBhaEvent.cxx.

76 : Algorithm( name, pSvcLocator )
77 , m_vr0cut( 1.0 )
78 , m_vz0cut( 5.0 )
79 , m_lowEnergyShowerCut( 0.1 )
80 , m_highEnergyShowerCut( 0.5 )
81 , m_matchThetaCut( 0.2 )
82 , m_matchPhiCut( 0.2 )
83 , m_highMomentumCut( 0.5 )
84 , m_EoPMaxCut( 1.3 )
85 , m_EoPMinCut( 0.6 )
86 , m_minAngShEnergyCut( 0.2 )
87 , m_minAngCut( 0.3 )
88 , m_acolliCut( 0.03 )
89 , m_eNormCut( 0.5 )
90 , m_pNormCut( 0.5 )
91 , m_oneProngMomentumCut( 1.2 )
92 ,
93
94 m_digiRangeCut( 6 )
95 , m_ShEneThreshCut( 0.02 )
96 , m_ShEneLeptonCut( 1. )
97 , m_minNrXtalsShowerCut( 10 )
98 , m_maxNrXtalsShowerCut( 70 )
99 , m_phiDiffMinCut( 0.05 )
100 , m_phiDiffMaxCut( 0.2 )
101 , m_nrShThreshCut( 20 )
102 , m_thetaDiffCut( 0.04 )
103 , m_LATCut( 0.8 )
104 ,
105
106 m_showersAccepted( 0 )
107 ,
108 //--------------------
109 m_writeMVToFile( true )
110 , m_fileExt( "" )
111 , m_inputFileDir( "../InputData/" )
112 , m_fileDir( "/home/besdata/public/liucx/Calib/" )
113 , m_selMethod( "Ixtal" )
114 , m_nXtals( 6240 )
115 , m_sigmaCut( 1. )
116 , m_beamEnergy( 1.843 )
117 , m_MsgFlag( 0 )
118 , m_Num( 0 )
119 , m_fileNum( 0 )
120
121{
122
123 // Declare the properties
124
125 declareProperty( "Vr0cut", m_vr0cut = 1.0 ); // suggest cut: |z0|<5cm && r0<1cm
126 declareProperty( "Vz0cut", m_vz0cut = 5.0);
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( "selMethod", m_selMethod );
164 declareProperty( "sigmaCut", m_sigmaCut );
165 declareProperty( "ReadBeamEFromDB", m_ReadBeamEFromDB = false );
166
167 declareProperty( "beamEnergy", m_beamEnergy );
168 declareProperty( "Dbeam", m_dbeam = 0.00 );
169
170 declareProperty( "UseBeamDetectorEnergy", m_useBeamDetectorEnergy = false );
171
172 declareProperty( "elecSaturation", m_elecSaturation = true );
173
174 declareProperty( "MsgFlag", m_MsgFlag );
175 declareProperty( "Num", m_Num );
176 declareProperty( "fileNum", m_fileNum );
177
178 int j = 0;
179 m_index = new int*[56];
180 for ( j = 0; j < 56; j++ )
181 {
182 m_index[j] = new int[120];
183 for ( int k = 0; k < 120; k++ ) { m_index[j][k] = -1; }
184 }
185
186 m_iGeoSvc = 0;
187
188 for ( int i = 0; i < 6240; i++ ) { m_inputConst[i] = 1.0; }
189
190 m_irun = 0;
191}

Referenced by EmcSelBhaEvent().

◆ ~EmcSelBhaEvent()

EmcSelBhaEvent::~EmcSelBhaEvent ( )

Definition at line 196 of file EmcSelBhaEvent.cxx.

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

Member Function Documentation

◆ Angle2ClosestShower()

double EmcSelBhaEvent::Angle2ClosestShower ( int ShowerID)

Definition at line 1594 of file EmcSelBhaEvent.cxx.

1594 {
1595
1596 double minDist = 999;
1597
1598 SmartDataPtr<EvtRecEvent> evtRecEvent( eventSvc(), EventModel::EvtRec::EvtRecEvent );
1599 SmartDataPtr<EvtRecTrackCol> evtRecTrkCol( eventSvc(), EventModel::EvtRec::EvtRecTrackCol );
1600
1601 EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + ShowerID;
1602
1603 RecEmcShower* theShower = ( *itTrk )->emcShower();
1604 HepLorentzVector theShowerVec( 1, 1, 1, 1 );
1605 theShowerVec.setTheta( theShower->theta() );
1606 theShowerVec.setPhi( theShower->phi() );
1607 theShowerVec.setRho( theShower->energy() );
1608 theShowerVec.setE( theShower->energy() );
1609
1610 for ( int j = 0; j < evtRecEvent->totalTracks(); j++ )
1611 {
1612 EvtRecTrackIterator jtTrk = evtRecTrkCol->begin() + j;
1613
1614 if ( !( *jtTrk )->isEmcShowerValid() ) continue;
1615 if ( ShowerID == ( *jtTrk )->trackId() ) continue;
1616
1617 RecEmcShower* aShower = ( *jtTrk )->emcShower();
1618
1619 if ( aShower->energy() > m_minAngShEnergyCut )
1620 {
1621
1622 HepLorentzVector aShowerVec( 1, 1, 1, 1 );
1623 aShowerVec.setTheta( aShower->theta() );
1624 aShowerVec.setPhi( aShower->phi() );
1625 aShowerVec.setRho( aShower->energy() );
1626 aShowerVec.setE( aShower->energy() );
1627
1628 double dist = theShowerVec.angle( aShowerVec );
1629
1630 if ( dist < minDist ) minDist = dist;
1631 }
1632 }
1633
1634 return minDist;
1635}
EvtRecTrackCol::iterator EvtRecTrackIterator

◆ CollectBhabha()

void EmcSelBhaEvent::CollectBhabha ( )

Definition at line 860 of file EmcSelBhaEvent.cxx.

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

Referenced by execute().

◆ execute()

StatusCode EmcSelBhaEvent::execute ( )

Definition at line 289 of file EmcSelBhaEvent.cxx.

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

◆ FillBhabha()

void EmcSelBhaEvent::FillBhabha ( )

Definition at line 609 of file EmcSelBhaEvent.cxx.

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

Referenced by execute().

◆ finalize()

StatusCode EmcSelBhaEvent::finalize ( )

Definition at line 423 of file EmcSelBhaEvent.cxx.

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

◆ findPhiDiff()

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

Definition at line 1424 of file EmcSelBhaEvent.cxx.

1424 {
1425 double diff;
1426 diff = phi1 - phi2; // rad
1427
1428 while ( diff > pi ) diff -= twopi;
1429 while ( diff < -pi ) diff += twopi;
1430
1431 return diff;
1432}
Double_t phi2
Double_t phi1
double pi

◆ index()

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

Definition at line 83 of file EmcSelBhaEvent.h.

83 {
84 int val = ( ( m_index )[theta][phi] );
85 return ( val );
86 }

Referenced by CollectBhabha(), and execute().

◆ initGeom()

void EmcSelBhaEvent::initGeom ( )

Definition at line 1307 of file EmcSelBhaEvent.cxx.

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

Referenced by initialize().

◆ initialize()

StatusCode EmcSelBhaEvent::initialize ( )

Definition at line 209 of file EmcSelBhaEvent.cxx.

209 {
210
211 MsgStream log( msgSvc(), name() );
212 log << MSG::INFO << "in initialize()" << endmsg;
213
214 //---------------------------------------<<<<<<<<<<
215 m_showersAccepted = 0;
216 m_events = 0;
217 m_Nothing = 0;
218 m_OneProng = 0;
219 // number of events with TwoProngMatched
220 m_TwoProngMatched = 0;
221 // number of events with TwoProngOneMatched
222 m_TwoProngOneMatched = 0;
223
224 //--------------------------------------->>>>>>>>>>>
225 // initialize Emc geometry to convert between index <=> theta,phi
226 initGeom();
227
228 // create the object that holds the calibration data
229 if ( m_writeMVToFile ) myCalibData = new EmcBhaCalibData( m_nXtals, m_MsgFlag );
230 else myCalibData = 0;
231
232 // get EmcRecGeoSvc
233
234 ISvcLocator* svcLocator = Gaudi::svcLocator();
235 StatusCode sc = svcLocator->service( "EmcRecGeoSvc", m_iGeoSvc );
236 if ( sc != StatusCode::SUCCESS ) { cout << "Error: Can't get EmcRecGeoSvc" << endl; }
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" << endmsg;
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" << endmsg; }
256
257 // read correction function from the file of 'cor.conf'
258 // from MC Bhabha data,
259 // expected depostion energy for bhabha calibration at cms. system
260 // it is as a function of thetaID(0-55)
261 readCorFun();
262 // read Esigma(Itheta)
263 // from MC Bhabha data,
264 // it is as a function of thetaID(0-55) from the file of 'sigma.conf'
265 readEsigma();
266
267 // read peak of bhabha rawdata before bhabha calibration,
268 // it is as a function of thetaID(0-55) from the file of "peakI.conf"
270
271 // read sigma of bhabha rawdata before bhabha calibration,
272 // it is as a function of thetaID(0-55) from the file of "sigmaI.conf"
273 readSigmaExp();
275 // read data/mc(expected) with ixtal
277 /*
278 ofstream out;
279 out.open("expectedE.conf");
280 for(int i=0; i<6240;i++){
281 out<<i<<"\t"<<expectedEnergy(i)<<endl;
282 }
283 out.close();
284 */
285 return StatusCode::SUCCESS;
286}

◆ OutputMV()

void EmcSelBhaEvent::OutputMV ( )

Definition at line 1336 of file EmcSelBhaEvent.cxx.

1336 {
1337
1338 MsgStream log( msgSvc(), name() );
1339
1340 // check this first because I sometimes got two endJob transitions
1341 if ( myCalibData != 0 )
1342
1343 // if set write the matrix and vector to a file
1344 if ( m_writeMVToFile )
1345 {
1346
1347 int count;
1348 char cnum[20];
1349 if ( m_run < 0 ) { count = sprintf( cnum, "MC%d_%i", -m_run, m_Num ); }
1350 if ( m_run >= 0 ) { count = sprintf( cnum, "%d_%i", m_run, m_fileNum ); }
1351
1352 std::string runnum = "";
1353 runnum.append( cnum );
1354
1355 ofstream runnumberOut;
1356 std::string runnumberFile = m_fileDir;
1357 runnumberFile += m_fileExt;
1358 runnumberFile += "runnumbers.dat";
1359 runnumberOut.open( runnumberFile.c_str(), ios::out | ios::app );
1360
1361 ifstream runnumberIn;
1362 runnumberIn.open( runnumberFile.c_str() );
1363 bool status = false;
1364 while ( !runnumberIn.eof() )
1365 {
1366
1367 std::string num;
1368 runnumberIn >> num;
1369 if ( runnum == num )
1370 {
1371 status = true;
1372 log << MSG::INFO << " the runnumber: " << runnum
1373 << " exists in the file runnumbers.dat" << endmsg;
1374 break;
1375 }
1376 else
1377 {
1378 status = false;
1379 log << MSG::INFO << " the runnumber: " << runnum
1380 << " does not exist in the file runnumbers.dat" << endmsg;
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
1402 myCalibData->writeOut( matrixOut, vectorOut );
1403
1404 log << MSG::INFO << " Wrote files " << ( vectorFile ) << " and " << ( matrixFile )
1405 << endmsg;
1406
1407 if ( !status )
1408 {
1409 runnumberOut << runnum << "\n";
1410 log << MSG::INFO << "Wrote files " << runnumberFile << endmsg;
1411 }
1412 }
1413 else
1414 log << MSG::WARNING << " Could not open vector and/or matrix file !" << endl
1415 << "matrix file : " << matrixFile << endl
1416 << "vector file : " << vectorFile << endmsg;
1417
1418 vectorOut.close();
1419 matrixOut.close();
1420 runnumberOut.close();
1421 }
1422}
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]

Referenced by finalize().

◆ passed()

bool EmcSelBhaEvent::passed ( )
inline

Definition at line 72 of file EmcSelBhaEvent.h.

72{ return m_passed; }

Referenced by setPassed().

◆ readCorFun()

void EmcSelBhaEvent::readCorFun ( )

Definition at line 1434 of file EmcSelBhaEvent.cxx.

1434 {
1435
1436 ifstream corFunIn;
1437 std::string corFunFile = m_inputFileDir;
1438 corFunFile += m_fileExt;
1439 corFunFile += "cor.conf";
1440 corFunIn.open( corFunFile.c_str() );
1441 for ( int i = 0; i < 56; i++ )
1442 {
1443 corFunIn >> m_corFun[i];
1444
1445 cout << "energy corFun=" << m_corFun[i] << endl;
1446 }
1447 corFunIn.close();
1448}

Referenced by initialize().

◆ readDataAndMCIxtal()

void EmcSelBhaEvent::readDataAndMCIxtal ( )

Definition at line 1531 of file EmcSelBhaEvent.cxx.

1531 {
1532 // read mean of e5x5cms
1533 ifstream EIn;
1534 std::string EFile = m_inputFileDir;
1535 EFile += m_fileExt;
1536 EFile += "X4680-meaNo3-e5x5cmsCut0.7-2mc.conf";
1537 EIn.open( EFile.c_str() );
1538
1539 double MeanData[6240], MeanMC[6240];
1540 double RmsData[6240], RmsMC[6240];
1541 int ixtal;
1542 for ( int i = 0; i < 6240; i++ )
1543 {
1544 EIn >> ixtal >> MeanData[i] >> MeanMC[i] >> RmsData[i] >> RmsMC[i];
1545 m_eMeanData[ixtal] = MeanData[i];
1546 m_eMeanMC[ixtal] = MeanMC[i];
1547 // m_eRmsData[ixtal]=RmsData[i];
1548 // m_eRmsMC[ixtal]=RmsMC[i];
1549 }
1550 EIn.close();
1551
1552 /////////////////// read peak of e5x5cms
1553
1554 ifstream EIn1, EIn2, EIn3, EIn4;
1555
1556 std::string EFile1 = m_inputFileDir;
1557 std::string EFile2 = m_inputFileDir;
1558 std::string EFile3 = m_inputFileDir;
1559 std::string EFile4 = m_inputFileDir;
1560
1561 EFile1 += "findpeak-all-IV.conf";
1562 EFile2 += "findrms-all-IV.conf";
1563 EFile3 += "peakIxtalMC.conf";
1564 EFile4 += "findrms-all-MC.conf";
1565
1566 EIn1.open( EFile1.c_str() );
1567 EIn2.open( EFile2.c_str() );
1568 EIn3.open( EFile3.c_str() );
1569 EIn4.open( EFile4.c_str() );
1570
1571 // double MeanData[6240],MeanMC[6240];
1572 // double RmsData[6240],RmsMC[6240];
1573 int ixtal1, ixtal2, ixtal3, ixtal4;
1574 for ( int i = 0; i < 6240; i++ )
1575 {
1576 EIn1 >> ixtal1 >> MeanData[i];
1577 EIn2 >> ixtal2 >> RmsData[i];
1578 EIn3 >> ixtal3 >> MeanMC[i];
1579 EIn4 >> ixtal4 >> RmsMC[i];
1580 // m_eMeanData[ixtal1]=MeanData[i];
1581 m_eRmsData[ixtal2] = RmsData[i];
1582 // m_eMeanMC[ixtal3]=MeanMC[i];
1583 m_eRmsMC[ixtal4] = RmsMC[i];
1584 // cout<<"..........."<<
1585 // m_eMeanData[ixtal1]<<"\t"<<m_eRmsData[ixtal2]<<"\t"<<m_eMeanMC[ixtal3]<<"\t"<<m_eRmsMC[ixtal4]<<endl;
1586 }
1587
1588 EIn1.close();
1589 EIn2.close();
1590 EIn3.close();
1591 EIn4.close();
1592}

Referenced by initialize().

◆ readDepEneFun()

void EmcSelBhaEvent::readDepEneFun ( )

Definition at line 1466 of file EmcSelBhaEvent.cxx.

1466 {
1467
1468 ifstream EDepEneIn;
1469 std::string EDepEneFile = m_inputFileDir;
1470 EDepEneFile += m_fileExt;
1471 EDepEneFile += "peakI.conf";
1472 EDepEneIn.open( EDepEneFile.c_str() );
1473 for ( int i = 0; i < 56; i++ )
1474 {
1475 EDepEneIn >> m_eDepEne[i];
1476 // m_eDepEne[i]=m_eDepEne[i]-0.020;
1477 // m_eDepEne[i]=m_eDepEne[i]/1.843*m_beamEnergy;
1478 cout << "DepEne=" << m_eDepEne[i] << endl;
1479 }
1480 EDepEneIn.close();
1481}

Referenced by initialize().

◆ readEsigma()

void EmcSelBhaEvent::readEsigma ( )

Definition at line 1450 of file EmcSelBhaEvent.cxx.

1450 {
1451
1452 ifstream EsigmaIn;
1453 std::string EsigmaFile = m_inputFileDir;
1454 EsigmaFile += m_fileExt;
1455 EsigmaFile += "sigma.conf";
1456 EsigmaIn.open( EsigmaFile.c_str() );
1457 for ( int i = 0; i < 56; i++ )
1458 {
1459 EsigmaIn >> m_eSigma[i];
1460
1461 cout << "Sigma=" << m_eSigma[i] << endl;
1462 }
1463 EsigmaIn.close();
1464}

Referenced by initialize().

◆ readRawPeakIxtal()

void EmcSelBhaEvent::readRawPeakIxtal ( )

Definition at line 1497 of file EmcSelBhaEvent.cxx.

1497 {
1498
1499 ifstream EIn;
1500 std::string EFile = m_inputFileDir;
1501 EFile += m_fileExt;
1502 EFile += "findpeak.conf";
1503 EIn.open( EFile.c_str() );
1504
1505 double Peak[6240];
1506 int ixtal;
1507 for ( int i = 0; i < 6240; i++ )
1508 {
1509 EIn >> ixtal >> Peak[i];
1510 m_eRawPeak[ixtal] = Peak[i];
1511 }
1512 EIn.close();
1513
1514 /*
1515 ifstream EIn1;
1516 std::string EFile1 = m_inputFileDir;
1517 EFile1 += m_fileExt;
1518 EFile1 += "findpeak-mc.conf";
1519 EIn1.open(EFile1.c_str());
1520
1521 double Peak1[6240];
1522 int ixtal1;
1523 for(int i=0;i<6240;i++) {
1524 EIn1>>ixtal1>>Peak1[i];
1525 m_eMcPeak[ixtal1]=Peak1[i];
1526 }
1527 EIn1.close();
1528 */
1529}

Referenced by initialize().

◆ readSigmaExp()

void EmcSelBhaEvent::readSigmaExp ( )

Definition at line 1483 of file EmcSelBhaEvent.cxx.

1483 {
1484 ifstream ESigmaExpIn;
1485 std::string ESigmaExpFile = m_inputFileDir;
1486 ESigmaExpFile += m_fileExt;
1487 ESigmaExpFile += "sigmaI.conf";
1488 ESigmaExpIn.open( ESigmaExpFile.c_str() );
1489 for ( int i = 0; i < 56; i++ )
1490 {
1491 ESigmaExpIn >> m_eSigmaExp[i];
1492 cout << "SigmaExp=" << m_eSigmaExp[i] << endl;
1493 }
1494 ESigmaExpIn.close();
1495}

Referenced by initialize().

◆ SelectBhabha()

void EmcSelBhaEvent::SelectBhabha ( )

Definition at line 500 of file EmcSelBhaEvent.cxx.

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

Referenced by execute().

◆ selectedTrkID1()

int EmcSelBhaEvent::selectedTrkID1 ( ) const
inline

Definition at line 77 of file EmcSelBhaEvent.h.

77{ return m_selectedTrkID1; }

◆ selectedTrkID2()

int EmcSelBhaEvent::selectedTrkID2 ( ) const
inline

Definition at line 79 of file EmcSelBhaEvent.h.

79{ return m_selectedTrkID2; }

◆ selectedType()

int EmcSelBhaEvent::selectedType ( ) const
inline

Definition at line 75 of file EmcSelBhaEvent.h.

75{ return m_selectedType; }

◆ SelectFillBhabha()

StatusCode EmcSelBhaEvent::SelectFillBhabha ( )

◆ setPassed()

void EmcSelBhaEvent::setPassed ( bool passed)
inline

Definition at line 73 of file EmcSelBhaEvent.h.

73{ m_passed = passed; }

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