Files in a TChain

Hello everyone!

I have two files containing a TTree with a similar structure, one from MonteCarlo and one from Cosmic Data. My idea is to work with a TChain in which I add both files. So that is what I do and create my analysis class with chain->MakeClass().

BUT

When looping over all the events, filling my histograms, how do I know which event come from the Data file and which from the MonteCarlo? Is there a way to tell them apart?

Thanks a lot in advance for your help,
Cheers, Laurent

In your Loop function, you can use
TFile *file = fTree->GetCurrentFile();
and check file->GetName() or other attributes

Rene