Hi,
I have sent this twice to roottalk today, and my emails (from two different
adresses) don’t seem to arrive…
Basically, I have a TChain of files I wish to analyse with v3.10/01.
When I do
TChain tchen(“tree”);
tchen.Add(“rfio:cchpssindra:/hpss/in2p3.fr/group/indra/campagne5/root/run6020.root”);
tchen.Add(“rfio:cchpssindra:/hpss/in2p3.fr/group/indra/campagne5/root/run6021.root”);
tchen.Add(“rfio:cchpssindra:/hpss/in2p3.fr/group/indra/campagne5/root/run6022.root”);
KVINDRAReconEvent *data = 0;
tchen.SetBranchAddress(“data”,&data);
nothing happens, that is to say that the ctor for KVINDRAReconEvent is not called
when I “SetBranchAddress”. This is fine because as soon as I do
tchen.GetEntry(0)
then the ctor is called and at the moment when it is called at least one of the files in the TChain
is open and in memory, because the ctor in question looks for an object in the file which was
saved along with the TTree. This is the behaviour I expect.
Now, I have created an analysis class with tchen.MakeSelector(), and I do
TChain tchen(“tree”);
tchen.Add(“rfio:cchpssindra:/hpss/in2p3.fr/group/indra/campagne5/root/run6020.root”);
tchen.Add(“rfio:cchpssindra:/hpss/in2p3.fr/group/indra/campagne5/root/run6021.root”);
tchen.Add(“rfio:cchpssindra:/hpss/in2p3.fr/group/indra/campagne5/root/run6022.root”);
tchen.Process(“Analysis.C+”);
In the Analysis::Init() method, I have the following lines:
// Set object pointer
data = 0;
// Set branch addresses
if (tree == 0) return;
fChain = (TChain*)tree;
fChain->SetMakeClass(1);
fChain->SetBranchAddress(“data”,&data);
and so I would expect the same behaviour as the previous example, but in fact the call
to SetBranchAddress in this case actually calls the ctor for KVINDRAReconEvent, and apparently
none of the files in the TChain is open at this time, because the ctor does not find the object
it looks for, with the inevitable consequences (segv…).
Can you tell me how to get the same behaviour as in the first case when I use TChain::Process ?
Thankyou
John