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"
16 return StatusCode::SUCCESS;
22 Gaudi::svcLocator()->service(
"MessageSvc",
msgSvc);
23 MsgStream log(
msgSvc,
"MrpcRecTDS");
24 log << MSG::INFO <<
"Initialize: MrpcRecTDS::RegisterNullRecTofTrack()" << endreq;
26 IDataProviderSvc* eventSvc;
27 Gaudi::svcLocator()->service(
"EventDataSvc", eventSvc);
33 DataObject *aRecTofTrackCol;
34 eventSvc->findObject(
"/Event/Recon/RecTofTrackCol", aRecTofTrackCol );
35 if( aRecTofTrackCol != NULL ) {
36 sc = eventSvc->unregisterObject(
"/Event/Recon/RecTofTrackCol" );
37 if( sc != StatusCode::SUCCESS ) {
38 log << MSG::FATAL <<
"Initialize: Could not unregister RecTofTrack collection!" << endreq;
39 delete recTofTrackCol;
40 return StatusCode::FAILURE;
43 delete aRecTofTrackCol;
45 sc = eventSvc->registerObject(
"/Event/Recon/RecTofTrackCol", recTofTrackCol);
46 if( sc != StatusCode::SUCCESS ) {
47 log << MSG::FATAL <<
"Initialize: MrpcRec could not register Null Rec TOF track collection!" << endreq;
48 delete recTofTrackCol;
49 return StatusCode::FAILURE;
52 return StatusCode::SUCCESS;
60 return StatusCode::SUCCESS;
66 Gaudi::svcLocator()->service(
"MessageSvc",
msgSvc);
67 MsgStream log(
msgSvc,
"MrpcRecTDS");
69 IDataProviderSvc* eventSvc;
70 Gaudi::svcLocator()->service(
"EventDataSvc", eventSvc);
73 DataObject *aReconEvent ;
74 eventSvc->findObject(
"/Event/Recon",aReconEvent);
75 if(aReconEvent==NULL) {
76 log << MSG::INFO <<
"MrpcRecTDS::RegisterReconEvent()" << endreq;
78 StatusCode sc = eventSvc->registerObject(
"/Event/Recon",aReconEvent);
79 if(sc!=StatusCode::SUCCESS) {
80 log << MSG::FATAL <<
"MrpcRec could not register ReconEvent!" <<endreq;
81 return StatusCode::FAILURE;
84 return StatusCode::SUCCESS;
90 Gaudi::svcLocator()->service(
"MessageSvc",
msgSvc);
91 MsgStream log(
msgSvc,
"MrpcRecTDS");
92 log << MSG::INFO <<
"MrpcRecTDS::RegisterRecTofTrack()" << endreq;
94 IDataProviderSvc* eventSvc;
95 Gaudi::svcLocator()->service(
"EventDataSvc", eventSvc);
99 std::vector<MrpcTrack*>::iterator
iter = tofTrackVec->begin();
100 for( ;
iter < tofTrackVec->end();
iter++ ) {
101 (*iter)->convert2RecTofTrackCol( recTofTrackCol );
106 DataObject *aRecTofTrackCol;
107 eventSvc->findObject(
"/Event/Recon/RecTofTrackCol", aRecTofTrackCol );
108 if( aRecTofTrackCol != NULL ) {
110 sc = eventSvc->unregisterObject(
"/Event/Recon/RecTofTrackCol" );
112 delete aRecTofTrackCol;
114 if( sc != StatusCode::SUCCESS ) {
115 log << MSG::FATAL <<
"Could not unregister RecTofTrack collection!" << endreq;
117 RecTofTrackCol::iterator iter_tof = recTofTrackCol->begin();
118 for( ; iter_tof!=recTofTrackCol->end(); iter_tof++ ) {
121 recTofTrackCol->clear();
122 delete recTofTrackCol;
124 std::vector<MrpcTrack*>::iterator iter_data = tofTrackVec->begin();
125 for( ; iter_data!=tofTrackVec->end(); iter_data++ ) {
128 tofTrackVec->clear();
131 return StatusCode::FAILURE;
135 sc = eventSvc->registerObject(
"/Event/Recon/RecTofTrackCol", recTofTrackCol);
136 if( sc != StatusCode::SUCCESS ) {
137 log << MSG::FATAL <<
"MrpcRec could not register Rec TOF track collection!" << endreq;
138 RecTofTrackCol::iterator iter_tof = recTofTrackCol->begin();
139 for( ; iter_tof!=recTofTrackCol->end(); iter_tof++ ) {
142 recTofTrackCol->clear();
143 delete recTofTrackCol;
144 return StatusCode::FAILURE;
147 return StatusCode::SUCCESS;
ObjectVector< RecTofTrack > RecTofTrackCol
StatusCode RegisterNullRecTofTrackCol()
StatusCode InitializeTDS()
StatusCode RegisterTDS(int runNumber, int eventNumber, std::vector< MrpcTrack * > *&tofTrackVec)
StatusCode RegisterReconEvent()
StatusCode RegisterRecTofTrackCol(std::vector< MrpcTrack * > *&tofTrackVec)