GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » PANDA » PandaRoot » General » Access to EventHeader. after Digitization
Access to EventHeader. after Digitization [message #19293] Fri, 27 May 2016 15:16 Go to next message
Dominik Steinschaden is currently offline  Dominik Steinschaden
Messages: 28
Registered: April 2015
continuous participant
From: *smi.oeaw.ac.at
Hi all,

At the moment I try to analyse some data created using the time based simulation/digitization. Therefore I need access to the EventHeader. which stores the MC Event time for every event.

So far I have access to all the data stored in the output file of the digitization stage, beside the Event time information.

Below a short version of the Macro I'm using is attached. May I have to do something different to access these information, so if somebody has an idea pleas tell me Smile

In this macro the EventTime as well as the individual Timestamps of all Tracks hitting the SciTil should be displayed.
But only the SciTil Timestamps are displayed correctly. For the EventTime only 0 is displayed.
If I look into the digi.root files using the TBrowser, the Eventheader. is filled with the correct, non zero EventTimes

regards Dominik
  • Attachment: test.C
    (Size: 1.75KB, Downloaded 225 times)
Re: Access to EventHeader. after Digitization [message #19294 is a reply to message #19293] Fri, 27 May 2016 17:00 Go to previous messageGo to next message
StefanoSpataro is currently offline  StefanoSpataro
Messages: 2736
Registered: June 2005
Location: Torino
first-grade participant

From: *to.infn.it
Hi,
I have the feeling that in such a way you retrieve the event header only one time and before the event loop, and not event by event. I have never used in such a way the code, in general I have always set the branch addess from the tee.
One example can be found in macro/gem/TB_checkHitReconstruction.C. I don0t know of moving the GetObject inside the event loop will help (but you could try).
Re: Access to EventHeader. after Digitization [message #19304 is a reply to message #19294] Tue, 31 May 2016 15:48 Go to previous messageGo to next message
Dominik Steinschaden is currently offline  Dominik Steinschaden
Messages: 28
Registered: April 2015
continuous participant
From: *smi.oeaw.ac.at
as expected, moving it into the loop didn't help.
But I was able to access the information by directly opening the tree and setting the branch address.

Thanks for the help.

ps: its a little bit counter intuitive that the way one can access the information stored by the detectors is not working for the EventHeader. may we can update this sometimes?

Dominik
Re: Access to EventHeader. after Digitization [message #19900 is a reply to message #19293] Thu, 17 November 2016 13:18 Go to previous messageGo to next message
Michael Papenbrock is currently offline  Michael Papenbrock
Messages: 24
Registered: September 2014
continuous participant
From: *physics.uu.se
Hi!

I just ran into a similar problem, but within a FairTask, which was also executed after digitization. I used the following code in order to access the event time:
FairRootManager *ioManager = FairRootManager::Instance();
  if (FairRunAna::Instance()->IsTimeStamp()) {
    Double_t eventTime = ioManager->GetEventTime();
  }


Whether I call it in the Init() or Exec() method yields zero. However, the event times in the digi root-file look fine. Has this been resolved or is there a common workaround?
Re: Access to EventHeader. after Digitization [message #19903 is a reply to message #19900] Thu, 17 November 2016 15:11 Go to previous messageGo to next message
Radoslaw Karabowicz is currently offline  Radoslaw Karabowicz
Messages: 108
Registered: June 2004
Location: GSI
continuous participant
From: *gsi.de
Did you try to run it without the

if (FairRunAna::Instance()->IsTimeStamp()) {

check?
Re: Access to EventHeader. after Digitization [message #19907 is a reply to message #19293] Thu, 17 November 2016 15:18 Go to previous messageGo to next message
Michael Papenbrock is currently offline  Michael Papenbrock
Messages: 24
Registered: September 2014
continuous participant
From: *physics.uu.se
Yes, same thing, unfortunately.
Re: Access to EventHeader. after Digitization [message #19917 is a reply to message #19907] Sat, 19 November 2016 12:15 Go to previous messageGo to next message
Radoslaw Karabowicz is currently offline  Radoslaw Karabowicz
Messages: 108
Registered: June 2004
Location: GSI
continuous participant
From: *dip0.t-ipconnect.de
Dear Michael,

Indeed it seems that I have introduced a bug while creating FairFileSource.
It causes it not to read the fEventTime from the input tree, when
the user does not run in TimeBased mode.

I have traced down the error to coming from:

FairFileSource.cxx
FairFileSource::ReadEvent(UInt_t i){
...
SetEventTime();
...
}

This line should be changed to fEventTime = GetEventTime();
In the dev/ it is line number 331.

Is it possible for you to change the line, build FairRoot again, and test if digitization
works as before, and in the reconstruction you do retrieve the event time properly?

cheers
radek
Re: Access to EventHeader. after Digitization [message #19919 is a reply to message #19293] Mon, 21 November 2016 10:05 Go to previous messageGo to next message
Michael Papenbrock is currently offline  Michael Papenbrock
Messages: 24
Registered: September 2014
continuous participant
From: *physics.uu.se
Dear Radek,

I implemented the change and it seems to be working for the first event, i.e. the event time for the first event is carried over and can be accessed. However, for subsequent events I get the output below. The returned value of GetEventTime() is always the one of the first event.

Error in <TClonesArray::At>: index 0 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 1 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 2 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 3 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 4 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 5 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 6 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 7 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 8 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 9 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 10 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 11 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 12 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 13 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 14 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 15 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 16 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 17 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 18 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 19 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 20 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 21 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 22 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 23 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 24 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 25 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 26 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 27 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 28 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 29 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 30 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 31 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 32 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 33 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 34 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 35 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 36 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 37 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 38 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 39 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 40 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 41 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 42 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 43 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 44 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 45 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 46 out of bounds (size: 0, this: 0x35df510)
Error in <TClonesArray::At>: index 47 out of bounds (size: 0, this: 0x35df510)


Cheers,
Michael
Re: Access to EventHeader. after Digitization [message #19925 is a reply to message #19919] Mon, 21 November 2016 18:08 Go to previous messageGo to next message
Radoslaw Karabowicz is currently offline  Radoslaw Karabowicz
Messages: 108
Registered: June 2004
Location: GSI
continuous participant
From: *dip0.t-ipconnect.de
Hi Michael,

could you send me the task and macro that you are trying to run?
I would like to test it myself.

yours
radek
Re: Access to EventHeader. after Digitization [message #19928 is a reply to message #19293] Tue, 22 November 2016 11:33 Go to previous messageGo to next message
Michael Papenbrock is currently offline  Michael Papenbrock
Messages: 24
Registered: September 2014
continuous participant
From: *physics.uu.se
Dear Radek,

I have attached the task together with the project files to run it. "sim_complete.C" and "digi_complete.C" produce the necessary data, "reco_complete.C" executes the task. Let me know if you need anything else!

Best regards,
Michael
Re: Access to EventHeader. after Digitization [message #19932 is a reply to message #19928] Tue, 22 November 2016 16:38 Go to previous messageGo to next message
Radoslaw Karabowicz is currently offline  Radoslaw Karabowicz
Messages: 108
Registered: June 2004
Location: GSI
continuous participant
From: *gsi.de
Hi Michael,

This time I want you to add three lines in two files:

void FairFileSource::FillEventHeader(FairEventHeader* feh)
{
fEventTime = GetEventTime(); // <===== ADD THIS LINE
feh->SetEventTime(fEventTime);


Int_t FairRootManager::ReadNonTimeBasedEventFromBranches(Int_t Entry)
{
if ( fSource ){
TObject *Obj;
fListOfNonTimebasedBranchesIter->Reset();
while ( (Obj=fListOfNonTimebasedBranchesIter->Next())) {
// LOG(INFO) << "GETTING EVENT " << Entry << " FOR OBJ >" << Obj->GetName() << "<" << FairLogger::endl;
fSource->ReadBranchEvent(Obj->GetName(),Entry);
}
}else{
return 0;
}

fSource->FillEventHeader(fEventHeader); // / <===== ADD THIS LINE
fCurrentTime = fEventHeader->GetEventTime(); // / <===== ADD THIS LINE

return 1;
}

Then please rebuild FairRoot and let me know the results.
I still try to understand, why it seems to have been working before.

yours
radek
Re: Access to EventHeader. after Digitization [message #19941 is a reply to message #19293] Wed, 23 November 2016 12:30 Go to previous messageGo to next message
Michael Papenbrock is currently offline  Michael Papenbrock
Messages: 24
Registered: September 2014
continuous participant
From: *physics.uu.se
Dear Radek,

this produced some interesting results. First, let me show you the number I got from a simulation of just 10 events:

ioManager->GetEventTime(): 8.89033   myEventHeader->GetEventTime(): 8.89033
ioManager->GetEventTime(): 239.621   myEventHeader->GetEventTime(): 8.89033
ioManager->GetEventTime(): 290.828   myEventHeader->GetEventTime(): 239.621
ioManager->GetEventTime(): 300.156   myEventHeader->GetEventTime(): 290.828
ioManager->GetEventTime(): 312.479   myEventHeader->GetEventTime(): 300.156
ioManager->GetEventTime(): 382.595   myEventHeader->GetEventTime(): 312.479
ioManager->GetEventTime(): 386.654   myEventHeader->GetEventTime(): 382.595
ioManager->GetEventTime(): 428.155   myEventHeader->GetEventTime(): 386.654
ioManager->GetEventTime(): 439.536   myEventHeader->GetEventTime(): 428.155
ioManager->GetEventTime(): 445.36   myEventHeader->GetEventTime(): 439.536
ioManager->GetEventTime(): 445.36   myEventHeader->GetEventTime(): 445.36
ioManager->GetEventTime(): 445.36   myEventHeader->GetEventTime(): 445.36
ioManager->GetEventTime(): 445.36   myEventHeader->GetEventTime(): 445.36
ioManager->GetEventTime(): 445.36   myEventHeader->GetEventTime(): 445.36
ioManager->GetEventTime(): 445.36   myEventHeader->GetEventTime(): 445.36
ioManager->GetEventTime(): 445.36   myEventHeader->GetEventTime(): 445.36
ioManager->GetEventTime(): 445.36   myEventHeader->GetEventTime(): 445.36
ioManager->GetEventTime(): 445.36   myEventHeader->GetEventTime(): 445.36
ioManager->GetEventTime(): 445.36   myEventHeader->GetEventTime(): 445.36
ioManager->GetEventTime(): 445.36   myEventHeader->GetEventTime(): 445.36


After simulation, I have 10 events in the root file as defined in my macro. After digitization I have 11, which is also expected, but after reconstruction there are 20. However, looking at the output above the last 10 seem to be more or less the same. Also, it is noteworthy that the FairEventHeader lags one event behind the FairRootManager. Overall, it looks like a step in the right direction!

Cheers,
Michael
Re: Access to EventHeader. after Digitization [message #19944 is a reply to message #19941] Wed, 23 November 2016 13:03 Go to previous messageGo to next message
Tobias Stockmanns is currently offline  Tobias Stockmanns
Messages: 489
Registered: May 2007
first-grade participant
From: *ikp.kfa-juelich.de
Dear Michael,

the difference between the number of events in simulation, digitization and reconstruction is not surprising. The simulation file is identical in TimeBased and EventBased simulation, so you have here the number of events you have simulated. In the digitization stage the ordering of the digi stream is randomized depending on your detector and afterwards sorted by the TimeStamp. The digis of one event are not longer in the same entry as in the simulation and they can be completely mixed up. The last entry in the digitization file contains all data of the sorter which has not finished sorting before the last event happend.

The number of events in the reco file can be anything from 1 to (almost) infinity. It only depends on the way you take the data from the digi file via the GetData method. You can have less events if you have events merged together or more, if one event is split into many "pseudo-events".

Cheers,

Tobias
Re: Access to EventHeader. after Digitization [message #19953 is a reply to message #19941] Thu, 24 November 2016 09:06 Go to previous messageGo to next message
Radoslaw Karabowicz is currently offline  Radoslaw Karabowicz
Messages: 108
Registered: June 2004
Location: GSI
continuous participant
From: *gsi.de
Hi Michael,

ioManager->FillEventHeader(myEventHeader);

I added the above line, and then I do get proper data from myEventHeader.

yours
radek
Re: Access to EventHeader. after Digitization [message #19957 is a reply to message #19293] Thu, 24 November 2016 10:33 Go to previous message
Michael Papenbrock is currently offline  Michael Papenbrock
Messages: 24
Registered: September 2014
continuous participant
From: *eduroam.uu.se
Dear Radek,

great! Thank you for the help!

Also thank you to Tobias for the explanations!

Cheers,
Michael
Previous Topic: HGS-HIRe SUMMER STUDENT PROGRAM at G S I / F A I R, July 24 - Sep. 14, 2017
Next Topic: Merry Christmas
Goto Forum:
  


Current Time: Wed Dec 08 14:00:51 CET 2021

Total time taken to generate the page: 0.02051 seconds