TTree inside TDirectoryFile

From: Marc Escalier <escalier_at_lal.in2p3.fr>
Date: Sat, 14 May 2011 11:26:40 +0200


Hello,

in the context of a program of skimming=reducing of the content of a file for those events that pass a given property (which works fine but is too long/complex to be reproduced here),

the file to be skimmed, contains :
-in the root directory (baseline) : a given Tree "photon" : this works fine -in a subdirectory of the root file : TDirectoryFile "photonMeta", a given TTree "BunchConfTree"

for the moment, i use this :

   TChain *tree_photon_source_full=new TChain("photon");    TChain *tree_BunchConfTree_source_full=new TChain("BunchConfTree");

   for (int iFile=0; iFile<fileList.size(); iFile++) {

     const char* filePath = fileList[iFile].c_str();
     tree_photon_source_full->Add(filePath);
     tree_BunchConfTree_source_full->Add(filePath); <------problem here
   }

but i don't know how to express the fact that the tree BuncConfTree is inside a subdirectory of the root file for the instructions above

-->would you have a hint to make the "link" between the tree and the subdirectory photonMeta so that it could
read the content ?

(bonus if time available) :
at the end, when filling the tree that pass the cuts, i use :

       tree_photon_source_full->GetEntry(ievt);
       tree_photon_destination->Fill();

       tree_BunchConfTree_source_full->GetEntry(ievt);
       tree_BunchConfTree_destination->Fill();

-->how to create a subdirectory : TDirectoryFile "photonMeta" a save the tree "BunchConfTree"
only in this directory (while keeping the other in the main directory) ? ( in order to respect the format of the original file)

for the moment, i use :

   file_destination=tree_photon_destination->GetCurrentFile();
   file_destination->Write();
   file_destination->Close();

thanks Received on Sat May 14 2011 - 11:26:44 CEST

This archive was generated by hypermail 2.2.0 : Sat May 14 2011 - 17:50:01 CEST