File name in TChain

Dear rooters,
I was wandering if there is a way to access the linux file name of a file that contains a tree aded to a chain when using TSelector.

TChain ch("Run");

Then if i process the chain ch, using TSelector, can I access the individual filename being process event by event?

Thank you and best regards,

How about: const char *current_file_name = ch.GetFile()->GetName();

Dear Pepe,
With your suggestion I managed to get the solution as follows:

const char *current_file_name = Myselector::fChain->GetCurrentFile()->GetName();

Thank you!

Are you saying that the doesn’t work and you have to use (note that this method may easily return 0, I believe)?
Maybe you could try: const char *current_file_name = ((TChain*)(Myselector::fChain))->GetFile()->GetName(); where the “(TChain*)fChain” casting may be needed because the automatically generated skeleton source code often defines a “TTree *fChain;” instead of a “TChain *fChain;”.

Yes, that’s right. The TSelector skeleton built a TTree for fChain.
Now casting TChain, the method “GetFile()” works fine.
Thank you!