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"
9#include "EventModel/EventHeader.h"
10#include "EvtRecEvent/EvtRecEvent.h"
11#include "EvtRecEvent/EvtRecTrack.h"
12#include "EvtRecEvent/EvtRecPi0.h"
13#include "GaudiKernel/INTupleSvc.h"
14#include "GaudiKernel/NTuple.h"
15#include "GaudiKernel/Bootstrap.h"
16#include "GaudiKernel/IHistogramSvc.h"
17#include "CLHEP/Vector/ThreeVector.h"
18#include "CLHEP/Vector/LorentzVector.h"
19#include "CLHEP/Vector/TwoVector.h"
20#include "CLHEP/Geometry/Point3D.h"
21#include "MdcRecEvent/RecMdcKalTrack.h"
23#include "BFieldCorr/BFieldCorr.h"
25#include "CLHEP/Matrix/Vector.h"
26#include "CLHEP/Vector/LorentzVector.h"
27#include "CLHEP/Vector/ThreeVector.h"
28#include "CLHEP/Matrix/SymMatrix.h"
29#include "CLHEP/Matrix/Matrix.h"
30using CLHEP::HepVector;
31using CLHEP::HepLorentzVector;
32using CLHEP::Hep3Vector;
33using CLHEP::HepMatrix;
34using CLHEP::HepSymMatrix;
36#include "CLHEP/Geometry/Point3D.h"
37#ifndef ENABLE_BACKWARDS_COMPATIBILITY
47 declareProperty(
"CorrectionFactor", m_factor = 1.0000);
52 m_Ew = HepSymMatrix(5, 0);
55 m_Ew[2][2] = fabs(m_factor) < 1e-6 ? 1.0 : 1.0 / m_factor;
63 MsgStream log(
msgSvc(), name());
64 log << MSG::INFO <<
"in MagCorr::initialize()" <<endmsg;
65 return StatusCode::SUCCESS;
70 MsgStream log(
msgSvc(), name());
71 log << MSG::INFO <<
"in BFieldCorr::execute()" << endreq;
72 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
73 int run_no = eventHeader->runNumber();
74 if (run_no < 0)
return StatusCode::SUCCESS;
79 log << MSG::FATAL <<
"Could not find EvtRecEvent" << endreq;
80 return StatusCode::SUCCESS;
86 log << MSG::FATAL <<
"Could not find EvtRecTrackCol" << endreq;
87 return StatusCode::SUCCESS;
90 if ((
unsigned int)evtRecEvent->totalTracks() > evtRecTrkCol->size())
return StatusCode::SUCCESS;
95 if (fabs(m_factor - 1.000) < 1e-6)
97 if (run_no >= RUN_BEGIN_10 && run_no <= RUN_END_10)
99 else if (run_no >= RUN_BEGIN_11 && run_no <= RUN_END_11)
108 m_Ew[2][2] = fabs(factor) < 1e-6 ? 1.0 : 1.0 / factor;
110 for (
int i = 0; i < evtRecEvent->totalCharged(); i++)
113 if (!(*itTrk)->isMdcTrackValid())
continue;
114 if (!(*itTrk)->isMdcKalTrackValid())
continue;
119 mdc_trk->
setError( mdc_trk->
err().similarity(m_Ew) );
120 mdc_trk->
setP( factor * mdc_trk->
p() );
121 mdc_trk->
setPxy( factor * mdc_trk->
pxy() );
122 mdc_trk->
setPx( factor * mdc_trk->
px() );
123 mdc_trk->
setPy( factor * mdc_trk->
py() );
124 mdc_trk->
setPz( factor * mdc_trk->
pz() );
136 for (
int j = 0; j < 5; j++)
140 kal_trk->
setZError( kal_trk->
err().similarity(m_Ew), j );
141 kal_trk->
setP( factor * kal_trk->
p(), j );
142 kal_trk->
setPxy( factor * kal_trk->
pxy(), j );
143 kal_trk->
setPx( factor * kal_trk->
px(), j );
144 kal_trk->
setPy( factor * kal_trk->
py(), j );
145 kal_trk->
setPz( factor * kal_trk->
pz(), j );
148 return StatusCode::SUCCESS;
153 MsgStream log(
msgSvc(), name());
154 log << MSG::INFO <<
"in BFieldCorr::finalize()" << endreq;
155 return StatusCode::SUCCESS;
HepGeom::Point3D< double > HepPoint3D
EvtRecTrackCol::iterator EvtRecTrackIterator
BFieldCorr(const std::string &name, ISvcLocator *pSvcLocator)
void setPz(const double pz, const int pid)
const HepVector & helix() const
void setZError(const HepSymMatrix &error, const int pid)
void setP(const double p, const int pid)
void setPx(const double px, const int pid)
void setPxy(const double pxy, const int pid)
void setPy(const double py, const int pid)
static void setPidType(PidType pidType)
void setZHelix(const HepVector &helix, const int pid)
const HepSymMatrix & err() const
void setPxy(const double pxy)
void setPy(const double py)
const HepSymMatrix err() const
void setError(double err[15])
void setP(const double p)
void setHelix(double helix[5])
const HepVector helix() const
......
void setPz(const double pz)
void setPx(const double px)
_EXTERN_ std::string EvtRecEvent
_EXTERN_ std::string EvtRecTrackCol