1#include "GaudiKernel/MsgStream.h"
2#include "GaudiKernel/ISvcLocator.h"
3#include "GaudiKernel/IDataProviderSvc.h"
4#include "GaudiKernel/Bootstrap.h"
5#include "GaudiKernel/IMessageSvc.h"
6#include "GaudiKernel/StatusCode.h"
7#include "GaudiKernel/SmartDataPtr.h"
8#include "ReconEvent/ReconEvent.h"
9#include "TofRecEvent/RecTofTrack.h"
12#include "MrpcRecDBS/MrpcDBSTrack.h"
13#include "MrpcRecDBS/MrpcDBSRecTDS.h"
18 return StatusCode::SUCCESS;
24 Gaudi::svcLocator()->service(
"MessageSvc",
msgSvc);
25 MsgStream log(
msgSvc,
"MrpcRecDBSTDS");
26 log << MSG::INFO <<
"Initialize: MrpcRecDBSTDS::RegisterNullRecTofTrack()" << endreq;
28 IDataProviderSvc* eventSvc;
29 Gaudi::svcLocator()->service(
"EventDataSvc", eventSvc);
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;
45 delete aRecTofTrackCol;
47 sc = eventSvc->registerObject(
"/Event/Recon/RecTofTrackCol", recTofTrackCol);
48 if( sc != StatusCode::SUCCESS ) {
49 log << MSG::FATAL <<
"Initialize: MrpcRecDBS could not register Null Rec TOF track collection!" << endreq;
50 delete recTofTrackCol;
51 return StatusCode::FAILURE;
54 return StatusCode::SUCCESS;
62 return StatusCode::SUCCESS;
68 Gaudi::svcLocator()->service(
"MessageSvc",
msgSvc);
69 MsgStream log(
msgSvc,
"MrpcRecDBSTDS");
71 IDataProviderSvc* eventSvc;
72 Gaudi::svcLocator()->service(
"EventDataSvc", eventSvc);
75 DataObject *aReconEvent ;
76 eventSvc->findObject(
"/Event/Recon",aReconEvent);
77 if(aReconEvent==NULL) {
78 log << MSG::INFO <<
"MrpcRecDBSTDS::RegisterReconEvent()" << endreq;
80 StatusCode sc = eventSvc->registerObject(
"/Event/Recon",aReconEvent);
81 if(sc!=StatusCode::SUCCESS) {
82 log << MSG::FATAL <<
"MrpcRecDBS could not register ReconEvent!" <<endreq;
83 return StatusCode::FAILURE;
86 return StatusCode::SUCCESS;
92 Gaudi::svcLocator()->service(
"MessageSvc",
msgSvc);
93 MsgStream log(
msgSvc,
"MrpcRecDBSTDS");
94 log << MSG::INFO <<
"MrpcRecDBSTDS::RegisterRecTofTrack()" << endreq;
96 IDataProviderSvc* eventSvc;
97 Gaudi::svcLocator()->service(
"EventDataSvc", eventSvc);
101 std::vector<MrpcDBSTrack*>::iterator
iter = tofTrackVec->begin();
102 for( ;
iter < tofTrackVec->end();
iter++ ) {
103 (*iter)->convert2RecTofTrackCol( recTofTrackCol );
108 DataObject *aRecTofTrackCol;
109 eventSvc->findObject(
"/Event/Recon/RecTofTrackCol", aRecTofTrackCol );
110 if( aRecTofTrackCol != NULL ) {
112 sc = eventSvc->unregisterObject(
"/Event/Recon/RecTofTrackCol" );
114 delete aRecTofTrackCol;
116 if( sc != StatusCode::SUCCESS ) {
117 log << MSG::FATAL <<
"Could not unregister RecTofTrack collection!" << endreq;
119 RecTofTrackCol::iterator iter_tof = recTofTrackCol->begin();
120 for( ; iter_tof!=recTofTrackCol->end(); iter_tof++ ) {
123 recTofTrackCol->clear();
124 delete recTofTrackCol;
126 std::vector<MrpcDBSTrack*>::iterator iter_data = tofTrackVec->begin();
127 for( ; iter_data!=tofTrackVec->end(); iter_data++ ) {
130 tofTrackVec->clear();
133 return StatusCode::FAILURE;
137 sc = eventSvc->registerObject(
"/Event/Recon/RecTofTrackCol", recTofTrackCol);
138 if( sc != StatusCode::SUCCESS ) {
139 log << MSG::FATAL <<
"MrpcRecDBS could not register Rec TOF track collection!" << endreq;
140 RecTofTrackCol::iterator iter_tof = recTofTrackCol->begin();
141 for( ; iter_tof!=recTofTrackCol->end(); iter_tof++ ) {
144 recTofTrackCol->clear();
145 delete recTofTrackCol;
146 return StatusCode::FAILURE;
149 return StatusCode::SUCCESS;
ObjectVector< RecTofTrack > RecTofTrackCol
StatusCode RegisterNullRecTofTrackCol()
StatusCode RegisterRecTofTrackCol(std::vector< MrpcDBSTrack * > *&tofTrackVec)
StatusCode RegisterReconEvent()
StatusCode InitializeTDS()
StatusCode RegisterTDS(std::vector< MrpcDBSTrack * > *&tofTrackVec)