148 {
149
150
151
152 MsgStream log(
msgSvc(), name());
153 log << MSG::INFO << "MrpcRecDBS in execute()!" << endreq;
154
155 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
156 if( !eventHeader ) {
157 log << MSG::FATAL << "MrpcRecDBS could not find Event Header!" << endreq;
158 return StatusCode::FAILURE;
159 }
160 int run = eventHeader->runNumber();
161 int event = eventHeader->eventNumber();
162 if( ( event % 1000 == 0 ) && m_printOutInfo ) {
163 std::cout << "run:" << run << " event: " << event << std::endl;
164 }
165 log << MSG::INFO << "run= " << run << " event= " << event << endreq;
166
169
170
171 if( m_acceleratorStatus == "Colliding" ) {
172
173 SmartDataPtr<RecEsTimeCol> estimeCol(eventSvc(),"/Event/Recon/RecEsTimeCol");
174 if( !estimeCol || ( estimeCol->size() == 0 ) ) {
175 log << MSG::WARNING << "MrpcRecDBS Could not find RecEsTimeCol! Run = " << run << " Event = " << event << endreq;
176 return StatusCode::SUCCESS;
177 }
178 RecEsTimeCol::iterator iter_ESTime=estimeCol->begin();
179 double t0 = (*iter_ESTime)->getTest();
180 int t0Stat = (*iter_ESTime)->getStat();
181 log << MSG::INFO << "t0= " << t0 << " t0Stat= " << t0Stat << endreq;
182
183
184
185
186
187 SmartDataPtr<RecMdcKalTrackCol> mdcKalTrackCol(eventSvc(),"/Event/Recon/RecMdcKalTrackCol");
188 if( !mdcKalTrackCol ) {
189 log << MSG::WARNING << "No MdcKalTrackCol in TDS! Run = " << run << " Event = " << event << endreq;
190 return StatusCode::SUCCESS;
191 }
192
193
194
195
196 SmartDataPtr<RecExtTrackCol> extTrackCol(eventSvc(),"/Event/Recon/RecExtTrackCol");
197 if( !extTrackCol ) {
198 log << MSG::WARNING << "No ExtTrackCol in TDS! Run = " << run << " Event = " << event << endreq;
199 return StatusCode::SUCCESS;
200 }
201 else
202 {
203 if( m_printOutInfo ) { m_printOut->
setExtTrackNum( extTrackCol->size() ); }
204 }
205
206
207
208
210 RecExtTrackCol::iterator iter_track = extTrackCol->begin();
211 for( ; iter_track < extTrackCol->end(); iter_track++ ) {
212 RecMdcKalTrackCol::iterator iter_kal = mdcKalTrackCol->begin();
213 for( ; iter_kal != mdcKalTrackCol->end(); iter_kal++ ) {
214 if( (*iter_kal)->trackId() == (*iter_track)->trackId() ) break;
215 }
216 int kal[5] = {-1};
217 if( iter_kal != mdcKalTrackCol->end() ) {
218 for( unsigned int i=0; i<5; i++ ) {
219 kal[i] = (*iter_kal)->getStat( 1, i );
220 }
221 }
223 tof->
setExtTrack( (*iter_track), kal, t0, t0Stat );
224
225 if( tofTrackVec->size()>0 ) {
226 std::vector<MrpcDBSTrack*>::iterator iterExt = tofTrackVec->begin();
227 for( ; iterExt < tofTrackVec->end(); iterExt++ ) {
228 if( (*iterExt)->isNoHit() ) continue;
230 }
231 }
232
233 tofTrackVec->push_back( tof );
234 }
235
236
237 if( m_printOutInfo )
238 {
240 }
241
242
244 if( tofDataMap.empty() ) {
245 log << MSG::WARNING << "No Tof Data Map in RawDataProviderSvc! Run=" << run << " Event=" << event << endreq;
246 }
247
248
249 std::vector<MrpcDBSTrack*>::iterator
iter = tofTrackVec->begin();
250 for( ;
iter < tofTrackVec->end();
iter++ ) {
251 if( (*iter)->isNoHit() ) continue;
252 (*iter)->setTofData( tofDataMap,m_neighborhood );
254 if( (*iter)->isNoHit() ) continue;
255 (*iter)->match(tofTrackVec );
257 }
258
259 iter = tofTrackVec->begin();
260
261 for( ;
iter < tofTrackVec->end();
iter++ )
262 {
263 (*iter)->setCalibration();
265
266
267
268
269
270 if(m_store_trans_time==1)
271 {
272
273
274
275 m_mrpc_dbs=(*iter)->mrpc_dbs();
276 m_mrpc_extrap=(*iter)->mrpc_extra();
277 m_mrpc_aver=(*iter)->mrpc_aver();
278
279 m_partID=(*iter)->mrpc_partid();
280 m_stripidentifier=(*iter)->mrpc_stripidentifier();
281 m_time_1=(*iter)->mrpc_time_1();
282 m_time_2=(*iter)->mrpc_time_2();
283 m_trans_time=(*iter)->mrpc_trans_time();
284
285 m_r_ext=(*iter)->mrpc_r_ext();
286 m_phi_ext=(*iter)->mrpc_phi_ext();
287
288
289
290 SmartDataPtr<Event::TofMcHitCol> mcParticleCol(eventSvc(), "/Event/MC/TofMcHitCol");
291 double mc_truth_x,mc_truth_y;
292 double mc_truth_trans_time;
293 bool write_root_data=false;
296
297
298
299
300 if (!mcParticleCol)
301 {
302 std::cout << "Could not retrieve McParticelCol" << std::endl;
303 }
304 else
305 {
306
307 Event::TofMcHitCol::iterator iter_mc = mcParticleCol->begin();
308 for (; iter_mc != mcParticleCol->end(); iter_mc++)
309 {
310
311
312
313 mc_truth_x=(*iter_mc)->getPositionX();
314 mc_truth_y=(*iter_mc)->getPositionY();
315 const Identifier ident = (*iter_mc)->identify();
320
322
323
324
325
326
327 if(m_partID==mc_truth_partid && mc_truth_tofmod==((int)m_stripidentifier/25) && ((int)m_stripidentifier%25)==(mc_truth_tofstr))
328 {
329 write_root_data=true;
330 break;
331 }
332
333 }
334
335 }
336 if(mc_truth_trans_time==0) m_transition_time_simulation=-100;
337 else m_transition_time_simulation=mc_truth_trans_time;
338
339 if(write_root_data) m_tree_mrpc->Fill();
340 }
341
342
343
344 }
345
347
349
350
351 SmartDataPtr<RecTofTrackCol> tofTrackCol(eventSvc(),"/Event/Recon/RecTofTrackCol");
352 if (!tofTrackCol) {
353 log << MSG::FATAL << "MrpcRecDBS could not find RecTofTrackCol!" << endreq;
354 return StatusCode::FAILURE;
355 }
356
357
358 }
359 else {
360 log << MSG::FATAL << "In MrpcRecDBS: AcceleratorStatus is NOT correct! m_acceleratorStatus = " << m_acceleratorStatus << endreq;
361 return StatusCode::FAILURE;
362 }
363
364 return StatusCode::SUCCESS;
365
366}
IRawDataProviderSvc * tofDigiSvc
std::vector< MrpcTrack * > TofTrackVec
std::multimap< unsigned int, TofData * > TofDataMap
static G4int Get_module_mrpc_from_unique_identifier(G4int unique_identifier_f)
static double GetTransitionTime_extrap_track(G4double x_mm, G4double y_mm, int partId_f, int module_mrpc_f, int my_strip)
static G4int Get_stripnumber_from_unique_identifier(G4int unique_identifier_f)
virtual TofDataMap & tofDataMapTof(double estime=0)=0
void setTrack2(MrpcDBSTrack *&tof)
void setTrack1Col(std::vector< MrpcDBSTrack * > *&tofTrackVec)
void setExtTrackNum(unsigned int ntrk)
void setTrack3(MrpcDBSTrack *&tof)
void setTrack4(MrpcDBSTrack *&tof)
StatusCode RegisterNullRecTofTrackCol()
StatusCode RegisterTDS(std::vector< MrpcDBSTrack * > *&tofTrackVec)
void clearTofTrackVec(std::vector< MrpcDBSTrack * > *&tofTrackVec)
void setExtTrack(RecExtTrack *extTrack, int kal[5], double t0, int t0Stat)
void getMultiHit(MrpcDBSTrack *&)
static int phi_module(const Identifier &id)
static int barrel_ec(const Identifier &id)
Values of different levels (failure returns 0)