DTag Class Reference

#include <DTag.h>

List of all members.

Public Member Functions

 DTag (const std::string &name, ISvcLocator *pSvcLocator)
StatusCode initialize ()
StatusCode execute ()
StatusCode finalize ()

Private Member Functions

StatusCode registerParent (MsgStream &log)
StatusCode clearEvtRecDTagCol (MsgStream &log)
void registerEvtRecDTagCol (MsgStream &log)

Private Attributes

bool m_recD0
Algorithmm_NeutralDReconstruction
bool m_recDp
Algorithmm_ChargedDReconstruction
bool m_recDs
Algorithmm_DsReconstruction
bool m_rawdstonly


Detailed Description

Definition at line 8 of file DTag.h.


Constructor & Destructor Documentation

DTag::DTag ( const std::string name,
ISvcLocator *  pSvcLocator 
)

Definition at line 18 of file DTag.cxx.

References m_recD0, m_recDp, and m_recDs.

00018                                                           :
00019   Algorithm(name, pSvcLocator) {
00020   //Declare the properties
00021   declareProperty("NeutralDReconstruction",  m_recD0 = true);
00022   declareProperty("ChargedDReconstruction",  m_recDp = true);
00023   declareProperty("DsReconstruction",        m_recDs = true);
00024   // declareProperty("RawDstOnly",              m_rawdstonly = true);
00025 }


Member Function Documentation

StatusCode DTag::clearEvtRecDTagCol ( MsgStream &  log  )  [private]

Definition at line 82 of file DTag.cxx.

References EventModel::EvtRec::EvtRecDTagCol, and registerParent().

Referenced by execute().

00082                                                   {
00083   StatusCode sc = registerParent(log);
00084   if (sc != StatusCode::SUCCESS) {
00085     return sc;
00086   }
00087   
00088   DataObject* aEvtRecDTagCol;
00089   eventSvc()->findObject("/Event/EvtRec/EvtRecDTagCol",aEvtRecDTagCol);
00090   if (aEvtRecDTagCol != NULL) {
00091     //IDataManagerSvc* dataManSvc = dynamic_cast<IDataManagerSvc*>(eventSvc());
00092     SmartIF<IDataManagerSvc> dataManSvc(eventSvc());
00093     dataManSvc->clearSubTree("/Event/EvtRec/EvtRecDTagCol");
00094     eventSvc()->unregisterObject("/Event/EvtRec/EvtRecDTagCol");
00095   } 
00096   
00097   SmartDataPtr<EvtRecDTagCol> evtRecDTagCol(eventSvc(), EventModel::EvtRec::EvtRecDTagCol);
00098   if( evtRecDTagCol != NULL){
00099     //IDataManagerSvc* dataManSvc = dynamic_cast<IDataManagerSvc*>(eventSvc());
00100     SmartIF<IDataManagerSvc> dataManSvc(eventSvc());
00101     dataManSvc->clearSubTree("/Event/EvtRec/EvtRecDTagCol");
00102     eventSvc()->unregisterObject("/Event/EvtRec/EvtRecDTagCol");
00103   } 
00104   
00105   return StatusCode::SUCCESS;
00106 }

StatusCode DTag::execute (  ) 

Definition at line 118 of file DTag.cxx.

References clearEvtRecDTagCol(), deljobs::end, EventModel::EvtRec::EvtRecDTagCol, msgSvc(), and registerEvtRecDTagCol().

00118                          {
00119   
00120 
00121   //check if DTagList exists
00122   //if true, will exit the program
00123   SmartDataPtr<EvtRecDTagCol> evtRecDTagCol(eventSvc(), EventModel::EvtRec::EvtRecDTagCol);
00124   if( evtRecDTagCol != NULL ){
00125     if ( evtRecDTagCol->size()>0 ) {
00126       cout << "************************************************"<<endl;
00127       cout << "EvtRecDTagCol already exists in this file!" << endl;
00128       cout << " Please run this program on a raw dst file!" << endl;
00129       cout << " *** This job is now being killed. ***" << endl;
00130       cout << "************************************************"<<endl;
00131       return StatusCode::FAILURE;
00132     }  
00133   }  
00134 
00135     
00136   MsgStream log(msgSvc(), name());
00137   StatusCode sc = clearEvtRecDTagCol(log);
00138   if (sc != StatusCode::SUCCESS) {
00139     return sc;
00140   }
00141 
00142   DataObject* aEvtRecDTagCol;
00143   eventSvc()->findObject("/Event/EvtRec/EvtRecDTagCol", aEvtRecDTagCol);
00144   if (aEvtRecDTagCol == NULL) {
00145     registerEvtRecDTagCol(log);
00146   }
00147   
00148   std::vector<Algorithm*>::const_iterator it  = subAlgorithms()->begin();
00149   std::vector<Algorithm*>::const_iterator end = subAlgorithms()->end();
00150   for(; it != end; it++) {
00151     sc = (*it)->execute();
00152     if(sc.isFailure()) {
00153       log << "Error executing selection "  << (*it)->name() << endreq;
00154     }
00155   }
00156 
00157 
00158   return StatusCode::SUCCESS;
00159 }

