Hello, in a Geant4 simulation, a produce a TTree where branches are double.
Here the file WeTransfer - Send Large Files & Share Photos Online - Up to 2GB Free
The first branch is Edep where Edep[0] is the deposited energy in the first detector, Edep[1] the deposite energy in the second one.
A collegue needs the root file of the simulation (only the deposited energy). He usually works with TH1F, then to simplify his life, I should create a new root file just storing the deposited energy, but splitting the Edep vector in two branches, ie.:
Edep[0] will be filled in EdepGePD
Edep[1] will be filled in EdepGeDD.
I wrote the macro and it looks like working (i.e. a produce the new root file with 2 branches), but I see different number of entries. For example, when using the original file (Sim.root) I plot
Tree1->Draw("Edep[0]>>htemp0(5100,0.,5100)", "Edep[0]>0");
I get
on the contrary, when using the new splitted file, by the command
Tree1->Draw("EdepGePD>>htemp0(5100,0.,5100)", "EdepGePD>0");
I get
As you can see, in the new file I get a number of entries larger then in the old one, but I don’t understand the reason. Here the macro and the new file
edepsplit.cpp (1.5 KB)