BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
TofRecTDS Class Reference

#include <TofRecTDS.h>

Public Member Functions

StatusCode InitializeTDS ()
 
StatusCode RegisterNullRecTofTrackCol ()
 
StatusCode RegisterTDS (int runNumber, int eventNumber, std::vector< TofTrack * > *&tofTrackVec, bool m_forCalibration, std::string m_calibData)
 
StatusCode RegisterReconEvent ()
 
StatusCode RegisterRecTofTrackCol (std::vector< TofTrack * > *&tofTrackVec)
 
StatusCode RegisterRecBTofCalHitCol (int runNumber, int eventNumber, std::vector< TofTrack * > *&tofTrackVec, std::string calibData)
 
StatusCode RegisterRecETofCalHitCol (int runNumber, int eventNumber, std::vector< TofTrack * > *&tofTrackVec, std::string calibData)
 

Detailed Description

Definition at line 7 of file TofRecTDS.h.

Member Function Documentation

◆ InitializeTDS()

StatusCode TofRecTDS::InitializeTDS ( )

Definition at line 15 of file TofRecTDS.cxx.

15 {
16 if( RegisterReconEvent() == StatusCode::FAILURE ) return StatusCode::FAILURE;
17 if( RegisterNullRecTofTrackCol() == StatusCode::FAILURE ) return StatusCode::FAILURE;
18 return StatusCode::SUCCESS;
19}
StatusCode RegisterNullRecTofTrackCol()
Definition: TofRecTDS.cxx:22
StatusCode RegisterReconEvent()
Definition: TofRecTDS.cxx:69

◆ RegisterNullRecTofTrackCol()

StatusCode TofRecTDS::RegisterNullRecTofTrackCol ( )

Definition at line 22 of file TofRecTDS.cxx.

22 {
23 IMessageSvc* msgSvc;
24 Gaudi::svcLocator()->service("MessageSvc", msgSvc);
25 MsgStream log(msgSvc, "TofRecTDS");
26 log << MSG::INFO << "Initialize: TofRecTDS::RegisterNullRecTofTrack()" << endreq;
27
28 IDataProviderSvc* eventSvc;
29 Gaudi::svcLocator()->service("EventDataSvc", eventSvc);
30
31 RecTofTrackCol* recTofTrackCol = new RecTofTrackCol;
32
33// Check whether the RecTofTrackCol has been registered.
34 StatusCode sc;
35 DataObject *aRecTofTrackCol;
36 eventSvc->findObject( "/Event/Recon/RecTofTrackCol", aRecTofTrackCol );
37 if( aRecTofTrackCol != NULL ) {
38 sc = eventSvc->unregisterObject( "/Event/Recon/RecTofTrackCol" );
39 if( sc != StatusCode::SUCCESS ) {
40 log << MSG::FATAL << "Initialize: Could not unregister RecTofTrack collection!" << endreq;
41 delete recTofTrackCol;
42 return StatusCode::FAILURE;
43 }
44 }
45 delete aRecTofTrackCol;
46
47 sc = eventSvc->registerObject("/Event/Recon/RecTofTrackCol", recTofTrackCol);
48 if( sc != StatusCode::SUCCESS ) {
49 log << MSG::FATAL << "Initialize: TofRec could not register Null Rec TOF track collection!" << endreq;
50 delete recTofTrackCol;
51 return StatusCode::FAILURE;
52 }
53
54 return StatusCode::SUCCESS;
55}
ObjectVector< RecTofTrack > RecTofTrackCol
Definition: RecTofTrack.h:33
IMessageSvc * msgSvc()
#define NULL

Referenced by TofRec::execute(), and InitializeTDS().

◆ RegisterRecBTofCalHitCol()

StatusCode TofRecTDS::RegisterRecBTofCalHitCol ( int  runNumber,
int  eventNumber,
std::vector< TofTrack * > *&  tofTrackVec,
std::string  calibData 
)

Definition at line 156 of file TofRecTDS.cxx.

