//==============================
void upsilon_2StepFit(Int_t iRapBin = 0,
		      Int_t iPTBin = 0, 		     
		      Double_t nSigma = 2.,
		      Char_t *fileNameIn = "RootFiles/selEvents_data_Ups_2Aug2011.root"){
  
  GetHisto(fileNameIn, iRapBin, iPTBin);
  if(hMass->GetEntries() < 1.){
    printf("\n\n\nskip processing this bin, because the number of entries is smaller than 1\n\n\n");
    return;
  }
  FitSignalBG(nSigma, iRapBin, iPTBin);
  DrawFit(nSigma, iRapBin, iPTBin);
}
void ChargedHiggsHW::Init()
{

    for ( string l : AllLabel()  ) {
        cout <<"[ChargedHiggsHW]::[Init]::[INFO] Boking Histo CutFlow_" <<l<<endl;
        Book( ("ChargedHiggsHW/CutFlow/CutFlow_"+ l ) .c_str(), ("CutFlow "+ l).c_str(),100,-.5,100-.5);
        GetHisto(("ChargedHiggsHW/CutFlow/CutFlow_"+l).c_str(),"")->GetXaxis()->SetBinLabel(1,"Total");


        //Histograms should be booked here for details see src/AnalysisChargedHiggsTauNu.cpp


    }

}
void ChargedHiggsTauNu::initGen(){
    for ( string& l : AllLabel()  ) {
        Book( "ChargedHiggsTauNu/Gen/CutFlow_"+l,"CutFlow",100,0,100);

        GetHisto("ChargedHiggsTauNu/Gen/CutFlow_"+l,"")->GetXaxis()->SetBinLabel(1, "All");
        GetHisto("ChargedHiggsTauNu/Gen/CutFlow_"+l,"")->GetXaxis()->SetBinLabel(2, "H#pm");
        GetHisto("ChargedHiggsTauNu/Gen/CutFlow_"+l,"")->GetXaxis()->SetBinLabel(3, "H#pm#rightarrow#tau");
        GetHisto("ChargedHiggsTauNu/Gen/CutFlow_"+l,"")->GetXaxis()->SetBinLabel(4, "H#pm#rightarrow#tau^{h} (B)");
        GetHisto("ChargedHiggsTauNu/Gen/CutFlow_"+l,"")->GetXaxis()->SetBinLabel(5, "(B) + Lep Veto Gen Level");
        GetHisto("ChargedHiggsTauNu/Gen/CutFlow_"+l,"")->GetXaxis()->SetBinLabel(6, "(B) + LooseIso Veto");
        GetHisto("ChargedHiggsTauNu/Gen/CutFlow_"+l,"")->GetXaxis()->SetBinLabel(7, "(B) + MiniIso Veto");
    }

}
Beispiel #4
0
void DYAnalysis::Init(){

    for ( string l : AllLabel()  ) {
	    Log(__FUNCTION__,"INFO","Booking Histo Mass");
	    Book ("DYAnalysis/Vars/Mee_"+ l ,"Mee;m^{ee} [GeV];Events"    , 100,50,200);
	    Book ("DYAnalysis/Vars/Mmm_"+ l ,"Mmm;m^{#mu#mu} [GeV];Events", 100,50,200);
	    Book ("DYAnalysis/Vars/Mem_"+ l ,"Mem;m^{e#mu} [GeV];Events"  , 100,50,200);
	    // 
	    Book ("DYAnalysis/Vars/MuonIso_"+ l ,"Muon Isolation;Iso^{#mu} [GeV];Events", 1000,0,0.1);

	    Book ("DYAnalysis/Vars/Ptee_"+ l ,"Ptee;p_{T}^{ee} [GeV];Events"    , 1000,0,1000);
	    Book ("DYAnalysis/Vars/Ptmm_"+ l ,"Ptmm;p_{T}^{#mu#mu} [GeV];Events", 1000,0,1000);
	    Book ("DYAnalysis/Vars/Ptem_"+ l ,"Ptem;p_{T}^{e#mu} [GeV];Events"  , 1000,0,1000);
	    Book ("DYAnalysis/Vars/PtemNoMCut_"+ l ,"Ptem;p_{T}^{e#mu} [GeV];Events"  , 1000,0,1000);
        // counting unweighted events
	    Book ("DYAnalysis/Vars/PtmmUW_"+ l ,"Ptmm;p_{T}^{#mu#mu} [GeV];Events", 1000,0,1000);
        // trilepton
	    Book ("DYAnalysis/Vars/Ptlll_"+ l ,"Ptlll;p_{T}^{ll} [GeV];Events"  , 100,0,1000);
        // eta
	    Book ("DYAnalysis/Vars/EtaMu1_"+ l ,"EtaMu1;#eta^{#mu1} ;Events", 1000,-5,5);
        //
	    Book ("DYAnalysis/Vars/NJee_"+ l ,"NJee;N_{jets}^{ee};Events"    , 10,0,10);
	    Book ("DYAnalysis/Vars/NJmm_"+ l ,"NJmm;N_{jets}^{#mu#mu};Events", 10,0,10);
	    Book ("DYAnalysis/Vars/NJem_"+ l ,"NJem;N_{jets}^{e#mu};Events"  , 10,0,10);
        //
	    Book ("DYAnalysis/Vars/Npvee_"+ l ,"Npvee", 50,0,50);
	    Book ("DYAnalysis/Vars/Npvmm_"+ l ,"Npvmm", 50,0,50);
	    Book ("DYAnalysis/Vars/Npvem_"+ l ,"Npvem", 50,0,50);
        //
	    Book ("DYAnalysis/Vars/MHighPtee_"+ l ,"MHighPtee", 1000,0,1000);
	    Book ("DYAnalysis/Vars/MHighPtmm_"+ l ,"MHighPtmm", 1000,0,1000);
	    Book ("DYAnalysis/Vars/MJHighPtee_"+ l ,"MJHighPtee", 1000,0,1000);
	    Book ("DYAnalysis/Vars/MJHighPtmm_"+ l ,"MJHighPtmm", 1000,0,1000);
        //
	    Book ("DYAnalysis/Vars/MCloseMt_"+ l ,"MCloseMt", 1000,0,1000);
	    Book ("DYAnalysis/Vars/MCloseJZ_"+ l ,"MCloseJZ", 1000,0,1000);
        //
	    Book ("DYAnalysis/Vars/Pt20mm_"+ l ,"Ptmm20", 1000,0,1000);

	    Book ("DYAnalysis/Vars/Accmm_"+ l ,";Events", 10,0,10);
        {
            GetHisto("DYAnalysis/Vars/Accmm_"+ l,"") ->GetXaxis() ->SetBinLabel(1,"Gen-Reco");
            GetHisto("DYAnalysis/Vars/Accmm_"+ l,"") ->GetXaxis() ->SetBinLabel(2,"Gen-!Reco");
            GetHisto("DYAnalysis/Vars/Accmm_"+ l,"") ->GetXaxis() ->SetBinLabel(3,"!Gen-Reco");
        }
	    Book ("DYAnalysis/Vars/Accee_"+ l ,";Events", 10,0,10);
        {
            GetHisto("DYAnalysis/Vars/Accee_"+ l,"") ->GetXaxis() ->SetBinLabel(1,"Gen-Reco");
            GetHisto("DYAnalysis/Vars/Accee_"+ l,"") ->GetXaxis() ->SetBinLabel(2,"Gen-!Reco");
            GetHisto("DYAnalysis/Vars/Accee_"+ l,"") ->GetXaxis() ->SetBinLabel(3,"!Gen-Reco");
        }
    }

}
RooHistPdf* GetRooHistPdf(TFile* fin, string region, string process, string varname, RooRealVar* var, float& norm, TH1F*& histo, bool do_mcstat, bool do_norm, float input_norm){
    TH1F* h  =  GetHisto(fin,region,process,varname, norm, do_norm, input_norm);
    histo = h;
    if(do_mcstat)
    {
        //randomisation of the histo ...
        for(int i=1;i<=h->GetNbinsX();i++)
        {
            h->SetBinContent(i,randomnessGenerator->Gaus(h->GetBinContent(i),h->GetBinError(i)));
        }
    }
    string rdhname = "rdh_"+region+"_"+process;
    RooDataHist *rdh  = new RooDataHist(rdhname.c_str(),rdhname.c_str(),RooArgList(*var),Import(*h));
    string pdfname = "pdf_"+region+"_"+process;
    RooHistPdf *pdf  = new  RooHistPdf(pdfname.c_str(),pdfname.c_str(),RooArgSet(*var),*rdh);
    return pdf;
}
void ChargedHiggsQCDPurity::Init()
{
    // -- simplified selection
    for ( string& l : AllLabel()  ) 
        for (size_t iBin = -1 ; iBin + 1 < PtBins.size() ; ++iBin )
        {
            float pt = -1;
            if (iBin>=0 ) pt= PtBins[iBin];
            //                       direct, fullSel
            Book( dir + HistName(pt, true , false)+"_"+ l  , ("EtMiss "+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, false, false)+"_"+ l  , ("EtMissIsoInv "+ l).c_str(),250,0.,500.);
            // ---- 
            Book( dir + HistName(pt, true , false, "Upar")+"_"+ l  , ("EtMissParallel "+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, false, false, "Upar")+"_"+ l  , ("EtMissParallelIsoInv "+ l).c_str(),250,0.,500.);

            Book( dir + HistName(pt, true , false, "Uperp")+"_"+ l  , ("EtMissPerp "+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, false, false, "Uperp")+"_"+ l  , ("EtMissPerpIsoInv "+ l).c_str(),250,0.,500.);
            //  Used in case of spline reweighting iterations
            Book( dir + HistName(pt, true,  false, "TauPt")+"_"+ l  , ("PtTau "+ l).c_str(),1000,0.,1000.);
            Book( dir + HistName(pt, false, false, "TauPt")+"_"+ l  , ("PtTauIsoInv "+ l).c_str(),1000,0.,1000.);

            // QG ? Tau 
            Book( dir + HistName(pt, true , false)+"_Q_" + l  , ("EtMiss Q"+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, false, false)+"_Q_" + l  , ("EtMissIsoInv Q"+ l).c_str(),250,0.,500.);
            Book( dir + HistName(pt, true , false)+"_G_" + l  , ("EtMiss G"+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, false, false)+"_G_" + l  , ("EtMissIsoInv G"+ l).c_str(),250,0.,500.);
            Book( dir + HistName(pt, true , false)+"_T_" + l  , ("EtMiss G"+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, false, false)+"_T_" + l  , ("EtMissIsoInv G"+ l).c_str(),250,0.,500.);
            Book( dir + HistName(pt, true , false)+"_U_" + l  , ("EtMiss G"+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, false, false)+"_U_" + l  , ("EtMissIsoInv G"+ l).c_str(),250,0.,500.);
            // Prong
            Book( dir + HistName(pt, true , false)+"_1p_"+ l  , ("EtMiss "+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, false, false)+"_1p_"+ l  , ("EtMissIsoInv "+ l).c_str(),250,0.,500.);
            Book( dir + HistName(pt, true , false)+"_3p_"+ l  , ("EtMiss "+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, false, false)+"_3p_"+ l  , ("EtMissIsoInv "+ l).c_str(),250,0.,500.);
        }
    // --- for event NOT BINNED! CONTROL PLOTS
    for (string &l : AllLabel() )
    {
        
            // Cut flow with QCD
        Book(    "ChargedHiggsTauNu/CutFlowQCD/CutFlowQCD_"+l , ("CutFlowQCD "+ l).c_str(), 10, -.5, 10.0-.5);
        GetHisto("ChargedHiggsTauNu/CutFlowQCD/CutFlowQCD_"+l,"")->GetXaxis()->SetBinLabel(1, "N_{taus} #geq 1 \\ N_{leps} = 0 \\ N_{jets} #geq 3 \\ Trigger");
        GetHisto("ChargedHiggsTauNu/CutFlowQCD/CutFlowQCD_"+l,"")->GetXaxis()->SetBinLabel(2,"N_{Bjets} #geq 1");
        GetHisto("ChargedHiggsTauNu/CutFlowQCD/CutFlowQCD_"+l,"")->GetXaxis()->SetBinLabel(3,"MET > 60 GeV");
        GetHisto("ChargedHiggsTauNu/CutFlowQCD/CutFlowQCD_"+l,"")->GetXaxis()->SetBinLabel(4,"R_{bb}^{Min}>40");
    
    
            //  Used for control plots
            string hist= "TauPt_IsoInv_Control";
            Book( dir + hist+"_"+ l  , ("PtTauIsoInv "+ l).c_str(),1000,0.,1000.); // this guys has the R factor applied in the loos selection
            hist= "TauPt_Control";
            Book( dir + hist+"_"+ l  , ("PtTau "+ l).c_str(),1000,0.,1000.); // this guys has the R factor applied in the loos selection
            hist= "EtMiss_IsoInv_Control";
            Book( dir + hist+"_"+ l  , ("EtMissTauIsoInv "+ l).c_str(),250,0,500);
            hist= "EtMiss_Control";
            Book( dir + hist+"_"+ l  , ("EtMiss "+ l).c_str(),250,0,500);
    }
    // -- full selection
    for ( string& l : AllLabel()  ) 
    {
        for (size_t iBin = -1 ; iBin + 1 < PtBins.size() ; ++iBin )
        {
            float pt = -1;
            if (iBin>=0 ) pt= PtBins[iBin];
            //                       direct full
            Book( dir + HistName(pt, true , true)+"_"+ l  , ("EtMiss "+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, false, true)+"_"+ l  , ("EtMissIsoInv "+ l).c_str(),250,0.,500.);

            Book( dir + HistName(pt, true , true)+"_1p_"+ l  , ("EtMiss "+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, false, true)+"_1p_"+ l  , ("EtMissIsoInv "+ l).c_str(),250,0.,500.);
            Book( dir + HistName(pt, true , true)+"_3p_"+ l  , ("EtMiss "+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, false, true)+"_3p_"+ l  , ("EtMissIsoInv "+ l).c_str(),250,0.,500.);
            // ---  NoR
            Book( dir + HistName(pt, false, true)+"_NoR_"+ l  , ("EtMissIsoInv "+ l).c_str(),250,0.,500.);
            //
            Book( dir + HistName(pt, true , true, "Upar")+"_"+ l  , ("EtMissParallel "+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, true, true, "Uperp")+"_"+ l  , ("EtMissPerp "+ l).c_str(),250,0.,500.);

            Book( dir + HistName(pt, false , true, "Upar")+"_"+ l  , ("EtMissParallelIsoInv "+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, false, true, "Uperp")+"_"+ l  , ("EtMissPerpIsoInv "+ l).c_str(),250,0.,500.);
            // QG ? 
            Book( dir + HistName(pt, true , true )+"_Q_" + l  , ("EtMiss Q"+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, false, true )+"_Q_" + l  , ("EtMissIsoInv Q"+ l).c_str(),250,0.,500.);
            Book( dir + HistName(pt, true , true )+"_G_" + l  , ("EtMiss G"+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, false, true )+"_G_" + l  , ("EtMissIsoInv G"+ l).c_str(),250,0.,500.);
            Book( dir + HistName(pt, true , true )+"_T_" + l  , ("EtMiss G"+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, false, true )+"_T_" + l  , ("EtMissIsoInv G"+ l).c_str(),250,0.,500.);
            Book( dir + HistName(pt, true , true )+"_U_" + l  , ("EtMiss G"+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, false, true )+"_U_" + l  , ("EtMissIsoInv G"+ l).c_str(),250,0.,500.);

        }
        // I don't need to split it by pt
            Book( dir + "Mt"+"_"+ l  , ("Mt "+ l).c_str(),8000,0.,8000); // same binning in TauNu
            Book( dir + "MtIsoInv"+"_"+ l  , ("MtIsoInv "+ l).c_str(),8000,0.,8000.);
            Book( none + "EtMissIsoInv"+"_"+ l  , ("EtMissIsoInv "+ l).c_str(),1000,0.,1000.);
            Book( none + "EtMiss"+"_"+ l  , ("EtMiss "+ l).c_str(),1000,0.,1000.); // copy of the Tau Nu ? 

        Book(    none+"RbbMin_"+l,"RbbMin "+l+";R_{bb}^{min}",100,0,2*TMath::Pi());
        Book(    none+"RCollMin_"+l,"RCollMin "+l+";R_{coll}^{min}",100,0,2*TMath::Pi());

        Book(    none+"RbbMinIsoInv_"+l,"RbbMin IsoInv "+l+";R_{bb}^{min}",100,0,2*TMath::Pi());
        Book(    none+"RCollMinIsoInv_"+l,"RCollMin IsoInv "+l+";R_{coll}^{min}",100,0,2*TMath::Pi());
 
        
        Book(    none+"NBjets_"+l,"NBjets "+l+";NBjets",1000,0,1000);
        Book(    none+"NBjetsIsoInv_"+l,"NBjets IsoInv "+l+";NBjets",1000,0,1000);
        
        Book(    none+"Tau1Pt_"+l,"Tau1Pt "+l+";Tau1Pt",1000,0,1000);
        Book(    none+"Tau1PtIsoInv_"+l,"Tau1Pt IsoInv "+l+";Tau1Pt",1000,0,1000);

    
    
    }

}
Beispiel #7
0
void DrawPlots(TString fn="rootplots/ttbar_partonLevel_histos_"+run+".root") {
  TFile *f = TFile::Open(fn);
  if (f==NULL) fatal("Cannot open file "+fn);
  
  TString pdf("Pdfs/top_plot_"+run+".pdf");
  c = new TCanvas();

  c->Print(pdf+"[");

  //divide canvas into quadrants
    c->Divide(2,2);

    TLatex tex; tex.SetNDC();
    tex.DrawLatex(0.35,0.49,"Leptonic pseudotop");
    c->cd(1); GetHisto(f,"pseudo_mass_matched")->Draw("e1");
    c->Update();

    c->cd(2); GetHisto(f,"pseudo_mass_unmatched")->Draw("e1");
    c->Update();

    c->cd(3); GetHisto(f,"pseudo_pt_matched")->Draw("e1 ");
    c->Update();

    c->cd(4); GetHisto(f,"pseudo_pt_unmatched") ->Draw("e1 ");
    c->Print(pdf);



    c->cd(1); GetHisto(f,"pseudo_eta_matched")->Draw("e1 ");
    c->Update();

    c->cd(2); GetHisto(f,"pseudo_eta_unmatched")->Draw("e1 ");

    c->Update();

    c->cd(3); GetHisto(f,"whadronic")->Draw("e1 y+ ");
    c->Update();

    c->cd(4); GetHisto(f,"wleptonic")->Draw("e1");
    c->Print(pdf);


    c->cd(1); GetHisto(f,"m_top")->Draw("e1");

    c->cd(2); GetHisto(f,"eta_top")->Draw("e1 c ");

    c->cd(3); GetHisto(f,"pt_top") ->Draw("e1 ");

    c->cd(4); GetHisto(f,"y_top")->Draw("e1 ");
    c->Print(pdf);



    c->cd(1); GetHisto(f,"eff_vs_topPt")->Draw("e1 ");

    c->cd(2); GetHisto(f,"neff_vs_topPt")->Draw("e1  ");

    c->cd(3); GetHisto(f,"eff_vs_topMass") ->Draw("e1 ");

    c->cd(4); GetHisto(f,"eff_vs_topeta") ->Draw("e1");
    c->Print(pdf);


    c->cd(1); GetHisto(f,"pseudo_btop_mass")->Draw("e1 ");

    c->cd(2); GetHisto(f,"pseudo_HW_top")->Draw("e1 ");

    c->cd(3); GetHisto(f,"pseudb")->Draw("e1");

    c->cd(4); GetHisto(f,"eff_vs_bmass")->Draw("e1");
    c->Print(pdf);

    c->Print(pdf+"]");


  }