StatusCode DTag::finalize (  ) 

Definition at line 162 of file DTag.cxx.

References Bes_Common::INFO, and msgSvc().

00162                           {
00163 
00164   MsgStream log(msgSvc(), name());
00165   log << MSG::INFO << "in finalize()" << endmsg;
00166   return StatusCode::SUCCESS;
00167 }

StatusCode DTag::initialize (  ) 

Definition at line 28 of file DTag.cxx.

References calibUtil::ERROR, Bes_Common::INFO, m_ChargedDReconstruction, m_DsReconstruction, m_NeutralDReconstruction, m_recD0, m_recDp, m_recDs, and msgSvc().

00028                             {
00029 
00030   MsgStream log(msgSvc(), name());
00031   
00032   log << MSG::INFO << "creating DTag sub Algorithm" << endreq;
00033 
00034   StatusCode sc;
00035 
00036 
00037 
00038 
00039   if(m_recD0) { 
00040     sc = createSubAlgorithm("NeutralDReconstruction", "NeutralDReconstruction", m_NeutralDReconstruction);
00041     if(sc.isFailure()) {
00042       log << MSG::ERROR << "Error while creating D0Reconstruction" << endreq;
00043       return StatusCode::FAILURE;
00044     }
00045   }
00046 
00047   if(m_recDp) { 
00048     sc = createSubAlgorithm("ChargedDReconstruction", "ChargedDReconstruction", m_ChargedDReconstruction);
00049     if(sc.isFailure()) {
00050       log << MSG::ERROR << "Error while creating D+Reconstruction" << endreq;
00051       return StatusCode::FAILURE;
00052     }
00053   }
00054 
00055   if(m_recDs) { 
00056     sc = createSubAlgorithm("DsReconstruction", "DsReconstruction", m_DsReconstruction);
00057     if(sc.isFailure()) {
00058       log << MSG::ERROR << "Error while creating DsReconstruction" << endreq;
00059       return StatusCode::FAILURE;
00060     }
00061   }
00062 
00063   log << MSG::INFO << "successfully return from initialize()" <<endmsg;
00064   return StatusCode::SUCCESS;
00065 
00066 }

void DTag::registerEvtRecDTagCol ( MsgStream &  log  )  [private]

Definition at line 108 of file DTag.cxx.

References EventModel::EvtRec::EvtRecDTagCol, and Bes_Common::FATAL.

Referenced by execute().

00108                                                {
00109   EvtRecDTagCol* aNewEvtRecDTagCol = new EvtRecDTagCol;
00110   StatusCode sc = eventSvc()->registerObject("/Event/EvtRec/EvtRecDTagCol",
00111                                              aNewEvtRecDTagCol);
00112   if (sc != StatusCode::SUCCESS) {
00113     log << MSG::FATAL << "Could not register EvtRecDTagCol in TDS!" << endreq;
00114   }
00115 }

StatusCode DTag::registerParent ( MsgStream &  log  )  [private]

Definition at line 68 of file DTag.cxx.

References EventModel::EvtRec::EvtRecEvent, and Bes_Common::FATAL.

Referenced by clearEvtRecDTagCol().

00068                                               {
00069   DataObject *aEvtRecEvent;
00070   eventSvc()->findObject("/Event/EvtRec",aEvtRecEvent);
00071   if (aEvtRecEvent == NULL) {
00072     aEvtRecEvent = new EvtRecEvent();
00073     StatusCode sc = eventSvc()->registerObject("/Event/EvtRec",aEvtRecEvent);
00074     if (sc != StatusCode::SUCCESS) {
00075       log << MSG::FATAL << "Could not register EvtRecEvent" <<endreq;
00076       return StatusCode::FAILURE;
00077     }
00078   }
00079   return StatusCode::SUCCESS;
00080 }


Member Data Documentation

Algorithm* DTag::m_ChargedDReconstruction [private]

Definition at line 25 of file DTag.h.

Referenced by initialize().

Algorithm* DTag::m_DsReconstruction [private]

Definition at line 27 of file DTag.h.

Referenced by initialize().

Algorithm* DTag::m_NeutralDReconstruction [private]

Definition at line 23 of file DTag.h.

Referenced by initialize().

bool DTag::m_rawdstonly [private]

Definition at line 29 of file DTag.h.

bool DTag::m_recD0 [private]

Definition at line 22 of file DTag.h.

Referenced by DTag(), and initialize().

bool DTag::m_recDp [private]

Definition at line 24 of file DTag.h.

Referenced by DTag(), and initialize().

bool DTag::m_recDs [private]

Definition at line 26 of file DTag.h.

Referenced by DTag(), and initialize().


Generated on Tue Nov 29 23:18:32 2016 for BOSS_7.0.2 by  doxygen 1.4.7