156 {
157 IMessageSvc* msgSvc;
158 Gaudi::svcLocator()->service("MessageSvc", msgSvc);
159 MsgStream log(msgSvc, "TofRecTDS");
160 log << MSG::INFO << "TofRecTDS::RegisterRecBTofCalHitCol()" << endreq;
161
162 IDataProviderSvc* eventSvc;
163 Gaudi::svcLocator()->service("EventDataSvc", eventSvc);
164
165 RecBTofCalHitCol* recBTofCalHitCol = new RecBTofCalHitCol;
166
167 std::vector<TofTrack*>::iterator iter = tofTrackVec->begin();
168 for( ; iter < tofTrackVec->end(); iter++ ) {
169 ExtTrackCase hitcase = (*iter)->hitCase();
170 // if( ( hitcase == InnerLayer ) || ( hitcase == OuterLayer ) || ( hitcase == DoubleLayer ) ) {
171 if( ( hitcase == InnerLayer ) || ( hitcase == DoubleLayer ) ) {
172 (*iter)->convert2RecBTofCalHitColBarrel( runNumber, eventNumber, recBTofCalHitCol, m_calibData );
173 }
174 if( ( hitcase == EastEndcapMRPC ) || ( hitcase == WestEndcapMRPC ) ) {
175 (*iter)->convert2RecBTofCalHitColETF( runNumber, eventNumber, recBTofCalHitCol, m_calibData );
176 }
177 }
178
179// Check whether the RecBTofCalHitCol has been registered.
180 StatusCode scb;
181 DataObject *aRecBTofCalHitCol;
182 eventSvc->findObject( "/Event/Recon/RecBTofCalhitCol", aRecBTofCalHitCol );
183 if( aRecBTofCalHitCol != NULL ) {
184 scb = eventSvc->unregisterObject( "/Event/Recon/RecBTofCalHitCol" );
185 if( scb != StatusCode::SUCCESS ) {
186 log << MSG::FATAL << "Could not unregister RecBTofCalHit collection!" << endreq;
187
188 RecBTofCalHitCol::iterator iter_btof = recBTofCalHitCol->begin();
189 for( ; iter_btof!=recBTofCalHitCol->end(); iter_btof++ ) {
190 delete (*iter_btof);
191 }
192 recBTofCalHitCol->clear();
193 delete recBTofCalHitCol;
194
195 std::vector<TofTrack*>::iterator iter_data = tofTrackVec->begin();
196 for( ; iter_data!=tofTrackVec->end(); iter_data++ ) {
197 delete (*iter_data);
198 }
199 tofTrackVec->clear();
200 delete tofTrackVec;
201
202 return StatusCode::FAILURE;
203 }
204 }
205
206 StatusCode sh1 = eventSvc->registerObject("/Event/Recon/RecBTofCalHitCol", recBTofCalHitCol);
207 if(sh1!=StatusCode::SUCCESS) {
208 log << MSG::FATAL << "TofRec could not register BTOF CalHit collection!!" << endreq;
209 RecBTofCalHitCol::iterator iter_btof = recBTofCalHitCol->begin();
210 for( ; iter_btof!=recBTofCalHitCol->end(); iter_btof++ ) {
211 delete (*iter_btof);
212 }
213 recBTofCalHitCol->clear();
214 delete recBTofCalHitCol;
215 return StatusCode::FAILURE;
216 }
217
218 return StatusCode::SUCCESS;
219}
ObjectVector< RecBTofCalHit > RecBTofCalHitCol
Definition: RecBTofCalHit.h:94
ExtTrackCase
Definition: TofTrack.h:20
@ EastEndcapMRPC
Definition: TofTrack.h:20
@ InnerLayer
Definition: TofTrack.h:20
@ DoubleLayer
Definition: TofTrack.h:20
@ WestEndcapMRPC
Definition: TofTrack.h:20
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)

Referenced by RegisterTDS().

◆ RegisterRecETofCalHitCol()

StatusCode TofRecTDS::RegisterRecETofCalHitCol ( int  runNumber,
int  eventNumber,
std::vector< TofTrack * > *&  tofTrackVec,
std::string  calibData 
)

Definition at line 222 of file TofRecTDS.cxx.

