root [0] TFile *f= new TFile("TFR.root");
root [1] etaBinsH->Draw();
Info in <TCanvas::MakeDefCanvas>: created default TCanvas with name c1
root [2] EtaLt0p9_All_Data->Draw();
input_line_46:2:3: error: use of undeclared identifier 'EtaLt0p9_All_Data'
(EtaLt0p9_All_Data->Draw())
^
root [3]
Check how you set the names and titles of all your graphs.
It seems to me that they all contain an “invisible” character at the very beginning.
Try:
(int)(gFile->GetListOfKeys()->At(0)->GetName())[0]
TString Cuts[4] = {"Ratio","mT","DPhi","All"};
for (int iEta=0; iEta<3; ++iEta) {
for (int iCut=0; iCut<nCuts; ++iCut) {
s1 = EtaBins[iEta];
s2 = Cuts[iCut];
sprintf(name, “%s_%s_Data”,s1,s2);
cout<<" The name to be used "<<name<<endl;
effCut[iEta][iCut]->SetName(name);
fileOut->cd();
effCut[iEta][iCut]->Write();
…
}
}
fileOut->Write();
fileOut->Close();
[/code]
You are trying to mix “std::string”, “TString” and “char *” (in “sprintf”).
Try simply:
effCut[iEta][iCut]->SetName(EtaBins[iEta] + “_” + Cuts[iCut] + “_Data”);
or try to use:
const char *s1, *s2;