//////////////////////////////////////////////////////
//
//this function overlays many lumi_compare
//
/////////////////////////////////////////////////////
void lumi_many( TString nameChunk ,TString dirName,TString filtOpt){
//cout << nameChunk << " " << histName << " " << dirName << endl;
TSystemDirectory d1;
d1.SetDirectory(dirName);
l1 = d1.GetListOfFiles();
Bool_t isFirst = kTRUE;
int imax = l1->LastIndex();
cout << "number of files in "<<dirName <<": " << imax << endl;
Int_t iColour = 2;
Int_t iCount=0;
//TObjArray histArray(0);
TH1D *rs_true;
TLegend *leg = new TLegend(0.91,-1.2,0.95,-0.5,"luminosity spectrum","");
//histArray->Add(leg);
TH1D* histArray=new TH1D[500];
for ( int i = 0; i<imax + 1; i++){
//cout << "i=" << i << endl;
f = l1.At(i);
Char_t* fn = f->GetName();
TString fName = TString(fn);
if ( fName.Contains( nameChunk ) ){
lumi_compare(fName+"/cornew/fort.51","noplot",filtOpt.Data());
//rs_true->SetLineColor(iColor);
histArray[i]=&rs_true;
leg.AddEntry(rs_true,fName.Data());
iCount++;
}
}
TCanvas *ov=new TCanvas("ov","overlay lumi spectra",500,600 );
//gPad->SetLogy();
//TH1D *h =(TH1D*)histArray[1];
//cout << histArray[1]<< endl;
TH1D *h;
for (Int_t i=0; i<iCount ;i++ ){
h = (TH1D*)histArray[i];
if (i==0){
cout << "a" << endl;
h->GetXaxis()->SetTitle("E / E_{0}");
cout << "a0" << endl;
h->GetYaxis()->SetTitle("probability");
ov->cd(0);
cout <<h->GetEntries() << endl;
h->Draw();
leg.Draw();
isFirst=0;
cout << "a1" << endl;
}else{
cout << "a2" << endl;
ov->cd(0);
cout << "a3" << endl;
h->SetLineColor(iColour);
h->Draw("same");
iColour++;
}
delete h;
}
}