Beispiel #8
0
void CorrPtCut(char *prodname = "LHC10d4 PYTHIA D6T 7 TeV p+p", char *shortprodname = "LHC10d4", char *filename="Et.ESD.new.sim.LHC10d4.pp.merged.root"){

  gStyle->SetOptTitle(0);
  gStyle->SetOptStat(0);
  gStyle->SetOptFit(0);
  TCanvas *c = new TCanvas("c","c",500,400);
  c->SetTopMargin(0.04);
  c->SetRightMargin(0.04);
  c->SetLeftMargin(0.181452);
  c->SetBottomMargin(0.134409);
  c->SetBorderSize(0);
  c->SetFillColor(0);
  c->SetFillColor(0);
  c->SetBorderMode(0);
  c->SetFrameFillColor(0);
  c->SetFrameBorderMode(0);
  float etacut = 0.7;
  cout<<"Pt cut = 150 MeV/c"<<endl;
  TH1D *High = GetHisto(0.15-.001,"High",filename,etacut);
  float tpcHigh=highbound;
  float tpcLow=lowbound;
  float tpcsyserr = syserr;
  float tpcmean = mean;
  float x1 = High->GetXaxis()->GetBinLowEdge(1);
  //TBox *tpcBox = new TBox(-x1*.99,1.0-tpcLow,x1*.99,1.0-tpcHigh);
  TBox *tpcBox = new TBox(-x1*.99,1.0-(mean-syserr),x1*.99,1.0-(mean+syserr));
  tpcBox->SetFillColor(5);
  tpcBox->SetLineColor(0);
  tpcBox->SetFillStyle(1001);
  cout<<"Pt cut = 100 MeV/c"<<endl;
  TH1D *Low = GetHisto(0.1-.001,"Low",filename,etacut);
  float itsHigh=highbound;
  float itsLow=lowbound;
  float itssyserr = syserr;
  float itsmean = mean;

  cout<<Form("dataset & %2.4f \\pm %2.4f &  %2.4f \\pm %2.4f \\",itsmean,itssyserr,tpcmean,tpcsyserr)<<endl;
  float x = Low->GetXaxis()->GetBinLowEdge(1);
  //TBox *itsBox = new TBox(-x*.99,1.0-itsLow,x*.99,1.0-itsHigh);
  TBox *itsBox = new TBox(-x1*.99,1.0-(mean-syserr),x1*.99,1.0-(mean+syserr));
  itsBox->SetFillColor(5);
  itsBox->SetLineColor(0);
  itsBox->SetFillStyle(1001);
  cout<<"Pt cut = 50 MeV/c"<<endl;
  TH1D *Lowest = GetHisto(0.05-.001,"Lowest",filename,etacut);
  TF1 *funcLow = new TF1("funcLow","[0]",-.7,.7);
  funcLow->SetParameter(0,0.01);
  Low->Fit(funcLow);
  TF1 *funcHigh = new TF1("funcHigh","[0]",-.7,.7);
  funcHigh->SetParameter(0,0.02);
  High->Fit(funcLow);
  High->SetMaximum(0.06);
  High->SetMinimum(0.0);
  High->SetMarkerColor(2);
  Low->SetMarkerColor(4);
  High->SetLineColor(2);
  Low->SetLineColor(4);
  High->SetMinimum(0.0);
  High->SetMarkerStyle(20);
  Low->SetMarkerStyle(21);
  Lowest->SetMarkerStyle(22);
  High->Draw();
  tpcBox->Draw("f");
  High->Draw("same");
  itsBox->Draw("f");
  //return;
  Low->Draw("same");
  //Lowest->Draw("same");
  TLatex *tex = new TLatex(-0.723444,0.0373593+0.019,prodname);
  tex->SetTextSize(0.0537634);
  tex->Draw();
  TLegend *leg = new TLegend(0.217742,0.696237,0.477823,0.873656);
  leg->AddEntry(High,"p_{T} cut-off = 0.15 GeV/c");
  leg->AddEntry(Low,"p_{T} cut-off = 0.1 GeV/c");
  //leg->AddEntry(Lowest,"p_{T} cut-off = 0.05 GeV/c");
  leg->SetFillStyle(0);
  leg->SetFillColor(0);
  leg->SetBorderSize(0);
  leg->SetTextSize(0.0537634);
  leg->Draw();
  c->SaveAs(Form("pics/%s/fptcut.eps",shortprodname));
  c->SaveAs(Form("pics/%s/fptcut.png",shortprodname));
  c->SaveAs(Form("pics/%s/fptcut.pdf",shortprodname));
}
Beispiel #9
0
void EfficiencyMaps(TString Signal, TString Analysis, TString Channel, bool entries = false) {

  int const nSRs = 12;
  TString SRname[nSRs] = {"SR1_NoJet", "SR1_NoTag", "SR1_Veto", "SR1_Tag", 
			  "SR2_NoJet", "SR2_NoTag", "SR2_Veto", "SR2_Tag", 
			  "SR3_Veto",  "SR3_Tag",   "SR3_Veto_isr", "SR3_Tag_isr"};
  TString SRtitle[nSRs] = {"SR1^{\\text{0Jet}}_{\\text{0Tag}}", "SR1_^{\\text{Jets}}_{\\text{0Tag}}", "SR1_{\\text{0Tag}}", "SR1_{\\text{Tags}}", 
			   "SR2^{\\text{0Jet}}_{\\text{0Tag}}", "SR2_^{\\text{Jets}}_{\\text{0Tag}}", "SR2_{\\text{0Tag}}", "SR2_{\\text{Tags}}", 
			   "SR3_{\\text{0Tag}}", "SR3_{\\text{Tags}}", "SR3^{\\text{ISR}}_{\\text{0Tag}}", "SR3^{\\text{ISR}}_{\\text{Tags}}"};
  bool UseSR[nSRs]; 
  if (Analysis=="_Stop") {
    UseSR[0] = 0; UseSR[1] = 0; UseSR [2] = 1; UseSR [3] = 1;
    UseSR[4] = 0; UseSR[5] = 0; UseSR [6] = 1; UseSR [7] = 1;
    UseSR[8] = 0; UseSR[9] = 0; UseSR[10] = 1; UseSR[11] = 1; 
  } else if (Analysis=="_Chargino") {
    UseSR[0] = 1; UseSR[1] = 1; UseSR [2] = 0; UseSR [3] = 0;
    UseSR[4] = 1; UseSR[5] = 1; UseSR [6] = 0; UseSR [7] = 0;
    UseSR[8] = 1; UseSR[9] = 0; UseSR[10] = 0; UseSR[11] = 0; 
  }

  int nSRsignal = 0;
  for (int sr = 0; sr<nSRs; sr++)
    if (UseSR[sr]) 
      nSRsignal++;

  TH2F *EffMap  = new TH2F("EffMap",  "", 7, 0., 140., nSRsignal, 0., nSRsignal);
  TH2F *StatMap = new TH2F("StatMap", "", 7, 0., 140., nSRsignal, 0., nSRsignal);

  EffMap->SetXTitle("M_{T2}(ll) [GeV]");
  StatMap->SetXTitle("M_{T2}(ll) [GeV]");
  
  TString Syst = entries ? "noweight" : "nominal"; 
  myfile0 = new TFile("../minitrees/rootfilesOct17/" + Syst + "/Stop/" + Signal + ".root", "read");

  int isr = 1;

  for (int sr = 0; sr<nSRs; sr++)
    if (UseSR[sr]) {

      EffMap->GetYaxis()->SetBinLabel(isr, SRtitle[sr]);
      StatMap->GetYaxis()->SetBinLabel(isr, SRtitle[sr]);

      TString HistoName = "Stop/02_" + SRname[sr] + "/h_MT2ll" + Channel; 
      TString HistoNameGen = HistoName; 
      HistoNameGen.ReplaceAll("SR1", "SR1gen");
      HistoNameGen.ReplaceAll("SR2", "SR2gen");
      HistoNameGen.ReplaceAll("SR3", "SR3gen");
      HistoNameGen.ReplaceAll("MT2ll", "MT2llgen");
      if (SRname[sr].Contains("_isr")) {
	HistoName.ReplaceAll("_isr", "");
	HistoName.ReplaceAll("MT2ll", "MT2llisr");
	HistoNameGen.ReplaceAll("_isr", "");
	HistoNameGen.ReplaceAll("MT2ll", "MT2llisr");
      }

      TH1F *ThisHisto = GetHisto(HistoName);
      TH1F *ThisHistoGen = GetHisto(HistoNameGen);

      for (int ib = 1; ib<=7; ib++) {
	
	//float XXX = ThisHisto->GetBinContent(ib);
	//float EEE = ThisHistoGen->GetBinContent(ib);
	float XXX = 35.896*(ThisHisto->GetBinContent(ib)+ThisHistoGen->GetBinContent(ib))/2.;
        float EEE = 35.896*(ThisHisto->GetBinError(ib)+ThisHistoGen->GetBinError(ib))/2.;
	float value = EEE/XXX;
	if (entries) value = ThisHisto->GetBinContent(ib);
	EffMap->SetBinContent(ib, isr, value);
	//EffMap->SetBinError(ib, isr, EEE);
	
      }	

      isr++;
      
    }
  
  gStyle->SetOptStat(0);
  //gStyle->SetPaintTextFormat("5.2f");

  TCanvas *CC = new TCanvas("CC", "", 600, 400);
  CC->Divide(1, 1); 

  EffMap->Draw("COLZtext");
  //EffMap->Draw("COLZtexte");
  
  TString channelFlag = (Channel=="_em") ? "_emu" : "_eemumu";
  TString PlotName = entries ? "SignalEntries" : "SignalStatError";
  CC->Print("../Plots/MapMySignal/" + PlotName + "Map_" + Signal + channelFlag + ".pdf");
  CC->Print("../Plots/MapMySignal/" + PlotName + "Map_" + Signal + channelFlag + ".png");

}
void ChargedHiggsTauNu::Init()
{
    Log(__FUNCTION__,"INFO",Form("nProngs selected=%d",nprongs) );

    if ( doGen ) initGen();

    for ( string& l : AllLabel()  ) {

        Log(__FUNCTION__,"INFO", "Booking Histo CutFlow_" + l);
  
        Book(    "ChargedHiggsTauNu/CutFlow/CutFlow_"+ l  , ("CutFlow "+ l).c_str(),100,-.5,100-.5);
        {
            GetHisto("ChargedHiggsTauNu/CutFlow/CutFlow_"+l,"")->GetXaxis()->SetBinLabel(Total+1,"Total"); // bin shift
            GetHisto("ChargedHiggsTauNu/CutFlow/CutFlow_"+l,"")->GetXaxis()->SetBinLabel(OneTau+1,"N_{taus} #geq 1");
            GetHisto("ChargedHiggsTauNu/CutFlow/CutFlow_"+l,"")->GetXaxis()->SetBinLabel(NoLep+1,"N_{leps} = 0");
            GetHisto("ChargedHiggsTauNu/CutFlow/CutFlow_"+l,"")->GetXaxis()->SetBinLabel(ThreeJets,"N_{jets} #geq 3");
            GetHisto("ChargedHiggsTauNu/CutFlow/CutFlow_"+l,"")->GetXaxis()->SetBinLabel(OneBjet,"N_{Bjets} #geq 1");
            GetHisto("ChargedHiggsTauNu/CutFlow/CutFlow_"+l,"")->GetXaxis()->SetBinLabel(Met,"MET > 60 GeV");
            //GetHisto("ChargedHiggsTauNu/CutFlow/CutFlow_"+l,"")->GetXaxis()->SetBinLabel(7,"R_{sr}^{Max} < 1.96");
            //GetHisto("ChargedHiggsTauNu/CutFlow/CutFlow_"+l,"")->GetXaxis()->SetBinLabel(7,"R_{sr}^{Max} < 140");
            GetHisto("ChargedHiggsTauNu/CutFlow/CutFlow_"+l,"")->GetXaxis()->SetBinLabel(AngColl,"R_{coll}^{Min}>40");
            GetHisto("ChargedHiggsTauNu/CutFlow/CutFlow_"+l,"")->GetXaxis()->SetBinLabel(AngRbb,"R_{bb}^{Min}>40");
            //GetHisto("ChargedHiggsTauNu/CutFlow/CutFlow_"+l,"")->GetXaxis()->SetBinLabel(7,"#Delta #phi (Tau,Jet1)<2.09");
        }

        // Cut flow with QCD
        Book(    "ChargedHiggsTauNu/CutFlowQCD/CutFlowQCD_"+l , ("CutFlowQCD "+ l).c_str(), 100, -.5, 100-.5);
        {
            GetHisto("ChargedHiggsTauNu/CutFlowQCD/CutFlowQCD_"+l,"")->GetXaxis()->SetBinLabel(1, "N_{taus} #geq 1 \\ N_{leps} = 0 \\ N_{jets} #geq 3 \\ Trigger");
            GetHisto("ChargedHiggsTauNu/CutFlowQCD/CutFlowQCD_"+l,"")->GetXaxis()->SetBinLabel(2,"N_{Bjets} #geq 1");
            GetHisto("ChargedHiggsTauNu/CutFlowQCD/CutFlowQCD_"+l,"")->GetXaxis()->SetBinLabel(3,"MET > 60 GeV");
            GetHisto("ChargedHiggsTauNu/CutFlowQCD/CutFlowQCD_"+l,"")->GetXaxis()->SetBinLabel(4,"R_{bb}^{Min}>40");
        }

        // -- cut flow 2 is the one used to synchronized with HIP
        Book(    "ChargedHiggsTauNu/CutFlow/CutFlow2_"+ l  , ("CutFlow "+ l).c_str(),100,-.5,100-.5);

        // study on base selection
        Book(    "ChargedHiggsTauNu/Base/Tau1Pt_"+l,"Tau1Pt "+l +";p_{T}^{#tau}(leading #tau) [GeV]" ,1000,0,1000);
        Book(    "ChargedHiggsTauNu/Base/Tau1Pt_0Pi_"+l,"Tau1Pt "+l +";p_{T}^{#tau}(leading #tau) [GeV]" ,1000,0,1000);
        Book(    "ChargedHiggsTauNu/Base/Tau1Pt_1Pi_"+l,"Tau1Pt "+l +";p_{T}^{#tau}(leading #tau) [GeV]" ,1000,0,1000);
        Book(    "ChargedHiggsTauNu/Base/Tau1Pt_2Pi_"+l,"Tau1Pt "+l +";p_{T}^{#tau}(leading #tau) [GeV]" ,1000,0,1000);
        Book(    "ChargedHiggsTauNu/Base/Tau1Pt_0Pi_TrSingleTau_"+l,"Tau1Pt "+l +";p_{T}^{#tau}(leading #tau) [GeV]" ,1000,0,1000);
        Book(    "ChargedHiggsTauNu/Base/Tau1Pt_1Pi_TrSingleTau_"+l,"Tau1Pt "+l +";p_{T}^{#tau}(leading #tau) [GeV]" ,1000,0,1000);
        Book(    "ChargedHiggsTauNu/Base/Tau1Pt_0Pi_TrMet110_"+l,"Tau1Pt "+l +";p_{T}^{#tau}(leading #tau) [GeV]" ,1000,0,1000);
        Book(    "ChargedHiggsTauNu/Base/Tau1Pt_1Pi_TrMet110_"+l,"Tau1Pt "+l +";p_{T}^{#tau}(leading #tau) [GeV]" ,1000,0,1000);
        Book(    "ChargedHiggsTauNu/Base/Tau1Pt_TrMet110_"+l,"Tau1Pt "+l +";p_{T}^{#tau}(leading #tau) [GeV]" ,1000,0,1000);
        Book(    "ChargedHiggsTauNu/Base/Tau1Pt_Met150_TrMet110_"+l,"Tau1Pt "+l +";p_{T}^{#tau}(leading #tau) [GeV]" ,1000,0,1000);
        Book(    "ChargedHiggsTauNu/Base/Tau1Pt_TrSingleTau_"+l,"Tau1Pt "+l +";p_{T}^{#tau}(leading #tau) [GeV]" ,1000,0,1000);
        Book(    "ChargedHiggsTauNu/Base/Tau1Pt_TrBoth_"+l,"Tau1Pt "+l +";p_{T}^{#tau}(leading #tau) [GeV]" ,1000,0,1000);
        Book(    "ChargedHiggsTauNu/Base/Tau1Pt_Met150_TrBoth_"+l,"Tau1Pt "+l +";p_{T}^{#tau}(leading #tau) [GeV]" ,1000,0,1000);
        //

        Book(    "ChargedHiggsTauNu/NOne/NTaus_"+l,"NTaus "+l +";Number of selected hadronic tau" ,1000,0,1000);

        Book(    "ChargedHiggsTauNu/NOne/Tau1Pt_"+l,"Tau1Pt "+l +";p_{T}^{#tau}(leading #tau) [GeV]" ,1000,0,1000);


        //Book(    "ChargedHiggsTauNu/NOne/Tau1Eta_"+l,"Tau1Eta "+l +";#eta^{#tau}(leading #tau) [GeV]",100,-5,5);

        Book(    "ChargedHiggsTauNu/NOne/NJets_"+l,"NJets "+l + "; Number of selected jets",1000,0,1000);

        Book(    "ChargedHiggsTauNu/NOne/Jet1Pt_"+l,"Jet1Pt "+l+";p_{T}^{jet}(leading jet) [GeV]",1000,0,1000);

        Book(    "ChargedHiggsTauNu/NOne/Jet1Eta_"+l,"Jet1Eta "+l+";#eta^{jet}(leading jet) [GeV]",100,-5,5);

        //Book(    "ChargedHiggsTauNu/NOne/Jet2Pt_"+l,"Jet2Pt "+l+";p_{T}^{jet}(sub-leading jet) [GeV]",1000,0,1000);

        //Book(    "ChargedHiggsTauNu/NOne/Jet2Eta_"+l,"Jet2Eta "+l+";#eta^{jet}(sub-leading jet) [GeV]",100,-5,5);

        //Book(    "ChargedHiggsTauNu/NOne/Jet3Pt_"+l,"Jet3Pt "+l+";p_{T}^{jet}(subsub-leading jet) [GeV]",1000,0,1000);

        //Book(    "ChargedHiggsTauNu/NOne/Jet3Eta_"+l,"Jet3Eta "+l + ";#eta^{jet}(subsub-leading jet) [GeV]",100,-5,5);

        Book(    "ChargedHiggsTauNu/NOne/NBjets_"+l,"NBjets "+l + ";Number of selected b jets",1000,0,1000);

        Book(    "ChargedHiggsTauNu/NOne/Bdiscr_"+l,"BDiscr "+l + ";Btag Discr",1000,-2,2);

        Book(    "ChargedHiggsTauNu/NOne/Bjet1Pt_"+l,"Bjet1Pt "+l+"p_{T}^{b-tagged jet} [GeV]",1000,0,1000);

        //Book(    "ChargedHiggsTauNu/NOne/Bjet1Eta_"+l,"Bjet1Eta "+l+";#eta^{b-tagged jet} [GeV]",100,-5,5);

        //Book(    "ChargedHiggsTauNu/NOne/MaxDEtaBjetJets_"+l,"MaxDEtaBjetJets "+l+";Max #Delta#eta (b-tagged jet,jets)",100,0,10);

        //Book(    "ChargedHiggsTauNu/NOne/MaxInvMassBjetJets_"+l,"MaxInvMassBjetJets "+l+";Max invariant mass (b-tagged jet,jets) [GeV]",2000,0,2000);

        Book(    "ChargedHiggsTauNu/NOne/EtMiss_"+l,"EtMiss "+l+";E_{T}^{miss} [GeV]",1000,0,1000);

        //Book2D(  "ChargedHiggsTauNu/NOne/EtMissVsMt_"+l,"EtMissVsMt "+l+";m_{T} [GeV];E_{T}^{miss} [GeV]",1000,0,1000,1000,0,1000);

        Book2D(  "ChargedHiggsTauNu/NOne/DPhiJet1MetVsDPhiTauMet_"+l,"DPhiJetMetVsDPhiTauMet "+l + ";#Delta #phi(#tau,MET);#Delta #phi(Jet1,MET)",50,0,TMath::Pi(),50,0,TMath::Pi());

        Book2D(  "ChargedHiggsTauNu/NOne/DPhiJet2MetVsDPhiTauMet_"+l,"DPhiJetMetVsDPhiTauMet "+l+";Delta #phi(#tau,MET);#Delta #phi(Jet2,MET)",50,0,TMath::Pi(),50,0,TMath::Pi());

        Book2D(  "ChargedHiggsTauNu/NOne/DPhiJet3MetVsDPhiTauMet_"+l,"DPhiJetMetVsDPhiTauMet "+l+";#Delta #phi(#tau,MET);#Delta #phi(Jet3,MET)",50,0,TMath::Pi(),50,0,TMath::Pi());

        Book(    "ChargedHiggsTauNu/NOne/RCollMin_"+l,"RCollMin "+l+";R_{coll}^{min}",100,0,2*TMath::Pi());

        Book(    "ChargedHiggsTauNu/NOne/RbbMin_"+l,"RbbMin "+l+";R_{bb}^{min}",100,0,2*TMath::Pi());

        //Book(    "ChargedHiggsTauNu/NOne/RsrMax_"+l,"RsrMax "+l+";R_{sr}^{max}",100,0,2*TMath::Pi());

        //Book(    "ChargedHiggsTauNu/NOne/DPhiTauJet1_"+l,"DPhiTauJet1 "+l+";#Delta #phi (#tau, leading jet)",50,0,TMath::Pi());

        //Book2D(  "ChargedHiggsTauNu/NOne/RCollMinVsMt_"+l,"RCollMinVsMt "+l + ";m_{T} [GeV];R_{Coll}^{min}",1000,0,1000,100,0,2*TMath::Pi());

        //Book2D(  "ChargedHiggsTauNu/NOne/RbbMinVsMt_"+l,"RbbMinVsMt "+l+";m_{T} [GeV];R_{bb}^{min}",1000,0,1000,100,0,2*TMath::Pi());

        //Book2D(  "ChargedHiggsTauNu/NOne/RsrMaxVsMt_"+l,"RsrMaxVsMt "+l+";m_{T} [GeV];R_{sr}^{Max}",1000,0,1000,100,0,2*TMath::Pi());

        //Book2D(  "ChargedHiggsTauNu/NOne/DPhiTauJet1VsMt_"+l,"DPhiTauJet1VsMt "+l + ";m_{T} [GeV];#Delta #phi (#tau, leading jet)",1000,0,1000,50,0,TMath::Pi());

        /*********************************************
         *              FULL SELECTION               *
         *********************************************/

        // for the TTJets background
        Book(    "ChargedHiggsTauNu/Vars/JetInvMass_" + l ,"Jet Invariant mass;m_{jj} [GeV]",1000,0,1000) ;
        //Book(    "ChargedHiggsTauNu/Vars/Jet13InvMass_" + l ,"Jet Invariant mass;m_{jj} [GeV]",1000,0,1000) ;
        //Book(    "ChargedHiggsTauNu/Vars/Jet23InvMass_" + l ,"Jet Invariant mass;m_{jj} [GeV]",1000,0,1000) ;

        //Book(    "ChargedHiggsTauNu/Vars/Jet1QGL_" + l ,"QGL of the leading jet;QGL",300,-1.5,1.5) ;
        //Book(    "ChargedHiggsTauNu/Vars/Jet2QGL_" + l ,"QGL of the subleading jet;QGL",300,-1.5,1.5) ;

        //Book(    "ChargedHiggsTauNu/Vars/MtDecoQ_" + l ,"Mt deco;MtQ",1000,0,1000) ;
        //Book(    "ChargedHiggsTauNu/Vars/MtDecoCosPhi_" + l ,"Mt deco;MtCosPhi",1000,-1,1) ;

        Book(    "ChargedHiggsTauNu/Vars/Mt_matchTau_"+l,"Mt "+l + ";m_{T} [GeV]",8000,0,8000); // the Vars directory contains the full selection
        Book(    "ChargedHiggsTauNu/Vars/Mt_matchEle_"+l,"Mt "+l + ";m_{T} [GeV]",8000,0,8000); // the Vars directory contains the full selection
        Book(    "ChargedHiggsTauNu/Vars/Mt_matchMu_"+l,"Mt "+l + ";m_{T} [GeV]",8000,0,8000); // the Vars directory contains the full selection
        Book(    "ChargedHiggsTauNu/Vars/Mt_matchJet_"+l,"Mt "+l + ";m_{T} [GeV]",8000,0,8000); // the Vars directory contains the full selection
        Book(    "ChargedHiggsTauNu/Vars/Mt_matchOther_"+l,"Mt "+l + ";m_{T} [GeV]",8000,0,8000); // the Vars directory contains the full selection
        /**********************************************
         *                   MT                       *
         **********************************************/
        Book(    "ChargedHiggsTauNu/Vars/Mt_"+l,"Mt "+l + ";m_{T} [GeV]",8000,0,8000); // the Vars directory contains the full selection
        AddFinalHisto("ChargedHiggsTauNu/Vars/Mt_"+l);
        // study categorization
        for(int i=0;i<=1;++i)
        {
        Book(    string("ChargedHiggsTauNu/Vars/Mt_")+Form("cat%d",i)+"_"+l,"Mt "+l + ";m_{T} [GeV]",8000,0,8000); // the Vars directory contains the full selection
        }


    }

}
void DoComparison_ppVsMCallPanels(){

  Init();
  LoadFileNamesAll();
  
  if(!includeset[0]){
    Printf("The pp dataset is expected to be included! Cannot proceed"); return;
  }
  
  TH1D *h;
  // for(Int_t iset=0;iset<1;iset++){
  for(Int_t iset=0;iset<nSets;iset++){
    if(!includeset[iset])continue;
    for(Int_t kassoc=0;kassoc<nbinAssocpt;kassoc++){
      for(Int_t jmes=firstDpt;jmes<nbinDpt;jmes++){

	if(iset==0){
	  histo[iset][kassoc][jmes]=GetHistoAndSyst(filenames[iset][kassoc][jmes],iset,"fhDaverage","AverageSystematicUncertainty",err[iset][kassoc][jmes],ltscale[iset][kassoc][jmes]); 
	
	  
	// pp style
	  histo[iset][kassoc][jmes]->SetMarkerColor(4); 
	  histo[iset][kassoc][jmes]->SetMarkerStyle(21); 
	  histo[iset][kassoc][jmes]->SetLineColor(4);  
	  
	  
	  subtractedhisto[iset][kassoc][jmes] = GetPedestalHistoAndSystAndSubtractPed(iset,kassoc,jmes,histo[iset][kassoc][jmes],err[iset][kassoc][jmes],suberr[iset][kassoc][jmes],"CanvasBaselineVariationTrendPedestal",grbase[iset][kassoc][jmes],grv2[iset][kassoc][jmes]);
	  Printf("Histo subtrcated obtained");
	  cout<<"sub -> "<<subtractedhisto[iset][kassoc][jmes]->GetBinContent(5)<<endl;	
	  Printf("Histo subtrcated: pointer is working");
	  if(grv2[iset][kassoc][jmes]){
	    Printf("SHOULD NOT ENTER HERE");
	    grv2[iset][kassoc][jmes]->SetFillStyle(3002);
	    grv2[iset][kassoc][jmes]->SetFillColor(kMagenta);  
	  }
	  suberr[iset][kassoc][jmes]->SetLineColor(kBlack);
	}
	

	else{
	  h=GetHisto(filenames[iset][kassoc][jmes],"hCorrDeltaPhi");
	  if(reflTempl)histo[iset][kassoc][jmes]=AliHFCorrelationUtils::ReflectHisto(h,0.5);
	  else histo[iset][kassoc][jmes]=h;

	    histo[iset][kassoc][jmes]->SetMarkerColor(modelColors[iset-1]);// -1 because first iset is data
	    histo[iset][kassoc][jmes]->SetLineColor(modelColors[iset-1]); 
	    histo[iset][kassoc][jmes]->SetLineWidth(2); 
	    histo[iset][kassoc][jmes]->SetMarkerStyle(kDot); 
	    //  histo[iset][kassoc][jmes]->SetMarkerStyle(kOpenSquare); 

	   subtractedhisto[iset][kassoc][jmes] = GetPedestalHistoAndSystAndSubtractPedMC(iset,kassoc,jmes,histo[iset][kassoc][jmes],"CanvasBaselineVariationTrendPedestal");
	   
	}

	
	subtractedhisto[iset][kassoc][jmes]->SetMinimum(minYaxis[kassoc]);
      	subtractedhisto[iset][kassoc][jmes]->SetMaximum(maxYaxis[kassoc]);


      }      
    }
  }

  Printf("All Histos and Graphs created");
  // UP TO HERE SHOULD BE OK
  TCanvas *cFinalPaperStyle;
  cFinalPaperStyle=new TCanvas("cFinalPaperStyle","cFinalPaperStyle",900.,900.);
  //  cFinalPaperStyle=new TCanvas("cFinalPaperStyle","cFinalPaperStyle",1200.,1800.);
  cFinalPaperStyle->Divide(3,3,0.0,0.0,0);
  Set3x3PadPositions(cFinalPaperStyle);
  cFinalPaperStyle->Modified();
  cFinalPaperStyle->Update();

  
  for(Int_t iassoc=0;iassoc<nbinAssocpt;iassoc++){
    for(Int_t jDpt=firstDpt;jDpt<nbinDpt;jDpt++){
      cout<<"#################***************** "<<iassoc<<"  "<<jDpt<<endl;
      TPad *pd=cFinalPaperStyle->cd((nbinDpt-firstDpt)*iassoc+jDpt-firstDpt+1);
      SetPadStyle(pd);
      pd->Modified();
      pd->Update();
      //    gPad->SetLeftMargin(0.3);
      //    gPad->SetRightMargin(0.);
      //    gPad->SetTopMargin(0.3);
      //    gPad->SetBottomMargin(0.3);
      
      Double_t startline,endline,wi;
      wi=subtractedhisto[0][iassoc][jDpt]->GetBinWidth(1);
      startline=subtractedhisto[0][iassoc][jDpt]->GetBinLowEdge(1);
      // endline=subtractedhisto[0][iassoc][jDpt]->GetBinLowEdge(subtractedhisto[0][iassoc][jDpt]->GetNbinsX())+wi+0.4;
      endline=subtractedhisto[0][iassoc][jDpt]->GetBinLowEdge(subtractedhisto[0][iassoc][jDpt]->GetNbinsX())+wi+0.15;
      // cout<<"******************* "<<startline<<"  "<<endline<<endl;
      TLine* line=new TLine(startline, 0, endline, 0);
      line->SetLineStyle(2);
      
      TH1D* h=new TH1D(*subtractedhisto[0][iassoc][jDpt]);
      h->Reset();
      h->GetXaxis()->SetLimits(startline,endline);
      h->SetLineColor(0);

      h->GetYaxis()->SetTitleFont(43);
      h->GetXaxis()->SetTitleFont(43);
      h->GetYaxis()->SetLabelFont(43);
      h->GetXaxis()->SetLabelFont(43);
      h->GetYaxis()->SetTitleSize(28*innerPadHeight/referencePadHeight*resizeTextFactor);//0.07/(gPad->GetHNDC())*scaleHeightPads);
      h->GetXaxis()->SetTitleSize(30*innerPadHeight/referencePadHeight*resizeTextFactor);//;0.07/(gPad->GetWNDC())*scaleHeightPads);
      h->GetYaxis()->SetLabelSize(30*innerPadHeight/referencePadHeight*resizeTextFactor);//0.07/(gPad->GetHNDC())*scaleHeightPads);
      h->GetXaxis()->SetLabelSize(30*innerPadHeight/referencePadHeight*resizeTextFactor);//0.07/(gPad->GetWNDC())*scaleHeightPads);
      h->GetYaxis()->SetTitleOffset(5.5*innerPadHeight/referencePadHeight*resizeTextFactor);//8*innerPadHeight/referencePadHeight*resizeTextFactor);//1.3*(gPad->GetHNDC())/scaleHeightPads);
      h->GetXaxis()->CenterTitle();
      h->GetYaxis()->CenterTitle();

      //      h->GetXaxis()->Delete();
      //      h->GetYaxis()->Delete();
      if(jDpt>0){
	h->GetYaxis()->SetTitleSize(0);
	h->GetYaxis()->SetLabelSize(0);
      }

      if(iassoc!=2){
	h->GetXaxis()->SetTitleSize(0);
	h->GetXaxis()->SetLabelSize(0);
      }

      if(iassoc==2 && jDpt>=0){
	//	h->GetXaxis()->SetLabelOffset(-0.005);
	h->GetXaxis()->SetTitleOffset(3.5*innerPadHeight/referencePadHeight*resizeTextFactor);//8*innerPadHeight/referencePadHeight*resizeTextFactor);

      }

      /*     if(iassoc==2 && jDpt>0==1){
	h->GetXaxis()->SetLabelOffset(-0.005);
	h->GetXaxis()->SetTitleOffset(0.8);

      }
    if(iassoc==2 && jDpt>0==2){
	h->GetXaxis()->SetLabelOffset(-0.004);
	h->GetXaxis()->SetTitleOffset(0.8);

      }
      */

      h->Draw();


      //  box2[4]->Draw("same");
      // SetColorGraphs(0,grbase[0][iassoc][jDpt]);

      //      grbase[0][iassoc][jDpt]->SetFillStyle(3002);
      grbase[0][iassoc][jDpt]->SetFillColor(kGray+2);
      grbase[0][iassoc][jDpt]->SetLineColor(kGray+2);
      suberr[0][iassoc][jDpt]->SetLineColor(kBlack);

      
      grbase[0][iassoc][jDpt]->Draw("E2");
      line->Draw(); 
      subtractedhisto[0][iassoc][jDpt]->Draw("same");
      suberr[0][iassoc][jDpt]->Draw("E2");

      Float_t size=0.058;
      SetScaleUncertaintyPositionAndSize(ltscale[0][iassoc][jDpt],0.08,0.104,22);//0.08
      //      if(iassoc==2)SetScaleUncertaintyPositionAndSize(ltscale[0][iassoc][jDpt],0.11,0.2,0.06);
      if(iassoc==1)SetScaleUncertaintyPositionAndSize(ltscale[0][iassoc][jDpt],0.1,0.2,22);//0.087
      //      if(iassoc==0 && jDpt==1)SetScaleUncertaintyPositionAndSize(ltscale[0][iassoc][jDpt],0.11,0.11,0.062);
      if(iassoc==2 && jDpt==0)SetScaleUncertaintyPositionAndSize(ltscale[0][iassoc][jDpt],0.1,0.2,22);//0.07
      if(iassoc==2 && jDpt==1)SetScaleUncertaintyPositionAndSize(ltscale[0][iassoc][jDpt],0.1,0.2,22);//0.085
      if(iassoc==2 && jDpt==2)SetScaleUncertaintyPositionAndSize(ltscale[0][iassoc][jDpt],0.1,0.2,22);//0.078
     
      //     if((nbinDpt-firstDpt)*iassoc+jDpt-firstDpt+1==1){
      //ltscale[0][iassoc][jDpt]->SetY(0.11/gPad->GetHNDC()+gPad->GetBottomMargin());
      //}
      ltscale[0][iassoc][jDpt]->Draw();
      for(Int_t kmod=1;kmod<nSets;kmod++){
	if(includeset[kmod])subtractedhisto[kmod][iassoc][jDpt]->Draw("hist same c");
      }
//       subtractedhisto[1][iassoc][jDpt]->Draw("hist same c");//Perugia0
//       subtractedhisto[2][iassoc][jDpt]->Draw("hist same c");//Perugia2010
//       subtractedhisto[3][iassoc][jDpt]->Draw("hist same c");//Perugia2011
//       subtractedhisto[4][iassoc][jDpt]->Draw("hist same c");//PYTHIA8
//       subtractedhisto[5][iassoc][jDpt]->Draw("hist same c");//POWHEG
//       subtractedhisto[6][iassoc][jDpt]->Draw("hist same c");//EPOS3

     // subtractedhisto[1][iassoc][jDpt]->Draw("same");//Perugia0
     //  subtractedhisto[2][iassoc][jDpt]->Draw("same");//Perugia2010
     //  subtractedhisto[3][iassoc][jDpt]->Draw("same");//Perugia2011
     //  subtractedhisto[4][iassoc][jDpt]->Draw("same");//PYTHIA8
     //  subtractedhisto[5][iassoc][jDpt]->Draw("same");//POWHEG
      subtractedhisto[0][iassoc][jDpt]->Draw("same");//pp DATA 
      suberr[0][iassoc][jDpt]->Draw("E2");
    
      TPaveText *pvAverage=GetAveragepavetext((nbinDpt-firstDpt)*iassoc+jDpt-firstDpt+1);
      TPaveText *alice=GetALICEpavetext((nbinDpt-firstDpt)*iassoc+jDpt-firstDpt+1);  
      //TPaveText *pvKineInfo = GetPaveKineInfo(strPtMesonText[jDpt],strPtAssocText[iassoc],(nbinDpt-firstDpt)*iassoc+jDpt-firstDpt+1);
      TPaveText *pvKineInfo = GetPaveKineInfo(jDpt,iassoc,(nbinDpt-firstDpt)*iassoc+jDpt-firstDpt+1);
      TPaveText *pvKineInfo2 = GetPaveKineInfo2((nbinDpt-firstDpt)*iassoc+jDpt-firstDpt+1);
      TLegend *legendbase=GetLegendBaselines(grbase[0][iassoc][firstDpt],(nbinDpt-firstDpt)*iassoc+jDpt-firstDpt+1);
      if(jDpt==0 && iassoc==0) legendbase->Draw();
      //   if(jDpt==1 && iassoc==0) legendbase->Draw();
      if((nbinDpt-firstDpt)*iassoc+jDpt-firstDpt+1==1)alice->Draw();
      pvKineInfo->Draw("same");
      if((nbinDpt-firstDpt)*iassoc+jDpt-firstDpt+1==1)pvAverage->Draw("same");
      //if((nbinDpt-firstDpt)*iassoc+jDpt-firstDpt+1==1)pvKineInfo2->Draw("same");
      if(jDpt==0 && iassoc==0)pvKineInfo2->Draw("same");
      //   if(jDpt==1 && iassoc==0)pvKineInfo2->Draw("same");

      // N.B. GetLegendData does not assume that the pointers to histograms that are passed are not null --> no need to check which model is included 
      if(jDpt==0 && iassoc==0){
	TLegend *legendData=GetLegendData(subtractedhisto[0][iassoc][jDpt],(nbinDpt-firstDpt)*iassoc+jDpt-firstDpt+1);
	legendData->Draw();
	
      }
      if(jDpt==1 && iassoc==0){
	TLegend *legendMC;
	if(splitLegendMC){
	  legendMC=GetLegendMC(subtractedhisto[1][iassoc][jDpt],subtractedhisto[2][iassoc][jDpt],subtractedhisto[3][iassoc][jDpt],0x0,0x0,0x0,(nbinDpt-firstDpt)*iassoc+jDpt-firstDpt+1);
	}
	else{
	  legendMC=GetLegendMC(subtractedhisto[1][iassoc][jDpt],subtractedhisto[2][iassoc][jDpt],subtractedhisto[3][iassoc][jDpt],subtractedhisto[4][iassoc][jDpt],subtractedhisto[5][iassoc][jDpt],subtractedhisto[6][iassoc][jDpt],(nbinDpt-firstDpt)*iassoc+jDpt-firstDpt+1);
	}
	legendMC->Draw();
      }
      if(jDpt==2 && iassoc==0 && splitLegendMC){
	
	TLegend *legendMC=GetLegendMC(0x0,0x0,0x0,subtractedhisto[4][iassoc][jDpt],subtractedhisto[5][iassoc][jDpt],subtractedhisto[6][iassoc][jDpt],(nbinDpt-firstDpt)*iassoc+jDpt-firstDpt+1);
	
	legendMC->Draw();
      }

    }
  }


  // for(Int_t j=1;j<=9;j++){
  //   // for(Int_t j=6;j>=1;j--){
  //   TPad *pd=(TPad*)cFinalPaperStyle->cd(j);
  //   pd->Draw();
  // }

  TString nameout="2";
  cFinalPaperStyle->SaveAs(Form("CorrelationppMC3x3_%sNew.pdf",nameout.Data()));
  cFinalPaperStyle->SaveAs(Form("CorrelationppMC3x3_%sNew.eps",nameout.Data()));
  cFinalPaperStyle->SaveAs(Form("CorrelationppMC3x3_%sNew.gif",nameout.Data()));
  cFinalPaperStyle->SaveAs(Form("CorrelationppMC3x3_%sNew.png",nameout.Data()));
  cFinalPaperStyle->SaveAs(Form("CorrelationppMC3x3_%sNew.root",nameout.Data()));
  
}