@@ -140,9 +140,9 @@ void RawToDigitsTask::run(framework::ProcessingContext& pc)
140140 }
141141 int first = mAccumulateDigits .size ();
142142 mAccumulateDigits .insert (mAccumulateDigits .end (), mDecod ->mDigits .begin (), mDecod ->mDigits .end ());
143- int last = mAccumulateDigits .size () - 1 ;
144- if (last >= first) {
145- mEvents .push_back (o2::hmpid::Event ( mDecod ->mIntReco , ( uint32_t ) first, ( uint32_t ) last) );
143+ int last = mAccumulateDigits .size ();
144+ if (last > first) {
145+ mEvents .emplace_back (o2::hmpid::Trigger{ mDecod ->mIntReco , first, last - first} );
146146 mDigitsReceived += mDecod ->mDigits .size ();
147147 }
148148 mFramesReceived ++;
@@ -200,9 +200,9 @@ void RawToDigitsTask::parseNoTF()
200200 }
201201 int first = mAccumulateDigits .size ();
202202 mAccumulateDigits .insert (mAccumulateDigits .end (), mDecod ->mDigits .begin (), mDecod ->mDigits .end ());
203- int last = mAccumulateDigits .size () - 1 ;
204- if (last >= first) {
205- mEvents .push_back ( o2::hmpid::Event ( mDecod ->mIntReco , ( uint32_t ) first, ( uint32_t ) last) );
203+ int last = mAccumulateDigits .size ();
204+ if (last > first) {
205+ mEvents .emplace_back ( mDecod ->mIntReco , first, last - first );
206206 mDigitsReceived += mDecod ->mDigits .size ();
207207 }
208208 mFramesReceived ++;
@@ -236,7 +236,7 @@ void RawToDigitsTask::writeResults()
236236
237237 /* ------ ROOT file version 1 ----------
238238 o2::hmpid::Digit digit;
239- o2::hmpid::Event event;
239+ o2::hmpid::Trigger event;
240240 TString filename;
241241 TString tit;
242242
@@ -250,32 +250,30 @@ void RawToDigitsTask::writeResults()
250250 theTree = new TTree("o2hmp", tit);
251251
252252 theDigits = theTree->Branch("HMPDigit", &digit, sizeof(o2::hmpid::Digit), 1);
253- theEvents = theTree->Branch("InteractionRecords", &event, sizeof(o2::hmpid::Event ), 1);
253+ theEvents = theTree->Branch("InteractionRecords", &event, sizeof(o2::hmpid::Trigger ), 1);
254254
255- o2::hmpid::Event prevEvent = mEvents[0];
255+ o2::hmpid::Trigger prevEvent = mEvents[0];
256256 uint32_t theFirstDigit = 0;
257257 uint32_t theLastDigit = 0;
258258 for (int e = 0; e < mEvents.size(); e++) {
259259 LOG(INFO) << "Manage event " << mEvents[e];
260260 if (prevEvent != mEvents[e]) { // changes the event Flush It
261261 event = prevEvent;
262- event.mFirstDigit = theFirstDigit;
263- event.mLastDigit = theLastDigit-1;
262+ event.setDataRange(theFirstDigit, theLastDigit-theFirstDigit);
264263 theEvents->Fill();
265264 theFirstDigit = theLastDigit;
266265 prevEvent = mEvents[e];
267266 }
268- int first = mEvents[e].mFirstDigit ;
269- int last = mEvents[e].mLastDigit ;
267+ int first = mEvents[e].getFirstEntry() ;
268+ int last = mEvents[e].getLastEntry() ;
270269 for(int idx = first; idx <= last; idx++) {
271270 digit = mAccumulateDigits[idx];
272271 theDigits->Fill();
273272 theLastDigit++;
274273 }
275274 }
276275 event = prevEvent;
277- event.mFirstDigit = theFirstDigit;
278- event.mLastDigit = theLastDigit-1;
276+ event.setDataRange(theFirstDigit, theLastDigit-theFirstDigit);
279277 theEvents->Fill();
280278 theTree->Write();
281279 mfileOut.Close();
@@ -286,7 +284,7 @@ void RawToDigitsTask::writeResults()
286284 TString tit;
287285
288286 std::vector<o2::hmpid::Digit> digitVec;
289- std::vector<o2::hmpid::Event > eventVec;
287+ std::vector<o2::hmpid::Trigger > eventVec;
290288
291289 filename = TString::Format (" %s" , mOutRootFileName .c_str ());
292290 LOG (INFO) << " Create the ROOT file " << filename.Data ();
@@ -298,24 +296,24 @@ void RawToDigitsTask::writeResults()
298296 theTree->Branch (" HMPIDDigits" , &digitVec);
299297
300298 // builds the two arranged vectors of objects
301- o2::hmpid::Event prevEvent = mEvents [0 ];
299+ o2::hmpid::Trigger prevEvent = mEvents [0 ];
302300 uint32_t theFirstDigit = 0 ;
303301 uint32_t theLastDigit = 0 ;
304302 for (int e = 0 ; e < mEvents .size (); e++) {
305303 LOG (DEBUG) << " Manage event " << mEvents [e];
306304 if (prevEvent != mEvents [e]) { // changes the event Flush It
307- eventVec.push_back (o2::hmpid::Event ( o2:: InteractionRecord (prevEvent.getBc (), prevEvent.getOrbit ()), theFirstDigit, theLastDigit - 1 ) );
305+ eventVec.emplace_back (o2::InteractionRecord (prevEvent.getBc (), prevEvent.getOrbit ()), theFirstDigit, theLastDigit - theFirstDigit );
308306 theFirstDigit = theLastDigit;
309307 prevEvent = mEvents [e];
310308 }
311- int first = mEvents [e].mFirstDigit ;
312- int last = mEvents [e].mLastDigit ;
309+ int first = mEvents [e].getFirstEntry () ;
310+ int last = mEvents [e].getLastEntry () ;
313311 for (int idx = first; idx <= last; idx++) {
314312 digitVec.push_back (mAccumulateDigits [idx]);
315313 theLastDigit++;
316314 }
317315 }
318- eventVec.push_back (o2::hmpid::Event ( o2:: InteractionRecord (prevEvent.getBc (), prevEvent.getOrbit ()), theFirstDigit, theLastDigit - 1 ) );
316+ eventVec.emplace_back (o2::InteractionRecord (prevEvent.getBc (), prevEvent.getOrbit ()), theFirstDigit, theLastDigit - theFirstDigit );
319317 theTree->Fill ();
320318 theTree->Write ();
321319 mfileOut.Close ();
0 commit comments