Missing Event IDs' inside the AnalysisTree

REST version : v2.2.20.
REST commit : 2d24a5ae.

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)?
image

===============================
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) )
image
Am I doing something wrong? How should I get the Event ID instead?
Thanks in advance!

Dear Andrii, thanks for your feedback.

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.

restRoot myfile.root

Screenshot 2020-11-17 at 16.21.01

I think we should just change the lable to “Entry Number”. it is better because entry number is always continuous.

Hi,

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,

restRoot --m 1
REST_ViewG4Event("Run17001_restG4_U238_readout_surface_4bar_3um_zar30003.root")

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.

Ok, great! I tested a bit and it works fine for me.

However, I cannot make it work for the latest plot options @ddiez introduced at DrawEvent.

I.e. if I write ids[0,288] the signals from the first FEC would be plotted.

See also the doc at TRestRawSignalEvent

https://sultan.unizar.es/rest/classTRestRawSignalEvent.html#a4148fb81167722275ddbb5d84eab1c54

Hi Javier,

Thank you for your commit and for the remarks. Now, I can have access to EventID of the entry via:

run->GetEntry(i);
~~~
Ev_ID = run->GetAnalysisTree()->GetEventID();

Although, when I am accessing an entry in such way:

run->GetAnalysisTree()->GetBranch(varName)->GetEntry(i);
~~~
Ev_ID = run->GetAnalysisTree()->GetEventID();

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:

Inside TRestAnalysisTree.h

170     void EnableBranches(vector<string> obsNames);
171     void DisableBranches(vector<string> obsNames);
172 
173     void EnableAllBranches();
174     void DisableAllBranches();

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

118     TBranch* br1 = GetBranch("eventID");
119     TBranch* br2 = GetBranch("subEventID");
120     TBranch* br3 = GetBranch("timeStamp");
121     TBranch* br4 = GetBranch("subEventTag");
122     TBranch* br5 = GetBranch("runOrigin");
123     TBranch* br6 = GetBranch("subRunOrigin");

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.

Thank you very much, I will definitely use these methods!

Yes, I ended up using such an expression :slight_smile:.

Hi @nkx,

I installed REST with the latest commit (7e946d61) and now I am not able to visualize the SignalEvents through the TRestBrowser:

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.

Sure I believe that deserves a new topic. We didn’t install the discourse plugin to close a thread :slight_smile:

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.

To undo 1 commit it is possible to do:

git reset HEAD~
git reset --hard

Carefull: This will wash out all local changes

Thank you very much! Yes, it was definitely not a problem related to the TRestBrowser as I tried with several older commits.