How to "import" chain->Add() lines from another file

Hi Jibo,

I believe you’re almost certainly better of having code like:

TChain *chainPtr = new TChain ("someTree")
loadFilesToChain (chainPtr, "listOfFiles.txt")

where loadFilesToChain looks something like this (you’ll need the right headers, etc).

void loadFilesToChain (TChain *chainPtr, const std::string &filename)
{
   string line;
   ifstream source (listname.c_str(), ios::in);
   while ( getline (source, line) )
   {
      // you may want to clean line here...
     chainPtr->AddFile( line.c_str() );
   }
}

This way, you only need to keep lists of files, not try and write code that loads each set of files.

Cheers,
Charles