BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
McCor Class Reference

#include <McCor.h>

+ Inheritance diagram for McCor:

Public Member Functions

 McCor (const std::string &name, ISvcLocator *pSvcLocator)
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 
double corEnergyMc (double eg, double theid)
 

Detailed Description

Definition at line 9 of file McCor.h.

Constructor & Destructor Documentation

◆ McCor()

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

Definition at line 48 of file McCor.cxx.

48 :
49 Algorithm(name, pSvcLocator) {
50
51 //Declare the properties
52 ntOut = true;
53 declareProperty("NTupleOut",ntOut);
54
55/*
56 declareProperty("b0",m_b[0] = 0.9976);
57 declareProperty("b1",m_b[1] = -0.01718);
58 declareProperty("b2",m_b[2] = 0.01634);
59*/
60
61}

Member Function Documentation

◆ corEnergyMc()

double McCor::corEnergyMc ( double eg,
double theid )

Definition at line 177 of file McCor.cxx.

177 {
178
179 double Energy5x5=eg;
180 if(eg<0.029)eg=0.029;
181 if(eg>1.76)eg=1.76;
182 if(theid<=0)theid=0.001;
183 if(theid>=27)theid=26.999;
184 Float_t einter = eg + 0.00001;
185 Float_t tinter = theid+0.0001;
186 double ecor=dt->Interpolate(einter,tinter);
187 if(!(ecor))return Energy5x5;
188 if(ecor<0.5)return Energy5x5;
189 double EnergyCor=Energy5x5/ecor;
190 return EnergyCor;
191}
TGraph2DErrors * dt
Definition McCor.cxx:45

Referenced by execute().

◆ execute()

StatusCode McCor::execute ( )

Definition at line 121 of file McCor.cxx.

121 {
122
123
124 MsgStream log(msgSvc(), name());
125 log << MSG::INFO << "in execute()" << endreq;
126
127 SmartDataPtr<Event::EventH> eventHeader(eventSvc(),"/Event");
128 SmartDataPtr<EvtRecEvent> evtRecEvent(eventSvc(), EventModel::EvtRec::EvtRecEvent);
129 // log << MSG::INFO << "get event tag OK" << endreq;
130 log << MSG::DEBUG <<"ncharg, nneu, tottks = "
131 << evtRecEvent->totalCharged() << " , "
132 << evtRecEvent->totalNeutral() << " , "
133 << evtRecEvent->totalTracks() <<endreq;
134
135 SmartDataPtr<EvtRecTrackCol> evtRecTrkCol(eventSvc(), EventModel::EvtRec::EvtRecTrackCol);
136
137
138 for(int i = 0; i< evtRecEvent->totalTracks(); i++) {
139
140 EvtRecTrackIterator itTrk=evtRecTrkCol->begin() + i;
141 if(!(*itTrk)->isEmcShowerValid()) continue;
142 RecEmcShower *emcTrk = (*itTrk)->emcShower();
143
144 int intid = emcTrk->cellId();
145 Identifier id=Identifier(intid);
146 int getthetaid = EmcID::theta_module(id);
147 int getmodule = EmcID::barrel_ec(id);
148 if(getthetaid>21)getthetaid=43-getthetaid;
149 if(getmodule==1)getthetaid=getthetaid+6;
150 double energyF = emcTrk->energy();
151 double e5x5 = emcTrk->e5x5();
152 double costheta = cos(emcTrk->theta());
153 double dthetaid=double(getthetaid);
154 double energyC = McCor::corEnergyMc(e5x5,dthetaid);
155
156 if(ntOut == true){
157 m_ct = costheta;
158 m_ef = energyF;
159 m_e5 = e5x5;
160 m_ec = energyC;
161 m_tuple1->write();
162 }
163 emcTrk->setEnergy(energyC);
164
165 }
166}
double cos(const BesAngle a)
Definition BesAngle.h:213
EvtRecTrackCol::iterator EvtRecTrackIterator
IMessageSvc * msgSvc()
int cellId() const
double theta() const
double e5x5() const
double energy() const
void setEnergy(double e)
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
double corEnergyMc(double eg, double theid)
Definition McCor.cxx:177
_EXTERN_ std::string EvtRecEvent
Definition EventModel.h:116
_EXTERN_ std::string EvtRecTrackCol
Definition EventModel.h:117
float costheta

