BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
RootRawEvtReader Class Reference

#include <RootRawEvtReader.h>

+ Inheritance diagram for RootRawEvtReader:

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)
 

Detailed Description

Definition at line 11 of file RootRawEvtReader.h.

Constructor & Destructor Documentation

◆ RootRawEvtReader()

RootRawEvtReader::RootRawEvtReader ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 37 of file RootRawEvtReader.cxx.

37 :
38 Algorithm(name, pSvcLocator)
39{
40
41 declareProperty("MdcDigi",m_mdcDigi=1);
42 declareProperty("TofDigi",m_tofDigi=1);
43 declareProperty("EmcDigi",m_emcDigi=1);
44 declareProperty("MucDigi",m_mucDigi=1);
45 declareProperty("InputFiles",m_inputFiles);
46
47 m_totalEvents=0;
48 m_fileNumber=0;
49 m_tempNumber=-1;
50 m_currentEntries=-1;
51 m_currentEntry=-1;
52}

◆ ~RootRawEvtReader()

RootRawEvtReader::~RootRawEvtReader ( )
virtual

Definition at line 54 of file RootRawEvtReader.cxx.

55{
56}

Member Function Documentation

◆ execute()

StatusCode RootRawEvtReader::execute ( )

Definition at line 73 of file RootRawEvtReader.cxx.

73 {
74
75 MsgStream log(msgSvc(), name());
76 log << MSG::INFO << "in execute()" << endreq;
77
78 DigiEvent* aDigiEvent = new DigiEvent;
79 StatusCode sc = m_evtSvc->registerObject("/Event/Digi",aDigiEvent);
80 if(sc!=StatusCode::SUCCESS) {
81 std::cout<< "Could not register DigiEvent" <<std::endl;
82 }
83
84
85 if(m_tempNumber != m_fileNumber)
86 {
87 m_currentEntry = 0;
88 TFile* m_input = TFile::Open(m_inputFiles[m_fileNumber].c_str(), "READ");
89 std::cout<<"input file: "<<m_inputFiles[m_fileNumber].c_str()<<std::endl;
90 m_tree= (TTree *)m_input->Get("Event");
91 m_tree->SetMakeClass(1);
92 m_currentEntries=(Int_t)m_tree->GetEntries();
93 std::cout<<"m_currentEntries: "<<m_currentEntries<<std::endl;
94
95 m_tempNumber = m_fileNumber;
96 }
97
98 if(m_mdcDigi)
99 readMdc(m_currentEntry);
100
101 if(m_tofDigi)
102 readTof(m_currentEntry);
103
104 if(m_emcDigi)
105 readEmc(m_currentEntry);
106
107 if(m_mucDigi)
108 readMuc(m_currentEntry);
109
110 log << MSG::INFO << "current Entry: "<< m_currentEntry << endreq;
111 //std::cout << "current Entry: "<< m_currentEntry << std::endl;
112 m_currentEntry++;
113
114 if(m_currentEntry==m_currentEntries)
115 {
116 m_fileNumber++;
117 }
118
119 m_totalEvents++;
120 log << MSG::INFO << "total events: "<< m_totalEvents << endreq;
121 //std::cout << "total events: "<< m_totalEvents << std::endl;
122
123 return StatusCode::SUCCESS;
124}
IMessageSvc * msgSvc()
StatusCode readTof(int entry)
StatusCode readMuc(int entry)
StatusCode readEmc(int entry)
StatusCode readMdc(int entry)

◆ finalize()

StatusCode RootRawEvtReader::finalize ( )

Definition at line 295 of file RootRawEvtReader.cxx.

295 {
296
297 MsgStream log(msgSvc(), name());
298 log << MSG::INFO << "in finalize()" << endreq;
299
300 return StatusCode::SUCCESS;
301}

◆ initialize()

StatusCode RootRawEvtReader::initialize ( )

Definition at line 59 of file RootRawEvtReader.cxx.

59 {
60
61 MsgStream log(msgSvc(), name());
62 log << MSG::INFO << "in initialize()" << endreq;
63
64 ISvcLocator* svcLocator = Gaudi::svcLocator();
65 StatusCode sc=svcLocator->service("EventDataSvc", m_evtSvc);
66 if (sc.isFailure())
67 std::cout<<"Could not accesss EventDataSvc!"<<std::endl;
68
69 return StatusCode::SUCCESS;
70}

◆ readEmc()

StatusCode RootRawEvtReader::readEmc ( int  entry)

Definition at line 213 of file RootRawEvtReader.cxx.

