I am new here and new to using ROOT.
Currently, I am working on processing a ROOT tree, but I am having some problems understanding the structure of the Tree. The ROOT file I am using has one tree in it, and it is called “jet.”
When I type jet->Print() I get the results shown in the text file attached.JetPrintOutput.txt (84.0 KB)
I can tell that the top part of the output shown below is telling me the name of the tree and the number of entries in the tree. I am good with that.
Also, how do I know how many branches there are in the tree? When I try to use jet->Scan() I get the following output, which I thought should show me the branches inside the tree, but that doesn’t seem to be the case since I know that the branches should be named “AntiKtR060NHits12” or “AntiKtR050NHits12” and not " AntiKtR06"
Thank you for the quick reply! I did come across these resources, but they did not address the the case where we have both “Branch” and “Br”. I don’t seem to be able to find an explanation to that. Would it be possible to address this? Thank you very much!
For Example, in the ROOT User’s Guide -> Trees, I find this:
But, it doesn’t have a “Branch” nor does it explain the difference between “Branch” and “Br.” The difference between the two and what it mean to have both of them in the same tree is what I am getting stuck on. Can you please address that? Than you very much!
And I can’t really tell what it means since I have a branch called AntiKtR060NHits12, but then I have *Br 0 :fUniqueID . I can’t tell if fUniqueID is a subbranch in the branch AntiKtR060NHits12 or if it means something else. Having both ''Branch" and “Br” in the same tree is throwing me off.
This is the result of a “splitting” of a branch … to split a branch (e.g. “AntiKtR060NHits12”) means to create a sub-branch for each data member in the object (e.g. fUniqueID, fBits, mRunId). Actually, the split-level can be set to 0 to disable splitting or it can be set to a number between 1 and 99 indicating the depth of splitting (search e.g. for “splitlevel” in the links that I gave you).
I actually have one more question here. It is not very clear to me what the result of splitting is.
Case 1:
Before splitting, the tree has a branch named Events that stores events of class MyEvent which has the members fUniqueID , fBits , mRunId etc.
After splitting, now we have a tree with a branch named “Events” and within the branch Events, we have sub-branches fUniqueID , fBits , mRunId etc.
Case 2:
Before splitting, a tree has a branch named Events that stores events of class MyEvent which has the members fUniqueID , fBits , mRunId etc.
After splitting, we have a tree with branches fUniqueID , fBits , mRunId etc. So, the branch Events no longer exits because it was split?
Or it could be something that is not described by the two cases I provided.
I don’t think you can have " Case 2:". If an object is split (i.e. a branch in “decomposed object mode”) then it will still appear as a branch and then there will be sub-branches, i.e. there will appear “BranchElement (see below)”.
Thank you very much! Taking your answer into consideration, I want to see if I am thinking about this correctly:
Let’s consider the following example:
Before splitting, the tree MyTree has a branch named Events that stores events of class MyEvent which has the members fUniqueID , fBits , mRunId , mEventId etc.
After splitting, now we have a tree MyTree with a branch named Events and within the branch Events, we have sub-branches fUniqueID , fBits , mRunId, mEventId etc.
Would this be the right way to process a branch from MyTree?
TChain* eventChain = new Chain("MyTree")
eventChain -> Add(eventFile.root) // Assuming that other files will be chained too.
MyEvent* event = 0;
eventChain->SetBranchAddress("Events", &event)
eventChain->GetEvent(1)
event->RunId() // Where RunId() is a member function of the class MyEvent
event->EventId() // Where EventId() is a member function of the class MyEvent
I am providing this example in an attempt to see if:
a) I need to assign a pointer to each sub-branch,
b) or if I can still have one pointer of class MyEvent and all the information from the sub-branches can be access using one pointer, in this case the pointer event, since one entry of the sub-branches corresponds to all the data members of class MyEvent and the pointer event is of type MyEvent.
Can you please let me know if I am reading the tree correctly and if either my interpretation in a or b is correct? If not, what is the correct way to go about it?