//Opens files
//rfc: working version 1.1 jul 25 2007
#include <string>
#include <sstream>
#include <iostream>
#include <vector>
#include <TFile.h>
#include <TTree.h>
#include <TChain.h>
#include <TObject.h>
using namespace std;

/////////////////////////////////////////////////////////////////////////////////
//                                                                             //
// Rgetfiles                                                                   //
// Use to open files from a list of paths in a .txt file                       //
// Can also open single file like this as well if file with one path supplied. //
// Pointer to TTree of TChained files is given to user                        //
////////////////////////////////////////////////////////////////////////////////


class Rgetfiles {
private:
TChain * calibtree;

public:
Rgetfiles(){};
~Rgetfiles();
TTree * filelistopen(char * files, char * treename = "calibTree");
};

//**********File open function*********

TTree * Rgetfiles::filelistopen(char * files, char * treename){
//Open files function, user supplies file list in .txt file and Treename of TTree's to open.
//Returns a pointer to the TTree with chained data
FILE *fp=fopen(files,"r");

char filename[200];

cout << "Adding files" << endl;
calibtree = new TChain(treename); //name of the NTuple
while(fscanf(fp,"%s/n",filename)!=EOF){
 cout<<filename<<endl;
 calibtree->Add(filename);
}
return calibtree;
}

//**********Destructor*********
Rgetfiles::~Rgetfiles(){delete calibtree;}


This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.