Peter H Fisher wrote: > Hi Rooters, > > I have using TChain to loop through tens of files. I am having a problem > when one file closes and the nxt opens and I would like to know the name > of the file for each event (I am using GetEntry(i) to read each event > sequentially). I can use > > mychain->GetFile()-Print(); > > to print the whole TTree, which also prints the file name, but Iwould liek > to find a way to print *JUST* the filename. Any ideas? > > Best Regards, > > Peter Fisher > MIT > > Peter Fisher Office 617-253-8561 > Professor of Physics Fax 617-253-4100 > 44-118 MIT email fisherp@mit.edu > Cambridge, MA, 02139 Hello Peter, A way to obtain the name of the file you are actually reading is to use one of the following methods: mychain->GetFile()->GetName() mychain->GetCurrentFile()->GetName() mychain->GetDirectory()->GetName() they return a character chain (char *) which contains the name of the file. You have first to call the mychain->GetEntry(number) method to set the pointer to the TFile properly. I hope this helps. - Daniel CUSSOL LPC Caen Boulevard du Marechal Juin 14050 CAEN CEDEX e-mail : cussol@in2p3.fr Tel : +33-(0)2-31-45-29-73 FAX : +33-(0)2-31-45-25-49
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:12 MET