39#include "GaudiKernel/MsgStream.h"
40#include "GaudiKernel/AlgFactory.h"
41#include "GaudiKernel/SmartDataPtr.h"
42#include "GaudiKernel/IDataProviderSvc.h"
43#include "GaudiKernel/PropertyMgr.h"
44#include "GaudiKernel/ISvcLocator.h"
45#include "GaudiKernel/Bootstrap.h"
59#include "CLHEP/Vector/ThreeVector.h"
60#include "CLHEP/Geometry/Point3D.h"
61#ifndef ENABLE_BACKWARDS_COMPATIBILITY
64#include "CLHEP/Random/RandGauss.h"
68using CLHEP::Hep3Vector;
69using CLHEP::RandGauss;
73typedef std::vector<int>
Vint;
74typedef std::vector<HepLorentzVector>
Vp4;
81 :Algorithm(name, pSvcLocator),
84 m_lowEnergyShowerCut(0.1),
85 m_highEnergyShowerCut(0.5),
88 m_highMomentumCut(0.5),
91 m_minAngShEnergyCut(0.2),
96 m_oneProngMomentumCut(1.2),
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),
106 m_thetaDiffCut(0.04),
109 m_showersAccepted(0),
111 m_writeMVToFile(
true),
113 m_inputFileDir("../InputData/"),
114 m_fileDir("/home/besdata/public/liucx/Calib/"),
115 m_selMethod("Ixtal"),
128 declareProperty (
"Vr0cut", m_vr0cut);
129 declareProperty (
"Vz0cut", m_vz0cut);
131 declareProperty (
"lowEnergyShowerCut", m_lowEnergyShowerCut);
132 declareProperty (
"highEnergyShowerCut", m_highEnergyShowerCut);
133 declareProperty (
"matchThetaCut", m_matchThetaCut);
134 declareProperty (
"matchPhiCut", m_matchPhiCut);
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);
148 declareProperty(
"digiRangeCut", m_digiRangeCut);
150 declareProperty(
"ShEneThreshCut", m_ShEneThreshCut);
151 declareProperty(
"ShEneLeptonCut", m_ShEneLeptonCut);
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);
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 );
170 declareProperty(
"beamEnergy", m_beamEnergy);
171 declareProperty(
"Dbeam", m_dbeam=0.00);
173 declareProperty(
"UseBeamDetectorEnergy", m_useBeamDetectorEnergy=
false);
175 declareProperty(
"elecSaturation", m_elecSaturation =
true );
177 declareProperty(
"MsgFlag", m_MsgFlag);
178 declareProperty(
"Num", m_Num);
179 declareProperty(
"fileNum", m_fileNum);
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++) {
192 for (
int i=0; i<6240;i++)
194 m_inputConst[i] = 1.0;
205 if ( m_index != 0 ) {
206 for (
int i =0; i<56; i++ )
213 for (
int j=0;j<6240;j++ ) {
220 MsgStream log(
msgSvc(), name());
221 log << MSG::INFO <<
"in initialize()" << endreq;
231 m_TwoProngOneMatched=0;
238 if ( m_writeMVToFile )
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;
264 StatusCode scBeamEnergy;
265 scBeamEnergy = Gaudi::svcLocator() -> service(
"BeamEnergySvc", m_BeamEnergySvc);
267 if( scBeamEnergy != StatusCode::SUCCESS){
268 log << MSG::ERROR <<
"can not use BeamEnergySvc" << endreq;
301 return StatusCode::SUCCESS;
307 MsgStream log(
msgSvc(), name());
308 log << MSG::DEBUG <<
"in execute()" << endreq;
314 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
316 run=eventHeader->runNumber();
317 event=eventHeader->eventNumber();
326 if(m_ReadBeamEFromDB&&m_irun!=run){
330 m_beamEnergy=m_BeamEnergySvc->
getbeamE();
335 cout<<
"beamEnergy="<< m_beamEnergy<<endl;
336 m_beamEnergy=m_beamEnergy-m_dbeam;
340 HepLorentzVector
ptrk;
343 ptrk.setPz(m_beamEnergy*
cos(the));
344 ptrk.setE(m_beamEnergy);
348 cout<<
"beamEnergy="<< m_beamEnergy<<
" cms "<<
ptrk.e()<<
" ratio="<< (m_beamEnergy-
ptrk.e())/
ptrk.e()<<endl;
349 m_beamEnergy=
ptrk.e();
353 if(m_useBeamDetectorEnergy){
358 scScan = Gaudi::svcLocator()->service(
"ScanEnergySvc", m_ScanEnergySvc);
359 if( scScan != StatusCode::SUCCESS){
360 cout <<
"can not use ScanEnergySvc" << endreq;
364 std::cout <<
"Test ScanEnergySvc getScanEnergy= "
365 << m_ScanEnergySvc -> getScanEnergy()
367 m_beamEnergy= m_ScanEnergySvc -> getScanEnergy()/2.0/1000.;
368 cout<<
"ScanbeamEnergy="<< m_beamEnergy<<endl;
379 for (
int j=0;j<6240;j++ ) {
383 if (m_elecSaturation==
true)
387 SmartDataPtr<EmcDigiCol> emcDigiCol(eventSvc(),
"/Event/Digi/EmcDigiCol");
389 log << MSG::FATAL <<
"Could not find EMC digi" << endreq;
390 return( StatusCode::FAILURE);
393 EmcDigiCol::iterator iter3;
394 for (iter3=emcDigiCol->begin();iter3!= emcDigiCol->end();iter3++) {
395 RecEmcID id((*(iter3))->identify());
398 unsigned int npart,ntheta,nphi;
403 unsigned int newthetaInd;
404 if (npart==0) newthetaInd = ntheta;
405 if (npart==1) newthetaInd = ntheta + 6;
406 if (npart==2) newthetaInd = 55 - ntheta;
408 int ixtal=
index(newthetaInd,nphi);
409 m_measure[ixtal]=(*iter3)->getMeasure();
444 return StatusCode::SUCCESS;
450 MsgStream log(
msgSvc(), name());
452 log << MSG::INFO <<
"in finalize()" << endreq;
465 if ( m_writeMVToFile ) {
470 cout<<
"Event="<<m_events<<endl;
472 cout<<
"m_Nothing ="<<m_Nothing <<endl;
473 cout<<
"m_OneProng="<<m_OneProng<<endl;
475 cout<<
"m_TwoProngMatched="<<m_TwoProngMatched<<endl;
477 cout<<
"m_TwoProngOneMatched="<<m_TwoProngOneMatched<<endl;
479 cout<<
"m_showersAccepted="<<m_showersAccepted<<endl;
481 return StatusCode::SUCCESS;
489EmcSelBhaEvent::expectedEnergy(
long int ixtal ) {
494 unsigned int module, ntheta, nphi,ThetaIndex;
496 module=theEmcStruc->getPartId(ixtal);
497 ntheta=theEmcStruc->
getTheta(ixtal);
498 nphi=theEmcStruc->
getPhi(ixtal);
500 if (module==0) ThetaIndex = ntheta;
501 if (module==1) ThetaIndex = ntheta + 6;
502 if (module==2) ThetaIndex = 55 - ntheta;
509 double theta=SeedPos.theta();
510 double phi=SeedPos.phi();
511 HepLorentzVector
ptrk;
514 ptrk.setPz(m_beamEnergy*
cos(theta));
515 ptrk.setE(m_beamEnergy);
519 double depoEne_lab = m_corFun[ThetaIndex]*
ptrk.e();
529 MsgStream log(
msgSvc(), name());
581 for(
int i = 0; i < evtRecEvent->totalTracks(); i++){
583 if(i>=evtRecTrkCol->size())
break;
587 if((*itTrk)->isEmcShowerValid()) {
591 int TrkID = (*itTrk)->
trackId();
592 double Shower5x5=theShower->
e5x5();
617 if (Shower5x5>(0.6*m_beamEnergy)){
619 iGam.push_back( TrkID );
626 int nGam = iGam.size();
633 m_selectedTrkID1 =iGam[0];
634 m_selectedTrkID2 = iGam[1];
639 return StatusCode::SUCCESS;
648 MsgStream log(
msgSvc(), name());
671 double ene,theta,phi,eseed;
672 double showerX,showerY,showerZ;
673 long int thetaIndex,phiIndex,numberOfDigis;
676 unsigned int showerModule;
680 if ( ! m_showerList.empty()) m_showerList.clear();
682 for (
int ish=0; ish<2; ish++){
686 theShower=theShower1;
690 theShower=theShower2;
693 ene=theShower->
e5x5();
694 eseed=theShower->
eSeed();
721 showerPosition = theShower->
position();
722 theta = theShower->
theta();
723 phi= theShower->
phi();
724 showerX=theShower->
x();
725 showerY=theShower->
y();
726 showerZ=theShower->
z();
743 list<EmcShDigi> shDigiList;
746 double digiEne,
time, fraction, digiTheta, digiPhi;
747 double digiX, digiY, digiZ;
748 long int digiThetaIndex,digiPhiIndex;
751 RecEmcFractionMap::const_iterator ciFractionMap;
753 if ( ! shDigiList.empty()) shDigiList.clear();
755 for(ciFractionMap=fracMap5x5.begin();
756 ciFractionMap!=fracMap5x5.end();
759 digiEne = ciFractionMap->second.getEnergy();
761 time = ciFractionMap->second.getTime();
762 fraction = ciFractionMap->second.getFraction();
764 cellId=ciFractionMap->second.getCellId();
767 digiTheta = digiPos.theta();
768 digiPhi = digiPos.phi();
773 module=EmcID::barrel_ec(cellId);
791 aShDigi->
setY(digiX);
792 aShDigi->
setY(digiY);
793 aShDigi->
setZ(digiZ);
795 shDigiList.push_back(*aShDigi);
800 numberOfDigis = shDigiList.size();
802 maxima = *(--shDigiList.end());
816 aShower->
setX(showerX);
817 aShower->
setY(showerY);
818 aShower->
setZ(showerZ);
819 m_showerList.push_back(*aShower);
829 if (m_showerList.size() == 2) {
831 list<EmcShower>::const_iterator iter_Sh;
833 for (iter_Sh = m_showerList.begin();
834 iter_Sh != m_showerList.end(); iter_Sh++) {
839 double theta = iter_Sh->theta();
850 unsigned int newthetaInd ;
859 unsigned int newphiInd=shower.
phiIndex();
864 log << MSG::INFO << name() <<
": Positron: theta,phi energy "
880 unsigned int newthetaInd;
888 unsigned int newphiInd=shower.
phiIndex();
892 log << MSG::INFO << name() <<
": Electron: theta,phi energy "
908 MsgStream log(
msgSvc(), name());
916 double calibEnergy=0.;
917 double energyError=0.;
927 unsigned int module, ntheta, nphi;
955 calibEnergy = myBhaEvt->
956 getDepoMCShowerEnergy_lab(SeedPos.theta(),
963 if (m_selMethod==
"DataMCIxtal"){
964 calibEnergy = myBhaEvt->
965 getDepoMCShowerEnergy_lab(SeedPos.theta(),
980 if ( calibEnergy > 0 ) {
982 energyError = myBhaEvt->
986 if (m_selMethod==
"DataMCIxtal"){
991 log << MSG::WARNING <<
" Did not find MC deposited cluster energy "
992 <<
" for this cluster: thetaInd: "
997 <<
"Will not use this cluster for the Emc "
998 <<
"Bhabha calibration !"
1008 log << MSG::INFO<< name()
1009 <<
": Electron was not selected ! "
1023 unsigned int module, ntheta, nphi;
1051 calibEnergy = myBhaEvt->
1052 getDepoMCShowerEnergy_lab(SeedPos.theta(),
1059 if (m_selMethod==
"DataMCIxtal"){
1060 calibEnergy = myBhaEvt->
1061 getDepoMCShowerEnergy_lab(SeedPos.theta(),
1077 if ( calibEnergy > 0. ) {
1079 energyError = myBhaEvt->
1084 if (m_selMethod==
"DataMCIxtal"){
1089 log << MSG::WARNING <<
" Did not find MC deposited cluster energy "
1090 <<
"for this cluster: thetaInd: "
1095 <<
"Will not use this cluster for the Emc "
1096 <<
"Bhabha calibration !"
1107 log << MSG::INFO << name()
1108 <<
": Positron was not selected ! "
1116 log << MSG::WARNING <<
" No Bhabha data for calibration found in event !"
1125EmcSelBhaEvent::fillMatrix( ) {
1136 for (
int i = 1; i <= 2; i++ ) {
1138 if ( i == 2 ) _theBhabha = *(myBhaEvt->
electron());
1139 else _theBhabha = *(myBhaEvt->
positron());
1147 int _bhaPhiIndex=_theBhabha.
phiIndex();
1150 double eraw =_bhaEne ;
1154 HepLorentzVector
ptrk;
1168 int ixtalIndex =
index(_bhaThetaIndex,_bhaPhiIndex);
1169 double peakCutMin,peakCutMax;
1172 if (m_selMethod==
"Ithe"){
1173 peakCutMin= m_eDepEne[_bhaThetaIndex]*m_beamEnergy
1174 - SigCut*m_eSigmaExp[_bhaThetaIndex]*m_beamEnergy/100.;
1176 peakCutMax=m_eDepEne[_bhaThetaIndex] *m_beamEnergy
1177 + SigCut*m_eSigmaExp[_bhaThetaIndex]*m_beamEnergy/100.;
1198 if (m_selMethod==
"Ixtal"){
1199 peakCutMin= m_eRawPeak[ixtalIndex] *m_beamEnergy
1200 - SigCut*m_eSigmaExp[_bhaThetaIndex]*m_beamEnergy/100.;
1202 peakCutMax= m_eRawPeak[ixtalIndex] *m_beamEnergy
1203 + SigCut*m_eSigmaExp[_bhaThetaIndex]*m_beamEnergy/100.;
1206 if (m_selMethod==
"DataMCIxtal"){
1207 peakCutMin= m_eMeanData[ixtalIndex] *m_beamEnergy
1208 -SigCut*m_eRmsData[ixtalIndex]*m_beamEnergy;
1211 peakCutMax= m_eMeanData[ixtalIndex] *m_beamEnergy
1212 +SigCut*m_eRmsData[ixtalIndex]*m_beamEnergy;
1254 && _bhaEne >= peakCutMin
1255 && _bhaEne <= peakCutMax
1256 && m_measure[ixtalIndex] !=3 ) {
1271 m_showersAccepted++;
1273 _sigmaBha = _theBhabha.
sigma2();
1276 _theShower = _theBhabha.
shower();
1281 _DigiMax = _theShower.
maxima();
1283 unsigned int newThetaIndMax=999;
1300 list<EmcShDigi> _DigiList=_theShower.
digiList();
1302 list<EmcShDigi>::const_iterator _Digi1,_Digi2;
1308 for (_Digi1 = _DigiList.begin();
1309 _Digi1 != _DigiList.end(); _Digi1++) {
1315 unsigned int newThetaInd1=999;
1316 if (_Digi1->module()==0) newThetaInd1 = _Digi1->thetaIndex();
1317 if (_Digi1->module()==1) newThetaInd1 = _Digi1->thetaIndex() + 6;
1318 if (_Digi1->module()==2) newThetaInd1 = 55 - _Digi1->thetaIndex();
1320 int Digi1Index =
index(newThetaInd1,_Digi1->phiIndex());
1329 double dvec = ( (
static_cast<double>(_Digi1->energy())) *
1333 if ( m_writeMVToFile )
1334 (myCalibData->
vectorR(Digi1Index)) += dvec;
1337 if ( m_writeMVToFile )
1339 (myCalibData->
xtalHits(Digi1Index))++;
1343 if ( Digi1Index == maximaIndex ) {
1344 if ( m_writeMVToFile ){
1351 for (_Digi2 = _Digi1;
1352 _Digi2 != _DigiList.end(); _Digi2++) {
1354 unsigned int newThetaInd2=999;
1355 if (_Digi2->module()==0) newThetaInd2 = _Digi2->thetaIndex();
1356 if (_Digi2->module()==1) newThetaInd2 = _Digi2->thetaIndex() + 6;
1357 if (_Digi2->module()==2) newThetaInd2 = 55 - _Digi2->thetaIndex();
1359 int Digi2Index =
index(newThetaInd2, _Digi2->phiIndex());
1363 static_cast<double>((( (_Digi1->energy() *
1367 if ( m_writeMVToFile )
1368 myCalibData->
matrixMEle( Digi1Index, Digi2Index) += val;
1383 MsgStream log(
msgSvc(), name());
1385 int numberOfXtalsRing;
1396 for (
int the = theEmcStruc->
startingTheta(); the< nrOfTheRings; the++) {
1398 numberOfXtalsRing = theEmcStruc->
crystalsInRing((
unsigned int) the );
1400 for (
int phi=0; phi < numberOfXtalsRing; phi++) {
1402 m_index[the][phi] = theEmcStruc->
getIndex( (
unsigned int)the , (
unsigned int)phi);
1408 log << MSG::INFO <<
" Emc geometry for Bhabha calibration initialized !! "
1410 <<
"Number of Xtals: " << m_nXtals << endreq;
1421 MsgStream log(
msgSvc(), name());
1424 if ( myCalibData != 0 )
1427 if ( m_writeMVToFile ) {
1438 std::string runnum=
"";
1439 runnum.append(cnum);
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);
1447 ifstream runnumberIn;
1448 runnumberIn.open(runnumberFile.c_str());
1450 while( !runnumberIn.eof() ) {
1456 log << MSG::INFO<<
" the runnumber: "<<runnum
1457 <<
" exists in the file runnumbers.dat" <<endreq;
1461 log << MSG::INFO<<
" the runnumber: "<<runnum
1462 <<
" does not exist in the file runnumbers.dat" <<endreq;
1465 runnumberIn.close();
1468 std::string vectorFile = m_fileDir;
1469 vectorFile += m_fileExt;
1470 vectorFile += runnum;
1471 vectorFile +=
"CalibVector.dat";
1472 vectorOut.open(vectorFile.c_str());
1475 std::string matrixFile = m_fileDir;
1476 matrixFile += m_fileExt;
1477 matrixFile += runnum;
1478 matrixFile +=
"CalibMatrix.dat";
1479 matrixOut.open(matrixFile.c_str());
1481 if ( vectorOut.good() && matrixOut.good() &&runnumberOut.good()) {
1483 myCalibData->
writeOut(matrixOut, vectorOut);
1485 log << MSG::INFO<<
" Wrote files "
1486 << (vectorFile) <<
" and "
1487 << (matrixFile) <<endreq;
1491 runnumberOut<<runnum<<
"\n";
1492 log << MSG::INFO<<
"Wrote files "<<runnumberFile<< endreq;
1496 log << MSG::WARNING <<
" Could not open vector and/or matrix file !"
1498 <<
"matrix file : " << matrixFile << endl
1499 <<
"vector file : " << vectorFile
1504 runnumberOut.close();
1516 while( diff>
pi ) diff -= twopi;
1517 while( diff< -
pi ) diff += twopi;
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];
1534 cout<<
"energy corFun="<<m_corFun[i]<<endl;
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];
1550 cout<<
"Sigma="<<m_eSigma[i]<<endl;
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];
1567 cout<<
"DepEne="<<m_eDepEne[i]<<endl;
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;
1584 ESigmaExpIn.close();
1594 std::string EFile = m_inputFileDir;
1596 EFile +=
"findpeak.conf";
1597 EIn.open(EFile.c_str());
1601 for(
int i=0;i<6240;i++) {
1602 EIn>>ixtal>>Peak[i];
1603 m_eRawPeak[ixtal]=Peak[i];
1628 std::string EFile = m_inputFileDir;
1630 EFile +=
"X4680-meaNo3-e5x5cmsCut0.7-2mc.conf";
1631 EIn.open(EFile.c_str());
1633 double MeanData[6240],MeanMC[6240];
1634 double RmsData[6240],RmsMC[6240];
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];
1648 ifstream EIn1,EIn2,EIn3,EIn4;
1650 std::string EFile1 = m_inputFileDir;
1651 std::string EFile2 = m_inputFileDir;
1652 std::string EFile3 = m_inputFileDir;
1653 std::string EFile4 = m_inputFileDir;
1655 EFile1 +=
"findpeak-all-IV.conf";
1656 EFile2 +=
"findrms-all-IV.conf";
1657 EFile3 +=
"peakIxtalMC.conf";
1658 EFile4 +=
"findrms-all-MC.conf";
1660 EIn1.open(EFile1.c_str());
1661 EIn2.open(EFile2.c_str());
1662 EIn3.open(EFile3.c_str());
1663 EIn4.open(EFile4.c_str());
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];
1674 m_eRmsData[ixtal2]=RmsData[i];
1676 m_eRmsMC[ixtal4]=RmsMC[i];
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());
1703 for(
int j = 0; j < evtRecEvent->totalTracks(); j++){
1706 if(!(*jtTrk)->isEmcShowerValid())
continue;
1707 if (ShowerID == (*jtTrk)->trackId())
continue;
1711 if (aShower->
energy() > m_minAngShEnergyCut ){
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());
1719 double dist = theShowerVec.angle(aShowerVec);
1721 if ( dist < minDist )
double sin(const BesAngle a)
double cos(const BesAngle a)
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)
HepGeom::Point3D< double > HepPoint3D
std::vector< HepLorentzVector > Vp4
DOUBLE_PRECISION count[3]
EvtRecTrackCol::iterator EvtRecTrackIterator
map< RecEmcID, RecEmcFraction, less< RecEmcID > > RecEmcFractionMap
HepPoint3D position() const
double & vectorR(int ind)
int & xtalHitsDir(int ind)
double & matrixMEle(int row, int column)
void writeOut(ostream &OutM, ostream &outV)
EmcBhabha * setElectron()
EmcBhabha * positron() const
EmcBhabha * setPositron()
EmcBhabha * electron() const
const double & theta() const
void setPhiIndex(unsigned int phiIndex)
void setCalibEnergy(double energy)
const double & calibEnergy() const
const double & errorOnCalibEnergy() const
void setErrorOnCalibEnergy(double error)
void setShower(EmcShower aShower)
void setTheta(double theta)
const unsigned int & thetaIndex() const
const unsigned int & phiIndex() const
void setThetaIndex(unsigned int thetaIndex)
static Identifier crystal_id(const unsigned int barrel_ec, const unsigned int theta_module, const unsigned int phi_module)
For a single crystal.
static unsigned int barrel_ec(const Identifier &id)
Values of different levels (failure returns 0)
static unsigned int theta_module(const Identifier &id)
static unsigned int phi_module(const Identifier &id)
double findPhiDiff(double phi1, double phi2)
void readDataAndMCIxtal()
StatusCode SelectBhabha()
int index(int theta, int phi) const
double Angle2ClosestShower(int ShowerID)
void setWhere(HepPoint3D where)
const unsigned int & thetaIndex() const
const unsigned int & phiIndex() const
void setTheta(double theta)
void setModule(unsigned int module)
void setEnergy(double energy)
void setFraction(double fraction)
void setTime(double time)
void setPhiIndex(unsigned int phiIndex)
void setThetaIndex(unsigned int thetaIndex)
const unsigned int & module() const
const unsigned int & thetaIndex() const
void setEnergy(double energy)
const double & theta() const
void setTheta(double theta)
const double & energy() const
void setDigiList(std::list< EmcShDigi > digiList)
void setPhiIndex(unsigned int phiIndex)
const double & phi() const
void setThetaIndex(unsigned int thetaIndex)
const EmcShDigi maxima() const
void setMaxima(EmcShDigi maxima)
const unsigned int & phiIndex() const
void setWhere(HepPoint3D where)
const std::list< EmcShDigi > digiList() const
void setNumberOfDigis(long int numberOfDigis)
const unsigned int & module() const
void setModule(unsigned int module)
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()
unsigned int getPhi(long Index) const
unsigned int getTheta(long Index) const
virtual bool isRunValid()=0
virtual double getbeamE()=0
virtual void getBeamEnergyInfo()=0
virtual HepPoint3D GetCFrontCenter(const Identifier &id) const =0
RecEmcFractionMap getFractionMap5x5() const
RecEmcID getShowerId() const
_EXTERN_ std::string EvtRecEvent
_EXTERN_ std::string EvtRecTrackCol