◆ finalize()

StatusCode McCor::finalize ( )

Definition at line 169 of file McCor.cxx.

169 {
170
171 MsgStream log(msgSvc(), name());
172 log << MSG::INFO << "in finalize()" << endmsg;
173 return StatusCode::SUCCESS;
174}

◆ initialize()

StatusCode McCor::initialize ( )

Definition at line 64 of file McCor.cxx.

64 {
65 MsgStream log(msgSvc(), name());
66 log << MSG::INFO << "in initialize()" << endmsg;
67 StatusCode status;
68 if(ntOut == true){
69 NTuplePtr nt1(ntupleSvc(), "FILE1/ec");
70 if ( nt1 ) m_tuple1 = nt1;
71 else {
72 m_tuple1 = ntupleSvc()->book ("FILE1/ec", CLID_ColumnWiseTuple, "ks N-Tuple example");
73 if ( m_tuple1 ) {
74 status = m_tuple1->addItem ("ef", m_ef);
75 status = m_tuple1->addItem ("e5", m_e5);
76 status = m_tuple1->addItem ("ec", m_ec);
77 status = m_tuple1->addItem ("ct", m_ct);
78 }
79 else {
80 log << MSG::ERROR << " Cannot book N-tuple:" << long(m_tuple1) << endmsg;
81 return StatusCode::FAILURE;
82 }
83 }
84 }
85/*
86 string CoeffPath=getenv("MCCORROOT");
87 CoeffPath +="/share/McCorCoeff.txt";
88 ifstream in;
89 in.open(CoeffPath.c_str(),ios::in);
90 for(int i=0;i<4;i++){
91 in>>m_a[i];
92 in>>m_ae[i];
93 }
94*/
95 double energy,thetaid,peak,peakerr,res,reserr;
96 string DataPath;
97 DataPath=getenv("MCCORROOT");
98 DataPath += "/share/evset.txt";
99 ifstream in1;
100 in1.open(DataPath.c_str(),ios::in);
101// in.open("$MCCORROOT/share/evsc.txt");
102 double ep[18]={0.03,0.04,0.05,0.075,0.1,0.125,0.15,0.2,0.25,0.3,0.4,0.5,0.75,1.0,1.25,1.5,1.75,2.0};
103 for(int i=0;i<504;i++){
104 in1>>energy;
105 in1>>thetaid;
106 in1>>peak;
107 in1>>peakerr;
108 in1>>res;
109 in1>>reserr;
110 int j = i/28;
111 dt->SetPoint(i,energy,thetaid,peak);
112 dt->SetPointError(i,0,0,peakerr);
113 }
114 in1.close();
115 log << MSG::INFO << "successfully return from initialize()" <<endmsg;
116 return StatusCode::SUCCESS;
117
118}
************Class m_ypar INTEGER m_KeyWgt INTEGER m_KeyIHVP INTEGER m_KeyGPS INTEGER m_IsBeamPolarized INTEGER m_EvtGenInterface DOUBLE PRECISION m_Emin DOUBLE PRECISION m_sphot DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_q2 DOUBLE PRECISION m_PolBeam2 DOUBLE PRECISION m_xErrPb *COMMON c_KK2f $ !CMS energy average $ !Spin Polarization vector first beam $ !Spin Polarization vector second beam $ !Beam energy spread[GeV] $ !minimum hadronization energy[GeV] $ !input READ never touch them !$ !debug facility $ !maximum weight $ !inverse alfaQED $ !minimum real photon energy
Definition KK2f.h:50
INTupleSvc * ntupleSvc()
double int * ep
Definition qcdloop1.h:74

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