Dear ROOT experts,
I thought reviving this old thread would be the most straightforward way to ask you for help with reading the same file format as discussed here.
The code snippet provided Wile_E_Coyote works perfectly and is of great help.
My problem is that I can not get data from a branch with TVector3.
Br 87 :event.fFDEvents.fFdRecShower.fAxisCoreCS :
TVector3 fAxisCoreCS[event.fFDEvents_]
I tried to see if using MakeClass helps (generating and loading TVector3 dictionary does not change the outcome):
[] recData->MakeClass("recData");
The result is that the branch is filled with zeroes, while for GenShower (which is a scalar unlike FDEvents) it works:
[] .L recData.C
[] recData t
[] t.GetEntry(0)
[] t.Show()
======> EVENT:0
event.fFDEvents = 1
event.fFDEvents.fFdRecShower.fAxisCoreCS = 1
event.fGenShower.fAxisCoreCS = TVector3
[] t.event_fFDEvents_fFdRecShower_fAxisCoreCS[0].Z()
(double) 0.0000000
[] t.event_fGenShower_fAxisCoreCS.Z()
(double) 0.82028817
In the original root file the values are:
[] [5] recData->Scan("event.fFDEvents.fFdRecShower.fAxisCoreCS.Z():event.fGenShower.fAxisCoreCS.Z()")
***********************************************
* Row * Instance * event.fFD * event.fGe *
***********************************************
* 0 * 0 * 0.8220908 * 0.8202881 *
MakeClass produces the following code for the respective branches:
TTree *fChain; //!pointer to the analyzed TTree or TChain
const Int_t kMaxevent_fFDEvents = 3;
TVector3 event_fFDEvents_fFdRecShower_fAxisCoreCS[kMaxevent_fFDEvents];
TVector3 event_fGenShower_fAxisCoreCS;
TBranch *b_event_fFDEvents_fFdRecShower_fAxisCoreCS;
TBranch *b_event_fGenShower_fAxisCoreCS;
fChain->SetBranchAddress("event.fFDEvents.fFdRecShower.fAxisCoreCS", event_fFDEvents_fFdRecShower_fAxisCoreCS, &b_event_fFDEvents_fFdRecShower_fAxisCoreCS);
fChain->SetBranchAddress("event.fGenShower.fAxisCoreCS", &event_fGenShower_fAxisCoreCS, &b_event_fGenShower_fAxisCoreCS);
I am attaching recData.{C,h} and the original root file.
I use ROOT 5.34/38 which is a prerequisite for working with this file.
Many thanks!
All the best,
Alexey
pico.root (84.3 KB)
recData.C (1.4 KB)
recData.h (72.0 KB)