I have a set of root files with a tree and branches inside. Every branch is a class derived from TObject which contains a TClonesArray object where I store my final data.
If I use ROOT CLI to test it, eg:
TChain c("M").
c.Add("file1.root); c.Add("file2.root); c.Add("file3.root);
c.Draw("MGeantTrack.data.start.E")
all works fine and I see proper energy spectrum.
But when I try to use the same files from the application, where I read the chain using TChain::GetBranch()
and TChain::SetAddress()
and followed by getEntry(i)
, only data from the first file are OK. In my class I have function which can print all the members of the class, and when printing last two events of the first file the data are correct:
pos sta=(-63.860748,45.852509,-26.533522) sto=(-27.821383,43.458836,30.946054)
dir sta=(0.530840,-0.035504,0.846728) sto=(0.531200,-0.034308,0.846552)
start energy = 5382.276855, stop energy = 5082.808105
scat=0 process=
PID=1000110230 stop in det=1
num of sec=0
pos sta=(-66.399200,50.302349,16.030731) sto=(600.000000,-177.096909,-74.180840)
dir sta=(0.938943,-0.320097,-0.126192) sto=(0.938686,-0.320444,-0.127215)
start energy = 27827.259766, stop energy = 24863.156250
scat=0 process=
PID=1000150310 stop in det=0
num of sec=0
But every data from the second or later file gives always fixed data, always the same, like below:
pos sta=(-29.940292,91.304390,28.868572) sto=(462.300171,-327.365082,-600.000000)
dir sta=(0.545874,-0.464139,-0.697565) sto=(0.545903,-0.464326,-0.697417)
start energy = 84140.382812, stop energy = 83883.398438
scat=0 process=
PID=1000050110 stop in det=0
num of sec=0
Any idea where the difference in behaviour may come from?