thank you Benjamin
it doesn't crash anymore when doing your suggestion with the directory inside the TChain command.
Still i have a remaining issue :
TChain *tree_BunchConfTree_source_full=new TChain("photonMeta/BunchConfTree");
in the BunchConfTree, there is several variables, for example an integer : ConfigID, which is not 0 (by checking when reading the file by hand from root)
but when doing :
int ConfigID=0;
TBranch *b_ConfigID;
tree_BunchConfTree_source_full->SetBranchStatus("*",0); tree_BunchConfTree_source_full->SetBranchAddress("ConfigID",&ConfigID,&b_ConfigID);
for (int iFile=0; iFile<fileList.size(); iFile++) {
const char* filePath = fileList[iFile].c_str(); tree_BunchConfTree_source_full->Add(filePath);}
loop on events :
tree_BunchConfTree_source_full->GetEntry(ievt); cout << "ConfigID=" << ConfigID << endl;
-->
ConfigID is always 0
On Sat, 14 May 2011, Marc Escalier wrote:
> thanks
>
> i make some tests and will reply
>
> ==============
> ==============
> On Sat, 14 May 2011, Benjamin Stieger wrote:
>
>> Hi Marc,
>> Did you try to change the construction of your second TChain?
>>
>> TChain *tree_BunchConfTree_source_full = new
>> TChain("photonMeta/BunchConfTree");
>>
>> That works for me when making a chain of trees in subdirectories, but
>> no idea if it helps in your case.
>>
>> Cheers,
>> Benjamin
>>
>>
>> On Sat, May 14, 2011 at 11:26 AM, Marc Escalier <escalier_at_lal.in2p3.fr>
>> wrote:
>>> 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 - 16:41:53 CEST
This archive was generated by hypermail 2.2.0 : Sat May 14 2011 - 23:50:01 CEST