Hi,
I noticed that browsing through the G4 events via restViewG4Events G4_ev.root I receive information like this in the terminal:
Next event 3
Removing event
Total EDep 2200
Entry : -1
> Event ID : 0
> Event Time : 0
> Event Tag :
-----------------------------------------
Next event 4
Removing event
Total EDep 1180.65
Entry : -1
> Event ID : 0
> Event Time : 0
> Event Tag :
-----------------------------------------
I found it really strange that Event ID is always set to 0.
Also, do I understand correctly that EventId in the TRestBrowser corresponds to the Entry number and not to the Event ID (or Signal ID)?
===============================
In addition, when I am trying to get an EventID of the TrackEvents that were reconstructed from the same initial G4 events (G4_ev.root) like this:
TRestRun* run = new TRestRun();
~~~
for (int i = 0; i < run->GetEntries(); i++) {
~~~
Int_t Ev_ID = run->GetAnalysisTree()->GetEventID();
cout << "EventID: " << Ev_ID << endl;
}
on the output, I received only zeros for the EventID's. However, the corresponding leaf eventid is present inside the AnalysisTree:
I attached the full macro that I am using in order to store the event id’s (REST_Extract_entries.C (3.1 KB) )
Am I doing something wrong? How should I get the Event ID instead?
Thanks in advance!
In fact this is an error that I believe it is there since a long time, and by chance I also spotted not long time ago. The following commit I pushed 4 days ago at development should fix the branch connection problem.
Ok, it makes sense that if “Event ID” appears on the label, the user should provide the event ID. I just updated it at TRestBrowser so that one gets the “EventID”
Still, there is a problem here, that sometimes there is a unique eventId with several subEventIds. Then, it will load only the first one. With no chance to get the subEventId using TRestBrowser. There is room for improvement there.
But it is certainly possible using directly the method run0->GetEventWithID(evID, subEvID);
I believe this error is connected to the previous one, with my latest generated tracks file I open the file and get a good ev id value, hope the same for you after regeneration of tracks file with the latest updates.
I have pushed few changes to TRestBrowser in order to find a compromise. If the refresh button is pressed, the number on the input box will be taken as the EventID and it will load the corresponding event ID.
If we press next or prev arrows it will load the next and previous entries. When we do full chain decays this does a good job now. Because you may place yourself at a desired event ID and then move between subEvents using the arrows.
Still I find some problems from some events, I get this output message
Info in <TEveManager::TExceptionHandler::Handle>: TEveElement::ElementChanged not a TObject.
and the observables are not printed on screen.
On the other hand, when I execute on my local machine
restiewG4Event restG4file.root
the application is not responding and I cannot use it.
output from restViewG4Event
Load event id0
Removing event
TRestG4EventViewer::AddEvent. Total EDep 54.9994
Entry : 0
> Event ID : 0
> Event Time : -2084065920
> Event Tag : Pa234[73.920X]
-----------------------------------------
Running...
Press a key to exit
Warning in <TMacOSXSystem::Run>: handle uncaugth exception, terminating
It is perhaps a MacOs issue?
However, if I enter into restRoot and I execute the macro directly it works properly,
OK, I have updated the layout of TRestBrowser control bar. Now we have both row id, event id and sub event id on shown. We can switch events according to any of them.
I still don’t have an EventID stored in the Ev_ID variable. If I am not mistaken, that is what supposed to happen, as from one branch (varName) I shouldn’t have an access to contents of the other branch (eventID)?
Also, thank you @nkx for changing the TRestBrowser. It works fine for me.
Hi Andrii, that is not the conventional way to get an entry. Because you will be loading only the branch corresponding to the observable varName. In order to update the full event tree you should do:
run->GetAnalysisTree()->GetEntry(i)
That will update the value of all the variables/observables inside the analysis tree.
It is possible to disable/enable branches in order to perform a faster loading if necessary by using the following methods:
So, if you do run->GetAnalysisTree()->DisableAllBranches() and run->GetAnalysisTree()->EnableBranches( xxx); where xxx is a vector containing eventID and varName, then each time you call `run->GetAnalysisTree()->GetEntry(i) only those branches will be updated.
You can see that the eventID is a branch in itself as seen inside TRestAnalysisTree.cxx
I would still recommend to use run->GetEntry(i) because that call will keep synchronised the analysisTree and the corresponding event. Of course, if you are aware of that, it will be ok.
Although, further-on I have a problem with SignalToHits reconstruction process, so I assume that it could be a problem with TRestHitsToSignalProcess itself.
I will make another thread concerning this.
To understand if it is connected to the latest commit or the HitsToSignal an option is to test the generated files with the TRestBrowser of that commit and the previous.