222 {
223 IMessageSvc* msgSvc;
224 Gaudi::svcLocator()->service("MessageSvc", msgSvc);
225 MsgStream log(msgSvc, "TofRecTDS");
226 log << MSG::INFO << "TofRecTDS::RegisterRecETofCalHitCol()" << endreq;
227
228 IDataProviderSvc* eventSvc;
229 Gaudi::svcLocator()->service("EventDataSvc", eventSvc);
230
231 //sunss add 08/10/16
232
233 if( tofTrackVec->size() != 2 ) return StatusCode::SUCCESS;
234 std::vector<TofTrack*>::iterator iter1 = tofTrackVec->begin();
235 std::vector<TofTrack*>::iterator iter2 = iter1+1;
236 if( (*iter1)->tdc1() < 0.0 || (*iter2)->tdc1() < 0.0 ) return StatusCode::SUCCESS;
237 if( abs( (*iter1)->tdc1() - (*iter2)->tdc1() ) > 2.0 ) return StatusCode::SUCCESS;
238
239 //sunss add 08/10/16
240
241 RecETofCalHitCol* recETofCalHitCol = new RecETofCalHitCol;
242
243 std::vector<TofTrack*>::iterator iter = tofTrackVec->begin();
244 for( ; iter < tofTrackVec->end(); iter++ ) {
245 ExtTrackCase hitcase = (*iter)->hitCase();
246 if( ( hitcase == EastEndcap ) || ( hitcase == WestEndcap ) ) {
247 (*iter)->convert2RecETofCalHitCol( runNumber, eventNumber, recETofCalHitCol, m_calibData );
248 }
249 }
250
251// Check whether the RecETofCalHitCol has been registered.
252 StatusCode sce;
253
254 DataObject *aRecETofCalHitCol;
255 eventSvc->findObject( "/Event/Recon/RecETofCalhitCol", aRecETofCalHitCol );
256 if( aRecETofCalHitCol != NULL ) {
257 sce = eventSvc->unregisterObject( "/Event/Recon/RecETofCalHitCol" );
258 if( sce != StatusCode::SUCCESS ) {
259 log << MSG::FATAL << "Could not unregister RecETofCalHit collection!" << endreq;
260
261 RecETofCalHitCol::iterator iter_etof = recETofCalHitCol->begin();
262 for( ; iter_etof!=recETofCalHitCol->end(); iter_etof++ ) {
263 delete (*iter_etof);
264 }
265 recETofCalHitCol->clear();
266 delete recETofCalHitCol;
267
268 std::vector<TofTrack*>::iterator iter_data = tofTrackVec->begin();
269 for( ; iter_data!=tofTrackVec->end(); iter_data++ ) {
270 delete (*iter_data);
271 }
272 tofTrackVec->clear();
273 delete tofTrackVec;
274
275 return StatusCode::FAILURE;
276 }
277 }
278
279 StatusCode sh2 = eventSvc->registerObject("/Event/Recon/RecETofCalHitCol",recETofCalHitCol);
280 if(sh2!=StatusCode::SUCCESS) {
281 log << MSG::FATAL << "TofRec could not register ETOF CalHit collection!!" << endreq;
282 RecETofCalHitCol::iterator iter_etof = recETofCalHitCol->begin();
283 for( ; iter_etof!=recETofCalHitCol->end(); iter_etof++ ) {
284 delete (*iter_etof);
285 }
286 recETofCalHitCol->clear();
287 delete recETofCalHitCol;
288 return StatusCode::FAILURE;
289 }
290
291 return StatusCode::SUCCESS;
292}
ObjectVector< RecETofCalHit > RecETofCalHitCol
Definition: RecETofCalHit.h:82
@ WestEndcap
Definition: TofTrack.h:20
@ EastEndcap
Definition: TofTrack.h:20

Referenced by RegisterTDS().

◆ RegisterReconEvent()

StatusCode TofRecTDS::RegisterReconEvent ( )

Definition at line 69 of file TofRecTDS.cxx.

69 {
70 IMessageSvc* msgSvc;
71 Gaudi::svcLocator()->service("MessageSvc", msgSvc);
72 MsgStream log(msgSvc, "TofRecTDS");
73
74 IDataProviderSvc* eventSvc;
75 Gaudi::svcLocator()->service("EventDataSvc", eventSvc);
76
77// Register Reconstructed Track To TDS
78 DataObject *aReconEvent ;
79 eventSvc->findObject("/Event/Recon",aReconEvent);
80 if(aReconEvent==NULL) {
81 log << MSG::INFO << "TofRecTDS::RegisterReconEvent()" << endreq;
82 aReconEvent = new ReconEvent();
83 StatusCode sc = eventSvc->registerObject("/Event/Recon",aReconEvent);
84 if(sc!=StatusCode::SUCCESS) {
85 log << MSG::FATAL << "TofRec could not register ReconEvent!" <<endreq;
86 return StatusCode::FAILURE;
87 }
88 }
89 return StatusCode::SUCCESS;
90}

Referenced by InitializeTDS().

◆ RegisterRecTofTrackCol()

StatusCode TofRecTDS::RegisterRecTofTrackCol ( std::vector< TofTrack * > *&  tofTrackVec)

