3#include "GaudiKernel/MsgStream.h"
4#include "GaudiKernel/AlgFactory.h"
5#include "GaudiKernel/Bootstrap.h"
6#include "GaudiKernel/ISvcLocator.h"
7#include "GaudiKernel/SmartDataPtr.h"
8#include "GaudiKernel/IDataProviderSvc.h"
9#include "GaudiKernel/PropertyMgr.h"
10#include "GaudiKernel/DataObject.h"
11#include "GaudiKernel/GenericAddress.h"
12#include "GaudiKernel/ClassID.h"
39 Algorithm(name, pSvcLocator)
42 declareProperty(
"MdcDigi",m_mdcDigi=1);
43 declareProperty(
"TofDigi",m_tofDigi=1);
44 declareProperty(
"EmcDigi",m_emcDigi=1);
45 declareProperty(
"MucDigi",m_mucDigi=1);
46 declareProperty(
"InputFiles",m_inputFiles);
62 MsgStream log(
msgSvc(), name());
63 log << MSG::INFO <<
"in initialize()" << endreq;
65 ISvcLocator* svcLocator = Gaudi::svcLocator();
66 StatusCode sc=svcLocator->service(
"EventDataSvc", m_evtSvc);
68 std::cout<<
"Could not accesss EventDataSvc!"<<std::endl;
70 return StatusCode::SUCCESS;
76 MsgStream log(
msgSvc(), name());
77 log << MSG::INFO <<
"in execute()" << endreq;
80 StatusCode sc = m_evtSvc->registerObject(
"/Event/Digi",aDigiEvent);
81 if(sc!=StatusCode::SUCCESS) {
82 std::cout<<
"Could not register DigiEvent" <<std::endl;
86 if(m_tempNumber != m_fileNumber)
89 TFile* m_input = TFile::Open(m_inputFiles[m_fileNumber].c_str(),
"READ");
90 std::cout<<
"input file: "<<m_inputFiles[m_fileNumber].c_str()<<std::endl;
91 m_tree= (TTree *)m_input->Get(
"Event");
92 m_tree->SetMakeClass(1);
93 m_currentEntries=(Int_t)m_tree->GetEntries();
94 std::cout<<
"m_currentEntries: "<<m_currentEntries<<std::endl;
96 m_tempNumber = m_fileNumber;
111 log << MSG::INFO <<
"current Entry: "<< m_currentEntry << endreq;
115 if(m_currentEntry==m_currentEntries)
121 log << MSG::INFO <<
"total events: "<< m_totalEvents << endreq;
124 return StatusCode::SUCCESS;
131 TBranch *branch = m_tree->GetBranch(
"m_mdcDigiCol");
133 TObjArray* mdcDigiCol;
134 branch->SetAddress(&mdcDigiCol);
137 branch->GetEntry(entry);
141 TIter mdcDigiIter(mdcDigiCol);
145 while ((mdcDigiRoot = (
TMdcDigi*)mdcDigiIter.Next())) {
146 unsigned int id = mdcDigiRoot->
getIntId();
149 unsigned int overflow = mdcDigiRoot->
getOverflow();
158 mdcDigiTdsCol->push_back(mdcDigiTds);
165 StatusCode scMdc = m_evtSvc->registerObject(
"/Event/Digi/MdcDigiCol", mdcDigiTdsCol);
166 if(scMdc!=StatusCode::SUCCESS)
167 std::cout<<
"Could not register MDC digi collection" <<std::endl;
170 return StatusCode::SUCCESS;
175 TBranch *branch = m_tree->GetBranch(
"m_tofDigiCol");
177 TObjArray* tofDigiCol;
178 branch->SetAddress(&tofDigiCol);
181 branch->GetEntry(entry);
185 TIter tofDigiIter(tofDigiCol);
189 while ((tofDigiRoot = (
TTofDigi*)tofDigiIter.Next())) {
190 unsigned int id = tofDigiRoot->
getIntId();
193 unsigned int overflow = tofDigiRoot->
getOverflow();
202 tofDigiTdsCol->push_back(tofDigiTds);
206 StatusCode scTof = m_evtSvc->registerObject(
"/Event/Digi/TofDigiCol", tofDigiTdsCol);
207 if(scTof!=StatusCode::SUCCESS)
208 std::cout<<
"Could not register TOF digi collection" <<std::endl;
211 return StatusCode::SUCCESS;
216 TBranch *branch = m_tree->GetBranch(
"m_emcDigiCol");
218 TObjArray* emcDigiCol;
219 branch->SetAddress(&emcDigiCol);
222 branch->GetEntry(entry);
226 TIter emcDigiIter(emcDigiCol);
230 while ((emcDigiRoot = (
TEmcDigi*)emcDigiIter.Next())) {
231 unsigned int id = emcDigiRoot->
getIntId();
234 unsigned int measure = emcDigiRoot->
getMeasure();
243 emcDigiTdsCol->push_back(emcDigiTds);
247 StatusCode scEmc = m_evtSvc->registerObject(
"/Event/Digi/EmcDigiCol", emcDigiTdsCol);
248 if(scEmc!=StatusCode::SUCCESS)
249 std::cout<<
"Could not register EMC digi collection" <<std::endl;
252 return StatusCode::SUCCESS;
257 TBranch *branch = m_tree->GetBranch(
"m_mucDigiCol");
259 TObjArray* mucDigiCol;
260 branch->SetAddress(&mucDigiCol);
263 branch->GetEntry(entry);
267 TIter mucDigiIter(mucDigiCol);
271 while ((mucDigiRoot = (
TMucDigi*)mucDigiIter.Next())) {
272 unsigned int id = mucDigiRoot->
getIntId();
282 mucDigiTdsCol->push_back(mucDigiTds);
286 StatusCode scMuc = m_evtSvc->registerObject(
"/Event/Digi/MucDigiCol", mucDigiTdsCol);
287 if(scMuc!=StatusCode::SUCCESS)
288 std::cout<<
"Could not register MUC digi collection" <<std::endl;
291 return StatusCode::SUCCESS;
298 MsgStream log(
msgSvc(), name());
299 log << MSG::INFO <<
"in finalize()" << endreq;
301 return StatusCode::SUCCESS;
ObjectVector< EmcDigi > EmcDigiCol
ObjectVector< MdcDigi > MdcDigiCol
ObjectVector< MucDigi > MucDigiCol
ObjectVector< TofDigi > TofDigiCol
void setMeasure(const unsigned int measure)
void setOverflow(const unsigned int overflow)
void setTrackIndex(const int trackIndex)
void setChargeChannel(const unsigned int chargeChannel)
void setTimeChannel(const unsigned int timeChannel)
StatusCode readTof(int entry)
StatusCode readMuc(int entry)
virtual ~RootRawEvtReader()
StatusCode readEmc(int entry)
StatusCode readMdc(int entry)
UInt_t getMeasure() const
UInt_t getOverflow() const
int getTrackIndex() const
UInt_t getChargeChannel() const
UInt_t getTimeChannel() const
UInt_t getOverflow() const
void setOverflow(const unsigned int overflow)