hi,
i’m filling a root ntuple TTree as follows in a C++ framework:
TTree* tree= new TTree("T1","...");
TClonesArray* mc_data= new TClonesArray("TLorentzVector", 10000);
tree->Branch("mc_data", "TClonesArray", &mc_data, 32000, 0);
...
for (int index.....){
TLorentzVector a(0.0,0.0,0.0,0.0);
a.SetPxPyPzE(p.px(),p.py(),p.pz(),p.energy());
new((*mc_data) [index]) TLorentzVector(a);
}
...
tree->Fill();
if I access root and load the corresponding root file, one can use:
T1->Draw(“mc_data.M()”)
to plot the data to a histogram.
But for further analysis i would need to access the TBranch mc_data and loop over every single entry (TLorentzVector) to execute mc_data.M() and fill value by value into a TH1F?
thanks for help
Flo