TofEnergyRec Class Reference

#include <TofEnergyRec.h>

List of all members.

Public Member Functions

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

Private Attributes

int m_event
int m_eventNb
double m_calibConst
double m_isData
TofShowerm_tofShower
bool m_output
NTuple::Tuple * m_tuple
NTuple::Tuple * m_tuple1
NTuple::Tuple * m_tuple2


Detailed Description

Definition at line 15 of file TofEnergyRec.h.


Constructor & Destructor Documentation

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

Definition at line 45 of file TofEnergyRec.cxx.

References m_calibConst, m_eventNb, m_isData, and m_output.

00045                                                                           :
00046   Algorithm(name, pSvcLocator)
00047 {   
00048   declareProperty("Output",           m_output = false);
00049   declareProperty("EventNb",          m_eventNb = 0);
00050   declareProperty("CalibConst",       m_calibConst = 0.0085);
00051   declareProperty("IsData",           m_isData = true);
00052 }


Member Function Documentation

StatusCode TofEnergyRec::execute (  ) 

Definition at line 95 of file TofEnergyRec.cxx.

References Bes_Common::FATAL, TofShower::findShower(), Bes_Common::INFO, m_event, m_eventNb, m_tofShower, msgSvc(), EventModel::Recon::RecTofTrackCol, IRawDataProviderSvc::tofDataVectorTof(), tofDigiSvc, and Bes_Common::WARNING.

00095                                  {
00096 
00097   MsgStream log(msgSvc(), name());
00098   log << MSG::INFO << "TofEnergyRec in execute()!!" << endreq;
00099 
00100   SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
00101   if( !eventHeader ) {
00102     log << MSG::FATAL << "TofEnergyRec could not find Event Header!" << endreq;
00103     return StatusCode::FAILURE;
00104   }
00105   int run = eventHeader->runNumber();
00106   int event = eventHeader->eventNumber();
00107   if( m_eventNb!=0 && m_event%m_eventNb== 0 ) std::cout << "--------event: " << m_event 
00108     << ", run= " << run << "  event= " << event << std::endl;
00109   log << MSG::INFO << "run= " << run << "  event= " << event << endreq;
00110   m_event++;
00111 
00112 
00113   IRawDataProviderSvc* tofDigiSvc;
00114   StatusCode sc = service("RawDataProviderSvc", tofDigiSvc);
00115   if(sc != StatusCode::SUCCESS) {
00116     log << MSG::FATAL << "TofEnergyRec could not find RawDataProviderSvc!" << endreq;
00117     return StatusCode::SUCCESS;
00118   }
00119 
00120   //check whether the Recon has been already registered
00121   DataObject *aReconEvent;
00122   eventSvc()->findObject("/Event/Recon",aReconEvent);
00123   if(aReconEvent==NULL) {
00124     log << MSG::INFO << "Register ReconEvent" << endreq;
00125     //then register Recon
00126     aReconEvent = new ReconEvent();
00127     sc = eventSvc()->registerObject("/Event/Recon",aReconEvent);
00128     if(sc!=StatusCode::SUCCESS) {
00129       log << MSG::FATAL << "Could not register ReconEvent" <<endreq;
00130       return StatusCode::FAILURE;
00131     }
00132   }
00133 
00134   //Register RecTofTrackCol
00135   SmartDataPtr<RecTofTrackCol> tofTrackCol(eventSvc(),EventModel::Recon::RecTofTrackCol);
00136   if (!tofTrackCol) {
00137     log << MSG::INFO << "Register RecTofTrackCol!" << endreq;
00138     tofTrackCol = new RecTofTrackCol;
00139     sc = eventSvc()->registerObject(EventModel::Recon::RecTofTrackCol, tofTrackCol);
00140     if(sc!=StatusCode::SUCCESS) {
00141       log << MSG::FATAL << "Could not register RecTofTrackCol!" <<endreq;
00142     }
00143   }
00144 
00145 
00146 
00147   //Retrieve RecEsTimeCol 
00148   SmartDataPtr<RecEsTimeCol> estimeCol(eventSvc(),"/Event/Recon/RecEsTimeCol");
00149   if( !estimeCol || ( estimeCol->size() == 0 ) ) {
00150     log << MSG::WARNING << "TofRec Could not find RecEsTimeCol!   Run = " << run << " Event = " << event << endreq;                                                                               
00151     return StatusCode::SUCCESS;
00152   }
00153   RecEsTimeCol::iterator iter_ESTime=estimeCol->begin();
00154   double t0=0;
00155   t0  = (*iter_ESTime)->getTest();
00156   int t0Stat = (*iter_ESTime)->getStat();
00157 
00158 
00159   std::vector<TofData*> tofDataVec;
00160   tofDataVec = tofDigiSvc->tofDataVectorTof();
00161 
00162 
00163   m_tofShower->findShower(tofDataVec, tofTrackCol, t0);
00164 
00165   return StatusCode::SUCCESS;
00166 
00167 }

