BOSS 7.0.2
BESIII Offline Software System
Loading...
Searching...
No Matches
BFieldCorr Class Reference

#include <BFieldCorr.h>

+ Inheritance diagram for BFieldCorr:

Public Member Functions

 BFieldCorr (const std::string &name, ISvcLocator *pSvcLocator)
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 
 BFieldCorr (const std::string &name, ISvcLocator *pSvcLocator)
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 

Detailed Description

Constructor & Destructor Documentation

◆ BFieldCorr() [1/2]

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

Definition at line 45 of file BFieldCorr.cxx.

45 :Algorithm(name,pSvcLocator)
46{
47 declareProperty("CorrectionFactor", m_factor = 1.0000);
48}

◆ BFieldCorr() [2/2]

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

Member Function Documentation

◆ execute() [1/2]

StatusCode BFieldCorr::execute ( )

Definition at line 68 of file BFieldCorr.cxx.

69{
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;
75
76 SmartDataPtr<EvtRecEvent> evtRecEvent(eventSvc(), EventModel::EvtRec::EvtRecEvent);
77 if (!evtRecEvent)
78 {
79 log << MSG::FATAL << "Could not find EvtRecEvent" << endreq;
80 return StatusCode::SUCCESS;
81 }
82
83 SmartDataPtr<EvtRecTrackCol> evtRecTrkCol(eventSvc(), EventModel::EvtRec::EvtRecTrackCol);
84 if (!evtRecTrkCol)
85 {
86 log << MSG::FATAL << "Could not find EvtRecTrackCol" << endreq;
87 return StatusCode::SUCCESS;
88 }
89
90 if ((unsigned int)evtRecEvent->totalTracks() > evtRecTrkCol->size()) return StatusCode::SUCCESS;
91 //if (evtRecEvent->totalTracks() > 50) return StatusCode::SUCCESS;
92
93 //set Ew if by default
94 double factor;
95 if (fabs(m_factor - 1.000) < 1e-6)
96 {
97 if (run_no >= RUN_BEGIN_10 && run_no <= RUN_END_10)
98 factor = 1.0004;
99 else if (run_no >= RUN_BEGIN_11 && run_no <= RUN_END_11)
100 factor = 1.0002;
101 else
102 factor = 1.0000;
103 }
104 else
105 {
106 factor = m_factor;
107 }
108 m_Ew[2][2] = fabs(factor) < 1e-6 ? 1.0 : 1.0 / factor;
109
110 for (int i = 0; i < evtRecEvent->totalCharged(); i++)
111 {
112 EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + i;
113 if (!(*itTrk)->isMdcTrackValid()) continue;
114 if (!(*itTrk)->isMdcKalTrackValid()) continue;
115
116 //RecMdcTrack correction
117 RecMdcTrack *mdc_trk = (*itTrk)->mdcTrack();
118 mdc_trk->setHelix( m_Ew * mdc_trk->helix() );
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() );
125
126 //RecMdcKalTrack correction
127 RecMdcKalTrack *kal_trk = (*itTrk)->mdcKalTrack();
128 RecMdcKalTrack::PidType trk_type[] = {
134 };
135
136 for (int j = 0; j < 5; j++)
137 {
138 kal_trk->setPidType( trk_type[j] );
139 kal_trk->setZHelix( m_Ew * kal_trk->helix(), 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 );
146 }
147 }
148 return StatusCode::SUCCESS;
149}
void setZError(const HepSymMatrix &error, const int pid)
void setPxy(const double pxy, const int pid)
void setZHelix(const HepVector &helix, const int pid)
const HepSymMatrix err() const
void setError(double err[15])
void setHelix(double helix[5])
Definition: DstMdcTrack.cxx:98
const HepVector helix() const
......

◆ execute() [2/2]

StatusCode BFieldCorr::execute ( )

◆ finalize() [1/2]

StatusCode BFieldCorr::finalize ( )

Definition at line 151 of file BFieldCorr.cxx.

152{
153 MsgStream log(msgSvc(), name());
154 log << MSG::INFO << "in BFieldCorr::finalize()" << endreq;
155 return StatusCode::SUCCESS;
156}

◆ finalize() [2/2]

StatusCode BFieldCorr::finalize ( )

◆ initialize() [1/2]

StatusCode BFieldCorr::initialize ( )

Definition at line 50 of file BFieldCorr.cxx.

51{
52 m_Ew = HepSymMatrix(5, 0);
53 m_Ew[0][0] = 1.0;
54 m_Ew[1][1] = 1.0;
55 m_Ew[2][2] = fabs(m_factor) < 1e-6 ? 1.0 : 1.0 / m_factor;
56 m_Ew[3][3] = 1.0;
57 m_Ew[4][4] = 1.0;
58 RUN_BEGIN_10 = 11414;
59 RUN_END_10 = 14604;
60 RUN_BEGIN_11 = 20448;
61 RUN_END_11 = 23454;
62
63 MsgStream log(msgSvc(), name());
64 log << MSG::INFO << "in MagCorr::initialize()" <<endmsg;
65 return StatusCode::SUCCESS;
66}

◆ initialize() [2/2]

StatusCode BFieldCorr::initialize ( )

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