1#include "GaudiKernel/MsgStream.h"
2#include "GaudiKernel/AlgFactory.h"
3#include "GaudiKernel/ISvcLocator.h"
4#include "GaudiKernel/SmartDataPtr.h"
5#include "GaudiKernel/IDataProviderSvc.h"
6#include "GaudiKernel/PropertyMgr.h"
7#include "EventModel/EventModel.h"
8#include "EventModel/Event.h"
10#include "EvtRecEvent/EvtRecEvent.h"
11#include "EvtRecEvent/EvtRecTrack.h"
14#include "GaudiKernel/INTupleSvc.h"
15#include "GaudiKernel/NTuple.h"
16#include "GaudiKernel/Bootstrap.h"
17#include "GaudiKernel/IHistogramSvc.h"
18#include "CLHEP/Vector/ThreeVector.h"
19#include "CLHEP/Vector/LorentzVector.h"
20#include "CLHEP/Vector/TwoVector.h"
21using CLHEP::Hep3Vector;
22using CLHEP::Hep2Vector;
23using CLHEP::HepLorentzVector;
24#include "CLHEP/Geometry/Point3D.h"
25#ifndef ENABLE_BACKWARDS_COMPATIBILITY
28#include "McCor/McCor.h"
30#include "Identifier/Identifier.h"
32#include "TGraphErrors.h"
34#include "TGraph2DErrors.h"
45TGraph2DErrors *
dt =
new TGraph2DErrors();
48 Algorithm(name, pSvcLocator) {
52 declareProperty(
"NTupleOut",ntOut);
64 MsgStream log(
msgSvc(), name());
65 log << MSG::INFO <<
"in initialize()" << endmsg;
69 if ( nt1 ) m_tuple1 = nt1;
71 m_tuple1 =
ntupleSvc()->book (
"FILE1/ec", CLID_ColumnWiseTuple,
"ks N-Tuple example");
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);
79 log << MSG::ERROR <<
" Cannot book N-tuple:" << long(m_tuple1) << endmsg;
80 return StatusCode::FAILURE;
94 double energy,thetaid,peak,peakerr,res,reserr;
96 DataPath=getenv(
"MCCORROOT");
97 DataPath +=
"/share/evset.txt";
99 in1.open(DataPath.c_str(),ios::in);
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++){
110 dt->SetPoint(i,
energy,thetaid,peak);
111 dt->SetPointError(i,0,0,peakerr);
114 log << MSG::INFO <<
"successfully return from initialize()" <<endmsg;
115 return StatusCode::SUCCESS;
123 MsgStream log(
msgSvc(), name());
124 log << MSG::INFO <<
"in execute()" << endreq;
126 SmartDataPtr<Event::EventH> eventHeader(eventSvc(),
"/Event");
129 log << MSG::DEBUG <<
"ncharg, nneu, tottks = "
130 << evtRecEvent->totalCharged() <<
" , "
131 << evtRecEvent->totalNeutral() <<
" , "
132 << evtRecEvent->totalTracks() <<endreq;
137 for(
int i = 0; i< evtRecEvent->totalTracks(); i++) {
140 if(!(*itTrk)->isEmcShowerValid())
continue;
143 int intid = emcTrk->
cellId();
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);
170 MsgStream log(
msgSvc(), name());
171 log << MSG::INFO <<
"in finalize()" << endmsg;
172 return StatusCode::SUCCESS;
179 if(eg<0.029)eg=0.029;
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;
EvtRecTrackCol::iterator EvtRecTrackIterator
double cos(const BesAngle a)
************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
HepGeom::Point3D< double > HepPoint3D
static unsigned int barrel_ec(const Identifier &id)
Values of different levels (failure returns 0)
static unsigned int theta_module(const Identifier &id)
double corEnergyMc(double eg, double theid)
McCor(const std::string &name, ISvcLocator *pSvcLocator)
_EXTERN_ std::string EvtRecEvent
_EXTERN_ std::string EvtRecTrackCol