Hello,
In order to successfully write my Bachelor’s thesis I need to read a file mentionted in a description. It is a tree file and what I need to do is separate QES events from another events. I am working on Windows 10 and have root installed but I do not have GENIE. I was trying to find a documentation for a isQuastiElastic() function but cannot find it. My current file looks like this:
’
void test3()
{
TFile *input = new TFile(“gntp.0.gtrac.root”, “read”);
input->ls();
TTree *tree = (TTree*)input->Get("gRooTracker");
int entries = tree->GetEntries();
Event *event = 0;
tree->SetBranchAddress("event", &event);
cout << entries << endl;
for(int i=0; i < entries; i++)
{
tree->GetEntry(i);
}
input->Close();
}
’
Can you please help me?
Try:
tree->Print();
tree->MakeClass();
It is not what I am looking for unfortunately. When I use ‘tree->Show(0)’ it print an information about an event number 0. My file contains 10 000 events and I need to choose the QES events and put them in a separate file. I also have a problem with a variable type “Event” which root cannot find while I use this file.
Unfortunately, uncle Google is a no go here, I have been trying for couple of days to find anything about this format. Also, I have already tried MakeClass method, but I still have no idea how to find if an event is a QES and how to get to a variable with this information.
Talk to the one who gave you this ROOT file, and/or your colleagues, and/or your supervisor, and/or GENIE people.
BTW. I would try to “Scan” the tree, e.g.:
root -b -l -q gntp.0.gtrac.root -e 'gRooTracker->Scan("EvtFlags:EvtCode", "", "colsize=30");'
That’s what I got in return:
(TFile *) 0x55b45a80ce80
******************************************************************************
* Row * EvtFlags * EvtCode *
******************************************************************************
* 0 * 0 * 0 *
* 1 * 0 * 0 *
* 2 * 0 * 0 *
* 3 * 0 * 0 *
* 4 * 0 * 0 *
* 5 * 0 * 0 *
* 6 * 0 * 0 *
* 7 * 0 * 0 *
* 8 * 0 * 0 *
* 9 * 0 * 0 *
* 10 * 0 * 0 *
* 11 * 0 * 0 *
* 12 * 0 * 0 *
* 13 * 0 * 0 *
* 14 * 0 * 0 *
* 15 * 0 * 0 *
* 16 * 0 * 0 *
* 17 * 0 * 0 *
* 18 * 0 * 0 *
* 19 * 0 * 0 *
* 20 * 0 * 0 *
* 21 * 0 * 0 *
* 22 * 0 * 0 *
* 23 * 0 * 0 *
* 24 * 0 * 0 *
Type <CR> to continue or q to quit ==> CR
Attach your ROOT file for inspection.
The file is too big to attach it here unfortunately. Can i send it to you through an e-mail?
Try: rooteventselector -l 100 gntp.0.gtrac.root:gRooTracker gntp.100.gtrac.root
I tried it but I don’t understand what happened. What did it do? How do I specify that ‘rooteventselector’ selects only QES?
This creates a smaller file (with the first 100 events) to attach here.
Thank you very much! So this file selects every QES event and prints it right?
root -b -l -q gntp.0.gtrac.root -e 'gRooTracker->Scan("fString", "", "colsize=64");'
root -b -l -q gntp.0.gtrac.root -e 'gRooTracker->Scan("EvtCode.String()", "", "colsize=64");'
Note that, there are "proc:Weak[CC],QES;"
(i.e., “InteractionType == WeakCC
” and “ScatteringType == QuasiElastic
”) and "proc:Weak[NC],QES;"
(i.e., “InteractionType == WeakNC
” and “ScatteringType == QuasiElastic
”) events.
gRooTracker.cxx (2.8 KB)
NOTE: @pcanal It seems that the TTree::MakeClass
and the “legacy” TTree::MakeSelector
methods generate wrong source code for TBits
objects:
//TBits *EvtFlags;
UInt_t fNbits;
UInt_t fNbytes;
UChar_t fAllBits[1]; //[fNbytes]
The sizeof(fAllBits)
is 1
even though the fNbytes
is greater than 1
(fNbits
> 8
).
For the gntp.100.gtrac.root
file, compare the outputs of (fNbits
= 16
, fNbytes
= 2
):
root -b -l -q gntp.100.gtrac.root -e 'gRooTracker->MakeClass();'
root -b -l -q gntp.100.gtrac.root -e 'gRooTracker->Scan("fNbits:fNbytes");'