214{
215 TBranch *branch = m_tree->GetBranch("m_emcDigiCol");
216
217 TObjArray* emcDigiCol;
218 branch->SetAddress(&emcDigiCol);
219 emcDigiCol=0;
220
221 branch->GetEntry(entry);
222
223 //commonData m_common;
224
225 TIter emcDigiIter(emcDigiCol);
226 EmcDigiCol* emcDigiTdsCol = new EmcDigiCol;
227 TEmcDigi *emcDigiRoot = 0;
228
229 while ((emcDigiRoot = (TEmcDigi*)emcDigiIter.Next())) {
230 unsigned int id = emcDigiRoot->getIntId();
231 unsigned int time = emcDigiRoot->getTimeChannel();
232 unsigned int charge = emcDigiRoot->getChargeChannel();
233 unsigned int measure = emcDigiRoot->getMeasure();
234 int trackIndex = emcDigiRoot->getTrackIndex();
235
236 EmcDigi *emcDigiTds = new EmcDigi(id);
237 //m_common.m_rootEmcDigiMap[emcDigiRoot] = emcDigiTds;
238 emcDigiTds->setTimeChannel(time);
239 emcDigiTds->setChargeChannel(charge);
240 emcDigiTds->setMeasure(measure);
241 emcDigiTds->setTrackIndex(trackIndex);
242 emcDigiTdsCol->push_back(emcDigiTds);
243 }
244
245 //register EMC digits collection to TDS
246 StatusCode scEmc = m_evtSvc->registerObject("/Event/Digi/EmcDigiCol", emcDigiTdsCol);
247 if(scEmc!=StatusCode::SUCCESS)
248 std::cout<< "Could not register EMC digi collection" <<std::endl;
249
250
251 return StatusCode::SUCCESS;
252}
Double_t time
ObjectVector< EmcDigi > EmcDigiCol
Definition: EmcDigi.h:43
void setMeasure(const unsigned int measure)
Definition: EmcDigi.h:24
void setTrackIndex(const int trackIndex)
Definition: RawData.cxx:35
void setChargeChannel(const unsigned int chargeChannel)
Definition: RawData.cxx:30
void setTimeChannel(const unsigned int timeChannel)
Definition: RawData.cxx:25
UInt_t getMeasure() const
Definition: TEmcDigi.cxx:37
UInt_t getIntId() const
Definition: TRawData.cxx:50
int getTrackIndex() const
Definition: TRawData.cxx:45
UInt_t getChargeChannel() const
Definition: TRawData.cxx:60
UInt_t getTimeChannel() const
Definition: TRawData.cxx:55
float charge

Referenced by execute().

◆ readMdc()

StatusCode RootRawEvtReader::readMdc ( int  entry)

Definition at line 128 of file RootRawEvtReader.cxx.

129{
130 TBranch *branch = m_tree->GetBranch("m_mdcDigiCol");
131
132 TObjArray* mdcDigiCol;
133 branch->SetAddress(&mdcDigiCol);
134 mdcDigiCol=0;
135
136 branch->GetEntry(entry);
137
138 //commonData m_common;
139
140 TIter mdcDigiIter(mdcDigiCol);
141 MdcDigiCol* mdcDigiTdsCol = new MdcDigiCol;
142 TMdcDigi *mdcDigiRoot = 0;
143
144 while ((mdcDigiRoot = (TMdcDigi*)mdcDigiIter.Next())) {
145 unsigned int id = mdcDigiRoot->getIntId();
146 unsigned int time = mdcDigiRoot->getTimeChannel();
147 unsigned int charge = mdcDigiRoot->getChargeChannel();
148 unsigned int overflow = mdcDigiRoot->getOverflow();
149 int trackIndex = mdcDigiRoot->getTrackIndex();
150
151 MdcDigi *mdcDigiTds = new MdcDigi(id);
152 //m_common.m_rootMdcDigiMap[mdcDigiRoot] = mdcDigiTds;
153 mdcDigiTds->setTimeChannel(time);
154 mdcDigiTds->setChargeChannel(charge);
155 mdcDigiTds->setOverflow(overflow);
156 mdcDigiTds->setTrackIndex(trackIndex);
157 mdcDigiTdsCol->push_back(mdcDigiTds);
158 /*std::cout<<"trackID: "<<trackIndex;
159 std::cout<<" charge: "<<charge;
160 std::cout<<" time: "<<time<<std::endl;*/
161 }
162
163 //register MDC digits collection to TDS
164 StatusCode scMdc = m_evtSvc->registerObject("/Event/Digi/MdcDigiCol", mdcDigiTdsCol);
165 if(scMdc!=StatusCode::SUCCESS)
166 std::cout<< "Could not register MDC digi collection" <<std::endl;
167
168
169 return StatusCode::SUCCESS;
170}
ObjectVector< MdcDigi > MdcDigiCol
Definition: MdcDigi.h:39
void setOverflow(const unsigned int overflow)
Definition: MdcDigi.h:23
UInt_t getOverflow() const
Definition: TMdcDigi.cxx:42

