I’m using 4.02.00 in RHEL3 linux.
I am using CloneTree to rewrite one column of a tuple, so I turn off that branch, clone the tree, then add a branch of that name to the cloned tree and then fill it. I am TChaining files for the input.
It works fine with a single file in the TChain, but for multiple files, it is as if the CloneTree did not ignore the turned-off branch - the new column is identical to the original version! Here is a snippet of the code:
int doit(TChain* chain, char* fileStem) {
float origLivetime(0.);
float correctedLivetime(0.);
float run;
TFile* outfil = new TFile(fileStem,“RECREATE”);
chain->SetBranchStatus(“EvtLiveTime”,0); // turn off the livetime branch
TTree* clone = chain->CloneTree(0); // copy the other branches
clone->Branch(“EvtLiveTime”,&correctedLivetime,“EvtLiveTime/F”);
chain->SetBranchStatus(“EvtLiveTime”,1); // turn the livetime back on
chain->SetBranchAddress(“EvtLiveTime”,&origLivetime); // do this one by hand
chain->SetBranchAddress(“EvtRun”,&run); // do this one by hand
float timeOffset = 0.;
for ( ULong64_t iEvt(0); iEvt < chain->GetEntries(); iEvt++) {
// for ( ULong64_t iEvt(0); iEvt < 20; iEvt++) {
chain->LoadTree(iEvt);
chain->GetEntry(iEvt);
correctedLivetime = origLivetime + mapLive[(long long)run];
lastSeenLivetime = origLivetime;
clone->Fill();
}
// there is only a single output file anyhow, but in case
outfil = clone->GetCurrentFile();
// Write selected data to output disk file
outfil->Write(0, TObject::kWriteDelete);
return clone->GetEntries();
}
I searched the forum, but could not find any reference to a problem with CloneTree and multiple files…
Richard