Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:31:37

0001 //-----------------------------------------//
0002 // Version of the script which takes as input al list of filenames and labels
0003 //root [0] .L MultiHistoOverlap.C++
0004 //root [1] MultiHistoOverlap("BiasCheck_IDEAL.root=MC design,  BiasCheck_STARTUP.root=MC startup, BiasCheck_MP1073.root=Summer2011 Tk geometry",3)
0005 //root [1] MultiHistoOverlap("BiasCheck_IDEAL.root=MC design,  BiasCheck_STARTUP.root=MC startup, BiasCheck_MP1073.root=Summer2011 Tk geometry, BiasCheck_MP0743.root=Tk Summer2011 (no mass constraint)",4)
0006 //------------------------------------------//
0007 
0008 #include <iostream>
0009 #include <vector>
0010 #include "Gtypes.h"
0011 #include "TROOT.h"
0012 #include "TStyle.h"
0013 #include "TString.h"
0014 #include "TPaveText.h"
0015 #include "TFile.h"
0016 #include "TH1.h"
0017 #include "TH2.h"
0018 #include "TLegend.h"
0019 #include "TCanvas.h"
0020 #include "TList.h"
0021 #include "TMath.h"
0022 #include "RooPlot.h"
0023 #include "TAttMarker.h"
0024 
0025 const Color_t colorlist[7]={kRed,kBlack,kBlack,kGreen,kMagenta,kCyan,kTeal};
0026 const Int_t linestylelist[7]={1,1,1,1,1,1,1};
0027 const Int_t stylelist[7]={1,1,1,1,1,1,1};
0028 const Style_t markerstylelist[7]={kFullSquare,kFullCircle,kOpenCircle,kOpenTriangleUp,kOpenCircle,kOpenTriangleUp,kOpenCircle};
0029         
0030 void MultiHistoOverlap(TString namesandlabels, Int_t nOfFiles, const TString& outDir="./"){
0031 
0032   gROOT->Reset();
0033   gROOT->ProcessLine(".L tdrstyle.C"); 
0034   gROOT->ProcessLine("setTDRStyle()");
0035  
0036  //  gSystem->Load("libRooFit");
0037  //  using namespace RooFit;
0038  // preamble
0039   TPaveText *cmsprel = new TPaveText(0.19, 0.95, 0.95, 0.99, "NDC");
0040   cmsprel->SetTextSize(0.03);
0041   cmsprel->SetTextFont(42);
0042   cmsprel->SetFillColor(0);
0043   cmsprel->SetBorderSize(0);
0044   cmsprel->SetMargin(0.01);
0045   cmsprel->SetTextAlign(12); // align left
0046   TString text = "CMS Preliminary 2011";
0047   cmsprel->AddText(0.0, 0.5,text);  
0048   TString text2 = "#sqrt{s} = 7 TeV  |#eta_{#mu}|<2.4";             
0049   cmsprel->AddText(0.8, 0.5, text2);
0050 
0051 
0052   TList* FileList  = new TList();  
0053   TList* LabelList = new TList();    
0054   TObjArray *nameandlabelpairs = namesandlabels.Tokenize(",");  
0055   for (Int_t i = 0; i < nameandlabelpairs->GetEntries(); ++i) {    
0056     TObjArray *aFileLegPair = TString(nameandlabelpairs->At(i)->GetName()).Tokenize("=");       
0057     if(aFileLegPair->GetEntries() == 2) {      
0058       FileList->Add( TFile::Open(aFileLegPair->At(0)->GetName())  ); 
0059       LabelList->Add( aFileLegPair->At(1) );    
0060     } else {      
0061       std::cout << "Please give file name and legend entry in the following form:\n"        << " filename1=legendentry1,filename2=legendentry2\n";          
0062     }  
0063   }
0064   
0065 
0066  Int_t NOfFiles =  FileList->GetSize();  
0067  if ( NOfFiles!=nOfFiles ){
0068    std::cout<<"&MSG-e: NOfFiles = "<<nOfFiles<<std::endl;  
0069    return;
0070  }  
0071  
0072 
0073  std::vector<TString> LegLabels;
0074  LegLabels.reserve(nOfFiles);    
0075  for(Int_t j=0; j < nOfFiles; j++) {       
0076    TObjString* legend = (TObjString*)LabelList->At(j);    
0077    LegLabels.push_back(legend->String());
0078    std::cout<<"LegLabels["<<j<<"]"<<LegLabels[j]<<std::endl;  
0079  }
0080 
0081  TLegend *leg=0; 
0082 
0083  TCanvas* c0 = new TCanvas("c0", "c0",50, 20, 800,600);
0084  TCanvas* c1 = new TCanvas("c1", "c1",50, 20, 800,600);
0085  TCanvas* c2 = new TCanvas("c2", "c2",50, 20, 800,600);
0086  TCanvas* c3 = new TCanvas("c3", "c3",50, 20, 800,600);
0087  TCanvas* c4 = new TCanvas("c4", "c4",50, 20, 800,600);
0088  TCanvas* c5 = new TCanvas("c5", "c5",50, 20, 1200,800);
0089  TCanvas* c6 = new TCanvas("c6", "c6",50, 20, 1200,800);
0090 
0091  TCanvas* c0s = new TCanvas("c0s", "c0s",50, 20, 800,600);
0092  TCanvas* c1s = new TCanvas("c1s", "c1s",50, 20, 800,600);
0093  TCanvas* c2s = new TCanvas("c2s", "c2s",50, 20, 800,600);
0094  TCanvas* c3s = new TCanvas("c3s", "c3s",50, 20, 800,600);
0095 
0096  TCanvas* cFit = new TCanvas("cFit", "cFit",50, 20, 1600, 800);
0097 
0098 
0099  //----------------- CANVAS C0 --------------//
0100  c0->SetFillColor(0);  
0101  c0->cd();
0102 
0103  leg = new TLegend(0.50,0.25,0.90,0.40);  
0104  leg->SetBorderSize(1);
0105  leg->SetFillColor(0);
0106  leg->SetTextFont(42);
0107  
0108 // Mass VS muon phi plus -------------------------------
0109  TH1D *histoMassVsPhiPlus[nOfFiles];
0110  for(Int_t j=0; j < nOfFiles; j++) {     
0111    
0112    TFile *fin = (TFile*)FileList->At(j);    
0113    if (( histoMassVsPhiPlus[j] = (TH1D*)fin->Get("MassVsPhiPlus/allHistos/meanHisto"))){
0114      histoMassVsPhiPlus[j]->SetLineStyle(linestylelist[j]);
0115      histoMassVsPhiPlus[j]->SetMarkerColor(colorlist[j]);
0116      histoMassVsPhiPlus[j]->SetLineColor(colorlist[j]);
0117      histoMassVsPhiPlus[j]->SetMarkerStyle(markerstylelist[j]); 
0118      //     histoMassVsPhiPlus[j]->SetMarkerSize(0.75);
0119      if ( j == 0 ) {
0120        histoMassVsPhiPlus[j]->GetXaxis()->SetTitle("positive muon #phi (rad)");
0121        histoMassVsPhiPlus[j]->GetYaxis()->SetTitle("M_{#mu#mu} (GeV)");
0122        //       histoMassVsPhiPlus[j]->GetYaxis()->SetRangeUser(88.5,93.5);
0123        histoMassVsPhiPlus[j]->GetYaxis()->SetRangeUser(90.0,91.5);
0124        histoMassVsPhiPlus[j]->GetXaxis()->SetRangeUser(-3.14,3.14);
0125        histoMassVsPhiPlus[j]->Draw();
0126      } else {
0127        histoMassVsPhiPlus[j]->Draw("SAME");
0128      }
0129      leg->AddEntry(histoMassVsPhiPlus[j],LegLabels[j],"PL");  
0130    }
0131  }
0132  //cmsprel->Draw("same");
0133  leg->Draw("same");
0134  c0->SaveAs(outDir+"MassVsPhiPlus.png"); 
0135 
0136 
0137  //----------------- CANVAS C1 --------------//
0138  c1->SetFillColor(0);  
0139  c1->cd();
0140 
0141  leg = new TLegend(0.50,0.25,0.90,0.40);  
0142  leg->SetBorderSize(1);
0143  leg->SetFillColor(0);
0144  leg->SetTextFont(42);
0145  
0146 // Mass VS muon eta plus -------------------------------
0147  TH1D *histoMassVsEtaPlus[nOfFiles];
0148  for(Int_t j=0; j < nOfFiles; j++) {     
0149    
0150    TFile *fin = (TFile*)FileList->At(j);    
0151    if (( histoMassVsEtaPlus[j] = (TH1D*)fin->Get("MassVsEtaPlus/allHistos/meanHisto"))){
0152      histoMassVsEtaPlus[j]->SetLineStyle(linestylelist[j]);
0153      histoMassVsEtaPlus[j]->SetMarkerColor(colorlist[j]);
0154      histoMassVsEtaPlus[j]->SetLineColor(colorlist[j]);
0155      histoMassVsEtaPlus[j]->SetMarkerStyle(markerstylelist[j]); 
0156      //     histoMassVsEtaPlus[j]->SetMarkerSize(0.75);
0157      if ( j == 0 ) {
0158        histoMassVsEtaPlus[j]->GetXaxis()->SetTitle("positive muon #eta");
0159        histoMassVsEtaPlus[j]->GetYaxis()->SetTitle("M_{#mu#mu} (GeV)");
0160        //       histoMassVsEtaPlus[j]->GetYaxis()->SetRangeUser(88.5,93.5);
0161        histoMassVsEtaPlus[j]->GetYaxis()->SetRangeUser(90.0,91.5);
0162        histoMassVsEtaPlus[j]->GetXaxis()->SetRangeUser(-2.41,2.41);
0163        histoMassVsEtaPlus[j]->Draw();
0164      } else {
0165        histoMassVsEtaPlus[j]->Draw("SAME");
0166      }
0167      leg->AddEntry(histoMassVsEtaPlus[j],LegLabels[j],"PL");  
0168    }
0169  }
0170  //cmsprel->Draw("same");
0171  leg->Draw("same");
0172  c1->SaveAs(outDir+"MassVsEtaPlus.png"); 
0173 
0174 
0175  //----------------- CANVAS C2 --------------//
0176  c2->SetFillColor(0);  
0177  c2->cd();
0178 
0179  leg = new TLegend(0.50,0.25,0.90,0.40);  
0180  leg->SetBorderSize(1);
0181  leg->SetFillColor(0);
0182  leg->SetTextFont(42);
0183  
0184 // Mass VS muon eta plus - eta minus  -------------------------------
0185  TH1D *histoMassVsEtaPlusMinusDiff[nOfFiles];
0186  for(Int_t j=0; j < nOfFiles; j++) {     
0187    
0188    TFile *fin = (TFile*)FileList->At(j);    
0189    if (( histoMassVsEtaPlusMinusDiff[j] = (TH1D*)fin->Get("MassVsEtaPlusMinusDiff/allHistos/meanHisto"))){
0190      histoMassVsEtaPlusMinusDiff[j]->SetLineStyle(linestylelist[j]);
0191      histoMassVsEtaPlusMinusDiff[j]->SetMarkerColor(colorlist[j]);
0192      histoMassVsEtaPlusMinusDiff[j]->SetLineColor(colorlist[j]);
0193      histoMassVsEtaPlusMinusDiff[j]->SetMarkerStyle(markerstylelist[j]); 
0194      //     histoMassVsEtaPlusMinusDiff[j]->SetMarkerSize(0.75);
0195      if ( j == 0 ) {
0196        histoMassVsEtaPlusMinusDiff[j]->GetXaxis()->SetTitle("#eta pos. muon  #eta neg. muon");
0197        histoMassVsEtaPlusMinusDiff[j]->GetYaxis()->SetTitle("M_{#mu#mu} (GeV)");
0198        //       histoMassVsEtaPlusMinusDiff[j]->GetYaxis()->SetRangeUser(88.0,96.0);
0199        histoMassVsEtaPlusMinusDiff[j]->GetYaxis()->SetRangeUser(90.0,91.5);
0200        histoMassVsEtaPlusMinusDiff[j]->GetXaxis()->SetRangeUser(-3,3);
0201        histoMassVsEtaPlusMinusDiff[j]->Draw();
0202      } else {
0203        histoMassVsEtaPlusMinusDiff[j]->Draw("SAME");
0204      }
0205      leg->AddEntry(histoMassVsEtaPlusMinusDiff[j],LegLabels[j],"PL");  
0206    }
0207  }
0208  //cmsprel->Draw("same");
0209  leg->Draw("same");
0210  c2->SaveAs(outDir+"MassVsEtaPlusMinusDiff.png"); 
0211 
0212  //----------------- CANVAS C3 --------------//
0213  c3->SetFillColor(0);  
0214  c3->cd();
0215 
0216  leg = new TLegend(0.50,0.25,0.90,0.40);  
0217  leg->SetBorderSize(1);
0218  leg->SetFillColor(0);
0219  leg->SetTextFont(42);
0220  
0221 // Mass VS muon phi minus -------------------------------
0222  TH1D *histoMassVsPhiMinus[nOfFiles];
0223  for(Int_t j=0; j < nOfFiles; j++) {     
0224    
0225    TFile *fin = (TFile*)FileList->At(j);    
0226    if (( histoMassVsPhiMinus[j] = (TH1D*)fin->Get("MassVsPhiMinus/allHistos/meanHisto"))){
0227      histoMassVsPhiMinus[j]->SetLineStyle(linestylelist[j]);
0228      histoMassVsPhiMinus[j]->SetMarkerColor(colorlist[j]);
0229      histoMassVsPhiMinus[j]->SetLineColor(colorlist[j]);
0230      histoMassVsPhiMinus[j]->SetMarkerStyle(markerstylelist[j]); 
0231      //     histoMassVsPhiMinus[j]->SetMarkerSize(0.75);
0232      if ( j == 0 ) {
0233        histoMassVsPhiMinus[j]->GetXaxis()->SetTitle("negative muon #phi (rad)");
0234        histoMassVsPhiMinus[j]->GetYaxis()->SetTitle("M_{#mu#mu} (GeV)");
0235        //       histoMassVsPhiMinus[j]->GetYaxis()->SetRangeUser(88.5,93.5);
0236        histoMassVsPhiMinus[j]->GetYaxis()->SetRangeUser(90.0,91.5);
0237        histoMassVsPhiMinus[j]->GetXaxis()->SetRangeUser(-3.14,3.14);
0238        histoMassVsPhiMinus[j]->Draw();
0239      } else {
0240        histoMassVsPhiMinus[j]->Draw("SAME");
0241      }
0242      leg->AddEntry(histoMassVsPhiMinus[j],LegLabels[j],"PL");  
0243    }
0244  }
0245  //cmsprel->Draw("same");
0246  leg->Draw("same");
0247  c3->SaveAs(outDir+"MassVsPhiMinus.png"); 
0248 
0249 
0250  //----------------- CANVAS C4 --------------//
0251  c4->SetFillColor(0);  
0252  c4->cd();
0253 
0254  leg = new TLegend(0.50,0.25,0.90,0.40);  
0255  leg->SetBorderSize(1);
0256  leg->SetFillColor(0);
0257  leg->SetTextFont(42);
0258  
0259 // Mass VS muon eta minus -------------------------------
0260  TH1D *histoMassVsEtaMinus[nOfFiles];
0261  for(Int_t j=0; j < nOfFiles; j++) {     
0262    
0263    TFile *fin = (TFile*)FileList->At(j);    
0264    if (( histoMassVsEtaMinus[j] = (TH1D*)fin->Get("MassVsEtaMinus/allHistos/meanHisto"))){
0265      histoMassVsEtaMinus[j]->SetLineStyle(linestylelist[j]);
0266      histoMassVsEtaMinus[j]->SetMarkerColor(colorlist[j]);
0267      histoMassVsEtaMinus[j]->SetLineColor(colorlist[j]);
0268      histoMassVsEtaMinus[j]->SetMarkerStyle(markerstylelist[j]); 
0269      //     histoMassVsEtaMinus[j]->SetMarkerSize(0.75);
0270      if ( j == 0 ) {
0271        histoMassVsEtaMinus[j]->GetXaxis()->SetTitle("negative muon #eta");
0272        histoMassVsEtaMinus[j]->GetYaxis()->SetTitle("M_{#mu#mu} (GeV)");
0273        //       histoMassVsEtaMinus[j]->GetYaxis()->SetRangeUser(88.5,93.5);
0274        histoMassVsEtaMinus[j]->GetYaxis()->SetRangeUser(90.0,91.5);
0275        histoMassVsEtaMinus[j]->GetXaxis()->SetRangeUser(-2.41,2.41);
0276        histoMassVsEtaMinus[j]->Draw();
0277      } else {
0278        histoMassVsEtaMinus[j]->Draw("SAME");
0279      }
0280      leg->AddEntry(histoMassVsEtaMinus[j],LegLabels[j],"PL");  
0281    }
0282  }
0283  //cmsprel->Draw("same");
0284  leg->Draw("same");
0285  c4->SaveAs(outDir+"MassVsEtaMinus.png"); 
0286 
0287  //----------------- CANVAS C5 --------------//
0288  c5->SetFillColor(0);  
0289  c5->cd();
0290 
0291  leg = new TLegend(0.50,0.25,0.90,0.40);  
0292  leg->SetBorderSize(1);
0293  leg->SetFillColor(0);
0294  leg->SetTextFont(42);
0295  
0296  // Mass VS muon phi plus -------------------------------
0297  TH2D *histoMassVsEtaPhiPlus[nOfFiles];
0298 
0299  TStyle *newStyle;
0300  newStyle->SetPalette(1);
0301  // newStyle->SetOptTitle(1);
0302 
0303  Double_t zMin(82.);
0304  Double_t zMax(96.);
0305  for(Int_t j=0; j < nOfFiles; j++) {     
0306    
0307    TFile *fin = (TFile*)FileList->At(j);    
0308    if (( histoMassVsEtaPhiPlus[j] = (TH2D*)fin->Get("MassVsEtaPhiPlus/allHistos/meanHisto"))){
0309      if ( j == 0 ) {
0310        histoMassVsEtaPhiPlus[j]->SetTitle(LegLabels[j]);
0311        histoMassVsEtaPhiPlus[j]->GetXaxis()->SetTitle("positive muon #phi (rad)");
0312        histoMassVsEtaPhiPlus[j]->GetYaxis()->SetTitle("positive muon #eta");
0313        zMin = histoMassVsEtaPhiPlus[j]->GetMinimum();
0314        zMax = histoMassVsEtaPhiPlus[j]->GetMaximum();
0315        histoMassVsEtaPhiPlus[j]->Draw("COLZ");
0316        c5->SaveAs(outDir+"MassVsEtaPhiPlus_file0.png"); 
0317      } else {
0318        histoMassVsEtaPhiPlus[j]->SetTitle(LegLabels[j]);
0319        histoMassVsEtaPhiPlus[j]->SetMinimum(zMin);
0320        histoMassVsEtaPhiPlus[j]->SetMaximum(zMax);
0321        histoMassVsEtaPhiPlus[j]->Draw("COLZ");
0322        c5->SaveAs(outDir+"MassVsEtaPhiPlus_file"+(TString)Form("%d",(Int_t)j)+".png"); 
0323      }
0324 
0325    }
0326  }
0327  //cmsprel->Draw("same");
0328 
0329 //  //----------------- CANVAS C6 --------------//
0330 //  c6->SetFillColor(0);  
0331 //  c6->cd();
0332 
0333 //  leg = new TLegend(0.50,0.25,0.90,0.40);  
0334 //  leg->SetBorderSize(1);
0335 //  leg->SetFillColor(0);
0336 //  leg->SetTextFont(42);
0337  
0338 //  // Mass VS muon phi minus -------------------------------
0339 //  TH2D *histoMassVsEtaPhiMinus[nOfFiles];
0340 
0341 //  for(Int_t j=0; j < nOfFiles; j++) {     
0342    
0343 //    TFile *fin = (TFile*)FileList->At(j);    
0344 //    if (( histoMassVsEtaPhiMinus[j] = (TH2D*)fin->Get("MassVsEtaPhiMinus/allHistos/meanHisto"))){
0345 //      if ( j == 0 ) {
0346 //        histoMassVsEtaPhiMinus[j]->GetXaxis()->SetTitle("negative muon #phi (rad)");
0347 //        histoMassVsEtaPhiMinus[j]->GetYaxis()->SetTitle("negative muon #eta");
0348 //        zMin = histoMassVsEtaPhiMinus[j]->GetMinimum();
0349 //        zMax = histoMassVsEtaPhiMinus[j]->GetMaximum();
0350 //        histoMassVsEtaPhiMinus[j]->Draw();
0351 //      } else {
0352 //        histoMassVsEtaPhiMinus[j]->SetMinimum(zMin);
0353 //        histoMassVsEtaPhiMinus[j]->SetMaximum(zMax);
0354 //        histoMassVsEtaPhiMinus[j]->Draw("SAME");
0355 //      }
0356 //      leg->AddEntry(histoMassVsEtaPhiMinus[j],LegLabels[j],"PL");  
0357 //    }
0358 //  }
0359 //  //cmsprel->Draw("same");
0360 //  leg->Draw("same");
0361 //  c6->SaveAs(outDir+"MassVsEtaPhiMinus.png"); 
0362 
0363 // newStyle->SetOptTitle(0);
0364 
0365  const Color_t colorlist_resol[7]={kBlack,kGreen,kBlue,kMagenta,kCyan,kTeal,kRed};
0366  const Int_t linestylelist_resol[7]={1,1,1,1,1,1,1};
0367  const Int_t stylelist_resol[7]={1,1,1,1,1,1,1};
0368  const Style_t markerstylelist_resol[7]={kOpenCircle,kOpenTriangleUp,kOpenTriangleUp,kOpenCircle,kOpenTriangleUp,kOpenCircle,kOpenTriangleUp};
0369 
0370 
0371 //  //----------------- CANVAS C0S --------------//
0372 //  c0s->SetFillColor(0);  
0373 //  c0s->cd();
0374 
0375 //  leg = new TLegend(0.50,0.25,0.90,0.40);  
0376 //  leg->SetBorderSize(1);
0377 //  leg->SetFillColor(0);
0378 //  leg->SetTextFont(42);
0379 
0380 // // Sigma VS muon phi plus -------------------------------
0381 //  TH1D *histoSigmaVsPhiPlus[nOfFiles];
0382 //  for(Int_t j=0; j < nOfFiles; j++) {     
0383    
0384 //    TFile *fin = (TFile*)FileList->At(j);    
0385 //    if (( histoSigmaVsPhiPlus[j] = (TH1D*)fin->Get("MassVsPhiPlus/allHistos/sigmaHisto"))){
0386 //      histoSigmaVsPhiPlus[j]->SetLineStyle(linestylelist_resol[j]);
0387 //      histoSigmaVsPhiPlus[j]->SetMarkerColor(colorlist_resol[j]);
0388 //      histoSigmaVsPhiPlus[j]->SetLineColor(colorlist_resol[j]);
0389 //      histoSigmaVsPhiPlus[j]->SetMarkerStyle(markerstylelist_resol[j]); 
0390 //      //     histoSigmaVsPhiPlus[j]->SetMarkerSize(0.75);
0391 //      if ( j == 0 ) {
0392 //        histoSigmaVsPhiPlus[j]->GetXaxis()->SetTitle("positive muon #phi (rad)");
0393 //        histoSigmaVsPhiPlus[j]->GetYaxis()->SetTitle("#sigma(M_{#mu#mu}) (GeV)");
0394 //        //       histoSigmaVsPhiPlus[j]->GetYaxis()->SetRangeUser(88.5,93.5);
0395 //        histoSigmaVsPhiPlus[j]->GetYaxis()->SetRangeUser(0.,3.);
0396 //        histoSigmaVsPhiPlus[j]->GetXaxis()->SetRangeUser(-3.14,3.14);
0397 //        histoSigmaVsPhiPlus[j]->Draw();
0398 //      } else {
0399 //        histoSigmaVsPhiPlus[j]->Draw("SAME");
0400 //      }
0401 //      leg->AddEntry(histoSigmaVsPhiPlus[j],LegLabels[j],"PL");  
0402 //    }
0403 //  }
0404 //  //cmsprel->Draw("same");
0405 //  leg->Draw("same");
0406 //  c0s->SaveAs(outDir+"SigmaVsPhiPlus.png"); 
0407 
0408 
0409  //----------------- CANVAS C1S --------------//
0410  c1s->SetFillColor(0);  
0411  c1s->cd();
0412 
0413  leg = new TLegend(0.50,0.25,0.90,0.40);  
0414  leg->SetBorderSize(1);
0415  leg->SetFillColor(0);
0416  leg->SetTextFont(42);
0417 
0418  
0419 // Sigma VS muon eta plus -------------------------------
0420  TH1D *histoSigmaVsEtaPlus[nOfFiles];
0421  for(Int_t j=0; j < nOfFiles; j++) {     
0422    
0423    TFile *fin = (TFile*)FileList->At(j);    
0424    if (( histoSigmaVsEtaPlus[j] = (TH1D*)fin->Get("MassVsEtaPlus/allHistos/sigmaHisto"))){
0425      histoSigmaVsEtaPlus[j]->SetLineStyle(linestylelist_resol[j]);
0426      histoSigmaVsEtaPlus[j]->SetMarkerColor(colorlist_resol[j]);
0427      histoSigmaVsEtaPlus[j]->SetLineColor(colorlist_resol[j]);
0428      histoSigmaVsEtaPlus[j]->SetMarkerStyle(markerstylelist_resol[j]); 
0429      //     histoSigmaVsEtaPlus[j]->SetMarkerSize(0.75);
0430      if ( j == 0 ) {
0431        histoSigmaVsEtaPlus[j]->GetXaxis()->SetTitle("positive muon #eta");
0432        histoSigmaVsEtaPlus[j]->GetYaxis()->SetTitle("#sigma(M_{#mu#mu}) (GeV)");
0433        //       histoSigmaVsEtaPlus[j]->GetYaxis()->SetRangeUser(88.5,93.5);
0434        histoSigmaVsEtaPlus[j]->GetYaxis()->SetRangeUser(0.,3.);
0435        histoSigmaVsEtaPlus[j]->GetXaxis()->SetRangeUser(-2.41,2.41);
0436        histoSigmaVsEtaPlus[j]->Draw();
0437      } else {
0438        histoSigmaVsEtaPlus[j]->Draw("SAME");
0439      }
0440      leg->AddEntry(histoSigmaVsEtaPlus[j],LegLabels[j],"PL");  
0441    }
0442  }
0443  //cmsprel->Draw("same");
0444  leg->Draw("same");
0445  c1s->SaveAs(outDir+"SigmaVsEtaPlus.png"); 
0446 
0447 
0448 //  //----------------- CANVAS C2S --------------//
0449 //  c2s->SetFillColor(0);  
0450 //  c2s->cd();
0451 
0452 //  leg = new TLegend(0.50,0.25,0.90,0.40);  
0453 //  leg->SetBorderSize(1);
0454 //  leg->SetFillColor(0);
0455 //  leg->SetTextFont(42);
0456 
0457 // // Sigma VS muon eta plus - eta minus  -------------------------------
0458 //  TH1D *histoSigmaVsEtaPlusMinusDiff[nOfFiles];
0459 //  for(Int_t j=0; j < nOfFiles; j++) {     
0460    
0461 //    TFile *fin = (TFile*)FileList->At(j);    
0462 //    if (( histoSigmaVsEtaPlusMinusDiff[j] = (TH1D*)fin->Get("MassVsEtaPlusMinusDiff/allHistos/sigmaHisto"))){
0463 //      histoSigmaVsEtaPlusMinusDiff[j]->SetLineStyle(linestylelist_resol[j]);
0464 //      histoSigmaVsEtaPlusMinusDiff[j]->SetMarkerColor(colorlist_resol[j]);
0465 //      histoSigmaVsEtaPlusMinusDiff[j]->SetLineColor(colorlist_resol[j]);
0466 //      histoSigmaVsEtaPlusMinusDiff[j]->SetMarkerStyle(markerstylelist_resol[j]); 
0467 //      //     histoSigmaVsEtaPlusMinusDiff[j]->SetMarkerSize(0.75);
0468 //      if ( j == 0 ) {
0469 //        histoSigmaVsEtaPlusMinusDiff[j]->GetXaxis()->SetTitle("#eta pos. muon - #eta neg. muon");
0470 //        histoSigmaVsEtaPlusMinusDiff[j]->GetYaxis()->SetTitle("#sigma(M_{#mu#mu}) (GeV)");
0471 //        //       histoSigmaVsEtaPlusMinusDiff[j]->GetYaxis()->SetRangeUser(88.0,96.0);
0472 //        histoSigmaVsEtaPlusMinusDiff[j]->GetYaxis()->SetRangeUser(0.,3.);
0473 //        //histoSigmaVsEtaPlusMinusDiff[j]->GetYaxis()->SetRangeUser(90.60,90.75);
0474 //        histoSigmaVsEtaPlusMinusDiff[j]->GetXaxis()->SetRangeUser(-3.2,3.2);
0475 //        histoSigmaVsEtaPlusMinusDiff[j]->Draw();
0476 //      } else {
0477 //        histoSigmaVsEtaPlusMinusDiff[j]->Draw("SAME");
0478 //      }
0479 //      leg->AddEntry(histoSigmaVsEtaPlusMinusDiff[j],LegLabels[j],"PL");  
0480 //    }
0481 //  }
0482 //  //cmsprel->Draw("same");
0483 //  leg->Draw("same");
0484 //  c2s->SaveAs(outDir+"SigmaVsEtaPlusMinusDiff.png"); 
0485 
0486 
0487 //  //----------------- CANVAS C3S --------------//
0488 //  c3s->SetFillColor(0);  
0489 //  c3s->cd();
0490 
0491 //  leg = new TLegend(0.35,0.15,0.55,0.35);  
0492 //  leg->SetBorderSize(1);
0493 //  leg->SetFillColor(0);
0494 //  leg->SetTextFont(42);
0495  
0496 // // Sigma VS muon pT  -------------------------------
0497 //  TH1D *histoSigmaVsPt[nOfFiles];
0498 //  for(Int_t j=0; j < nOfFiles; j++) {     
0499    
0500 //    TFile *fin = (TFile*)FileList->At(j);    
0501 //    if (( histoSigmaVsPt[j] = (TH1D*)fin->Get("MassVsPt/allHistos/sigmaHisto"))){
0502 //      histoSigmaVsPt[j]->SetLineStyle(linestylelist_resol[j]);
0503 //      histoSigmaVsPt[j]->SetMarkerColor(colorlist_resol[j]);
0504 //      histoSigmaVsPt[j]->SetLineColor(colorlist_resol[j]);
0505 //      histoSigmaVsPt[j]->SetMarkerStyle(markerstylelist_resol[j]); 
0506 //      //     histoSigmaVsPt[j]->SetMarkerSize(0.75);
0507 //      if ( j == 0 ) {
0508 //        histoSigmaVsPt[j]->GetXaxis()->SetTitle("muon p_T (GeV)");
0509 //        histoSigmaVsPt[j]->GetYaxis()->SetTitle("#sigma(M_{#mu#mu}) (GeV)");
0510 //        //       histoSigmaVsPt[j]->GetYaxis()->SetRangeUser(88.0,96.0);
0511 //        histoSigmaVsPt[j]->GetYaxis()->SetRangeUser(0.,3.);
0512 //        //histoSigmaVsPt[j]->GetYaxis()->SetRangeUser(90.60,90.75);
0513 //        histoSigmaVsPt[j]->GetXaxis()->SetRangeUser(15.,105.);
0514 //        histoSigmaVsPt[j]->Draw();
0515 //      } else {
0516 //        histoSigmaVsPt[j]->Draw("SAME");
0517 //      }
0518 //      leg->AddEntry(histoSigmaVsPt[j],LegLabels[j],"PL");  
0519 //    }
0520 //  }
0521 //  //cmsprel->Draw("same");
0522 //  leg->Draw("same");
0523 //  c3s->SaveAs(outDir+"SigmaVsPt.png"); 
0524 
0525  //----------------- CANVAS CFIT --------------//
0526  cFit->SetFillColor(0);  
0527  cFit->cd();
0528  Float_t nN = TMath::Sqrt(nOfFiles);
0529  Int_t nX = (Int_t)nN;
0530  if ( nN-nX > 0.5 ) nX++;
0531  Int_t nY = (Int_t)(nOfFiles/nX);
0532  std::cout << nX << " ," << nY << std::endl;
0533  cFit->Divide(nOfFiles,1);
0534  
0535 // Mass VS muon phi plus -------------------------------
0536  TFile *ZFitFile = new TFile("ZFitFile.root","RECREATE");
0537  RooPlot *histoLineShape[nOfFiles];
0538  for(Int_t j=0; j < nOfFiles; j++) {     
0539    
0540    TFile *fin = (TFile*)FileList->At(j);    
0541    if (( histoLineShape[j] = (RooPlot*)fin->Get("hRecBestResAllEvents_Mass_frame"))){
0542      std::cout<<"Writing fit histogrem file n. "<<j<<std::endl;
0543      histoLineShape[j]->Write();
0544      cFit->cd(j+1);
0545      histoLineShape[j]->SetTitle(LegLabels[j]);
0546      histoLineShape[j]->Draw();
0547      histoLineShape[j]->GetXaxis()->SetTitle("M_{#mu#mu} (GeV)");
0548 //      TPaveText *cmsprel2 = new TPaveText(0.19, 0.95, 0.95, 0.99, "NDC");
0549 //      cmsprel2->SetTextSize(0.03);
0550 //      cmsprel2->SetTextFont(42);
0551 //      cmsprel2->SetFillColor(0);
0552 //      cmsprel2->SetBorderSize(0);
0553 //      cmsprel2->SetMargin(0.01);
0554 //      cmsprel2->SetTextAlign(12); // align left
0555 //      cmsprel2->AddText(0.666666, 0.5, LegLabels[j]);
0556 
0557    }
0558  }
0559  ZFitFile->Close();
0560  // cmsprel2->Draw("same");
0561  cFit->SaveAs("ZFitFile.root");
0562 
0563 
0564  
0565  return; 
0566 };