Definition at line 93 of file TofRecTDS.cxx.

93 {
94 IMessageSvc* msgSvc;
95 Gaudi::svcLocator()->service("MessageSvc", msgSvc);
96 MsgStream log(msgSvc, "TofRecTDS");
97 log << MSG::INFO << "TofRecTDS::RegisterRecTofTrack()" << endreq;
98
99 IDataProviderSvc* eventSvc;
100 Gaudi::svcLocator()->service("EventDataSvc", eventSvc);
101
102 RecTofTrackCol* recTofTrackCol = new RecTofTrackCol;
103
104 std::vector<TofTrack*>::iterator iter = tofTrackVec->begin();
105 for( ; iter < tofTrackVec->end(); iter++ ) {
106 (*iter)->convert2RecTofTrackCol( recTofTrackCol );
107 }
108
109// Check whether the RecTofTrackCol has been registered.
110 StatusCode sc;
111 DataObject *aRecTofTrackCol;
112 eventSvc->findObject( "/Event/Recon/RecTofTrackCol", aRecTofTrackCol );
113 if( aRecTofTrackCol != NULL ) {
114
115 sc = eventSvc->unregisterObject( "/Event/Recon/RecTofTrackCol" );
116
117 delete aRecTofTrackCol;
118
119 if( sc != StatusCode::SUCCESS ) {
120 log << MSG::FATAL << "Could not unregister RecTofTrack collection!" << endreq;
121
122 RecTofTrackCol::iterator iter_tof = recTofTrackCol->begin();
123 for( ; iter_tof!=recTofTrackCol->end(); iter_tof++ ) {
124 delete (*iter_tof);
125 }
126 recTofTrackCol->clear();
127 delete recTofTrackCol;
128
129 std::vector<TofTrack*>::iterator iter_data = tofTrackVec->begin();
130 for( ; iter_data!=tofTrackVec->end(); iter_data++ ) {
131 delete (*iter_data);
132 }
133 tofTrackVec->clear();
134 delete tofTrackVec;
135
136 return StatusCode::FAILURE;
137 }
138 }
139
140 sc = eventSvc->registerObject("/Event/Recon/RecTofTrackCol", recTofTrackCol);
141 if( sc != StatusCode::SUCCESS ) {
142 log << MSG::FATAL << "TofRec could not register Rec TOF track collection!" << endreq;
143 RecTofTrackCol::iterator iter_tof = recTofTrackCol->begin();
144 for( ; iter_tof!=recTofTrackCol->end(); iter_tof++ ) {
145 delete (*iter_tof);
146 }
147 recTofTrackCol->clear();
148 delete recTofTrackCol;
149 return StatusCode::FAILURE;
150 }
151
152 return StatusCode::SUCCESS;
153}

Referenced by RegisterTDS().

◆ RegisterTDS()

StatusCode TofRecTDS::RegisterTDS ( int  runNumber,
int  eventNumber,
std::vector< TofTrack * > *&  tofTrackVec,
bool  m_forCalibration,
std::string  m_calibData 
)

Definition at line 58 of file TofRecTDS.cxx.

58 {
59 // if( RegisterReconEvent() == StatusCode::FAILURE ) return StatusCode::FAILURE;
60 if( RegisterRecTofTrackCol( tofTrackVec ) == StatusCode::FAILURE ) return StatusCode::FAILURE;
61 if( forCalibration ) {
62 if( RegisterRecBTofCalHitCol( runNumber, eventNumber, tofTrackVec, calibData ) == StatusCode::FAILURE ) return StatusCode::FAILURE;
63 if( RegisterRecETofCalHitCol( runNumber, eventNumber, tofTrackVec, calibData ) == StatusCode::FAILURE ) return StatusCode::FAILURE;
64 }
65 return StatusCode::SUCCESS;
66}
StatusCode RegisterRecTofTrackCol(std::vector< TofTrack * > *&tofTrackVec)
Definition: TofRecTDS.cxx:93
StatusCode RegisterRecETofCalHitCol(int runNumber, int eventNumber, std::vector< TofTrack * > *&tofTrackVec, std::string calibData)
Definition: TofRecTDS.cxx:222
StatusCode RegisterRecBTofCalHitCol(int runNumber, int eventNumber, std::vector< TofTrack * > *&tofTrackVec, std::string calibData)
Definition: TofRecTDS.cxx:156

Referenced by TofRec::execute().


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