BOSS 7.0.6
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 47 of file McCor.cxx.

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

Member Function Documentation

◆ corEnergyMc()

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

Definition at line 176 of file McCor.cxx.

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

Referenced by execute().

◆ execute()

StatusCode McCor::execute ( )

Definition at line 120 of file McCor.cxx.

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

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

◆ initialize()

StatusCode McCor::initialize ( )

Definition at line 63 of file McCor.cxx.

63 {
64 MsgStream log(msgSvc(), name());
65 log << MSG::INFO << "in initialize()" << endmsg;
66 StatusCode status;
67 if(ntOut == true){
68 NTuplePtr nt1(ntupleSvc(), "FILE1/ec");
69 if ( nt1 ) m_tuple1 = nt1;
70 else {
71 m_tuple1 = ntupleSvc()->book ("FILE1/ec", CLID_ColumnWiseTuple, "ks N-Tuple example");
72 if ( m_tuple1 ) {
73 status = m_tuple1->addItem ("ef", m_ef);
74 status = m_tuple1->addItem ("e5", m_e5);
75 status = m_tuple1->addItem ("ec", m_ec);
76 status = m_tuple1->addItem ("ct", m_ct);
77 }
78 else {
79 log << MSG::ERROR << " Cannot book N-tuple:" << long(m_tuple1) << endmsg;
80 return StatusCode::FAILURE;
81 }
82 }
83 }
84/*
85 string CoeffPath=getenv("MCCORROOT");
86 CoeffPath +="/share/McCorCoeff.txt";
87 ifstream in;
88 in.open(CoeffPath.c_str(),ios::in);
89 for(int i=0;i<4;i++){
90 in>>m_a[i];
91 in>>m_ae[i];
92 }
93*/
94 double energy,thetaid,peak,peakerr,res,reserr;
95 string DataPath;
96 DataPath=getenv("MCCORROOT");
97 DataPath += "/share/evset.txt";
98 ifstream in1;
99 in1.open(DataPath.c_str(),ios::in);
100// in.open("$MCCORROOT/share/evsc.txt");
101 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};
102 for(int i=0;i<504;i++){
103 in1>>energy;
104 in1>>thetaid;
105 in1>>peak;
106 in1>>peakerr;
107 in1>>res;
108 in1>>reserr;
109 int j = i/28;
110 dt->SetPoint(i,energy,thetaid,peak);
111 dt->SetPointError(i,0,0,peakerr);
112 }
113 in1.close();
114 log << MSG::INFO << "successfully return from initialize()" <<endmsg;
115 return StatusCode::SUCCESS;
116
117}
************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()
std::ifstream ifstream
Definition: bpkt_streams.h:44

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