Dear rooters,
I have a problem with a method of a class where I have to build a tree starting from some other trees saved in files (the final tree is created with CopyEntries inside a loop). In particular, the problem lies on the fact that I first create the final tree, and the open the files where the others are in read mode. Here you can find the code:
void AliTOFcalib::CreateTreeFromGrid(Int_t minrun, Int_t maxrun){
// creating the chain with the trees for calibration
// collecting them from reference data
// from minrun to maxrun
Float_t p[CHENTRIESSMALL];
Int_t nentries;
fTree = new TTree("TOFCalib","Tree for TOF Calibration");
fTree->Branch("nentries",&nentries,"nentries/I");
fTree->Branch("TOFentries",p,"TOFentries[nentries]/F");
AliInfo("connected to alien");
TGrid::Connect("alien://");
Char_t filename[100];
for (Int_t irun = minrun;irun<=maxrun;irun++){
sprintf(filename,"alien:///alice/cern.ch/user/c/czampolli/TOFCalibReference_%i.root",irun);
TFile *filegrid = TFile::Open(filename,"READ");
TTree *tree = (TTree*)filegrid->Get("T");
tree->SetBranchAddress("nentries",&nentries);
tree->SetBranchAddress("TOFentries",p);
fTree->CopyEntries(tree);
delete tree;
fNruns++;
}
The fTree, as you can see, is a private member of the class. Moreover, I
don't need to write fTree on a file, for this reason I create it without
opening any file.
How should I avoid this error?
Thank you a lot in advance.
Best Regards,
Chiara
AliInfo(Form("Number of runs being analyzed %i",fNruns));
}
Received on Fri Sep 28 2007 - 10:14:41 CEST
This archive was generated by hypermail 2.2.0 : Fri Sep 28 2007 - 11:50:02 CEST