Identification of the file that contains a certain entry from a TChain

Hi,

I’m reading a TChain with several trees, and I would like to know which file the entry belongs to.

An example would be:

TChain * t = new TChain("midas_data");
t->Add( "tree1.root");
t->Add( "tree2.root");
for(int ev=0; ev < t->GetEntries() ; ++ev) cout << "entry " << ev << " belongs to file " << function(t,ev) << endl;

So, this function(t,ev) would return the file from the chain where a certain event is contained.

Thanks and sorry in advance. I’m pretty sure this must be already in some tutorial (it seems pretty simple), but I don’t manage to find it.

Best regards,
J

TChain::GetFile
TTree::GetCurrentFile

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.