StatusCode TofEnergyRec::finalize (  ) 

Definition at line 171 of file TofEnergyRec.cxx.

References m_event, and m_tofShower.

00171                                   {
00172   cout << "Total event:" << m_event << endl;
00173   delete m_tofShower;
00174   return StatusCode::SUCCESS;
00175 }

StatusCode TofEnergyRec::initialize (  ) 

Definition at line 56 of file TofEnergyRec.cxx.

References TofShower::BookNtuple(), calibUtil::ERROR, Bes_Common::INFO, m_calibConst, m_event, m_isData, m_output, m_tofShower, m_tuple, m_tuple1, m_tuple2, msgSvc(), ntupleSvc(), TofShower::setCalibConst(), and TofShower::setIsData().

00056                                     {
00057 
00058   MsgStream log(msgSvc(), name());
00059   log << MSG::INFO << "TofEnergyRec in initialize()" << endreq;   
00060 
00061   m_event = 0;
00062   m_tofShower = new TofShower;
00063   m_tofShower->setCalibConst(m_calibConst);
00064   m_tofShower->setIsData(m_isData);
00065   //m_tofShower->readCalibPar();
00066 
00067   if(m_output) {
00068     cout<<"--------Book Tof Energy Ntuple!"<<endl;
00069     NTuplePtr nt(ntupleSvc(), "FILE209/sci");
00070     NTuplePtr nt1(ntupleSvc(), "FILE209/shower");
00071     NTuplePtr nt2(ntupleSvc(), "FILE209/seed");
00072     if ( nt&&nt1&&nt2 ) {
00073       m_tuple = nt;
00074       m_tuple1 = nt1;
00075       m_tuple2 = nt2;
00076     } else {
00077       m_tuple = ntupleSvc()->book ("FILE209/sci", CLID_ColumnWiseTuple, "TofEnergyRec");
00078       m_tuple1 = ntupleSvc()->book ("FILE209/shower", CLID_ColumnWiseTuple, "TofEnergyRec");
00079       m_tuple2 = ntupleSvc()->book ("FILE209/seed", CLID_ColumnWiseTuple, "TofEnergyRec");
00080       if ( m_tuple&&m_tuple1&&m_tuple2 ) {
00081         m_tofShower->BookNtuple(m_tuple,m_tuple1,m_tuple2);
00082       }
00083       else    { 
00084         log << MSG::ERROR << " ----- TofShower cannot book N-tuple:" << long(m_tuple) << endmsg;
00085       }
00086     }
00087   }
00088 
00089 
00090   return StatusCode::SUCCESS;
00091 }


Member Data Documentation

double TofEnergyRec::m_calibConst [private]

Definition at line 26 of file TofEnergyRec.h.

Referenced by initialize(), and TofEnergyRec().

int TofEnergyRec::m_event [private]

Definition at line 24 of file TofEnergyRec.h.

Referenced by execute(), finalize(), and initialize().

int TofEnergyRec::m_eventNb [private]

Definition at line 25 of file TofEnergyRec.h.

Referenced by execute(), and TofEnergyRec().

double TofEnergyRec::m_isData [private]

Definition at line 27 of file TofEnergyRec.h.

Referenced by initialize(), and TofEnergyRec().

bool TofEnergyRec::m_output [private]

Definition at line 32 of file TofEnergyRec.h.

Referenced by initialize(), and TofEnergyRec().

TofShower* TofEnergyRec::m_tofShower [private]

Definition at line 28 of file TofEnergyRec.h.

Referenced by execute(), finalize(), and initialize().

NTuple::Tuple* TofEnergyRec::m_tuple [private]

Definition at line 33 of file TofEnergyRec.h.

Referenced by initialize().

NTuple::Tuple* TofEnergyRec::m_tuple1 [private]

Definition at line 34 of file TofEnergyRec.h.

Referenced by initialize().

NTuple::Tuple* TofEnergyRec::m_tuple2 [private]

Definition at line 35 of file TofEnergyRec.h.

Referenced by initialize().


Generated on Tue Nov 29 23:36:05 2016 for BOSS_7.0.2 by  doxygen 1.4.7