#include <RootRawEvtReader.h>
Public Member Functions | |
RootRawEvtReader (const std::string &name, ISvcLocator *pSvcLocator) | |
virtual | ~RootRawEvtReader () |
StatusCode | initialize () |
StatusCode | execute () |
StatusCode | finalize () |
StatusCode | readMdc (int entry) |
StatusCode | readTof (int entry) |
StatusCode | readEmc (int entry) |
StatusCode | readMuc (int entry) |
Private Attributes | |
IDataProviderSvc * | m_evtSvc |
int | m_mdcDigi |
int | m_tofDigi |
int | m_emcDigi |
int | m_mucDigi |
TTree * | m_tree |
int | m_totalEvents |
int | m_fileNumber |
int | m_tempNumber |
int | m_currentEntry |
int | m_currentEntries |
std::vector< std::string > | m_inputFiles |
Definition at line 11 of file RootRawEvtReader.h.
RootRawEvtReader::RootRawEvtReader | ( | const std::string & | name, | |
ISvcLocator * | pSvcLocator | |||
) |
Definition at line 37 of file RootRawEvtReader.cxx.
References m_currentEntries, m_currentEntry, m_emcDigi, m_fileNumber, m_inputFiles, m_mdcDigi, m_mucDigi, m_tempNumber, m_tofDigi, and m_totalEvents.
00037 : 00038 Algorithm(name, pSvcLocator) 00039 { 00040 00041 declareProperty("MdcDigi",m_mdcDigi=1); 00042 declareProperty("TofDigi",m_tofDigi=1); 00043 declareProperty("EmcDigi",m_emcDigi=1); 00044 declareProperty("MucDigi",m_mucDigi=1); 00045 declareProperty("InputFiles",m_inputFiles); 00046 00047 m_totalEvents=0; 00048 m_fileNumber=0; 00049 m_tempNumber=-1; 00050 m_currentEntries=-1; 00051 m_currentEntry=-1; 00052 }
RootRawEvtReader::~RootRawEvtReader | ( | ) | [virtual] |
StatusCode RootRawEvtReader::execute | ( | ) |
Definition at line 73 of file RootRawEvtReader.cxx.
References EvtCyclic3::c_str(), Bes_Common::INFO, m_currentEntries, m_currentEntry, m_emcDigi, m_evtSvc, m_fileNumber, m_inputFiles, m_mdcDigi, m_mucDigi, m_tempNumber, m_tofDigi, m_totalEvents, m_tree, msgSvc(), readEmc(), readMdc(), readMuc(), and readTof().
00073 { 00074 00075 MsgStream log(msgSvc(), name()); 00076 log << MSG::INFO << "in execute()" << endreq; 00077 00078 DigiEvent* aDigiEvent = new DigiEvent; 00079 StatusCode sc = m_evtSvc->registerObject("/Event/Digi",aDigiEvent); 00080 if(sc!=StatusCode::SUCCESS) { 00081 std::cout<< "Could not register DigiEvent" <<std::endl; 00082 } 00083 00084 00085 if(m_tempNumber != m_fileNumber) 00086 { 00087 m_currentEntry = 0; 00088 TFile* m_input = TFile::Open(m_inputFiles[m_fileNumber].c_str(), "READ"); 00089 std::cout<<"input file: "<<m_inputFiles[m_fileNumber].c_str()<<std::endl; 00090 m_tree= (TTree *)m_input->Get("Event"); 00091 m_tree->SetMakeClass(1); 00092 m_currentEntries=(Int_t)m_tree->GetEntries(); 00093 std::cout<<"m_currentEntries: "<<m_currentEntries<<std::endl; 00094 00095 m_tempNumber = m_fileNumber; 00096 } 00097 00098 if(m_mdcDigi) 00099 readMdc(m_currentEntry); 00100 00101 if(m_tofDigi) 00102 readTof(m_currentEntry); 00103 00104 if(m_emcDigi) 00105 readEmc(m_currentEntry); 00106 00107 if(m_mucDigi) 00108 readMuc(m_currentEntry); 00109 00110 log << MSG::INFO << "current Entry: "<< m_currentEntry << endreq; 00111 //std::cout << "current Entry: "<< m_currentEntry << std::endl; 00112 m_currentEntry++; 00113 00114 if(m_currentEntry==m_currentEntries) 00115 { 00116 m_fileNumber++; 00117 } 00118 00119 m_totalEvents++; 00120 log << MSG::INFO << "total events: "<< m_totalEvents << endreq; 00121 //std::cout << "total events: "<< m_totalEvents << std::endl; 00122 00123 return StatusCode::SUCCESS; 00124 }
StatusCode RootRawEvtReader::finalize | ( | ) |
Definition at line 295 of file RootRawEvtReader.cxx.
References Bes_Common::INFO, and msgSvc().
00295 { 00296 00297 MsgStream log(msgSvc(), name()); 00298 log << MSG::INFO << "in finalize()" << endreq; 00299 00300 return StatusCode::SUCCESS; 00301 }
StatusCode RootRawEvtReader::initialize | ( | ) |
Definition at line 59 of file RootRawEvtReader.cxx.
References Bes_Common::INFO, m_evtSvc, and msgSvc().
00059 { 00060 00061 MsgStream log(msgSvc(), name()); 00062 log << MSG::INFO << "in initialize()" << endreq; 00063 00064 ISvcLocator* svcLocator = Gaudi::svcLocator(); 00065 StatusCode sc=svcLocator->service("EventDataSvc", m_evtSvc); 00066 if (sc.isFailure()) 00067 std::cout<<"Could not accesss EventDataSvc!"<<std::endl; 00068 00069 return StatusCode::SUCCESS; 00070 }
StatusCode RootRawEvtReader::readEmc | ( | int | entry | ) |
Definition at line 213 of file RootRawEvtReader.cxx.
References TRawData::getChargeChannel(), TRawData::getIntId(), TEmcDigi::getMeasure(), TRawData::getTimeChannel(), TRawData::getTrackIndex(), m_evtSvc, m_tree, RawData::setChargeChannel(), EmcDigi::setMeasure(), RawData::setTimeChannel(), and RawData::setTrackIndex().
Referenced by execute().
00214 { 00215 TBranch *branch = m_tree->GetBranch("m_emcDigiCol"); 00216 00217 TObjArray* emcDigiCol; 00218 branch->SetAddress(&emcDigiCol); 00219 emcDigiCol=0; 00220 00221 branch->GetEntry(entry); 00222 00223 //commonData m_common; 00224 00225 TIter emcDigiIter(emcDigiCol); 00226 EmcDigiCol* emcDigiTdsCol = new EmcDigiCol; 00227 TEmcDigi *emcDigiRoot = 0; 00228 00229 while ((emcDigiRoot = (TEmcDigi*)emcDigiIter.Next())) { 00230 unsigned int id = emcDigiRoot->getIntId(); 00231 unsigned int time = emcDigiRoot->getTimeChannel(); 00232 unsigned int charge = emcDigiRoot->getChargeChannel(); 00233 unsigned int measure = emcDigiRoot->getMeasure(); 00234 int trackIndex = emcDigiRoot->getTrackIndex(); 00235 00236 EmcDigi *emcDigiTds = new EmcDigi(id); 00237 //m_common.m_rootEmcDigiMap[emcDigiRoot] = emcDigiTds; 00238 emcDigiTds->setTimeChannel(time); 00239 emcDigiTds->setChargeChannel(charge); 00240 emcDigiTds->setMeasure(measure); 00241 emcDigiTds->setTrackIndex(trackIndex); 00242 emcDigiTdsCol->push_back(emcDigiTds); 00243 } 00244 00245 //register EMC digits collection to TDS 00246 StatusCode scEmc = m_evtSvc->registerObject("/Event/Digi/EmcDigiCol", emcDigiTdsCol); 00247 if(scEmc!=StatusCode::SUCCESS) 00248 std::cout<< "Could not register EMC digi collection" <<std::endl; 00249 00250 00251 return StatusCode::SUCCESS; 00252 }
StatusCode RootRawEvtReader::readMdc | ( | int | entry | ) |
Definition at line 128 of file RootRawEvtReader.cxx.
References TRawData::getChargeChannel(), TRawData::getIntId(), TMdcDigi::getOverflow(), TRawData::getTimeChannel(), TRawData::getTrackIndex(), m_evtSvc, m_tree, EventModel::Digi::MdcDigiCol, RawData::setChargeChannel(), MdcDigi::setOverflow(), RawData::setTimeChannel(), and RawData::setTrackIndex().
Referenced by execute().
00129 { 00130 TBranch *branch = m_tree->GetBranch("m_mdcDigiCol"); 00131 00132 TObjArray* mdcDigiCol; 00133 branch->SetAddress(&mdcDigiCol); 00134 mdcDigiCol=0; 00135 00136 branch->GetEntry(entry); 00137 00138 //commonData m_common; 00139 00140 TIter mdcDigiIter(mdcDigiCol); 00141 MdcDigiCol* mdcDigiTdsCol = new MdcDigiCol; 00142 TMdcDigi *mdcDigiRoot = 0; 00143 00144 while ((mdcDigiRoot = (TMdcDigi*)mdcDigiIter.Next())) { 00145 unsigned int id = mdcDigiRoot->getIntId(); 00146 unsigned int time = mdcDigiRoot->getTimeChannel(); 00147 unsigned int charge = mdcDigiRoot->getChargeChannel(); 00148 unsigned int overflow = mdcDigiRoot->getOverflow(); 00149 int trackIndex = mdcDigiRoot->getTrackIndex(); 00150 00151 MdcDigi *mdcDigiTds = new MdcDigi(id); 00152 //m_common.m_rootMdcDigiMap[mdcDigiRoot] = mdcDigiTds; 00153 mdcDigiTds->setTimeChannel(time); 00154 mdcDigiTds->setChargeChannel(charge); 00155 mdcDigiTds->setOverflow(overflow); 00156 mdcDigiTds->setTrackIndex(trackIndex); 00157 mdcDigiTdsCol->push_back(mdcDigiTds); 00158 /*std::cout<<"trackID: "<<trackIndex; 00159 std::cout<<" charge: "<<charge; 00160 std::cout<<" time: "<<time<<std::endl;*/ 00161 } 00162 00163 //register MDC digits collection to TDS 00164 StatusCode scMdc = m_evtSvc->registerObject("/Event/Digi/MdcDigiCol", mdcDigiTdsCol); 00165 if(scMdc!=StatusCode::SUCCESS) 00166 std::cout<< "Could not register MDC digi collection" <<std::endl; 00167 00168 00169 return StatusCode::SUCCESS; 00170 }
StatusCode RootRawEvtReader::readMuc | ( | int | entry | ) |
Definition at line 254 of file RootRawEvtReader.cxx.
References TRawData::getChargeChannel(), TRawData::getIntId(), TRawData::getTimeChannel(), TRawData::getTrackIndex(), m_evtSvc, m_tree, EventModel::Digi::MucDigiCol, RawData::setChargeChannel(), RawData::setTimeChannel(), and RawData::setTrackIndex().
Referenced by execute().
00255 { 00256 TBranch *branch = m_tree->GetBranch("m_mucDigiCol"); 00257 00258 TObjArray* mucDigiCol; 00259 branch->SetAddress(&mucDigiCol); 00260 mucDigiCol=0; 00261 00262 branch->GetEntry(entry); 00263 00264 //commonData m_common; 00265 00266 TIter mucDigiIter(mucDigiCol); 00267 MucDigiCol* mucDigiTdsCol = new MucDigiCol; 00268 TMucDigi *mucDigiRoot = 0; 00269 00270 while ((mucDigiRoot = (TMucDigi*)mucDigiIter.Next())) { 00271 unsigned int id = mucDigiRoot->getIntId(); 00272 unsigned int time = mucDigiRoot->getTimeChannel(); 00273 unsigned int charge = mucDigiRoot->getChargeChannel(); 00274 int trackIndex = mucDigiRoot->getTrackIndex(); 00275 00276 MucDigi *mucDigiTds = new MucDigi(id); 00277 //m_common.m_rootMucDigiMap[mucDigiRoot] = mucDigiTds; 00278 mucDigiTds->setTimeChannel(time); 00279 mucDigiTds->setChargeChannel(charge); 00280 mucDigiTds->setTrackIndex(trackIndex); 00281 mucDigiTdsCol->push_back(mucDigiTds); 00282 } 00283 00284 //register MUC digits collection to TDS 00285 StatusCode scMuc = m_evtSvc->registerObject("/Event/Digi/MucDigiCol", mucDigiTdsCol); 00286 if(scMuc!=StatusCode::SUCCESS) 00287 std::cout<< "Could not register MUC digi collection" <<std::endl; 00288 00289 00290 return StatusCode::SUCCESS; 00291 }
StatusCode RootRawEvtReader::readTof | ( | int | entry | ) |
Definition at line 172 of file RootRawEvtReader.cxx.
References TRawData::getChargeChannel(), TRawData::getIntId(), TTofDigi::getOverflow(), TRawData::getTimeChannel(), TRawData::getTrackIndex(), m_evtSvc, m_tree, RawData::setChargeChannel(), TofDigi::setOverflow(), RawData::setTimeChannel(), RawData::setTrackIndex(), and EventModel::Digi::TofDigiCol.
Referenced by execute().
00173 { 00174 TBranch *branch = m_tree->GetBranch("m_tofDigiCol"); 00175 00176 TObjArray* tofDigiCol; 00177 branch->SetAddress(&tofDigiCol); 00178 tofDigiCol=0; 00179 00180 branch->GetEntry(entry); 00181 00182 //commonData m_common; 00183 00184 TIter tofDigiIter(tofDigiCol); 00185 TofDigiCol* tofDigiTdsCol = new TofDigiCol; 00186 TTofDigi *tofDigiRoot = 0; 00187 00188 while ((tofDigiRoot = (TTofDigi*)tofDigiIter.Next())) { 00189 unsigned int id = tofDigiRoot->getIntId(); 00190 unsigned int time = tofDigiRoot->getTimeChannel(); 00191 unsigned int charge = tofDigiRoot->getChargeChannel(); 00192 unsigned int overflow = tofDigiRoot->getOverflow(); 00193 int trackIndex = tofDigiRoot->getTrackIndex(); 00194 00195 TofDigi *tofDigiTds = new TofDigi(id); 00196 //m_common.m_rootTofDigiMap[tofDigiRoot] = tofDigiTds; 00197 tofDigiTds->setTimeChannel(time); 00198 tofDigiTds->setChargeChannel(charge); 00199 tofDigiTds->setOverflow(overflow); 00200 tofDigiTds->setTrackIndex(trackIndex); 00201 tofDigiTdsCol->push_back(tofDigiTds); 00202 } 00203 00204 //register TOF digits collection to TDS 00205 StatusCode scTof = m_evtSvc->registerObject("/Event/Digi/TofDigiCol", tofDigiTdsCol); 00206 if(scTof!=StatusCode::SUCCESS) 00207 std::cout<< "Could not register TOF digi collection" <<std::endl; 00208 00209 00210 return StatusCode::SUCCESS; 00211 }
int RootRawEvtReader::m_currentEntries [private] |
int RootRawEvtReader::m_currentEntry [private] |
int RootRawEvtReader::m_emcDigi [private] |
IDataProviderSvc* RootRawEvtReader::m_evtSvc [private] |
Definition at line 25 of file RootRawEvtReader.h.
Referenced by execute(), initialize(), readEmc(), readMdc(), readMuc(), and readTof().
int RootRawEvtReader::m_fileNumber [private] |
std::vector<std::string> RootRawEvtReader::m_inputFiles [private] |
int RootRawEvtReader::m_mdcDigi [private] |
int RootRawEvtReader::m_mucDigi [private] |
int RootRawEvtReader::m_tempNumber [private] |
int RootRawEvtReader::m_tofDigi [private] |
int RootRawEvtReader::m_totalEvents [private] |
TTree* RootRawEvtReader::m_tree [private] |