Referenced by execute().

◆ readMuc()

StatusCode RootRawEvtReader::readMuc ( int  entry)

Definition at line 254 of file RootRawEvtReader.cxx.

255{
256 TBranch *branch = m_tree->GetBranch("m_mucDigiCol");
257
258 TObjArray* mucDigiCol;
259 branch->SetAddress(&mucDigiCol);
260 mucDigiCol=0;
261
262 branch->GetEntry(entry);
263
264 //commonData m_common;
265
266 TIter mucDigiIter(mucDigiCol);
267 MucDigiCol* mucDigiTdsCol = new MucDigiCol;
268 TMucDigi *mucDigiRoot = 0;
269
270 while ((mucDigiRoot = (TMucDigi*)mucDigiIter.Next())) {
271 unsigned int id = mucDigiRoot->getIntId();
272 unsigned int time = mucDigiRoot->getTimeChannel();
273 unsigned int charge = mucDigiRoot->getChargeChannel();
274 int trackIndex = mucDigiRoot->getTrackIndex();
275
276 MucDigi *mucDigiTds = new MucDigi(id);
277 //m_common.m_rootMucDigiMap[mucDigiRoot] = mucDigiTds;
278 mucDigiTds->setTimeChannel(time);
279 mucDigiTds->setChargeChannel(charge);
280 mucDigiTds->setTrackIndex(trackIndex);
281 mucDigiTdsCol->push_back(mucDigiTds);
282 }
283
284 //register MUC digits collection to TDS
285 StatusCode scMuc = m_evtSvc->registerObject("/Event/Digi/MucDigiCol", mucDigiTdsCol);
286 if(scMuc!=StatusCode::SUCCESS)
287 std::cout<< "Could not register MUC digi collection" <<std::endl;
288
289
290 return StatusCode::SUCCESS;
291}
ObjectVector< MucDigi > MucDigiCol
Definition: MucDigi.h:29

Referenced by execute().

◆ readTof()

StatusCode RootRawEvtReader::readTof ( int  entry)

Definition at line 172 of file RootRawEvtReader.cxx.

173{
174 TBranch *branch = m_tree->GetBranch("m_tofDigiCol");
175
176 TObjArray* tofDigiCol;
177 branch->SetAddress(&tofDigiCol);
178 tofDigiCol=0;
179
180 branch->GetEntry(entry);
181
182 //commonData m_common;
183
184 TIter tofDigiIter(tofDigiCol);
185 TofDigiCol* tofDigiTdsCol = new TofDigiCol;
186 TTofDigi *tofDigiRoot = 0;
187
188 while ((tofDigiRoot = (TTofDigi*)tofDigiIter.Next())) {
189 unsigned int id = tofDigiRoot->getIntId();
190 unsigned int time = tofDigiRoot->getTimeChannel();
191 unsigned int charge = tofDigiRoot->getChargeChannel();
192 unsigned int overflow = tofDigiRoot->getOverflow();
193 int trackIndex = tofDigiRoot->getTrackIndex();
194
195 TofDigi *tofDigiTds = new TofDigi(id);
196 //m_common.m_rootTofDigiMap[tofDigiRoot] = tofDigiTds;
197 tofDigiTds->setTimeChannel(time);
198 tofDigiTds->setChargeChannel(charge);
199 tofDigiTds->setOverflow(overflow);
200 tofDigiTds->setTrackIndex(trackIndex);
201 tofDigiTdsCol->push_back(tofDigiTds);
202 }
203
204 //register TOF digits collection to TDS
205 StatusCode scTof = m_evtSvc->registerObject("/Event/Digi/TofDigiCol", tofDigiTdsCol);
206 if(scTof!=StatusCode::SUCCESS)
207 std::cout<< "Could not register TOF digi collection" <<std::endl;
208
209
210 return StatusCode::SUCCESS;
211}
ObjectVector< TofDigi > TofDigiCol
Definition: TofDigi.h:41
UInt_t getOverflow() const
Definition: TTofDigi.cxx:42
void setOverflow(const unsigned int overflow)
Definition: TofDigi.h:23

Referenced by execute().


The documentation for this class was generated from the following files: