Dear All,
I generated the framework with tree->MakeClass() which is perfectly works
with for single root file containing a tree. And now I want to use a chain of trees, but don’t know how to add a chain. So for a sigle tree in .h file in Constructor I used the following code:
t3333::t3333(TTree tree)
{
// if parameter tree is not specified (or zero), connect the file
// used to generate this class and read the Tree.
if (tree == 0) {
TFile f = (TFile)gROOT->GetListOfFiles()->FindObject(“CBNT.root”);
if (!f) {
f = new TFile(“file1.root”);
f->cd(“file1.root:/CBNT”);
}
tree = (TTree)gDirectory->Get(“3333”);
}
Init(tree);
}
I suspect istead of tree here I should initialize a Chain but how to do it?
I tried to replace the code by:
t3333::t3333(TTree *tree)
{
// if parameter tree is not specified (or zero), connect the file
// used to generate this class and read the Tree.
if (tree == 0) {
chain=new TChain(“CBNT”);
chain->Add(“file1.root”); // add the files
chain->Add(“file2.root”);
}
Init(chain);
}
But it crashes in Notify() call