Reading several root files in a macro

Hi,

I am trying to read many root files in the macro.
I have made vectors for the input root files as well as output.
But when i am trying to run the loop over the input files i am getting the following error:

Function Open(inputfile[i]) is not defined in current scope…

Here is the code snippet :

#include
#include
#include
#include
#include
#include
#include
#include
#include <TH1F.h>
#include <TFile.h>
#include <TCanvas.h>

using namespace std;

void macro()
{
vectorstd::stringinputfile;
inputfile.push_back(“QCDpt20to30WoMatched_EtaCut.root”);
inputfile.push_back(“QCDpt20to30WoMatched_PtCut.root”);
:
:
vectorstd::stringoutputfile;
outputfile.push_back(“QCDpt20to30WoMatched_EtaCutScaled.root”);
outputfile.push_back(“QCDpt20to30WoMatched_PtCutScaled.root”);
:
:
:
for (int i=0;i<inputfile.size();++i){
TFile *h1 = TFile::Open(inputfile[i]);
:
:
:

Thanks & Regards,
Nitish.

do

TFile *h1 = TFile::Open(inputfile[i].c_str());
Rene

Hi Rene,

Thanks a lot!!
It works. :smiley:

Nitish.