1#include "GaudiKernel/IDataManagerSvc.h"
2#include "GaudiKernel/IDataProviderSvc.h"
3#include "GaudiKernel/ISvcLocator.h"
4#include "GaudiKernel/MsgStream.h"
5#include "GaudiKernel/SmartDataPtr.h"
6#include "GaudiKernel/SmartIF.h"
9#include "EventModel/EventModel.h"
10#include "EvtRecEvent/EvtRecDTag.h"
11#include "EvtRecEvent/EvtRecEvent.h"
17DTag::
DTag( const
std::
string& name, ISvcLocator* pSvcLocator )
18 : Gaudi::
Sequence( name, pSvcLocator ) {
20 declareProperty(
"NeutralDReconstruction", m_recD0 =
true );
21 declareProperty(
"ChargedDReconstruction", m_recDp =
true );
22 declareProperty(
"DsReconstruction", m_recDs =
true );
23 declareProperty(
"LambdaCReconstruction", m_recLc =
true );
30 MsgStream log(
msgSvc(), name() );
32 log << MSG::INFO <<
"creating DTag sub Algorithm" << endmsg;
38 sc = createSubAlgorithm(
"NeutralDReconstruction",
"NeutralDReconstruction",
39 m_NeutralDReconstruction );
42 log << MSG::ERROR <<
"Error while creating D0Reconstruction" << endmsg;
43 return StatusCode::FAILURE;
49 sc = createSubAlgorithm(
"ChargedDReconstruction",
"ChargedDReconstruction",
50 m_ChargedDReconstruction );
53 log << MSG::ERROR <<
"Error while creating D+Reconstruction" << endmsg;
54 return StatusCode::FAILURE;
60 sc = createSubAlgorithm(
"DsReconstruction",
"DsReconstruction", m_DsReconstruction );
63 log << MSG::ERROR <<
"Error while creating DsReconstruction" << endmsg;
64 return StatusCode::FAILURE;
70 sc = createSubAlgorithm(
"LambdaCReconstruction",
"LambdaCReconstruction",
71 m_LambdaCReconstruction );
74 log << MSG::ERROR <<
"Error while creating LcReconstruction" << endmsg;
75 return StatusCode::FAILURE;
79 log << MSG::INFO <<
"Calling Sequence::initialize()" << endmsg;
80 return Gaudi::Sequence::initialize();
83StatusCode DTag::registerParent( MsgStream& log )
const {
84 DataObject* aEvtRecEvent;
85 eventSvc()->findObject(
"/Event/EvtRec", aEvtRecEvent ).ignore();
86 if ( aEvtRecEvent == NULL )
89 StatusCode sc = eventSvc()->registerObject(
"/Event/EvtRec", aEvtRecEvent );
90 if ( sc != StatusCode::SUCCESS )
92 log << MSG::FATAL <<
"Could not register EvtRecEvent" << endmsg;
93 return StatusCode::FAILURE;
96 return StatusCode::SUCCESS;
99StatusCode DTag::clearEvtRecDTagCol( MsgStream& log )
const {
100 StatusCode sc = registerParent( log );
101 if ( sc != StatusCode::SUCCESS ) {
return sc; }
103 DataObject* aEvtRecDTagCol;
104 eventSvc()->findObject(
"/Event/EvtRec/EvtRecDTagCol", aEvtRecDTagCol ).ignore();
105 if ( aEvtRecDTagCol )
108 SmartIF<IDataManagerSvc> dataManSvc( eventSvc() );
109 dataManSvc->clearSubTree(
"/Event/EvtRec/EvtRecDTagCol" ).ignore();
110 eventSvc()->unregisterObject(
"/Event/EvtRec/EvtRecDTagCol" ).ignore();
117 SmartIF<IDataManagerSvc> dataManSvc( eventSvc() );
118 dataManSvc->clearSubTree(
"/Event/EvtRec/EvtRecDTagCol" ).ignore();
119 eventSvc()->unregisterObject(
"/Event/EvtRec/EvtRecDTagCol" ).ignore();
122 return StatusCode::SUCCESS;
125void DTag::registerEvtRecDTagCol( MsgStream& log )
const {
128 eventSvc()->registerObject(
"/Event/EvtRec/EvtRecDTagCol", aNewEvtRecDTagCol );
129 if ( sc != StatusCode::SUCCESS )
130 { log << MSG::FATAL <<
"Could not register EvtRecDTagCol in TDS!" << endmsg; }
141 if ( evtRecDTagCol->size() > 0 )
143 cout <<
"************************************************" << endl;
144 cout <<
"EvtRecDTagCol already exists in this file!" << endl;
145 cout <<
" Please run this program on a raw dst file!" << endl;
146 cout <<
" *** This job is now being killed. ***" << endl;
147 cout <<
"************************************************" << endl;
148 return StatusCode::FAILURE;
152 MsgStream log(
msgSvc(), name() );
153 StatusCode sc = clearEvtRecDTagCol( log );
154 if ( sc != StatusCode::SUCCESS ) {
return sc; }
156 DataObject* aEvtRecDTagCol;
157 eventSvc()->findObject(
"/Event/EvtRec/EvtRecDTagCol", aEvtRecDTagCol ).ignore();
158 if ( aEvtRecDTagCol == NULL ) { registerEvtRecDTagCol( log ); }
160 std::vector<Algorithm*>::const_iterator it = subAlgorithms()->begin();
161 std::vector<Algorithm*>::const_iterator end = subAlgorithms()->end();
162 for ( ; it != end; it++ )
164 sc = ( *it )->execute( ctx );
165 if ( sc.isFailure() ) { log <<
"Error executing selection " << ( *it )->name() << endmsg; }
168 return StatusCode::SUCCESS;
174 MsgStream log(
msgSvc(), name() );
175 log << MSG::INFO <<
"in finalize()" << endmsg;
176 return Gaudi::Sequence::finalize();
DECLARE_COMPONENT(BesBdkRc)
ObjectVector< EvtRecDTag > EvtRecDTagCol
DTag(const std::string &name, ISvcLocator *pSvcLocator)
StatusCode execute(const EventContext &ctx) const
_EXTERN_ std::string EvtRecDTagCol