#include <TofEnergyRec.h>
Public Member Functions | |
StatusCode | execute () |
StatusCode | execute () |
StatusCode | finalize () |
StatusCode | finalize () |
StatusCode | initialize () |
StatusCode | initialize () |
TofEnergyRec (const std::string &name, ISvcLocator *pSvcLocator) | |
TofEnergyRec (const std::string &name, ISvcLocator *pSvcLocator) | |
Private Attributes | |
double | m_calibConst |
int | m_event |
int | m_eventNb |
double | m_isData |
bool | m_output |
TofShower * | m_tofShower |
TofShower * | m_tofShower |
NTuple::Tuple * | m_tuple |
NTuple::Tuple * | m_tuple |
NTuple::Tuple * | m_tuple1 |
NTuple::Tuple * | m_tuple1 |
NTuple::Tuple * | m_tuple2 |
NTuple::Tuple * | m_tuple2 |
|
00044 : 00045 Algorithm(name, pSvcLocator) 00046 { 00047 declareProperty("Output", m_output = false); 00048 declareProperty("EventNb", m_eventNb = 0); 00049 declareProperty("CalibConst", m_calibConst = 0.0085); 00050 declareProperty("IsData", m_isData = true); 00051 }
|
|
|
|
|
|
00093 { 00094 00095 MsgStream log(msgSvc(), name()); 00096 log << MSG::INFO << "TofEnergyRec in execute()!!" << endreq; 00097 00098 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader"); 00099 if( !eventHeader ) { 00100 log << MSG::FATAL << "TofEnergyRec could not find Event Header!" << endreq; 00101 return StatusCode::FAILURE; 00102 } 00103 int run = eventHeader->runNumber(); 00104 int event = eventHeader->eventNumber(); 00105 if( m_eventNb!=0 && m_event%m_eventNb== 0 ) std::cout << "--------event: " << m_event 00106 << ", run= " << run << " event= " << event << std::endl; 00107 log << MSG::INFO << "run= " << run << " event= " << event << endreq; 00108 m_event++; 00109 00110 IRawDataProviderSvc* tofDigiSvc; 00111 StatusCode sc = service("RawDataProviderSvc", tofDigiSvc); 00112 if(sc != StatusCode::SUCCESS) { 00113 log << MSG::FATAL << "TofEnergyRec could not find RawDataProviderSvc!" << endreq; 00114 return StatusCode::SUCCESS; 00115 } 00116 00117 //check whether the Recon has been already registered 00118 DataObject *aReconEvent; 00119 eventSvc()->findObject("/Event/Recon",aReconEvent); 00120 if(aReconEvent==NULL) { 00121 log << MSG::INFO << "Register ReconEvent" << endreq; 00122 //then register Recon 00123 aReconEvent = new ReconEvent(); 00124 sc = eventSvc()->registerObject("/Event/Recon",aReconEvent); 00125 if(sc!=StatusCode::SUCCESS) { 00126 log << MSG::FATAL << "Could not register ReconEvent" <<endreq; 00127 return StatusCode::FAILURE; 00128 } 00129 } 00130 00131 //Register RecTofTrackCol 00132 SmartDataPtr<RecTofTrackCol> tofTrackCol(eventSvc(),EventModel::Recon::RecTofTrackCol); 00133 if (!tofTrackCol) { 00134 log << MSG::INFO << "Register RecTofTrackCol!" << endreq; 00135 tofTrackCol = new RecTofTrackCol; 00136 sc = eventSvc()->registerObject(EventModel::Recon::RecTofTrackCol, tofTrackCol); 00137 if(sc!=StatusCode::SUCCESS) { 00138 log << MSG::FATAL << "Could not register RecTofTrackCol!" <<endreq; 00139 } 00140 } 00141 00142 std::vector<TofData*> tofDataVec; 00143 tofDataVec = tofDigiSvc->tofDataVectorTof(); 00144 00145 m_tofShower->findShower(tofDataVec, tofTrackCol); 00146 00147 return StatusCode::SUCCESS; 00148 00149 }
|
|
|
|
00153 { 00154 cout << "Total event:" << m_event << endl; 00155 delete m_tofShower; 00156 return StatusCode::SUCCESS; 00157 }
|
|
|
|
00055 { 00056 00057 MsgStream log(msgSvc(), name()); 00058 log << MSG::INFO << "TofEnergyRec in initialize()" << endreq; 00059 00060 m_event = 0; 00061 m_tofShower = new TofShower; 00062 m_tofShower->setCalibConst(m_calibConst); 00063 m_tofShower->setIsData(m_isData); 00064 //m_tofShower->readCalibPar(); 00065 00066 if(m_output) { 00067 cout<<"--------Book Tof Energy Ntuple!"<<endl; 00068 NTuplePtr nt(ntupleSvc(), "FILE209/sci"); 00069 NTuplePtr nt1(ntupleSvc(), "FILE209/shower"); 00070 NTuplePtr nt2(ntupleSvc(), "FILE209/seed"); 00071 if ( nt&&nt1&&nt2 ) { 00072 m_tuple = nt; 00073 m_tuple1 = nt1; 00074 m_tuple2 = nt2; 00075 } else { 00076 m_tuple = ntupleSvc()->book ("FILE209/sci", CLID_ColumnWiseTuple, "TofEnergyRec"); 00077 m_tuple1 = ntupleSvc()->book ("FILE209/shower", CLID_ColumnWiseTuple, "TofEnergyRec"); 00078 m_tuple2 = ntupleSvc()->book ("FILE209/seed", CLID_ColumnWiseTuple, "TofEnergyRec"); 00079 if ( m_tuple&&m_tuple1&&m_tuple2 ) { 00080 m_tofShower->BookNtuple(m_tuple,m_tuple1,m_tuple2); 00081 } 00082 else { 00083 log << MSG::ERROR << " ----- TofShower cannot book N-tuple:" << long(m_tuple) << endmsg; 00084 } 00085 } 00086 } 00087 00088 return StatusCode::SUCCESS; 00089 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|