Ejemplo n.º 1
0
void MakePlot(TString yvar = "mht30", int nbinsy = 100, double ylow=0., double yhigh=1000., TString xvar = "true_mu_ptW", int nbinsx = 100, double xlow=0., double xhigh=1000., TString axistitles="p_{T}^{W} [GeV];H_{T}^{miss} [GeV]", const TCut cuts="true_mu_pt>0&&num_true_mus==1&&num_true_els+num_true_had_taus==0", const TString treestring = "reduced_trees/13TeV/TTJets_MSDecaysCKM_central_Tune4C_13TeV-madgraph-tauola_Phys14DR-PU20bx25_PHYS14_25_V1-v1_MINIAODSIM_UCSB2406_v78/*.root", const TString plotNote="ttbar_1mu", bool logz = true, TString xvar_name="", TString yvar_name="") 
{
  set_plot_style();
  TH2D* h2 = new TH2D("h2",";"+axistitles,nbinsx,xlow,xhigh,nbinsy,ylow,yhigh);
  h2->SetStats(0);
  h2->GetZaxis()->SetLabelSize(0.02);
  h2->GetYaxis()->SetLabelSize(0.03);
  h2->GetYaxis()->SetTitleOffset(1.3);
  h2->GetXaxis()->SetLabelSize(0.03);
  TCut weighted_selection((cuts)*"(weightppb*10000.)");

  TChain * pypu = new TChain("reduced_tree");
  pypu->Add(treestring);// treestring is passed as an argument
  TCanvas * thecanvas= new TCanvas("thecanvas","the canvas",850,800);
  pypu->Draw(yvar+":"+xvar+">>h2",weighted_selection,"colz");

  h2->Scale(1/h2->Integral(1,nbinsx+1,1,nbinsy+1));

  thecanvas->SetLogz(logz);
  if (xvar_name.Length()>0) xvar=xvar_name;
  if (yvar_name.Length()>0) yvar=yvar_name;
  thecanvas->Print("macros/junews/lostleptons/conceptual_plots/"+yvar+"_vs_"+xvar+"_"+plotNote+"_scatter.pdf");
  
    
  delete h2;
  delete thecanvas;

}
Ejemplo n.º 2
0
void CrossCheckPlotter::setup() {
    // Set up the config map
    init_config_map();

    // Set up the style
    set_plot_style();

    // Set up colors and hatching
    init_color_styles();

    // Rescaling
    set_mc_scale_factors();
    if (data_config_.luminosity <= 0) {
        area_rescale_factor_ = set_area_rescale_factor();
        data_config_.luminosity = 1;
    } else {
        area_rescale_factor_ = -1;
    }
}
Ejemplo n.º 3
0
int defaultrootstyle() {
  gStyle->SetPalette(1);
  //gStyle->SetOptStat(10);
  gStyle->SetOptStat(0);
  gStyle->SetTitleFontSize(0.12);
  gStyle->SetTitleX(0.1f);
  gStyle->SetTitleW(0.8f);
  gStyle->SetTitleXOffset(0.8);
  gStyle->SetTitleYOffset(0.4);
  gStyle->SetTitleXSize(0.08);
  gStyle->SetTitleYSize(0.13);
  gStyle->SetPadTopMargin(0.15);
  gStyle->SetPadBottomMargin(0.18);
  gStyle->SetPadLeftMargin(0.15);
  gStyle->SetPadRightMargin(0.15);
  gStyle->SetLabelSize(0.06, "X");
  gStyle->SetLabelSize(0.06, "Y");
  gStyle->SetStatFontSize(0.3);
  gStyle->SetNdivisions(505, "X");
  gStyle->SetNdivisions(505, "Y");
  gStyle->SetStatY(0.83);
  gStyle->SetStatX(0.85);
  gStyle->SetStatW(0.15);
  gStyle->SetStatH(0.15);
  gStyle->SetStatBorderSize(0);
  gStyle->SetStatColor(0);
  gStyle->SetTitleBorderSize(0);
  gStyle->SetTitleFillColor(0);
  gStyle->SetFrameFillColor(kWhite);
  gStyle->SetFrameLineWidth(2);
  gStyle->SetCanvasColor(kWhite);
  gStyle->SetPadBorderSize(2);


  set_plot_style();
  cout << "set default style." << endl;
  return 0;
}
Ejemplo n.º 4
0
void DrawHistos(TString infile = "histos.root"){
    set_plot_style();
    gStyle->SetOptStat(0);
    gStyle->SetOptTitle(0);
    
    TFile *_file0 = TFile::Open(infile);
    TH1* hHardPartonspT = (TH1*)gROOT->FindObject("hHardPartonspT");
    TH1* hHardPartonsName = (TH1*)gROOT->FindObject("hHardPartonsName");
    TH1* hParticlepT = (TH1*)gROOT->FindObject("hParticlepT");
    TH2* hParticleEtaPhi = (TH2*)gROOT->FindObject("hParticleEtaPhi");

    TCanvas* can1 = new TCanvas("can1","",600,600);
    gPad->SetLeftMargin(0.15);
    gPad->SetLogy();
    SetHist(hParticlepT,"p_{T} (GeV/c)","Counts",2);
    SetHist(hHardPartonspT,"p_{T} (GeV/c)","Counts",1);
    hParticlepT->Draw();
    hHardPartonspT->Draw("same");
    TLegend* leg1 = new TLegend(0.6,0.7,0.85,0.85);
    SetLeg(leg1);
    leg1->AddEntry(hHardPartonspT,"Hard Parton","L");
    leg1->AddEntry(hParticlepT,"Final Particles","L");
    leg1->Draw();
    can1->SaveAs("pTgraph.png");
    
    TCanvas* can2 = new TCanvas("can2","",600,600);
    gPad->SetLeftMargin(0.15);
    SetHist(hHardPartonsName,"parton ID","Counts",1);
    hHardPartonsName->Draw();
    
    TCanvas* can3 = new TCanvas("can3","",600,600);
    gPad->SetLeftMargin(0.15);
    SetHist(hParticleEtaPhi,"p_{T} (GeV/c)","Counts",1);
    hParticleEtaPhi->Draw("COLZ");
   
    
  }
Ejemplo n.º 5
0
void ZBiScatterPlot(const TString yvar = "met", int nbinsy = 20, double ylow=0., double yhigh=1000., const TString xvar = "ht30", int nbinsx = 20, double xlow=0., double xhigh=2000., TString axistitles="H_{T} [GeV];E_{T}^{miss} [GeV]", const TCut cuts="num_jets_pt30>=4", const TString plotNote="4j_2b") 
{
  set_plot_style();
  TH1::SetDefaultSumw2(1);
  TH2::SetDefaultSumw2(1);
  TH2D* h2 = new TH2D("h2",";"+axistitles,nbinsx,xlow,xhigh,nbinsy,ylow,yhigh);
  TH2D* h2BG = new TH2D("h2BG",";"+axistitles,nbinsx,xlow,xhigh,nbinsy,ylow,yhigh);
  TH2D* h2ZBi = new TH2D("h2ZBi",";"+axistitles,nbinsx,xlow,xhigh,nbinsy,ylow,yhigh);
  h2->SetStats(0);
  h2ZBi->SetStats(0);
  h2ZBi->GetZaxis()->SetLabelSize(0.02);
  h2ZBi->GetZaxis()->SetTitle("Z(Bi)");
  h2ZBi->GetZaxis()->SetTitleOffset(0.7);
  h2ZBi->GetZaxis()->SetTitleFont(132);
  h2ZBi->GetYaxis()->SetLabelSize(0.03);
  h2ZBi->GetYaxis()->SetTitleOffset(1.3);
  h2ZBi->GetXaxis()->SetLabelSize(0.03);
  TCut weighted_selection((cuts+"num_jets_pt30>=4&&min_delta_phi_met_N>4&&num_reco_veto_electrons==0&&num_reco_veto_muons==0")*"(weightppb*5000.)");

  TChain *t1tttt_1500_100_ch = new TChain("reduced_tree");
  TChain *t1tttt_1200_800_ch = new TChain("reduced_tree");
  TChain *t1bbbb_1500_100_ch = new TChain("reduced_tree");
  TChain *t1bbbb_1000_900_ch = new TChain("reduced_tree");
  TChain *t1qqqq_1400_100_ch = new TChain("reduced_tree");
  TChain *t1qqqq_1000_800_ch = new TChain("reduced_tree");
  t1tttt_1500_100_ch->Add("reduced_trees/SMS-T1tttt_2J_mGl-1500_mLSP-100_Tune4C_13TeV-madgraph-tauola_Spring14miniaod-PU20bx25_POSTLS170_V5-v2_MINIAODSIM_UCSB2268_v76/*.root");
  t1tttt_1200_800_ch->Add("reduced_trees/SMS-T1tttt_2J_mGl-1200_mLSP-800_Tune4C_13TeV-madgraph-tauola_Spring14miniaod-PU20bx25_POSTLS170_V5-v2_MINIAODSIM_UCSB2267_v76/*.root");
  t1bbbb_1500_100_ch->Add("reduced_trees/SMS-T1bbbb_2J_mGl-1500_mLSP-100_Tune4C_13TeV-madgraph-tauola_Spring14miniaod-PU20bx25_POSTLS170_V5-v3_MINIAODSIM_UCSB2266_v76/*.root");
  t1bbbb_1000_900_ch->Add("reduced_trees/SMS-T1bbbb_2J_mGl-1000_mLSP-900_Tune4C_13TeV-madgraph-tauola_Spring14miniaod-PU20bx25_POSTLS170_V5-v2_MINIAODSIM_UCSB2264_v76/*.root");
  t1qqqq_1400_100_ch->Add("reduced_trees/SMS-T1qqqq_2J_mGl-1400_mLSP-100_Tune4C_13TeV-madgraph-tauola_Spring14miniaod-PU20bx25_POSTLS170_V5-v1_MINIAODSIM_UCSB2140_v75/*.root");
  t1qqqq_1000_800_ch->Add("reduced_trees/SMS-T1qqqq_2J_mGl-1000_mLSP-800_Tune4C_13TeV-madgraph-tauola_Spring14miniaod-PU20bx25_POSTLS170_V5-v1_MINIAODSIM_UCSB2139_v75/*.root");

  TChain * SM_ch = new TChain("reduced_tree");
  TFileCollection* ttbar_fc = new TFileCollection("ttbar_fc","","reduced_trees/tfcs/ttbar.txt");
  TFileCollection* qcd_fc = new TFileCollection("qcd_fc","","reduced_trees/tfcs/qcd.txt");
  TFileCollection* znn_fc = new TFileCollection("znn_fc","","reduced_trees/tfcs/znn.txt");
  TFileCollection* wjets_fc = new TFileCollection("wjets_fc","","reduced_trees/tfcs/wjets.txt");
  TFileCollection* single_top_fc = new TFileCollection("single_top_fc","","reduced_trees/tfcs/single_top.txt");
  TFileCollection* other_fc = new TFileCollection("other_fc","","reduced_trees/tfcs/other.txt");
  
  SM_ch->AddFileInfoList((TCollection*)ttbar_fc->GetList());
  SM_ch->AddFileInfoList((TCollection*)qcd_fc->GetList());
  SM_ch->AddFileInfoList((TCollection*)znn_fc->GetList());
  SM_ch->AddFileInfoList((TCollection*)wjets_fc->GetList());
  SM_ch->AddFileInfoList((TCollection*)single_top_fc->GetList());
  SM_ch->AddFileInfoList((TCollection*)other_fc->GetList());

  TCanvas * thecanvas= new TCanvas("thecanvas","the canvas",850,800);
  SM_ch->Draw(yvar+":"+xvar+">>h2BG",weighted_selection,"colz");
  t1tttt_1500_100_ch->Draw(yvar+":"+xvar+">>h2",weighted_selection,"colz");
  convert_to_ZBi_2D(h2ZBi, h2, h2BG, nbinsx, xlow, xhigh, nbinsy, ylow, yhigh);
  h2ZBi->Draw("colz");
  thecanvas->Print("macros/cutflow/plots/scatter/ZBi/t1tttt_1500_100/"+yvar+"_vs_"+xvar+"_"+plotNote+"_t1tttt_1500_100_ZBi_1114_5ifb_3evt.pdf");
  t1tttt_1200_800_ch->Draw(yvar+":"+xvar+">>h2",weighted_selection,"colz");
  convert_to_ZBi_2D(h2ZBi, h2, h2BG, nbinsx, xlow, xhigh, nbinsy, ylow, yhigh);
  h2ZBi->Draw("colz");
  thecanvas->Print("macros/cutflow/plots/scatter/ZBi/t1tttt_1200_800/"+yvar+"_vs_"+xvar+"_"+plotNote+"_t1tttt_1200_800_ZBi_1114_5ifb_3evt.pdf");
  t1bbbb_1500_100_ch->Draw(yvar+":"+xvar+">>h2",weighted_selection,"colz");
  convert_to_ZBi_2D(h2ZBi, h2, h2BG, nbinsx, xlow, xhigh, nbinsy, ylow, yhigh);
  h2ZBi->Draw("colz");
  thecanvas->Print("macros/cutflow/plots/scatter/ZBi/t1bbbb_1500_100/"+yvar+"_vs_"+xvar+"_"+plotNote+"_t1bbbb_1500_100_ZBi_1114_5ifb_3evt.pdf");
  t1bbbb_1000_900_ch->Draw(yvar+":"+xvar+">>h2",weighted_selection,"colz");
  convert_to_ZBi_2D(h2ZBi, h2, h2BG, nbinsx, xlow, xhigh, nbinsy, ylow, yhigh);
  h2ZBi->Draw("colz");
  thecanvas->Print("macros/cutflow/plots/scatter/ZBi/t1bbbb_1000_900/"+yvar+"_vs_"+xvar+"_"+plotNote+"_t1bbbb_1000_900_ZBi_1114_5ifb_3evt.pdf");
  t1qqqq_1400_100_ch->Draw(yvar+":"+xvar+">>h2",weighted_selection,"colz");
  convert_to_ZBi_2D(h2ZBi, h2, h2BG, nbinsx, xlow, xhigh, nbinsy, ylow, yhigh);
  h2ZBi->Draw("colz");
  thecanvas->Print("macros/cutflow/plots/scatter/ZBi/t1qqqq_1400_100/"+yvar+"_vs_"+xvar+"_"+plotNote+"_t1qqqq_1400_100_ZBi_1114_5ifb_3evt.pdf");
  t1qqqq_1000_800_ch->Draw(yvar+":"+xvar+">>h2",weighted_selection,"colz");
  convert_to_ZBi_2D(h2ZBi, h2, h2BG, nbinsx, xlow, xhigh, nbinsy, ylow, yhigh);
  h2ZBi->Draw("colz");
  thecanvas->Print("macros/cutflow/plots/scatter/ZBi/t1qqqq_1000_800/"+yvar+"_vs_"+xvar+"_"+plotNote+"_t1qqqq_1000_800_ZBi_1114_5ifb_3evt.pdf");


}
Ejemplo n.º 6
0
void spectraSysEff() {

  // === General Settings ===

  // Note centrality is by 2.5% bins, low bin is inclusive, high bin is exclusive
  // i.e. for 0-10% use minCent=0, maxCent=4. 


  int minCent[12] = {0,2,4,6,8,10,12,14,16,20,24,28};
  int maxCent[12] = {2,4,6,8,10,12,14,16,20,24,28,32};
  
  // absolute values of eta are used, negative eta values are included
  // for full eta range set etaMin=0 etaMax=2.4
  Double_t  etaMin = 2.0;
  Double_t  etaMax = 2.4;

double dndeta[12]= {1612,1313,1082,893.9,731.6,596.8, 482.3,383.9, 266.5, 153.2,79.5, 36.3 };
 
  double ptbins[18]={0.3,0.4,0.5,0.6,0.8,1.0,1.2,1.6,2.0,2.5,3.0,3.5,4.0,5.0,6.0,8.0,10.0,12.0};
 
  // Input File
  TFile *f = new TFile("LowPtSpectrum_fine_Full_d.root");
  TFile *fcorr = new TFile("validation3D_HydjetNoWedge_100k_flowSQ_vertexZ10.root");
  TFile *fcorrAMPT;
  TFile *fcorrDataMix = new TFile("validation3D_20pionBadWedge_SQ12_vertexZ10.root");
  // =========================

  gStyle->SetErrorX(0);
  gStyle->SetOptStat(0);


  set_plot_style();

  char dirname[256] = "spectrumGoodz14chi80";
  TH1D * spec[10][12];
  TH1D * eff[10][12];
  TH1D * fak[10][12];
  TH1D * sim[10][12];
  TH1D * rec[10][12];

  TGraphErrors * gSpectrum[10][12];
  TF1 * f1[10][12];

  Double_t  meanpt[10][12];
  Double_t  meanpterr[10][12];

  
    Double_t px[100],py[100],pxe[100],pye[100];
  for( int c=0; c<12; c++)
  {
    for( int j=0; j<3; j++)
    {
      spec[j][c] = getSpectrum( f, Form("%s/tracks3D",dirname), minCent[c], maxCent[c], etaMin, etaMax ); 
      if ( j==0 )
      {
        eff[j][c] = getSpectrum( fcorr, "hitrkPixelEffAnalyzer/heff3D", minCent[c], maxCent[c], etaMin, etaMax );
        sim[j][c] = getSpectrum( fcorr, "hitrkPixelEffAnalyzer/hsim3D", minCent[c], maxCent[c], etaMin, etaMax );
        fak[j][c] = getSpectrum( fcorr, "hitrkPixelEffAnalyzer/hfak3D", minCent[c], maxCent[c], etaMin, etaMax );
        rec[j][c] = getSpectrum( fcorr, "hitrkPixelEffAnalyzer/hrec3D", minCent[c], maxCent[c], etaMin, etaMax );
      }
      if ( j==1 )
      {
        eff[j][c] = getSpectrum( fcorrDataMix, "hitrkPixelEffAnalyzer/heff3D", minCent[c], maxCent[c], etaMin, etaMax );
        sim[j][c] = getSpectrum( fcorrDataMix, "hitrkPixelEffAnalyzer/hsim3D", minCent[c], maxCent[c], etaMin, etaMax );
        fak[j][c] = getSpectrum( fcorr, "hitrkPixelEffAnalyzer/hfak3D", minCent[c], maxCent[c], etaMin, etaMax );
        rec[j][c] = getSpectrum( fcorr, "hitrkPixelEffAnalyzer/hrec3D", minCent[c], maxCent[c], etaMin, etaMax );
      }
      if ( j==2 )
      {
        eff[j][c] = getSpectrum( fcorr, "hitrkPixelEffAnalyzer/heff3D", minCent[c], maxCent[c]+1, etaMin, etaMax );
        sim[j][c] = getSpectrum( fcorr, "hitrkPixelEffAnalyzer/hsim3D", minCent[c], maxCent[c]+1, etaMin, etaMax );
        fak[j][c] = getSpectrum( fcorr, "hitrkPixelEffAnalyzer/hfak3D", minCent[c], maxCent[c]+1, etaMin, etaMax );
        rec[j][c] = getSpectrum( fcorr, "hitrkPixelEffAnalyzer/hrec3D", minCent[c], maxCent[c]+1, etaMin, etaMax );
      }

      // determine correction factors


      TH1F * nevts = (TH1F *) f->Get(Form("%s/nevts",dirname));
      double Nevt = nevts->Integral( nevts->GetXaxis()->FindBin(minCent[c]+0.001), 
                                     nevts->GetXaxis()->FindBin(maxCent[c]-0.001) );


      Double_t maxy = 0.;
      Double_t miny = 100000.;

    for( int i=0; i<=16;i++)
    {
      double ptmin = ptbins[i]; double ptmax = ptbins[i+1];

      double iptmin = spec[j][c]->FindBin(ptmin+1e-3);
      double iptmax = spec[j][c]->FindBin(ptmax-1e-3);
      double icptmin = eff[j][c]->FindBin(ptmin+1e-3);
      double icptmax = eff[j][c]->FindBin(ptmax-1e-3);
      double pt = 0.;
      for( int k=iptmin;k<=iptmax;k++) pt += spec[j][c]->GetBinCenter(k) * spec[j][c]->GetBinContent(k);
      pt /= spec[j][c]->Integral(iptmin,iptmax);

      double yielderr;
      double yield = spec[j][c]->IntegralAndError(iptmin,iptmax,yielderr);
      yield /= (ptmax-ptmin) * Nevt * 2 * (etaMax-etaMin);
      yielderr /= (ptmax-ptmin) * Nevt * 2 * (etaMax-etaMin);

      double efmin = eff[j][c]->GetBinContent(icptmin)/sim[j][c]->GetBinContent(icptmin);
      double efmax = eff[j][c]->GetBinContent(icptmax)/sim[j][c]->GetBinContent(icptmax);
      double famin = fak[j][c]->GetBinContent(icptmin)/rec[j][c]->GetBinContent(icptmin);
      double famax = fak[j][c]->GetBinContent(icptmax)/rec[j][c]->GetBinContent(icptmax);

      double ef = (pt-ptmin)*(efmax-efmin)/(ptmax-ptmin)+efmin;
      double fa = (pt-ptmin)*(famax-famin)/(ptmax-ptmin)+famin;
      yield *= (1-fa)/ef;

      px[i] = pt;
      py[i] = yield;
      if( py[i] > maxy ) maxy = py[i];
      if( py[i] < miny ) miny = py[i];
      pxe[i] = 0.;
      pye[i] = yielderr;
    }

      gSpectrum[j][c] = new TGraphErrors( 16, px, py, pxe, pye );
      gSpectrum[j][c]->SetMarkerStyle(20);
      f1[j][c] = new TF1(Form("f1_%d_%d",c,j),PowerFuncScaled,0,6,3);
      f1[j][c]->SetParNames("n","p0","dN/dy");
      f1[j][c]->SetParameters(28,5,dndeta[c]);
      f1[j][c]->FixParameter(2,dndeta[c]);
      f1[j][c]->SetLineColor(kBlue);
      f1[j][c]->SetLineWidth(1);
      f1[j][c]->SetLineStyle(1);
      TFitResultPtr r =  gSpectrum[j][c]->Fit(Form("f1_%d_%d",c,j),"0RQNS");
  //    TFitResultPtr r;
      meanpt[j][c] = f1[j][c]->Mean(0,6);

    //  TF1 * me;
    //  me  = new TF1(Form("me_%d_%d",c,j),PowerFuncME,0,6,3);
    //  double intmeerror =  me->IntegralError(0,6,r->GetParams(), r->GetCovarianceMatrix()->GetMatrixArray() );
    //  double intme = me->Integral(0,6,r->GetParams() );
    //  double intspec = f1[j][c]->Integral(0,6);
    //  double intspecerr = f1[j][c]->IntegralError(0,6);
    //  meanpterr[j][c] = intme / intspec * sqrt( intmeerror * intmeerror / intme / intme
     //                                       + intspecerr * intspecerr / intspec / intspec );
     meanpterr[j][c] = 0.;
    }
    
  }

 
  TH1D* hDumCen = new TH1D("hDumCen",";Centrality (%);<p_{T}> Ratio",40,0.,80.); 
  hDumCen->GetXaxis()->CenterTitle(); hDumCen->GetYaxis()->SetTitleOffset(1.1);
  hDumCen->SetMaximum(1.5); hDumCen->SetMinimum(0.5);

  TCanvas *c1 = new TCanvas("c1","Mean Pt",600,600);
 
  c1->cd();
  hDumCen->Draw();

  TGraphErrors * gmean[3];
  
  int colors[4] = {0,kRed, kBlack, kBlue};

  for( int j=1; j<3; j++)
  {
    Double_t mx[12], mxe[12], my[12], mye[12];
    for(int i=0;i<12;i++) 
    { 
      mx[i] = (double)(maxCent[i]+minCent[i]) * 1.25;
      mxe[i] = 0; 
      my[i] = meanpt[j][i] / meanpt[0][i];
      mye[i] = my[i] * sqrt( meanpterr[j][i]*meanpterr[j][i]/meanpt[j][i]/meanpt[j][i] 
                           + meanpterr[0][i]*meanpterr[0][i]/meanpt[0][i]/meanpt[0][i] );
    
    }  

    gmean[j] = new TGraphErrors(12, mx, my, mxe, mye);
    gmean[j]->SetMarkerStyle(20);
    gmean[j]->SetMarkerColor(colors[j]);
    gmean[j]->SetLineColor(colors[j]);
    gmean[j]->Draw("p");
  
  }
  TLegend *legPt = new TLegend(0.45,0.7,0.89,0.89);
  legPt->SetFillColor(0); legPt->SetBorderSize(0);
  legPt->AddEntry(gmean[1],"Pion Datamixing Tables","lp");
  legPt->AddEntry(gmean[2],"HYDJET+2.5 Tables","lp");

  legPt->Draw();

  TLatex *  tex = new TLatex(20,0.8,Form( "GoodMergedTracks, %4.1f < |#eta| < %4.1f",etaMin, etaMax ));
    tex->SetTextSize(0.035);
    tex->Draw();

  TH1D* hDumPt = new TH1D("hDumPt",";p_{T} [GeV/c];ratio 1/N_{evt} d^{2}N_{ch}/d#etadp_{T}",40,0.,3.); hDumPt->SetMaximum(1.5);
  hDumPt->GetXaxis()->CenterTitle(); hDumPt->GetYaxis()->SetTitleOffset(1.1);

  hDumPt->SetMaximum(1.2); hDumPt->SetMinimum(0.8);

  TCanvas *c8 = new TCanvas("c8","Spectrum",1000,500);
  c8->Divide(3,1,0,0);

  TGraphErrors * gRatio[4][12]; 

  for( int q=0;q<3; q++)
  {
    c8->cd(q+1);
    int i;
    if (q==0) i=0; 
    if (q==1) i=5; 
    if (q==2) i=11; 
    hDumPt->Draw();
    for( int j=1; j<3; j++)
    { 
      Double_t rx[100],ry[100],rxe[100],rye[100];
      Double_t dx, nx, ny, dy, dye, nye; 
      for( int p=0;p<gSpectrum[0][i]->GetN();p++)
      {
        gSpectrum[0][i]->GetPoint(p,dx,dy);
        dye = gSpectrum[0][i]->GetErrorY(p);
        gSpectrum[j][i]->GetPoint(p,nx,ny);
        nye = gSpectrum[j][i]->GetErrorY(p);
        rx[p] = nx; rxe[p]=0;
        ry[p] = ny / dy;
        rye[p] = ry[p] * sqrt ( nye*nye/ny/ny + dye*dye/dy/dy);        
      }
      gRatio[j][i] = new TGraphErrors(gSpectrum[0][i]->GetN(), rx, ry, rxe, rye);
      gRatio[j][i]->SetMarkerStyle(20);
      gRatio[j][i]->SetMarkerColor(colors[j]);
      gRatio[j][i]->SetLineColor(colors[j]);
      gRatio[j][i]->Draw("p"); 
    tex = new TLatex(1,0.87,Form("%d-%d Cent.",(int)(minCent[i]*2.5),(int)(maxCent[i]*2.5)));
    tex->SetTextSize(0.045);
    tex->Draw();

    if( i==0) legPt->Draw();
  
    tex = new TLatex(1,0.85,Form("%4.1f < |#eta| < %4.1f",etaMin,etaMax));
    tex->SetTextSize(0.045);
    if( i==0) tex->Draw();
    tex = new TLatex(1,0.83,Form("GoodMergedTracks",etaMin,etaMax));
    tex->SetTextSize(0.045);
    if( i==0) tex->Draw();
    }
  } 
}
Ejemplo n.º 7
0
void mean(TString infile = "histos.root"){
    set_plot_style();
    gStyle->SetOptStat(0);
    gStyle->SetOptTitle(0);
    
    
    TH1* array[30];
    TFile *_file0 = TFile::Open("unfoldplots.root");
    TH1* xjgjetone = (TH1*)gROOT->FindObject("unfold5p2");
    array[0]= xjgjetone;
    
    TFile *_file1 = TFile::Open("unfoldplots.root");
    TH1* xjgjettwo = (TH1*)gROOT->FindObject("unfold5p3");
    array[1]= xjgjettwo;
    
    TFile *_file2 = TFile::Open("unfoldplots.root");
    TH1* xjgjetthree = (TH1*)gROOT->FindObject("unfold5p4");
    array[2]= xjgjetthree;
    
    TFile *_file3 = TFile::Open("unfoldplots.root");
    TH1* xjgjetfour = (TH1*)gROOT->FindObject("unfold10p2");
    array[3]= xjgjetfour;
    
    TFile *_file4 = TFile::Open("unfoldplots.root");
    TH1* xjgjetfive = (TH1*)gROOT->FindObject("unfold10p3");
    array[4]= xjgjetfive;
    
    TFile *_file5 = TFile::Open("unfoldplots.root");
    TH1* xjgjetsix = (TH1*)gROOT->FindObject("unfold10p4");
    array[5]= xjgjetsix;
    
    TFile *_file6 = TFile::Open("unfoldplots.root");
    TH1* xjgjetseven = (TH1*)gROOT->FindObject("unfold15p2");
    array[6]= xjgjetseven;
    
    TFile *_file7 = TFile::Open("unfoldplots.root");
    TH1* xjgjeteight = (TH1*)gROOT->FindObject("unfold15p3");
    array[7]= xjgjeteight;
    
    TFile *_file8 = TFile::Open("unfoldplots.root");
    TH1* xjgjetnine = (TH1*)gROOT->FindObject("unfold15p4");
    array[8]= xjgjetnine;
    
    TFile *_file0 = TFile::Open("unfoldplots.root");
    TH1* xjgjetonea = (TH1*)gROOT->FindObject("unfold20p2");
    array[9]= xjgjetonea;
    
    TFile *_file1 = TFile::Open("unfoldplots.root");
    TH1* xjgjettwoa = (TH1*)gROOT->FindObject("unfold20p3");
    array[10]= xjgjettwoa;
    
    TFile *_file2 = TFile::Open("unfoldplots.root");
    TH1* xjgjetthreea = (TH1*)gROOT->FindObject("unfold20p4");
    array[11]= xjgjetthreea;
    
    TFile *_file3 = TFile::Open("unfoldplots.root");
    TH1* xjgjetfoura = (TH1*)gROOT->FindObject("unfold25p2");
    array[12]= xjgjetfoura;
    
    TFile *_file4 = TFile::Open("unfoldplots.root");
    TH1* xjgjetfivea = (TH1*)gROOT->FindObject("unfold25p3");
    array[13]= xjgjetfivea;
    
    TFile *_file5 = TFile::Open("unfoldplots.root");
    TH1* xjgjetsixa = (TH1*)gROOT->FindObject("unfold25p4");
    array[14]= xjgjetsixa;
    
    TFile *_file0 = TFile::Open("unfoldplots.root");
    TH1* xjgjetone = (TH1*)gROOT->FindObject("unfold30p2");
    array[15]= xjgjetone;
    
    TFile *_file1 = TFile::Open("unfoldplots.root");
    TH1* xjgjettwo = (TH1*)gROOT->FindObject("unfold30p3");
    array[16]= xjgjettwo;
    
    TFile *_file2 = TFile::Open("unfoldplots.root");
    TH1* xjgjetthree = (TH1*)gROOT->FindObject("unfold30p4");
    array[17]= xjgjetthree;
    
    TFile *_file3 = TFile::Open("unfoldplots.root");
    TH1* xjgjetfour = (TH1*)gROOT->FindObject("unfold35p2");
    array[18]= xjgjetfour;
    
    TFile *_file4 = TFile::Open("unfoldplots.root");
    TH1* xjgjetfive = (TH1*)gROOT->FindObject("unfold35p3");
    array[19]= xjgjetfive;
    
    TFile *_file5 = TFile::Open("unfoldplots.root");
    TH1* xjgjetsix = (TH1*)gROOT->FindObject("unfold35p4");
    array[20]= xjgjetsix;
    
    TFile *_file6 = TFile::Open("unfoldplots.root");
    TH1* xjgjetseven = (TH1*)gROOT->FindObject("unfold40p2");
    array[21]= xjgjetseven;
    
    TFile *_file7 = TFile::Open("unfoldplots.root");
    TH1* xjgjeteight = (TH1*)gROOT->FindObject("unfold40p3");
    array[22]= xjgjeteight;
    
    TFile *_file8 = TFile::Open("unfoldplots.root");
    TH1* xjgjetnine = (TH1*)gROOT->FindObject("unfold40p4");
    array[23]= xjgjetnine;
    TFile *_file0 = TFile::Open("unfoldplots.root");
    TH1* xjgjetone = (TH1*)gROOT->FindObject("unfold45p2");
    array[24]= xjgjetone;
    
    TFile *_file1 = TFile::Open("unfoldplots.root");
    TH1* xjgjettwo = (TH1*)gROOT->FindObject("unfold45p3");
    array[25]= xjgjettwo;
    
    TFile *_file2 = TFile::Open("unfoldplots.root");
    TH1* xjgjetthree = (TH1*)gROOT->FindObject("unfold45p4");
    array[26]= xjgjetthree;
    
    TFile *_file3 = TFile::Open("unfoldplots.root");
    TH1* xjgjetfour = (TH1*)gROOT->FindObject("unfold50p2");
    array[27]= xjgjetfour;
    
    TFile *_file4 = TFile::Open("unfoldplots.root");
    TH1* xjgjetfive = (TH1*)gROOT->FindObject("unfold50p3");
    array[28]= xjgjetfive;
    
    TFile *_file5 = TFile::Open("unfoldplots.root");
    TH1* xjgjetsix = (TH1*)gROOT->FindObject("unfold50p4");
    array[29]= xjgjetsix;
    Double_t upt5[3];
    Double_t upt10[3];
    Double_t upt15[3];
    Double_t upt20[3];
    Double_t upt25[3];
    Double_t upt30[3];
    Double_t upt35[3];
    Double_t upt40[3];
    Double_t upt45[3];
    Double_t upt50[3];
    for(int i=0;i<3;i++)
        upt5[i]=array[i]->GetMean();
    for(int i=3;i<6;i++)
        upt10[i-3]=array[i]->GetMean();
    for(int i=6;i<9;i++)
        upt15[i-6]=array[i]->GetMean();
    for(int i=9;i<12;i++)
        upt20[i-9]=array[i]->GetMean();
    for(int i=12;i<15;i++)
        upt25[i-12]=array[i]->GetMean();
    for(int i=15;i<18;i++)
        upt30[i-15]=array[i]->GetMean();
    for(int i=18;i<21;i++)
        upt35[i-18]=array[i]->GetMean();
    for(int i=21;i<24;i++)
        upt40[i-21]=array[i]->GetMean();
    for(int i=24;i<27;i++)
        upt45[i-24]=array[i]->GetMean();
    for(int i=27;i<30;i++)
        upt50[i-27]=array[i]->GetMean();
    
    Double_t eupt5[3];
    Double_t eupt10[3];
    Double_t eupt15[3];
    Double_t eupt20[3];
    Double_t eupt25[3];
    Double_t eupt30[3];
    Double_t eupt35[3];
    Double_t eupt40[3];
    Double_t eupt45[3];
    Double_t eupt50[3];
    for(int i=0;i<3;i++)
        eupt5[i]=array[i]->GetRMS();
    for(int i=3;i<6;i++)
        eupt10[i-3]=array[i]->GetRMS();
    for(int i=6;i<9;i++)
        eupt15[i-6]=array[i]->GetRMS();
    for(int i=9;i<12;i++)
        eupt20[i-9]=array[i]->GetRMS();
    for(int i=12;i<15;i++)
        eupt25[i-12]=array[i]->GetRMS();
    for(int i=15;i<18;i++)
        eupt30[i-15]=array[i]->GetRMS();
    for(int i=18;i<21;i++)
        eupt35[i-18]=array[i]->GetRMS();
    for(int i=21;i<24;i++)
        eupt40[i-21]=array[i]->GetRMS();
    for(int i=24;i<27;i++)
        eupt45[i-24]=array[i]->GetRMS();
    for(int i=27;i<30;i++)
        eupt50[i-27]=array[i]->GetRMS();
TCanvas *c3= new TCanvas("c3","",1000,1000);
    Double_t jpt5[3]={0.469616,0.528041,0.566678};
    Double_t jpt15[3]={0.558344,0.627056,0.641796};
    Double_t jpt25[3]={0.6521,0.710176,0.719287};
    Double_t jpt35[3]={0.701202,0.753099,0.757408};
    Double_t jpt45[3]={0.742131,0.792112,0.806184};
    Double_t spt5[3]={1.09789,1.40334,1.90479};
    Double_t spt15[3]={0.648738,0.805447,1.05616};
    Double_t spt25[3]={0.699613,0.815683,0.985538};
    Double_t spt35[3]={0.735253,0.831829,0.95974};
    Double_t spt45[3]={0.760689,0.841417,0.946005};
    Double_t ejpt5[3]={0.243201,0.287315,0.330208};
    Double_t ejpt15[3]={0.264054,0.302826,0.342976};
    Double_t ejpt25[3]={0.254102,0.277335,0.316553};
    Double_t ejpt35[3]={0.234616,0.249164,0.287426};
    Double_t ejpt45[3]={0.207817,0.211231,0.238832};
    Double_t espt5[3]={0.331098,0.443326,0.52885};
    Double_t espt15[3]={0.228333,0.260963,0.307121};
    Double_t espt25[3]={0.23027,0.235426,0.248455};
    Double_t espt35[3]={0.218582,0.211284,0.215638};
    Double_t espt45[3]={0.202461,0.19085,0.191792};
    Double_t jpt10[3]={0.496099,0.577304,0.604262};
    Double_t jpt20[3]={0.61097,0.674566,0.681365};
    Double_t jpt30[3]={0.681712,0.734251,0.744046};
    Double_t jpt40[3]={0.728408,0.780619,0.792677};
    Double_t jpt50[3]={0.75418,0.804495,0.815444};
    Double_t spt10[3]={0.701405,0.892986,1.24353};
    Double_t spt20[3]={0.673904,0.80738,1.00034};
    Double_t spt30[3]={0.724249,0.826071,0.969782};
    Double_t spt40[3]={0.751304,0.838823,0.952558};
    Double_t spt50[3]={0.769957,0.84622,0.942272};
    Double_t ejpt10[3]={0.255846,0.299941,0.337053};
    Double_t ejpt20[3]={0.259329,0.291999,0.332003};
    Double_t ejpt30[3]={0.246683,0.266093,0.298417};
    Double_t ejpt40[3]={0.2144,0.223676,0.255009};
    Double_t ejpt50[3]={0.198518,0.194969,0.226226};
    Double_t espt10[3]={0.220521,0.286525,0.367507};
    Double_t espt20[3]={0.233455,0.251319,0.280164};
    Double_t espt30[3]={0.225364,0.219934,0.227235};
    Double_t espt40[3]={0.205521,0.197867,0.201941};
    Double_t espt50[3]={0.196179,0.185749,0.184484};
    Double_t count[3]={0.18,0.28,0.38};
    Double_t count2[3]={0.19,0.29,0.39};
    Double_t count3[3]={.2,.3,.4};
    Double_t count4[3]={.21,.31,.41};
    Double_t count5[3]={.22,.32,.42};
    Double_t range[3]={.15,.45,.3};
    Double_t ex[3]={0,0,0};
    
    TCanvas* c3 = new TCanvas("c3","",1000,1000);
    TGraphErrors *blank=new TGraphErrors(3,range,ex,ex,ex);
    blank->GetYaxis()->SetRangeUser(0,1.5);
    blank->GetYaxis()->SetTitle("mean X_{J#gamma}");
    blank->GetXaxis()->SetTitle("Jet Radius");
    blank->Draw();
    TGraphErrors *f = new TGraphErrors(3,count,jpt5,ex,ejpt5);
    f->GetYaxis()->SetRangeUser(0,3);
    f->GetXaxis()->SetRangeUser(.15,.42);
    f->SetMarkerStyle(23);
    f->SetMarkerSize(2);
    f->SetMarkerColor(kAzure);
    f->SetLineColor(kAzure);
    f->GetYaxis()->SetTitle("Mean XJG");
    f->GetXaxis()->SetTitle("Jet Radius");
    f->Draw("P");
    TGraphErrors *fe = new TGraphErrors(3,count2,jpt10,ex,ejpt10);
    fe->GetYaxis()->SetRangeUser(0,3);
    fe->GetXaxis()->SetRangeUser(.15,.45);
    fe->SetMarkerStyle(23);
    fe->SetMarkerSize(2);
    fe->SetMarkerColor(kAzure+2);
    fe->SetLineColor(kAzure+2);
    fe->GetYaxis()->SetTitle("Mean XJG");
    fe->GetXaxis()->SetTitle("Jet Radius");
    fe->Draw("P");
    TGraphErrors *g = new TGraphErrors(3,count3,jpt15,ex,ejpt15);
    //g->GetYaxis()->SetRangeUser(0,2);
    g->SetMarkerStyle(23);
    g->SetMarkerSize(2);
    g->SetMarkerColor(kMagenta);
    g->SetLineColor(kMagenta);
    g->Draw("P");
    TGraphErrors *ge = new TGraphErrors(3,count4,jpt20,ex,ejpt20);
    //g->GetYaxis()->SetRangeUser(0,2);
    ge->SetMarkerStyle(23);
    ge->SetMarkerSize(2);
    ge->SetMarkerColor(kMagenta+2);
    ge->SetLineColor(kMagenta+2);
    ge->Draw("P");
    TGraphErrors *h = new TGraphErrors(3,count5,jpt25,ex,ejpt25);
    //h->GetYaxis()->SetRangeUser(0,2);
    h->SetMarkerStyle(23);
    h->SetMarkerSize(2);
    h->SetMarkerColor(kRed);
    h->SetLineColor(kRed);
    h->Draw("P");
    TGraphErrors *he = new TGraphErrors(3,count,jpt30,ex,ejpt30);
    //h->GetYaxis()->SetRangeUser(0,2);
    he->SetMarkerStyle(23);
    he->SetMarkerSize(2);
    he->SetMarkerColor(kRed+2);
    he->SetLineColor(kRed+2);
    he->Draw("P");
    TGraphErrors *w = new TGraphErrors(3,count2,jpt35,ex,ejpt35);
    //g->GetYaxis()->SetRangeUser(0,2);
    w->SetMarkerStyle(23);
    w->SetMarkerSize(2);
    w->SetMarkerColor(kOrange);
    w->SetLineColor(kOrange);
    w->Draw("P");
    TGraphErrors *we = new TGraphErrors(3,count3,jpt40,ex,ejpt40);
    //g->GetYaxis()->SetRangeUser(0,2);
    we->SetMarkerStyle(23);
    we->SetMarkerSize(2);
    we->SetMarkerColor(kOrange+2);
    we->SetLineColor(kOrange+2);
    we->Draw("P");
    TGraphErrors *q = new TGraphErrors(3,count4,jpt45,ex,ejpt45);
    //h->GetYaxis()->SetRangeUser(0,2);
    q->SetMarkerStyle(23);
    q->SetMarkerSize(2);
    q->SetMarkerColor(kGreen);
    q->SetLineColor(kGreen);
    q->Draw("P");
    TGraphErrors *qe = new TGraphErrors(3,count5,jpt50,ex,ejpt50);
    //h->GetYaxis()->SetRangeUser(0,2);
    qe->SetMarkerStyle(23);
    qe->SetMarkerSize(2);
    qe->SetMarkerColor(kGreen+2);
    qe->SetLineColor(kGreen+2);
    qe->Draw("P");
    TGraphErrors *j = new TGraphErrors(3,count,spt5,ex,espt5);
    //h->GetYaxis()->SetRangeUser(0,2);
    j->SetMarkerStyle(28);
    j->SetMarkerSize(2);
    j->SetMarkerColor(kAzure);
    j->SetLineColor(kAzure);
    j->Draw("P");
    TGraphErrors *je = new TGraphErrors(3,count2,spt10,ex,espt10);
    //h->GetYaxis()->SetRangeUser(0,2);
    je->SetMarkerStyle(28);
    je->SetMarkerSize(2);
    je->SetMarkerColor(kAzure+2);
    je->SetLineColor(kAzure+2);
    je->Draw("P");
    TGraphErrors *k = new TGraphErrors(3,count3,spt15,ex,espt15);
    //h->GetYaxis()->SetRangeUser(0,2);
    k->SetMarkerStyle(28);
    k->SetMarkerSize(2);
    k->SetMarkerColor(kMagenta);
    k->SetLineColor(kMagenta);
    k->Draw("P");
    TGraphErrors *ke = new TGraphErrors(3,count4,spt20,ex,espt20);
    //h->GetYaxis()->SetRangeUser(0,2);
    ke->SetMarkerStyle(28);
    ke->SetMarkerSize(2);
    ke->SetMarkerColor(kMagenta+2);
    ke->SetLineColor(kMagenta+2);
    ke->Draw("P");
    TGraphErrors *l = new TGraphErrors(3,count5,spt25,ex,espt25);
    //h->GetYaxis()->SetRangeUser(0,2);
    l->SetMarkerStyle(28);
    l->SetMarkerSize(2);
    l->SetMarkerColor(kRed);
    l->SetLineColor(kRed);
    l->Draw("P");
    TGraphErrors *le = new TGraphErrors(3,count,spt30,ex,espt30);
    //h->GetYaxis()->SetRangeUser(0,2);
    le->SetMarkerStyle(28);
    le->SetMarkerSize(2);
    le->SetMarkerColor(kRed+2);
    le->SetLineColor(kRed+2);
    le->Draw("P");
    TGraphErrors *r = new TGraphErrors(3,count2,spt35,ex,espt35);
    //g->GetYaxis()->SetRangeUser(0,2);
    r->SetMarkerStyle(28);
    r->SetMarkerSize(2);
    r->SetMarkerColor(kOrange);
    r->SetLineColor(kOrange);
    r->Draw("P");
    TGraphErrors *re = new TGraphErrors(3,count3,spt40,ex,espt40);
    //g->GetYaxis()->SetRangeUser(0,2);
    re->SetMarkerStyle(28);
    re->SetMarkerSize(2);
    re->SetMarkerColor(kOrange+2);
    re->SetLineColor(kOrange+2);
    re->Draw("P");
    TGraphErrors *y = new TGraphErrors(3,count4,spt45,ex,espt45);
    //h->GetYaxis()->SetRangeUser(0,2);
    y->SetMarkerStyle(28);
    y->SetMarkerSize(2);
    y->SetMarkerColor(kGreen);
    y->SetLineColor(kGreen);
    y->Draw("P");
    TGraphErrors *ye = new TGraphErrors(3,count5,spt50,ex,espt50);
    //h->GetYaxis()->SetRangeUser(0,2);
    ye->SetMarkerStyle(28);
    ye->SetMarkerSize(2);
    ye->SetMarkerColor(kGreen+2);
    ye->SetLineColor(kGreen+2);
    ye->Draw("P");
    TGraphErrors *uj = new TGraphErrors(3,count,upt5,ex,eupt5);
    //h->GetYaxis()->SetRangeUser(0,2);
    uj->SetMarkerStyle(30);
    uj->SetMarkerSize(2);
    uj->SetMarkerColor(kAzure);
    uj->SetLineColor(kAzure);
    uj->Draw("P");
    TGraphErrors *uje = new TGraphErrors(3,count2,upt10,ex,eupt10);
    //h->GetYaxis()->SetRangeUser(0,2);
    uje->SetMarkerStyle(30);
    uje->SetMarkerSize(2);
    uje->SetMarkerColor(kAzure+2);
    uje->SetLineColor(kAzure+2);
    uje->Draw("P");
    TGraphErrors *uk = new TGraphErrors(3,count3,upt15,ex,eupt15);
    //h->GetYaxis()->SetRangeUser(0,2);
    uk->SetMarkerStyle(30);
    uk->SetMarkerSize(2);
    uk->SetMarkerColor(kMagenta);
    uk->SetLineColor(kMagenta);
    uk->Draw("P");
    TGraphErrors *uke = new TGraphErrors(3,count4,upt20,ex,eupt20);
    //h->GetYaxis()->SetRangeUser(0,2);
    uke->SetMarkerStyle(30);
    uke->SetMarkerSize(2);
    uke->SetMarkerColor(kMagenta+2);
    uke->SetLineColor(kMagenta+2);
    uke->Draw("P");
    TGraphErrors *ul = new TGraphErrors(3,count5,upt25,ex,eupt25);
    //h->GetYaxis()->SetRangeUser(0,2);
    ul->SetMarkerStyle(30);
    ul->SetMarkerSize(2);
    ul->SetMarkerColor(kRed);
    ul->SetLineColor(kRed);
    ul->Draw("P");
    TGraphErrors *ule = new TGraphErrors(3,count,upt30,ex,eupt30);
    //h->GetYaxis()->SetRangeUser(0,2);
    ule->SetMarkerStyle(30);
    ule->SetMarkerSize(2);
    ule->SetMarkerColor(kRed+2);
    ule->SetLineColor(kRed+2);
    ule->Draw("P");
    TGraphErrors *ur = new TGraphErrors(3,count2,upt35,ex,eupt35);
    //g->GetYaxis()->SetRangeUser(0,2);
    ur->SetMarkerStyle(30);
    ur->SetMarkerSize(2);
    ur->SetMarkerColor(kOrange);
    ur->SetLineColor(kOrange);
    ur->Draw("P");
    TGraphErrors *ure = new TGraphErrors(3,count3,upt40,ex,eupt40);
    //g->GetYaxis()->SetRangeUser(0,2);
    ure->SetMarkerStyle(30);
    ure->SetMarkerSize(2);
    ure->SetMarkerColor(kOrange+2);
    ure->SetLineColor(kOrange+2);
    ure->Draw("P");
    TGraphErrors *uy = new TGraphErrors(3,count4,upt45,ex,eupt45);
    //h->GetYaxis()->SetRangeUser(0,2);
    uy->SetMarkerStyle(30);
    uy->SetMarkerSize(2);
    uy->SetMarkerColor(kGreen);
    uy->SetLineColor(kGreen);
    uy->Draw("P");
    TGraphErrors *uye = new TGraphErrors(3,count5,upt50,ex,eupt50);
    //h->GetYaxis()->SetRangeUser(0,2);
    uye->SetMarkerStyle(30);
    uye->SetMarkerSize(2);
    uye->SetMarkerColor(kGreen+2);
    uye->SetLineColor(kGreen+2);
    uye->Draw("P");
    TLegend* leg9 = new TLegend(0.7,0.8,0.85,0.85);
    SetLeg(leg9,.03);
    leg9->AddEntry(fe,"PYTHIA","P");
    leg9->AddEntry(ye,"PYTHIA-#rhoA","P");
    leg9->AddEntry(ure,"Unfolded","P");
    leg9->AddEntry(f,"5 GeV","l");
    leg9->AddEntry(fe,"10 GeV","l");
    leg9->AddEntry(g,"15 GeV","l");
    leg9->AddEntry(ge,"20 GeV","l");
    leg9->AddEntry(h,"25 GeV","l");
    leg9->AddEntry(he,"30 GeV","l");
    leg9->AddEntry(w,"35 GeV","l");
    leg9->AddEntry(we,"40 GeV","l");
    leg9->AddEntry(q,"45 GeV","l");
    leg9->AddEntry(qe,"50 GeV","l");
    leg9->Draw();

    
//Effeciency plots using % error to quantify how well the subtractor and unfolding do numerically
    
    Double_t perupt5[3];
    Double_t perupt10[3];
    Double_t perupt15[3];
    Double_t perupt20[3];
    Double_t perupt25[3];
    Double_t perupt30[3];
    Double_t perupt35[3];
    Double_t perupt40[3];
    Double_t perupt45[3];
    Double_t perupt50[3];
    Double_t eperupt5[3];
    Double_t eperupt10[3];
    Double_t eperupt15[3];
    Double_t eperupt20[3];
    Double_t eperupt25[3];
    Double_t eperupt30[3];
    Double_t eperupt35[3];
    Double_t eperupt40[3];
    Double_t eperupt45[3];
    Double_t eperupt50[3];
    
    for(int i=0;i<3;i++)
        perupt5[i]=(fabs(jpt5[i]-upt5[i])/jpt5[i])*100;
    for(int i=0;i<3;i++)
        perupt10[i]=(fabs(jpt10[i]-upt10[i])/jpt10[i])*100;
    for(int i=0;i<3;i++)
        perupt15[i]=(fabs(jpt15[i]-upt15[i])/jpt15[i])*100;
    for(int i=0;i<3;i++)
        perupt20[i]=(fabs(jpt20[i]-upt20[i])/jpt20[i])*100;
    for(int i=0;i<3;i++)
        perupt25[i]=(fabs(jpt25[i]-upt25[i])/jpt25[i])*100;
    for(int i=0;i<3;i++)
        perupt30[i]=(fabs(jpt30[i]-upt30[i])/jpt30[i])*100;
    for(int i=0;i<3;i++)
        perupt35[i]=(fabs(jpt35[i]-upt35[i])/jpt35[i])*100;
    for(int i=0;i<3;i++)
        perupt40[i]=(fabs(jpt40[i]-upt40[i])/jpt40[i])*100;
    for(int i=0;i<3;i++)
        perupt45[i]=(fabs(jpt45[i]-upt45[i])/jpt45[i])*100;
    for(int i=0;i<3;i++)
        perupt50[i]=(fabs(jpt50[i]-upt50[i])/jpt50[i])*100;
    
    for(int i=0;i<3;i++)
        eperupt5[i]=TMath::Power((((eupt5[i]*eupt5[i])+(ejpt5[i]*ejpt5[i]))/(perupt5[i]*perupt5[i]))+((ejpt5[i]*ejpt5[i])/(jpt5[i]*jpt5[i])),0.5)*perupt5[i];
    for(int i=0;i<3;i++)
        eperupt10[i]=TMath::Power((((eupt10[i]*eupt10[i])+(ejpt10[i]*ejpt10[i]))/(perupt10[i]*perupt10[i]))+((ejpt10[i]*ejpt10[i])/(jpt10[i]*jpt10[i])),0.5)*perupt10[i];
    for(int i=0;i<3;i++)
        eperupt15[i]=TMath::Power((((eupt15[i]*eupt15[i])+(ejpt15[i]*ejpt15[i]))/(perupt15[i]*perupt15[i]))+((ejpt15[i]*ejpt15[i])/(jpt15[i]*jpt15[i])),0.5)*perupt15[i];
    for(int i=0;i<3;i++)
        eperupt20[i]=TMath::Power((((eupt20[i]*eupt20[i])+(ejpt20[i]*ejpt20[i]))/(perupt20[i]*perupt20[i]))+((ejpt20[i]*ejpt20[i])/(jpt20[i]*jpt20[i])),0.5)*perupt20[i];
    for(int i=0;i<3;i++)
        eperupt25[i]=TMath::Power((((eupt25[i]*eupt25[i])+(ejpt25[i]*ejpt25[i]))/(perupt25[i]*perupt25[i]))+((ejpt25[i]*ejpt25[i])/(jpt25[i]*jpt25[i])),0.5)*perupt25[i];
    for(int i=0;i<3;i++)
        eperupt30[i]=TMath::Power((((eupt30[i]*eupt30[i])+(ejpt30[i]*ejpt30[i]))/(perupt30[i]*perupt30[i]))+((ejpt30[i]*ejpt30[i])/(jpt30[i]*jpt30[i])),0.5)*perupt30[i];
    for(int i=0;i<3;i++)
        eperupt35[i]=TMath::Power((((eupt35[i]*eupt35[i])+(ejpt35[i]*ejpt35[i]))/(perupt35[i]*perupt35[i]))+((ejpt35[i]*ejpt35[i])/(jpt35[i]*jpt35[i])),0.5)*perupt35[i];
    for(int i=0;i<3;i++)
        eperupt40[i]=TMath::Power((((eupt40[i]*eupt40[i])+(ejpt40[i]*ejpt40[i]))/(perupt40[i]*perupt40[i]))+((ejpt40[i]*ejpt40[i])/(jpt40[i]*jpt40[i])),0.5)*perupt40[i];
    for(int i=0;i<3;i++)
        eperupt45[i]=TMath::Power((((eupt45[i]*eupt45[i])+(ejpt45[i]*ejpt45[i]))/(perupt45[i]*perupt45[i]))+((ejpt45[i]*ejpt45[i])/(jpt45[i]*jpt45[i])),0.5)*perupt45[i];
    for(int i=0;i<3;i++)
        eperupt50[i]=TMath::Power((((eupt50[i]*eupt50[i])+(ejpt50[i]*ejpt50[i]))/(perupt50[i]*perupt50[i]))+((ejpt50[i]*ejpt50[i])/(jpt50[i]*jpt50[i])),0.5)*perupt50[i];
    
    Double_t perspt5[3];
    Double_t perspt10[3];
    Double_t perspt15[3];
    Double_t perspt20[3];
    Double_t perspt25[3];
    Double_t perspt30[3];
    Double_t perspt35[3];
    Double_t perspt40[3];
    Double_t perspt45[3];
    Double_t perspt50[3];
    Double_t eperspt5[3];
    Double_t eperspt10[3];
    Double_t eperspt15[3];
    Double_t eperspt20[3];
    Double_t eperspt25[3];
    Double_t eperspt30[3];
    Double_t eperspt35[3];
    Double_t eperspt40[3];
    Double_t eperspt45[3];
    Double_t eperspt50[3];
    
    for(int i=0;i<3;i++)
        perspt5[i]=(fabs(jpt5[i]-spt5[i])/spt5[i])*100;
    for(int i=0;i<3;i++)
        perspt10[i]=(fabs(jpt10[i]-spt10[i])/spt10[i])*100;
    for(int i=0;i<3;i++)
        perspt15[i]=(fabs(jpt15[i]-spt15[i])/spt15[i])*100;
    for(int i=0;i<3;i++)
        perspt20[i]=(fabs(jpt20[i]-spt20[i])/spt20[i])*100;
    for(int i=0;i<3;i++)
        perspt25[i]=(fabs(jpt25[i]-spt25[i])/spt25[i])*100;
    for(int i=0;i<3;i++)
        perspt30[i]=(fabs(jpt30[i]-spt30[i])/spt30[i])*100;
    for(int i=0;i<3;i++)
        perspt35[i]=(fabs(jpt35[i]-spt35[i])/spt35[i])*100;
    for(int i=0;i<3;i++)
        perspt40[i]=(fabs(jpt40[i]-spt40[i])/spt40[i])*100;
    for(int i=0;i<3;i++)
        perspt45[i]=(fabs(jpt45[i]-spt45[i])/spt45[i])*100;
    for(int i=0;i<3;i++)
        perspt50[i]=(fabs(jpt50[i]-spt50[i])/spt50[i])*100;
    
    for(int i=0;i<3;i++)
        eperspt5[i]=TMath::Power((((espt5[i]*espt5[i])+(ejpt5[i]*ejpt5[i]))/(perspt5[i]*perspt5[i]))+((ejpt5[i]*ejpt5[i])/(jpt5[i]*jpt5[i])),0.5)*perspt5[i];
    for(int i=0;i<3;i++)
        eperspt10[i]=TMath::Power((((espt10[i]*espt10[i])+(ejpt10[i]*ejpt10[i]))/(perspt10[i]*perspt10[i]))+((ejpt10[i]*ejpt10[i])/(jpt10[i]*jpt10[i])),0.5)*perspt10[i];
    for(int i=0;i<3;i++)
        eperspt15[i]=TMath::Power((((espt15[i]*espt15[i])+(ejpt15[i]*ejpt15[i]))/(perspt15[i]*perspt15[i]))+((ejpt15[i]*ejpt15[i])/(jpt15[i]*jpt15[i])),0.5)*perspt15[i];
    for(int i=0;i<3;i++)
        eperspt20[i]=TMath::Power((((espt20[i]*espt20[i])+(ejpt20[i]*ejpt20[i]))/(perspt20[i]*perspt20[i]))+((ejpt20[i]*ejpt20[i])/(jpt20[i]*jpt20[i])),0.5)*perspt20[i];
    for(int i=0;i<3;i++)
        eperspt25[i]=TMath::Power((((espt25[i]*espt25[i])+(ejpt25[i]*ejpt25[i]))/(perspt25[i]*perspt25[i]))+((ejpt25[i]*ejpt25[i])/(jpt25[i]*jpt25[i])),0.5)*perspt25[i];
    for(int i=0;i<3;i++)
        eperspt30[i]=TMath::Power((((espt30[i]*espt30[i])+(ejpt30[i]*ejpt30[i]))/(perspt30[i]*perspt30[i]))+((ejpt30[i]*ejpt30[i])/(jpt30[i]*jpt30[i])),0.5)*perspt30[i];
    for(int i=0;i<3;i++)
        eperspt35[i]=TMath::Power((((espt35[i]*espt35[i])+(ejpt35[i]*ejpt35[i]))/(perspt35[i]*perspt35[i]))+((ejpt35[i]*ejpt35[i])/(jpt35[i]*jpt35[i])),0.5)*perspt35[i];
    for(int i=0;i<3;i++)
        eperspt40[i]=TMath::Power((((espt40[i]*espt40[i])+(ejpt40[i]*ejpt40[i]))/(perspt40[i]*perspt40[i]))+((ejpt40[i]*ejpt40[i])/(jpt40[i]*jpt40[i])),0.5)*perspt40[i];
    for(int i=0;i<3;i++)
        eperspt45[i]=TMath::Power((((espt45[i]*espt45[i])+(ejpt45[i]*ejpt45[i]))/(perspt45[i]*perspt45[i]))+((ejpt45[i]*ejpt45[i])/(jpt45[i]*jpt45[i])),0.5)*perspt45[i];
    for(int i=0;i<3;i++)
        eperspt50[i]=TMath::Power((((espt50[i]*espt50[i])+(ejpt50[i]*ejpt50[i]))/(perspt50[i]*perspt50[i]))+((ejpt50[i]*ejpt50[i])/(jpt50[i]*jpt50[i])),0.5)*perspt50[i];
    
    
    TCanvas* c7 = new TCanvas("c7","",1000,1000);
    TGraphErrors *blank=new TGraphErrors(3,range,ex,ex,ex);
    blank->GetYaxis()->SetRangeUser(0,150);
    blank->GetYaxis()->SetTitle("% error");
    blank->GetXaxis()->SetTitle("Jet Radius");
    blank->Draw();
    TGraphErrors *uj = new TGraphErrors(3,count,perupt5,ex,eperupt5);
    //h->GetYaxis()->SetRangeUser(0,2);
    uj->SetMarkerStyle(30);
    uj->SetMarkerSize(2);
    uj->SetMarkerColor(kAzure);
    uj->SetLineColor(kAzure);
    uj->Draw("P");
    TGraphErrors *uje = new TGraphErrors(3,count2,perupt10,ex,eperupt10);
    //h->GetYaxis()->SetRangeUser(0,2);
    uje->SetMarkerStyle(30);
    uje->SetMarkerSize(2);
    uje->SetMarkerColor(kAzure+2);
    uje->SetLineColor(kAzure+2);
    uje->Draw("P");
    TGraphErrors *uk = new TGraphErrors(3,count3,perupt15,ex,eperupt15);
    //h->GetYaxis()->SetRangeUser(0,2);
    uk->SetMarkerStyle(30);
    uk->SetMarkerSize(2);
    uk->SetMarkerColor(kMagenta);
    uk->SetLineColor(kMagenta);
    uk->Draw("P");
    TGraphErrors *uke = new TGraphErrors(3,count4,perupt20,ex,eperupt20);
    //h->GetYaxis()->SetRangeUser(0,2);
    uke->SetMarkerStyle(30);
    uke->SetMarkerSize(2);
    uke->SetMarkerColor(kMagenta+2);
    uke->SetLineColor(kMagenta+2);
    uke->Draw("P");
    TGraphErrors *ul = new TGraphErrors(3,count5,perupt25,ex,eperupt25);
    //h->GetYaxis()->SetRangeUser(0,2);
    ul->SetMarkerStyle(30);
    ul->SetMarkerSize(2);
    ul->SetMarkerColor(kRed);
    ul->SetLineColor(kRed);
    ul->Draw("P");
    TGraphErrors *ule = new TGraphErrors(3,count,perupt30,ex,eperupt30);
    //h->GetYaxis()->SetRangeUser(0,2);
    ule->SetMarkerStyle(30);
    ule->SetMarkerSize(2);
    ule->SetMarkerColor(kRed+2);
    ule->SetLineColor(kRed+2);
    ule->Draw("P");
    TGraphErrors *ur = new TGraphErrors(3,count2,perupt35,ex,eperupt35);
    //g->GetYaxis()->SetRangeUser(0,2);
    ur->SetMarkerStyle(30);
    ur->SetMarkerSize(2);
    ur->SetMarkerColor(kOrange);
    ur->SetLineColor(kOrange);
    ur->Draw("P");
    TGraphErrors *ure = new TGraphErrors(3,count3,perupt40,ex,eperupt40);
    //g->GetYaxis()->SetRangeUser(0,2);
    ure->SetMarkerStyle(30);
    ure->SetMarkerSize(2);
    ure->SetMarkerColor(kOrange+2);
    ure->SetLineColor(kOrange+2);
    ure->Draw("P");
    TGraphErrors *uy = new TGraphErrors(3,count4,perupt45,ex,eperupt45);
    //h->GetYaxis()->SetRangeUser(0,2);
    uy->SetMarkerStyle(30);
    uy->SetMarkerSize(2);
    uy->SetMarkerColor(kGreen);
    uy->SetLineColor(kGreen);
    uy->Draw("P");
    TGraphErrors *uye = new TGraphErrors(3,count5,perupt50,ex,eperupt50);
    //h->GetYaxis()->SetRangeUser(0,2);
    uye->SetMarkerStyle(30);
    uye->SetMarkerSize(2);
    uye->SetMarkerColor(kGreen+2);
    uye->SetLineColor(kGreen+2);
    uye->Draw("P");
    TGraphErrors *j = new TGraphErrors(3,count,perspt5,ex,eperspt5);
    //h->GetYaxis()->SetRangeUser(0,2);
    j->SetMarkerStyle(28);
    j->SetMarkerSize(2);
    j->SetMarkerColor(kAzure);
    j->SetLineColor(kAzure);
    j->Draw("P");
    TGraphErrors *je = new TGraphErrors(3,count2,perspt10,ex,eperspt10);
    //h->GetYaxis()->SetRangeUser(0,2);
    je->SetMarkerStyle(28);
    je->SetMarkerSize(2);
    je->SetMarkerColor(kAzure+2);
    je->SetLineColor(kAzure+2);
    je->Draw("P");
    TGraphErrors *k = new TGraphErrors(3,count3,perspt15,ex,eperspt15);
    //h->GetYaxis()->SetRangeUser(0,2);
    k->SetMarkerStyle(28);
    k->SetMarkerSize(2);
    k->SetMarkerColor(kMagenta);
    k->SetLineColor(kMagenta);
    k->Draw("P");
    TGraphErrors *ke = new TGraphErrors(3,count4,perspt20,ex,eperspt20);
    //h->GetYaxis()->SetRangeUser(0,2);
    ke->SetMarkerStyle(28);
    ke->SetMarkerSize(2);
    ke->SetMarkerColor(kMagenta+2);
    ke->SetLineColor(kMagenta+2);
    ke->Draw("P");
    TGraphErrors *l = new TGraphErrors(3,count5,perspt25,ex,eperspt25);
    //h->GetYaxis()->SetRangeUser(0,2);
    l->SetMarkerStyle(28);
    l->SetMarkerSize(2);
    l->SetMarkerColor(kRed);
    l->SetLineColor(kRed);
    l->Draw("P");
    TGraphErrors *le = new TGraphErrors(3,count,perspt30,ex,eperspt30);
    //h->GetYaxis()->SetRangeUser(0,2);
    le->SetMarkerStyle(28);
    le->SetMarkerSize(2);
    le->SetMarkerColor(kRed+2);
    le->SetLineColor(kRed+2);
    le->Draw("P");
    TGraphErrors *r = new TGraphErrors(3,count2,perspt35,ex,eperspt35);
    //g->GetYaxis()->SetRangeUser(0,2);
    r->SetMarkerStyle(28);
    r->SetMarkerSize(2);
    r->SetMarkerColor(kOrange);
    r->SetLineColor(kOrange);
    r->Draw("P");
    TGraphErrors *re = new TGraphErrors(3,count3,perspt40,ex,eperspt40);
    //g->GetYaxis()->SetRangeUser(0,2);
    re->SetMarkerStyle(28);
    re->SetMarkerSize(2);
    re->SetMarkerColor(kOrange+2);
    re->SetLineColor(kOrange+2);
    re->Draw("P");
    TGraphErrors *y = new TGraphErrors(3,count4,perspt45,ex,eperspt45);
    //h->GetYaxis()->SetRangeUser(0,2);
    y->SetMarkerStyle(28);
    y->SetMarkerSize(2);
    y->SetMarkerColor(kGreen);
    y->SetLineColor(kGreen);
    y->Draw("P");
    TGraphErrors *ye = new TGraphErrors(3,count5,perspt50,ex,eperspt50);
    //h->GetYaxis()->SetRangeUser(0,2);
    ye->SetMarkerStyle(28);
    ye->SetMarkerSize(2);
    ye->SetMarkerColor(kGreen+2);
    ye->SetLineColor(kGreen+2);
    ye->Draw("P");
    TLegend* leg9 = new TLegend(0.7,0.8,0.85,0.85);
    SetLeg(leg9,.03);
    leg9->AddEntry(ye,"PYTHIA-#rhoA","P");
    //leg9->AddEntry(ure,"Unfolded","P");
    leg9->AddEntry(f,"5 GeV","l");
    leg9->AddEntry(fe,"10 GeV","l");
    leg9->AddEntry(g,"15 GeV","l");
    leg9->AddEntry(ge,"20 GeV","l");
    leg9->AddEntry(h,"25 GeV","l");
    leg9->AddEntry(he,"30 GeV","l");
    leg9->AddEntry(w,"35 GeV","l");
    leg9->AddEntry(we,"40 GeV","l");
    leg9->AddEntry(q,"45 GeV","l");
    leg9->AddEntry(qe,"50 GeV","l");
    leg9->Draw();
    
    double submeanone=0;
    /*for(int i=0;i<1;i++)
        submeanone+=perupt5[i];
    for(int i=0;i<1;i++)
        submeanone+=perupt10[i];
    for(int i=0;i<1;i++)*/
        submeanone+=eperupt15[i];
    for(int i=0;i<1;i++)
        submeanone+=eperupt20[i];
    for(int i=0;i<1;i++)
        submeanone+=eperupt25[i];
    for(int i=0;i<1;i++)
        submeanone+=eperupt30[i];
    for(int i=0;i<1;i++)
        submeanone+=eperupt35[i];
    for(int i=0;i<1;i++)
        submeanone+=eperupt40[i];
    for(int i=0;i<1;i++)
        submeanone+=eperupt45[i];
    for(int i=0;i<1;i++)
        submeanone+=eperupt50[i];
        
    cout<<submeanone/8<<endl;
    
    double submeantwo=0;
    /*for(int i=1;i<2;i++)
        submeantwo+=perupt5[i];
    for(int i=1;i<2;i++)
        submeantwo+=perupt10[i];
    for(int i=1;i<2;i++)*/
        submeantwo+=eperupt15[i];
    for(int i=1;i<2;i++)
        submeantwo+=eperupt20[i];
    for(int i=1;i<2;i++)
        submeantwo+=eperupt25[i];
    for(int i=1;i<2;i++)
        submeantwo+=eperupt30[i];
    for(int i=1;i<2;i++)
        submeantwo+=eperupt35[i];
    for(int i=1;i<2;i++)
        submeantwo+=eperupt40[i];
    for(int i=1;i<2;i++)
        submeantwo+=eperupt45[i];
    for(int i=1;i<2;i++)
        submeantwo+=eperupt50[i];
    
    cout<<submeantwo/8<<endl;
    
    double submeanthree=0;
    /*for(int i=2;i<3;i++)
        submeanthree+=perupt5[i];
    for(int i=2;i<3;i++)
        submeanthree+=perupt10[i];
    for(int i=2;i<3;i++)*/
        submeanthree+=eperupt15[i];
    for(int i=2;i<3;i++)
        submeanthree+=eperupt20[i];
    for(int i=2;i<3;i++)
        submeanthree+=eperupt25[i];
    for(int i=2;i<3;i++)
        submeanthree+=eperupt30[i];
    for(int i=2;i<3;i++)
        submeanthree+=eperupt35[i];
    for(int i=2;i<3;i++)
        submeanthree+=eperupt40[i];
    for(int i=2;i<3;i++)
        submeanthree+=eperupt45[i];
    for(int i=2;i<3;i++)
        submeanthree+=eperupt50[i];
    
    cout<<submeanthree/8<<endl;
    
    
}
Ejemplo n.º 8
0
void optimize_n_jets(const TString sigName = "reduced_trees/SMS-T1tttt_2J_mGl-1500_mLSP-100*v75*.root", const TString bgName = "all", const TString plotNote="T1tttt_1500_100_met_200_ht40_1000", const TCut cuts="") 
{
  set_plot_style();
  TH1::StatOverflows(true);
  TH1::SetDefaultSumw2(); //trick to turn on Sumw2 for all histos
  //TH1::SetStats(0);

  const unsigned int nbins = 16;

  TH1D* h_n30sig = new TH1D("h_n30sig",";n_{jets};Events after cut (#int L dt = 5 fb^{-1})",nbins,0.,16.);
  TH1D* h_n30bg = new TH1D("h_n30bg","",nbins,0.,16.);
  TH1D* h_n40sig = new TH1D("h_n40sig","",nbins,0.,16.);
  TH1D* h_n40bg = new TH1D("h_n40bg","",nbins,0.,16.);
  TH1D* h_n50sig = new TH1D("h_n50sig","",nbins,0.,16.);
  TH1D* h_n50bg = new TH1D("h_n50bg","",nbins,0.,16.);
  TH1D* h_n70sig = new TH1D("h_n70sig","",nbins,0.,16.);
  TH1D* h_n70bg = new TH1D("h_n70bg","",nbins,0.,16.);
  TH1D* h_n100sig = new TH1D("h_n100sig","",nbins,0.,16.);
  TH1D* h_n100bg = new TH1D("h_n100bg","",nbins,0.,16.);

  // TH1D* h_n30sig_pass = new TH1D("h_n30sig_pass",";n_{jets};EventsPassing cut",nbins,0.,16.);
  // TH1D* h_n40sig_pass = new TH1D("h_n40sig_pass","",nbins,0.,16.);
  // TH1D* h_n50sig_pass = new TH1D("h_n50sig_pass","",nbins,0.,16.);
  // TH1D* h_n70sig_pass = new TH1D("h_n70sig_pass","",nbins,0.,16.);
  // TH1D* h_n100sig_pass = new TH1D("h_n100sig_pass","",nbins,0.,16.);

  TH1D* h_n30s_over_sqrt_b = new TH1D("h_n30s_over_sqrt_b",";n_{jets} cut;S/#sqrt{B}",nbins,0.,16.);
  TH1D* h_n40s_over_sqrt_b = new TH1D("h_n40s_over_sqrt_b","",nbins,0.,16.);
  TH1D* h_n50s_over_sqrt_b = new TH1D("h_n50s_over_sqrt_b","",nbins,0.,16.);
  TH1D* h_n70s_over_sqrt_b = new TH1D("h_n70s_over_sqrt_b","",nbins,0.,16.);
  TH1D* h_n100s_over_sqrt_b = new TH1D("h_n100s_over_sqrt_b","",nbins,0.,16.);

  h_n30sig->SetStats(0);
  h_n30s_over_sqrt_b->SetStats(0);


  TCut start(cuts+"met>200&&ht40>500&&num_csvm_jets30>1&&min_delta_phi_met_N>4&&num_reco_veto_muons==0&&num_reco_veto_electrons==0");
  TCut weighted_selection(start*"(weightppb*5000.)");

  TChain * bg = new TChain("reduced_tree");
  TChain * sig = new TChain("reduced_tree");
  if (!bgName.EqualTo("all")) bg->Add(bgName);// treestring is passed as an argument
  else {
    bg->Add("reduced_trees/skimmed/TTJets*v75*.root");
    bg->Add("reduced_trees/skimmed/QCD*v75*.root");
    bg->Add("reduced_trees/skimmed/WJets*v75*.root");
    bg->Add("reduced_trees/skimmed/ZJets*v75*.root");
    bg->Add("reduced_trees/skimmed/TTo*v75*.root");
    bg->Add("reduced_trees/skimmed/TBarTo*v75*.root");
    bg->Add("reduced_trees/skimmed/*tW*v75*.root");
    bg->Add("reduced_trees/skimmed/*HToBB*v75*.root");
    bg->Add("reduced_trees/skimmed/TTbarH*v75*.root");
  }
  sig->Add(sigName);

  TCanvas * thecanvas= new TCanvas("thecanvas","the canvas",800,1600);
  TPad* pad1 = new TPad("pad1","This is pad1",0.,0.5,1,1);
  TPad* pad2 = new TPad("pad1","This is pad2",0.,0.,1,0.5);
  pad1->Draw();
  pad2->Draw();

  sig->Project("h_n30sig","num_jets_pt30",weighted_selection);
  bg->Project("h_n30bg","num_jets_pt30",weighted_selection);
  sig->Project("h_n40sig","num_jets_pt40",weighted_selection);
  bg->Project("h_n40bg","num_jets_pt40",weighted_selection);
  sig->Project("h_n50sig","num_jets_pt50",weighted_selection);
  bg->Project("h_n50bg","num_jets_pt50",weighted_selection);
  sig->Project("h_n70sig","num_jets_pt70",weighted_selection);
  bg->Project("h_n70bg","num_jets_pt70",weighted_selection);
  sig->Project("h_n100sig","num_jets_pt100",weighted_selection);
  bg->Project("h_n100bg","num_jets_pt100",weighted_selection);

  convert_to_int(h_n30sig);
  convert_to_int(h_n40sig);
  convert_to_int(h_n50sig);
  convert_to_int(h_n70sig);
  convert_to_int(h_n100sig);
  convert_to_int(h_n30bg);
  convert_to_int(h_n40bg);
  convert_to_int(h_n50bg);
  convert_to_int(h_n70bg);
  convert_to_int(h_n100bg);

  for (unsigned int bin(0); bin<nbins+1; bin++) {
    if (h_n30bg->GetBinContent(bin+1)>0) h_n30s_over_sqrt_b->SetBinContent(bin+1, h_n30sig->GetBinContent(bin+1)/sqrt(h_n30bg->GetBinContent(bin+1)));
    else h_n30s_over_sqrt_b->SetBinContent(bin+1,100.);
    if (h_n40bg->GetBinContent(bin+1)>0) h_n40s_over_sqrt_b->SetBinContent(bin+1, h_n40sig->GetBinContent(bin+1)/sqrt(h_n40bg->GetBinContent(bin+1)));
    else h_n40s_over_sqrt_b->SetBinContent(bin+1,100.);
    if (h_n50bg->GetBinContent(bin+1)>0) h_n50s_over_sqrt_b->SetBinContent(bin+1, h_n50sig->GetBinContent(bin+1)/sqrt(h_n50bg->GetBinContent(bin+1)));
    else h_n50s_over_sqrt_b->SetBinContent(bin+1,100.);
    if (h_n70bg->GetBinContent(bin+1)>0) h_n70s_over_sqrt_b->SetBinContent(bin+1, h_n70sig->GetBinContent(bin+1)/sqrt(h_n70bg->GetBinContent(bin+1)));
    else h_n70s_over_sqrt_b->SetBinContent(bin+1,100.);
    if (h_n100bg->GetBinContent(bin+1)>0) h_n100s_over_sqrt_b->SetBinContent(bin+1, h_n100sig->GetBinContent(bin+1)/sqrt(h_n100bg->GetBinContent(bin+1)));
    else h_n100s_over_sqrt_b->SetBinContent(bin+1,100.);
   
    // h_n30sig_pass->SetBinContent(bin+1, h_n30sig->Integral(bin+1,nbins+1));
    // h_n40sig_pass->SetBinContent(bin+1, h_n40sig->Integral(bin+1,nbins+1));
    // h_n50sig_pass->SetBinContent(bin+1, h_n50sig->Integral(bin+1,nbins+1));
    // h_n70sig_pass->SetBinContent(bin+1, h_n70sig->Integral(bin+1,nbins+1));
    // h_n100sig_pass->SetBinContent(bin+1, h_n100sig->Integral(bin+1,nbins+1));
  }

  h_n30s_over_sqrt_b->SetLineColor(1);
  h_n40s_over_sqrt_b->SetLineColor(2);
  h_n50s_over_sqrt_b->SetLineColor(3);
  h_n70s_over_sqrt_b->SetLineColor(kOrange);
  h_n100s_over_sqrt_b->SetLineColor(kCyan);
  h_n30s_over_sqrt_b->SetLineWidth(3);
  h_n40s_over_sqrt_b->SetLineWidth(3);
  h_n50s_over_sqrt_b->SetLineWidth(3);
  h_n70s_over_sqrt_b->SetLineWidth(3);
  h_n100s_over_sqrt_b->SetLineWidth(3);

  h_n30sig->SetLineColor(1);
  h_n40sig->SetLineColor(2);
  h_n50sig->SetLineColor(3);
  h_n70sig->SetLineColor(kOrange);
  h_n100sig->SetLineColor(kCyan);
  h_n30sig->SetLineWidth(3);
  h_n40sig->SetLineWidth(3);
  h_n50sig->SetLineWidth(3);
  h_n70sig->SetLineWidth(3);
  h_n100sig->SetLineWidth(3);
 
  pad1->cd();
  h_n30sig->Draw("hist");
  h_n40sig->Draw("hist,same");
  h_n50sig->Draw("hist,same");
  h_n70sig->Draw("hist,same");
  h_n100sig->Draw("hist,same");

  TLegend* leg = new TLegend(0.7,0.7,0.9,0.9);
  leg->SetFillStyle(0);
  leg->SetLineStyle(0);
  leg->SetTextFont(132);
  leg->AddEntry(h_n30s_over_sqrt_b,"p_{T} > 30 GeV","l");
  leg->AddEntry(h_n40s_over_sqrt_b,"p_{T} > 40 GeV","l");
  leg->AddEntry(h_n50s_over_sqrt_b,"p_{T} > 50 GeV","l");
  leg->AddEntry(h_n70s_over_sqrt_b,"p_{T} > 70 GeV","l");
  leg->AddEntry(h_n100s_over_sqrt_b,"p_{T} > 100 GeV","l");
  leg->Draw();

  pad2->cd();
  h_n30s_over_sqrt_b->SetMinimum(0);
  if (sigName.Contains("tttt")||sigName.Contains("1000")) h_n30s_over_sqrt_b->SetMaximum(5);
  else h_n30s_over_sqrt_b->SetMaximum(2.5);
  h_n30s_over_sqrt_b->Draw("hist");
  h_n40s_over_sqrt_b->Draw("hist,same");
  h_n50s_over_sqrt_b->Draw("hist,same");
  h_n70s_over_sqrt_b->Draw("hist,same");
  h_n100s_over_sqrt_b->Draw("hist,same");



  thecanvas->Print("macros/cutflow/plots/optimize_n_jets/n_jets_optimization_"+plotNote+".pdf");


}
Ejemplo n.º 9
0
void Revolution(TString infile = "histos.root"){
    set_plot_style();
    gStyle->SetOptStat(0);
    gStyle->SetOptTitle(0);

    TH2* array[16];
    TFile *_file0 = TFile::Open("pone.root");
    TH2* xjgjetone = (TH2*)gROOT->FindObject("xjghist");
    array[0]= xjgjetone;
    
    TFile *_file1 = TFile::Open("ptwo.root");
    TH2* xjgjettwo = (TH2*)gROOT->FindObject("xjghist");
    array[1]= xjgjettwo;

    TFile *_file2 = TFile::Open("pthree.root");
    TH2* xjgjetthree = (TH2*)gROOT->FindObject("xjghist");
    array[2]= xjgjetthree;
    
    TFile *_file3 = TFile::Open("pfour.root");
    TH2* xjgjetfour = (TH2*)gROOT->FindObject("xjghist");
    array[3]= xjgjetfour;
    
    TFile *_file4 = TFile::Open("pseven.root");
    TH2* xjgjetfive = (TH2*)gROOT->FindObject("xjghist");
    array[4]= xjgjetfive;

    TFile *_file5 = TFile::Open("one.root");
    TH2* xjgjetsix = (TH2*)gROOT->FindObject("xjghist");
    array[5]= xjgjetsix;
    
    /*TFile *_file6 = TFile::Open("histseven.root");
    TH2* xjgjetseven = (TH2*)gROOT->FindObject("xjgjet");
    array[6]= xjgjetseven;
    
    TFile *_file7 = TFile::Open("histeight.root");
    TH2* xjgjeteight = (TH2*)gROOT->FindObject("xjgjet");
    array[7]= xjgjeteight;
    
    TFile *_file8 = TFile::Open("histnine.root");
    TH2* xjgjetnine = (TH2*)gROOT->FindObject("xjgjet");
    array[8]= xjgjetnine;

    TFile *_file9 = TFile::Open("histten.root");
    TH2* xjgjetten = (TH2*)gROOT->FindObject("xjgjet");
    array[9]= xjgjetten;

    TFile *_file10 = TFile::Open("histeleven.root");
    TH2* xjgjeteleven = (TH2*)gROOT->FindObject("xjgjet");
    array[10]= xjgjeteleven;

    TFile *_file11 = TFile::Open("histtwelve.root");
    TH2* xjgjettwelve = (TH2*)gROOT->FindObject("xjgjet");
    array[11]= xjgjettwelve;

    TFile *_file12 = TFile::Open("histthirteen.root");
    TH2* xjgjetthirteen = (TH2*)gROOT->FindObject("xjgjet");
    array[12]= xjgjetthirteen;

    TFile *_file13 = TFile::Open("histfourteen.root");
    TH2* xjgjetfourteen = (TH2*)gROOT->FindObject("xjgjet");
    array[13]= xjgjetfourteen;

    TFile *_file14 = TFile::Open("histfifteen.root");
    TH2* xjgjetfifteen = (TH2*)gROOT->FindObject("xjgjet");
    array[14]= xjgjetfifteen;

    TFile *_file15 = TFile::Open("histsixteen.root");
    TH2* xjgjetsixteen = (TH2*)gROOT->FindObject("xjgjet");
    array[15]= xjgjetsixteen;*/
    
    TCanvas* c1 = new TCanvas("c1","",1000,1000);
    gPad->SetLeftMargin(0.15);
    gPad->SetRightMargin(0.0);
    gPad->SetTopMargin(0.0);
    gPad->SetBottomMargin(0.0);
    c1->Divide(3,2);
    for(int i=0;i<6;i++){
        c1->cd(i+1);
        array[i]->Draw("colz");
        gPad->SetLogz();
        gPad->SetLeftMargin(0.1);
        gPad->SetRightMargin(0.1);
        gPad->SetTopMargin(0.1);
        gPad->SetBottomMargin(0.1);
         if(i==0){
            TLegend* leg = new TLegend(0.6,0.7,0.85,0.85);
            SetLeg(leg,.05);
            leg->SetHeader("R=.1");
            leg->Draw();
             array[i]->GetXaxis()->SetLabelOffset(999);
             array[i]->GetXaxis()->SetLabelSize(0);
        }
        else if(i==1){
            TLegend* leg2 = new TLegend(0.6,0.7,0.85,0.85);
            SetLeg(leg2,.05);
            leg2->SetHeader("R=.2");
            leg2->Draw();
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
        }
        else if(i==2){
            TLegend* leg3 = new TLegend(0.6,0.7,0.85,0.85);
            SetLeg(leg3,.05);
            leg3->SetHeader("R=.3");
            leg3->Draw();
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
        }
        else if(i==3){
            TLegend* leg4 = new TLegend(0.6,0.7,0.85,0.85);
            SetLeg(leg4,.05);
            leg4->SetHeader("R=.4");
            leg4->Draw();
        }
        else if(i==4){
            TLegend* leg5 = new TLegend(0.6,0.7,0.85,0.85);
            SetLeg(leg5,.05);
            leg5->SetHeader("R=.7");
            leg5->Draw();
        }
        else if(i==5){
            TLegend* leg6 = new TLegend(0.6,0.7,0.85,0.85);
            SetLeg(leg6,.05);
            leg6->SetHeader("R=1");
            leg6->Draw();
        }
    }
    TCanvas* c2 = new TCanvas("c2","XJG Distribution",1000,1000);
    gPad->SetLeftMargin(0.15);
    gPad->SetRightMargin(0.0);
    gPad->SetTopMargin(0.0);
    gPad->SetBottomMargin(0.0);
    c2->Divide(3,2);
    c2->cd(1);
    TH1 *f=array[0]->ProjectionY("f",1,-1);
    f->Draw();
    leg->Draw();
    Double_t r=f->GetMean();
    cout<<r<<endl;
    r=f->GetRMS();
    cout<<r<<endl;
    
    c2->cd(2);
    TH1 *g=array[1]->ProjectionY("g",1,-1);
    g->Draw();
    leg2->Draw();
    r=g->GetMean();
    cout<<r<<endl;
    r=g->GetRMS();
    cout<<r<<endl;
    
    c2->cd(3);
    TH1 *h=array[2]->ProjectionY("h",1,-1);
    h->Draw();
    leg3->Draw();
    r=h->GetMean();
    cout<<r<<endl;
    r=h->GetRMS();
    cout<<r<<endl;
    
    c2->cd(4);
    TH1 *j=array[3]->ProjectionY("j",1,-1);
    j->Draw();
    leg4->Draw();
    r=j->GetMean();
    cout<<r<<endl;
    r=j->GetRMS();
    cout<<r<<endl;
    
    c2->cd(5);
    TH1 *k=array[4]->ProjectionY("k",1,-1);
    k->Draw();
    leg5->Draw();
    r=k->GetMean();
    cout<<r<<endl;
    r=k->GetRMS();
    cout<<r<<endl;
    
    c2->cd(6);
    TH1 *l=array[5]->ProjectionY("l",1,-1);
    l->Draw();
    leg6->Draw();
    r=l->GetMean();
    cout<<r<<endl;
    r=l->GetRMS();
    cout<<r<<endl;
}
Ejemplo n.º 10
0
// -----------------------------------------------------------------------------
//
void test() {

  time_t start = TTimeStamp().GetSec();

  set_plot_style();

  bool draw = true;
  //bool debug = true;

  // Define analysis configuration
  PSet ps;
  defaultPSet(ps);

  // Response plots
  if (false) {
    //xSectDistr(ps);
    responseProfile();
    return;
  }
  
  // Print configuration
  std::stringstream ss;
  printPSet(ps,ss);
  std::cout << ss.str() << std::endl;
  
  // Params to store
  DoubleVV ratio, ratio_errh, ratio_errl, pass, pass_err, fail, fail_err;
  IntV length;
  clear( ratio, ratio_errh, ratio_errl, pass, pass_err, fail, fail_err, length );
  init( ps, ratio, ratio_errh, ratio_errl, pass, pass_err, fail, fail_err, length );
  
  // Loop through Meff bins 
  int loop = 0;
  int nloops = ps.nmeff;
  for ( int imeff = 0; imeff < ps.nmeff; ++imeff ) {

    // Generate numbers in (x1,x2) plane
    DoubleVV dalitz;
    generateTruth( ps, imeff, dalitz, true );

    // Integrate across dalitz plane
    integrate( ps, imeff, dalitz, ratio, ratio_errh, ratio_errl, 
	       pass, pass_err, fail, fail_err, length );
    
    // Labeling
    std::stringstream ss;
    ss << "Meff" << int( ps.meff_bins[imeff] );
    
    // New canvas for plots
    TCanvas* c1 = 0;
    if (draw) c1 = new TCanvas( TString("Canvas"+ss.str()), "" );
    
    // Pad for cross-section plot
    TPad* pad = 0;
    if (draw) pad = new TPad(TString("Pad"+ss.str()),"",0.,0.,1.,1.);
    if (pad) {
      pad->SetGrid();
      pad->Draw();
      pad->cd();
      pad->SetLogz();
    }
    TH1F* hr = 0;
    if (draw) hr = pad->DrawFrame(ps.min,ps.min,ps.max,ps.max);
    
    // Histo title
    if (hr) {
      std::stringstream sss;
      sss << "M_{eff}=" << ps.meff_bins[imeff] << " GeV"
	  << ", p_{T1}=" << dr(ps.pt1_bins[imeff],1) << " GeV"
	  << ", p_{T2}=" << dr(ps.pt2_bins[imeff],1) << " GeV"
	  << ", p_{T3}=" << dr(ps.pt3_bins[imeff],1) << " GeV";
      hr->SetTitle( sss.str().c_str() );
      hr->GetXaxis()->SetTitle( "x_{2}" );
      hr->GetYaxis()->SetTitle( "x_{1}" );
    }
    
    // Create 2D cross-section plot
    TH2D* his = 0;
    if (draw) his = new TH2D(TString("Histo"+ss.str()),"",
			     ps.nbins,ps.min,ps.max,
			     ps.nbins,ps.min,ps.max);
    
    //double x3 = ( 2. * ps.pt3_bins[imeff] ) / ( ps.meff_bins[imeff] + ps.pt3_bins[imeff] );
    
    // Fill 2D cross-section plot
    for ( int x2_bin = 0; x2_bin < ps.nbins; ++x2_bin ) { 
      for ( int x1_bin = 0; x1_bin < ps.nbins; ++x1_bin ) { 
// 	std::cout << " Fill:"
// 		  << " x2_bin: " << x2_bin 
// 		  << " x2: " << val(x2_bin,nbins) 
// 		  << " x1_bin: " << x1_bin 
// 		  << " x1: " << val(x1_bin,nbins) 
// 		  << " val: " << dalitz[x2_bin][x1_bin]
// 		  << std::endl;
	if (his) his->Fill( val(x2_bin,ps)+ps.width/2.,
			    val(x1_bin,ps)+ps.width/2.,
			    dalitz[x2_bin][x1_bin] ); 
      }
    }
    
    // Draw 2D cross-section plot
    gStyle->SetPalette(1);
    if (his) {
      //his->SetMaximum( his->GetMaximum()*10. );
      //his->SetMinimum( his->GetMinimum(1.e-12)*0.1 );
//       his->SetMaximum( 1.e9 );
//       his->SetMinimum( 1.e0 );
      his->Draw("COLZsame");
    }
    
    // Pad for AlphaT contours
    if (c1) c1->cd();
    TPad* overlay = 0;
    if (draw) overlay = new TPad(TString("Overlay"+ss.str()),"",0.,0.,1.,1.);
    if (overlay) {
      overlay->SetFillStyle(4000);
      overlay->SetFillColor(0);
      overlay->SetFrameFillStyle(4000);
      overlay->Draw();
      overlay->cd();
    }
    //TH1F* hframe = 0;
    if (draw) overlay->DrawFrame(pad->GetUxmin(),
				 pad->GetUymin(),
				 pad->GetUxmax(),
				 pad->GetUymax());
	  
    // Graphs of AlphaT contours
    TMultiGraph* mg = 0;
    if (draw) {
      mg = new TMultiGraph();
      for ( Int_t icut = 0; icut < (int)ps.cutValues.size(); icut++ ) {
	Double_t alpha_t = ps.cutValues[icut];
	const Int_t n = ps.nbins;
	DoubleV x1(n,0.);
	DoubleV x2(n,0.);
	for ( Int_t x2_bin = 0; x2_bin < ps.nbins; x2_bin++ ) {
	  x2[x2_bin] = x2_bin * ps.width;
	  x1[x2_bin] = cutAlgoInverse(ps.cutValues[icut],x2[x2_bin],ALGO_TYPE);
	}
	TGraph* gr = new TGraph(n,&x2.front(),&x1.front());
	mg->Add(gr,"l");
      }
      mg->Draw();
    }
	  
    if (c1) c1->cd();
    if (c1) c1->SaveAs(TString(ss.str()+".png"));
    if (c1) c1->SaveAs(TString(ss.str()+".pdf"));
    if (c1) c1->SaveAs(TString(ss.str()+".C"));

  }

  // Canvas for ratio vs Meff
  if (false) {
    
    TCanvas* c2 = new TCanvas( "c2", "" );
    c2->SetRightMargin(0.2);
    c2->SetLogy();
    c2->cd();
    TMultiGraph* mg2 = new TMultiGraph();

    DoubleV err( ps.nmeff, 0. );
    for ( Int_t icut = 0; icut < (int)ps.cutValues.size(); icut++ ) {
      if ( length[icut] == 0 ) { continue; }
//       TGraphAsymmErrors* gr = new TGraphAsymmErrors( length[icut], 
//  						     &ps.meff_bins.front(), 
//  						     &err.front(),
//  						     &err.front(),
//  						     &ratio[icut].front(),
//  						     &ratio_errl[icut].front(),
//  						     &ratio_errh[icut].front() );
      TGraph* gr = new TGraphAsymmErrors( length[icut], 
 					  &ps.meff_bins.front(), 
 					  &ratio[icut].front() );
      std::stringstream ss;
      ss << "a_{T}=" << ps.cutValues[icut];
// 	 << " Meff=" << meff_bins[imeff]
// 	 << ", p_{T3}=" << pt3_bins[imeff];
      mg2->Add(gr,"lp");
      gr->SetTitle(TString(ss.str()));
      gr->SetLineColor(2+icut);
      gr->SetLineWidth(2);
      gr->SetMarkerStyle(20+icut);
      gr->SetMarkerColor(2+icut);
      gr->SetMarkerSize(1.5);
    }
    
    mg2->Draw("a");
    mg2->GetYaxis()->SetRangeUser(1.e-6,1.e0);
    c2->Update();
    c2->BuildLegend(0.81,0.1,0.99,0.9);
    
    // Save canvases
    c2->cd();
    c2->SaveAs("RatioVsMeff.png");
    c2->SaveAs("RatioVsMeff.pdf");
    c2->SaveAs("RatioVsMeff.C");
    
  }
  
  time_t stop = TTimeStamp().GetSec();
  std::cout << " Time taken: " << stop - start <<  " seconds" << std::endl;

}
Ejemplo n.º 11
0
void mixtwo(TString infile = "histos.root"){
    set_plot_style();
    gStyle->SetOptStat(0);
    gStyle->SetOptTitle(0);

    TH1* array[30];
    TFile *_file0 = TFile::Open("plotstwocentral.root");
    TH1* xjgjetone = (TH1*)gROOT->FindObject("m5p2");
    array[0]= xjgjetone;
    
    TFile *_file1 = TFile::Open("plotstwocentral.root");
    TH1* xjgjettwo = (TH1*)gROOT->FindObject("m5p3");
    array[1]= xjgjettwo;

    TFile *_file2 = TFile::Open("plotstwocentral.root");
    TH1* xjgjetthree = (TH1*)gROOT->FindObject("m5p4");
    array[2]= xjgjetthree;
    
    TFile *_file3 = TFile::Open("plotstwocentral.root");
    TH1* xjgjetfour = (TH1*)gROOT->FindObject("m10p2");
    array[3]= xjgjetfour;
    
    TFile *_file4 = TFile::Open("plotstwocentral.root");
    TH1* xjgjetfive = (TH1*)gROOT->FindObject("m10p3");
    array[4]= xjgjetfive;

    TFile *_file5 = TFile::Open("plotstwocentral.root");
    TH1* xjgjetsix = (TH1*)gROOT->FindObject("m10p4");
    array[5]= xjgjetsix;
    
    TFile *_file6 = TFile::Open("plotstwocentral.root");
    TH1* xjgjetseven = (TH1*)gROOT->FindObject("m15p2");
    array[6]= xjgjetseven;
    
    TFile *_file7 = TFile::Open("plotstwocentral.root");
    TH1* xjgjeteight = (TH1*)gROOT->FindObject("m15p3");
    array[7]= xjgjeteight;
    
    TFile *_file8 = TFile::Open("plotstwocentral.root");
    TH1* xjgjetnine = (TH1*)gROOT->FindObject("m15p4");
    array[8]= xjgjetnine;
    
    TFile *_file0 = TFile::Open("plotstwocentral.root");
    TH1* xjgjetonea = (TH1*)gROOT->FindObject("m20p2");
    array[9]= xjgjetonea;
    
    TFile *_file1 = TFile::Open("plotstwocentral.root");
    TH1* xjgjettwoa = (TH1*)gROOT->FindObject("m20p3");
    array[10]= xjgjettwoa;
    
    TFile *_file2 = TFile::Open("plotstwocentral.root");
    TH1* xjgjetthreea = (TH1*)gROOT->FindObject("m20p4");
    array[11]= xjgjetthreea;
    
    TFile *_file3 = TFile::Open("plotstwocentral.root");
    TH1* xjgjetfoura = (TH1*)gROOT->FindObject("m25p2");
    array[12]= xjgjetfoura;
    
    TFile *_file4 = TFile::Open("plotstwocentral.root");
    TH1* xjgjetfivea = (TH1*)gROOT->FindObject("m25p3");
    array[13]= xjgjetfivea;
    
    TFile *_file5 = TFile::Open("plotstwocentral.root");
    TH1* xjgjetsixa = (TH1*)gROOT->FindObject("m25p4");
    array[14]= xjgjetsixa;
    
    TFile *_file0 = TFile::Open("plotstwocentral.root");
    TH1* xjgjetone = (TH1*)gROOT->FindObject("m30p2");
    array[15]= xjgjetone;
    
    TFile *_file1 = TFile::Open("plotstwocentral.root");
    TH1* xjgjettwo = (TH1*)gROOT->FindObject("m30p3");
    array[16]= xjgjettwo;
    
    TFile *_file2 = TFile::Open("plotstwocentral.root");
    TH1* xjgjetthree = (TH1*)gROOT->FindObject("m30p4");
    array[17]= xjgjetthree;
    
    TFile *_file3 = TFile::Open("plotstwocentral.root");
    TH1* xjgjetfour = (TH1*)gROOT->FindObject("m35p2");
    array[18]= xjgjetfour;
    
    TFile *_file4 = TFile::Open("plotstwocentral.root");
    TH1* xjgjetfive = (TH1*)gROOT->FindObject("m35p3");
    array[19]= xjgjetfive;
    
    TFile *_file5 = TFile::Open("plotstwocentral.root");
    TH1* xjgjetsix = (TH1*)gROOT->FindObject("m35p4");
    array[20]= xjgjetsix;
    
    TFile *_file6 = TFile::Open("plotstwocentral.root");
    TH1* xjgjetseven = (TH1*)gROOT->FindObject("m40p2");
    array[21]= xjgjetseven;
    
    TFile *_file7 = TFile::Open("plotstwocentral.root");
    TH1* xjgjeteight = (TH1*)gROOT->FindObject("m40p3");
    array[22]= xjgjeteight;
    
    TFile *_file8 = TFile::Open("plotstwocentral.root");
    TH1* xjgjetnine = (TH1*)gROOT->FindObject("m40p4");
    array[23]= xjgjetnine;
    TFile *_file0 = TFile::Open("plotstwocentral.root");
    TH1* xjgjetone = (TH1*)gROOT->FindObject("m45p2");
    array[24]= xjgjetone;
    
    TFile *_file1 = TFile::Open("plotstwocentral.root");
    TH1* xjgjettwo = (TH1*)gROOT->FindObject("m45p3");
    array[25]= xjgjettwo;
    
    TFile *_file2 = TFile::Open("plotstwocentral.root");
    TH1* xjgjetthree = (TH1*)gROOT->FindObject("m45p4");
    array[26]= xjgjetthree;
    
    TFile *_file3 = TFile::Open("plotstwocentral.root");
    TH1* xjgjetfour = (TH1*)gROOT->FindObject("m50p2");
    array[27]= xjgjetfour;
    
    TFile *_file4 = TFile::Open("plotstwocentral.root");
    TH1* xjgjetfive = (TH1*)gROOT->FindObject("m50p3");
    array[28]= xjgjetfive;
    
    TFile *_file5 = TFile::Open("plotstwocentral.root");
    TH1* xjgjetsix = (TH1*)gROOT->FindObject("m50p4");
    array[29]= xjgjetsix;
    
   
    
    TH1* carray[30];
    TFile *_file0 = TFile::Open("plotstwocentral.root");
    TH1* cone = (TH1*)gROOT->FindObject("c5p2");
    carray[0]= cone;
    
    TFile *_file1 = TFile::Open("plotstwocentral.root");
    TH1* ctwo = (TH1*)gROOT->FindObject("c5p3");
    carray[1]= ctwo;
    
    TFile *_file2 = TFile::Open("plotstwocentral.root");
    TH1* cthree = (TH1*)gROOT->FindObject("c5p4");
    carray[2]= cthree;
    
    TFile *_file3 = TFile::Open("plotstwocentral.root");
    TH1* cfour = (TH1*)gROOT->FindObject("c10p2");
    carray[3]= cfour;
    
    TFile *_file4 = TFile::Open("plotstwocentral.root");
    TH1* cfive = (TH1*)gROOT->FindObject("c10p3");
    carray[4]= cfive;
    
    TFile *_file5 = TFile::Open("plotstwocentral.root");
    TH1* csix = (TH1*)gROOT->FindObject("c10p4");
    carray[5]= csix;
    
    TFile *_file6 = TFile::Open("plotstwocentral.root");
    TH1* cseven = (TH1*)gROOT->FindObject("c15p2");
    carray[6]= cseven;
    
    TFile *_file7 = TFile::Open("plotstwocentral.root");
    TH1* ceight = (TH1*)gROOT->FindObject("c15p3");
    carray[7]= ceight;
    
    TFile *_file8 = TFile::Open("plotstwocentral.root");
    TH1* cnine = (TH1*)gROOT->FindObject("c15p4");
    carray[8]= cnine;
    
    TFile *_file0 = TFile::Open("plotstwocentral.root");
    TH1* conea = (TH1*)gROOT->FindObject("c20p2");
    carray[9]= conea;
    
    TFile *_file1 = TFile::Open("plotstwocentral.root");
    TH1* ctwoa = (TH1*)gROOT->FindObject("c20p3");
    carray[10]= ctwoa;
    
    TFile *_file2 = TFile::Open("plotstwocentral.root");
    TH1* cthreea = (TH1*)gROOT->FindObject("c20p4");
    carray[11]= cthreea;
    
    TFile *_file3 = TFile::Open("plotstwocentral.root");
    TH1* cfoura = (TH1*)gROOT->FindObject("c25p2");
    carray[12]= cfoura;
    
    TFile *_file4 = TFile::Open("plotstwocentral.root");
    TH1* cfivea = (TH1*)gROOT->FindObject("c25p3");
    carray[13]= cfivea;
    
    TFile *_file5 = TFile::Open("plotstwocentral.root");
    TH1* csixa = (TH1*)gROOT->FindObject("c25p4");
    carray[14]= csixa;
    
    TFile *_file0 = TFile::Open("plotstwocentral.root");
    TH1* cone = (TH1*)gROOT->FindObject("c30p2");
    carray[15]= cone;
    
    TFile *_file1 = TFile::Open("plotstwocentral.root");
    TH1* ctwo = (TH1*)gROOT->FindObject("c30p3");
    carray[16]= ctwo;
    
    TFile *_file2 = TFile::Open("plotstwocentral.root");
    TH1* cthree = (TH1*)gROOT->FindObject("c30p4");
    carray[17]= cthree;
    
    TFile *_file3 = TFile::Open("plotstwocentral.root");
    TH1* cfour = (TH1*)gROOT->FindObject("c35p2");
    carray[18]= cfour;
    
    TFile *_file4 = TFile::Open("plotstwocentral.root");
    TH1* cfive = (TH1*)gROOT->FindObject("c35p3");
    carray[19]= cfive;
    
    TFile *_file5 = TFile::Open("plotstwocentral.root");
    TH1* csix = (TH1*)gROOT->FindObject("c35p4");
    carray[20]= csix;
    
    TFile *_file6 = TFile::Open("plotstwocentral.root");
    TH1* cseven = (TH1*)gROOT->FindObject("c40p2");
    carray[21]= cseven;
    
    TFile *_file7 = TFile::Open("plotstwocentral.root");
    TH1* ceight = (TH1*)gROOT->FindObject("c40p3");
    carray[22]= ceight;
    
    TFile *_file8 = TFile::Open("plotstwocentral.root");
    TH1* cnine = (TH1*)gROOT->FindObject("c40p4");
    carray[23]= cnine;
    TFile *_file0 = TFile::Open("plotstwocentral.root");
    TH1* cone = (TH1*)gROOT->FindObject("c45p2");
    carray[24]= cone;
    
    TFile *_file1 = TFile::Open("plotstwocentral.root");
    TH1* ctwo = (TH1*)gROOT->FindObject("c45p3");
    carray[25]= ctwo;
    
    TFile *_file2 = TFile::Open("plotstwocentral.root");
    TH1* cthree = (TH1*)gROOT->FindObject("c45p4");
    carray[26]= cthree;
    
    TFile *_file3 = TFile::Open("plotstwocentral.root");
    TH1* cfour = (TH1*)gROOT->FindObject("c50p2");
    carray[27]= cfour;
    
    TFile *_file4 = TFile::Open("plotstwocentral.root");
    TH1* cfive = (TH1*)gROOT->FindObject("c50p3");
    carray[28]= cfive;
    
    TFile *_file5 = TFile::Open("plotstwocentral.root");
    TH1* csix = (TH1*)gROOT->FindObject("c50p4");
    carray[29]= csix;
    
    
    
    TH2* subxjg[30];
    TFile *_file0 = TFile::Open("subxjgplots.root");
    TH2* subxjgone = (TH2*)gROOT->FindObject("s5p2");
    subxjg[0]= subxjgone;
    
    TFile *_file1 = TFile::Open("subxjgplots.root");
    TH2* subxjgtwo = (TH2*)gROOT->FindObject("s5p3");
    subxjg[1]= subxjgtwo;
    
    TFile *_file2 = TFile::Open("subxjgplots.root");
    TH2* subxjgthree = (TH2*)gROOT->FindObject("s5p4");
    subxjg[2]= subxjgthree;
    
    TFile *_file3 = TFile::Open("evensubxjgplots.root");
    TH2* subxjgfour = (TH2*)gROOT->FindObject("s10p2");
    subxjg[3]= subxjgfour;
    
    TFile *_file4 = TFile::Open("evensubxjgplots.root");
    TH2* subxjgfive = (TH2*)gROOT->FindObject("s10p3");
    subxjg[4]= subxjgfive;
    
    TFile *_file5 = TFile::Open("evensubxjgplots.root");
    TH2* subxjgsix = (TH2*)gROOT->FindObject("s10p4");
    subxjg[5]= subxjgsix;
    
    TFile *_file6 = TFile::Open("subxjgplots.root");
    TH2* subxjgseven = (TH2*)gROOT->FindObject("s15p2");
    subxjg[6]= subxjgseven;
    
    TFile *_file7 = TFile::Open("subxjgplots.root");
    TH2* subxjgeight = (TH2*)gROOT->FindObject("s15p3");
    subxjg[7]= subxjgeight;
    
    TFile *_file8 = TFile::Open("subxjgplots.root");
    TH2* subxjgnine = (TH2*)gROOT->FindObject("s15p4");
    subxjg[8]= subxjgnine;
    
    TFile *_file0 = TFile::Open("evensubxjgplots.root");
    TH2* subxjgonea = (TH2*)gROOT->FindObject("s20p2");
    subxjg[9]= subxjgonea;
    
    TFile *_file1 = TFile::Open("evensubxjgplots.root");
    TH2* subxjgtwoa = (TH2*)gROOT->FindObject("s20p3");
    subxjg[10]= subxjgtwoa;
    
    TFile *_file2 = TFile::Open("evensubxjgplots.root");
    TH2* subxjgthreea = (TH2*)gROOT->FindObject("s20p4");
    subxjg[11]= subxjgthreea;
    
    TFile *_file3 = TFile::Open("subxjgplots.root");
    TH2* subxjgfoura = (TH2*)gROOT->FindObject("s25p2");
    subxjg[12]= subxjgfoura;
    
    TFile *_file4 = TFile::Open("subxjgplots.root");
    TH2* subxjgfivea = (TH2*)gROOT->FindObject("s25p3");
    subxjg[13]= subxjgfivea;
    
    TFile *_file5 = TFile::Open("subxjgplots.root");
    TH2* subxjgsixa = (TH2*)gROOT->FindObject("s25p4");
    subxjg[14]= subxjgsixa;
    
    TFile *_file0 = TFile::Open("evensubxjgplots.root");
    TH2* subxjgone = (TH2*)gROOT->FindObject("s30p2");
    subxjg[15]= subxjgone;
    
    TFile *_file1 = TFile::Open("evensubxjgplots.root");
    TH2* subxjgtwo = (TH2*)gROOT->FindObject("s30p3");
    subxjg[16]= subxjgtwo;
    
    TFile *_file2 = TFile::Open("evensubxjgplots.root");
    TH2* subxjgthree = (TH2*)gROOT->FindObject("s30p4");
    subxjg[17]= subxjgthree;
    
    TFile *_file3 = TFile::Open("subxjgplots.root");
    TH2* subxjgfour = (TH2*)gROOT->FindObject("s35p2");
    subxjg[18]= subxjgfour;
    
    TFile *_file4 = TFile::Open("subxjgplots.root");
    TH2* subxjgfive = (TH2*)gROOT->FindObject("s35p3");
    subxjg[19]= subxjgfive;
    
    TFile *_file5 = TFile::Open("subxjgplots.root");
    TH2* subxjgsix = (TH2*)gROOT->FindObject("s35p4");
    subxjg[20]= subxjgsix;
    
    TFile *_file6 = TFile::Open("evensubxjgplots.root");
    TH2* subxjgseven = (TH2*)gROOT->FindObject("s40p2");
    subxjg[21]= subxjgseven;
    
    TFile *_file7 = TFile::Open("evensubxjgplots.root");
    TH2* subxjgeight = (TH2*)gROOT->FindObject("s40p3");
    subxjg[22]= subxjgeight;
    
    TFile *_file8 = TFile::Open("evensubxjgplots.root");
    TH2* subxjgnine = (TH2*)gROOT->FindObject("s40p4");
    subxjg[23]= subxjgnine;
    TFile *_file0 = TFile::Open("subxjgplots.root");
    TH2* subxjgone = (TH2*)gROOT->FindObject("s45p2");
    subxjg[24]= subxjgone;
    
    TFile *_file1 = TFile::Open("subxjgplots.root");
    TH2* subxjgtwo = (TH2*)gROOT->FindObject("s45p3");
    subxjg[25]= subxjgtwo;
    
    TFile *_file2 = TFile::Open("subxjgplots.root");
    TH2* subxjgthree = (TH2*)gROOT->FindObject("s45p4");
    subxjg[26]= subxjgthree;
    
    TFile *_file3 = TFile::Open("evensubxjgplots.root");
    TH2* subxjgfour = (TH2*)gROOT->FindObject("s50p2");
    subxjg[27]= subxjgfour;
    
    TFile *_file4 = TFile::Open("evensubxjgplots.root");
    TH2* subxjgfive = (TH2*)gROOT->FindObject("s50p3");
    subxjg[28]= subxjgfive;
    
    TFile *_file5 = TFile::Open("evensubxjgplots.root");
    TH2* subxjgsix = (TH2*)gROOT->FindObject("s50p4");
    subxjg[29]= subxjgsix;
    
    
    
    
    TH2* mxjg[30];
    TFile *_file0 = TFile::Open("plotstwocentral.root");
    TH2* mxjgone = (TH2*)gROOT->FindObject("submixxjg5p2");
    mxjg[0]= mxjgone;
    
    TFile *_file1 = TFile::Open("plotstwocentral.root");
    TH2* mxjgtwo = (TH2*)gROOT->FindObject("submixxjg5p3");
    mxjg[1]= mxjgtwo;
    
    TFile *_file2 = TFile::Open("plotstwocentral.root");
    TH2* mxjgthree = (TH2*)gROOT->FindObject("submixxjg5p4");
    mxjg[2]= mxjgthree;
    
    TFile *_file3 = TFile::Open("plotstwocentral.root");
    TH2* mxjgfour = (TH2*)gROOT->FindObject("submixxjg10p2");
    mxjg[3]= mxjgfour;
    
    TFile *_file4 = TFile::Open("plotstwocentral.root");
    TH2* mxjgfive = (TH2*)gROOT->FindObject("submixxjg10p3");
    mxjg[4]= mxjgfive;
    
    TFile *_file5 = TFile::Open("plotstwocentral.root");
    TH2* mxjgsix = (TH2*)gROOT->FindObject("submixxjg10p4");
    mxjg[5]= mxjgsix;
    
    TFile *_file6 = TFile::Open("plotstwocentral.root");
    TH2* mxjgseven = (TH2*)gROOT->FindObject("submixxjg15p2");
    mxjg[6]= mxjgseven;
    
    TFile *_file7 = TFile::Open("plotstwocentral.root");
    TH2* mxjgeight = (TH2*)gROOT->FindObject("submixxjg15p3");
    mxjg[7]= mxjgeight;
    
    TFile *_file8 = TFile::Open("plotstwocentral.root");
    TH2* mxjgnine = (TH2*)gROOT->FindObject("submixxjg15p4");
    mxjg[8]= mxjgnine;
    
    TFile *_file0 = TFile::Open("plotstwocentral.root");
    TH2* mxjgonea = (TH2*)gROOT->FindObject("submixxjg20p2");
    mxjg[9]= mxjgonea;
    
    TFile *_file1 = TFile::Open("plotstwocentral.root");
    TH2* mxjgtwoa = (TH2*)gROOT->FindObject("submixxjg20p3");
    mxjg[10]= mxjgtwoa;
    
    TFile *_file2 = TFile::Open("plotstwocentral.root");
    TH2* mxjgthreea = (TH2*)gROOT->FindObject("submixxjg20p4");
    mxjg[11]= mxjgthreea;
    
    TFile *_file3 = TFile::Open("plotstwocentral.root");
    TH2* mxjgfoura = (TH2*)gROOT->FindObject("submixxjg25p2");
    mxjg[12]= mxjgfoura;
    
    TFile *_file4 = TFile::Open("plotstwocentral.root");
    TH2* mxjgfivea = (TH2*)gROOT->FindObject("submixxjg25p3");
    mxjg[13]= mxjgfivea;
    
    TFile *_file5 = TFile::Open("plotstwocentral.root");
    TH2* mxjgsixa = (TH2*)gROOT->FindObject("submixxjg25p4");
    mxjg[14]= mxjgsixa;
    
    TFile *_file0 = TFile::Open("plotstwocentral.root");
    TH2* mxjgone = (TH2*)gROOT->FindObject("submixxjg30p2");
    mxjg[15]= mxjgone;
    
    TFile *_file1 = TFile::Open("plotstwocentral.root");
    TH2* mxjgtwo = (TH2*)gROOT->FindObject("submixxjg30p3");
    mxjg[16]= mxjgtwo;
    
    TFile *_file2 = TFile::Open("plotstwocentral.root");
    TH2* mxjgthree = (TH2*)gROOT->FindObject("submixxjg30p4");
    mxjg[17]= mxjgthree;
    
    TFile *_file3 = TFile::Open("plotstwocentral.root");
    TH2* mxjgfour = (TH2*)gROOT->FindObject("submixxjg35p2");
    mxjg[18]= mxjgfour;
    
    TFile *_file4 = TFile::Open("plotstwocentral.root");
    TH2* mxjgfive = (TH2*)gROOT->FindObject("submixxjg35p3");
    mxjg[19]= mxjgfive;
    
    TFile *_file5 = TFile::Open("plotstwocentral.root");
    TH2* mxjgsix = (TH2*)gROOT->FindObject("submixxjg35p4");
    mxjg[20]= mxjgsix;
    
    TFile *_file6 = TFile::Open("plotstwocentral.root");
    TH2* mxjgseven = (TH2*)gROOT->FindObject("submixxjg40p2");
    mxjg[21]= mxjgseven;
    
    TFile *_file7 = TFile::Open("plotstwocentral.root");
    TH2* mxjgeight = (TH2*)gROOT->FindObject("submixxjg40p3");
    mxjg[22]= mxjgeight;
    
    TFile *_file8 = TFile::Open("plotstwocentral.root");
    TH2* mxjgnine = (TH2*)gROOT->FindObject("submixxjg40p4");
    mxjg[23]= mxjgnine;
    TFile *_file0 = TFile::Open("plotstwocentral.root");
    TH2* mxjgone = (TH2*)gROOT->FindObject("submixxjg45p2");
    mxjg[24]= mxjgone;
    
    TFile *_file1 = TFile::Open("plotstwocentral.root");
    TH2* mxjgtwo = (TH2*)gROOT->FindObject("submixxjg45p3");
    mxjg[25]= mxjgtwo;
    
    TFile *_file2 = TFile::Open("plotstwocentral.root");
    TH2* mxjgthree = (TH2*)gROOT->FindObject("submixxjg45p4");
    mxjg[26]= mxjgthree;
    
    TFile *_file3 = TFile::Open("plotstwocentral.root");
    TH2* mxjgfour = (TH2*)gROOT->FindObject("submixxjg50p2");
    mxjg[27]= mxjgfour;
    
    TFile *_file4 = TFile::Open("plotstwocentral.root");
    TH2* mxjgfive = (TH2*)gROOT->FindObject("submixxjg50p3");
    mxjg[28]= mxjgfive;
    
    TFile *_file5 = TFile::Open("plotstwocentral.root");
    TH2* mxjgsix = (TH2*)gROOT->FindObject("submixxjg50p4");
    mxjg[29]= mxjgsix;
    
    
    
    
    
    TCanvas* c3 = new TCanvas("c3","",1000,1000);
    gPad->SetLeftMargin(0.15);
    gPad->SetRightMargin(0.0);
    gPad->SetTopMargin(0.0);
    gPad->SetBottomMargin(0.0);
    Double_t *scalearray[30];
    c3->Divide(3,5);
    for(int i=0;i<15;i++){
        c3->cd(i+1);
        carray[i]->Draw();
        gPad->SetLogy();
        gPad->SetLeftMargin(0.1);
        gPad->SetRightMargin(0.1);
        gPad->SetTopMargin(0.1);
        gPad->SetBottomMargin(0.1);
        if(i==0){
            TLegend* leg = new TLegend(0.6,0.7,0.85,0.85);
            SetLeg(leg,.05);
            leg->SetHeader("Ptmin=5 GeV");
            leg->AddEntry("array[0]","R=0.2","");
            leg->AddEntry("array[0]","combined tracks","");
            leg->Draw();
        }
        else if(i==1){
            TLegend* leg2 = new TLegend(0.6,0.7,0.85,0.85);
            SetLeg(leg2,.05);
            leg2->SetHeader("R=0.3");
            leg2->AddEntry(array[0],"mixed event","l");
            leg2->AddEntry(carray[0],"combined tracks","l");
            leg2->Draw();
        }
        else if(i==2){
            TLegend* leg3 = new TLegend(0.6,0.7,0.85,0.85);
            SetLeg(leg3,.05);
            leg3->SetHeader("R=0.4");
            leg3->Draw();
        }
        else if(i==3){
            TLegend* leg4 = new TLegend(0.6,0.7,0.85,0.85);
            SetLeg(leg4,.05);
            leg4->SetHeader("Ptmin=10 GeV");
            leg4->Draw();
        }
        else if(i==6){
            TLegend* leg5 = new TLegend(0.7,0.8,0.85,0.85);
            SetLeg(leg5,.05);
            leg5->SetHeader("Ptmin=15 GeV");
            leg5->Draw();
        }
        else if(i==9){
            TLegend* leg5 = new TLegend(0.7,0.8,0.85,0.85);
            SetLeg(leg5,.05);
            leg5->SetHeader("Ptmin=20 GeV");
            leg5->Draw();
        }
        else if(i==12){
            TLegend* leg5 = new TLegend(0.7,0.8,0.85,0.85);
            SetLeg(leg5,.05);
            leg5->SetHeader("Ptmin=25 GeV");
            leg5->Draw();
        }
        for (int j=1;j<=150;j++){
            if(array[i]->GetBinContent(j)<5)
                array[i]->SetBinContent(j,0);
        }
        scale= ((carray[i]->Integral(0,50))/(array[i]->Integral(0,50)));
        scalearray[i]=scale;
        array[i]->Scale(scale);
        array[i]->SetLineColor(kRed);
        array[i]->Draw("same");
       // cout<<scale<<endl;
    }
   
    TCanvas* c2 = new TCanvas("c2","",1000,1000);
    gPad->SetLeftMargin(0.15);
    gPad->SetRightMargin(0.0);
    gPad->SetTopMargin(0.0);
    gPad->SetBottomMargin(0.0);
    c2->Divide(3,5);
    Double_t subtracted[30];
    for(int i=0;i<15;i++){
        c2->cd(i+1);
        TH1 *f=new TH1D("f","f",60,0,3);
        f=subxjg[i]->ProjectionY("f",0,-1);
        f->Draw();
        TH1 *g=new TH1D("g","g",60,0,3);
        g=mxjg[i]->ProjectionY("g",1,-1);
        scale=((carray[i]->Integral(0,50))/(array[i]->Integral(0,50)));
        g->Scale(scale);
        g->SetLineColor(kRed);
        g->Draw("same");
        TH1 *q=new TH1D("q","q",60,0,3);
        q=f;
        subtracted[i]=q->GetMean();
        if(i==0){
            TLegend* leg = new TLegend(0.6,0.7,0.85,0.85);
            SetLeg(leg,.05);
            leg->SetHeader("Ptmin=5 GeV");
            leg->AddEntry("array[0]","R=0.2","");
            leg->AddEntry("array[0]","combined tracks","");
            leg->Draw();
        }
        else if(i==1){
            TLegend* leg2 = new TLegend(0.6,0.7,0.85,0.85);
            SetLeg(leg2,.05);
            leg2->SetHeader("R=0.3");
            leg2->AddEntry(subxjg[0],"pythia-rho","l");
            leg2->AddEntry(array[0],"mixed event","l");
            leg2->Draw();
        }
        else if(i==2){
            TLegend* leg3 = new TLegend(0.6,0.7,0.85,0.85);
            SetLeg(leg3,.05);
            leg3->SetHeader("R=0.4");
            leg3->Draw();
        }
        else if(i==3){
            TLegend* leg4 = new TLegend(0.6,0.7,0.85,0.85);
            SetLeg(leg4,.05);
            leg4->SetHeader("Ptmin=10 GeV");
            leg4->Draw();
        }
        else if(i==6){
            TLegend* leg5 = new TLegend(0.7,0.8,0.85,0.85);
            SetLeg(leg5,.05);
            leg5->SetHeader("Ptmin=15 GeV");
            leg5->Draw();
        }
        else if(i==9){
            TLegend* leg5 = new TLegend(0.7,0.8,0.85,0.85);
            SetLeg(leg5,.05);
            leg5->SetHeader("Ptmin=20 GeV");
            leg5->Draw();
        }
        else if(i==12){
            TLegend* leg5 = new TLegend(0.7,0.8,0.85,0.85);
            SetLeg(leg5,.05);
            leg5->SetHeader("Ptmin=25 GeV");
            leg5->Draw();
        }
    }

    TCanvas* c4 = new TCanvas("c4","",1000,1000);
    
    gPad->SetLeftMargin(0.15);
    gPad->SetRightMargin(0.0);
    gPad->SetTopMargin(0.0);
    gPad->SetBottomMargin(0.0);
    c4->Divide(3,5);
    for(int i=15;i<30;i++){
        c4->cd(i-14);
        carray[i]->Draw();
        gPad->SetLogy();
        gPad->SetLeftMargin(0.1);
        gPad->SetRightMargin(0.1);
        gPad->SetTopMargin(0.1);
        gPad->SetBottomMargin(0.1);
        if(i==15){
            TLegend* leg6 = new TLegend(0.7,0.8,0.85,0.85);
            SetLeg(leg6,.05);
            leg6->SetHeader("Ptmin=30 GeV");
            leg6->AddEntry("array[15]","R=0.2","");
            leg6->AddEntry("array[15]","combined tracks","");
            leg6->Draw();
        }
        else if(i==16){
            TLegend* leg2 = new TLegend(0.6,0.7,0.85,0.85);
            SetLeg(leg2,.05);
            leg2->SetHeader("R=0.3");
            leg2->AddEntry(array[0],"mixed event","l");
            leg2->AddEntry(carray[0],"combined tracks","l");
            leg2->Draw();
        }
        else if(i==17){
            TLegend* leg3 = new TLegend(0.6,0.7,0.85,0.85);
            SetLeg(leg3,.05);
            leg3->SetHeader("R=0.4");
            leg3->Draw();
        }
        else if(i==18){
            TLegend* leg7 = new TLegend(0.7,0.8,0.85,0.85);
            SetLeg(leg7,.05);
            leg7->SetHeader("Ptmin=35 GeV");
            leg7->Draw();
        }
        else if(i==21){
            TLegend* leg8 = new TLegend(0.7,0.8,0.85,0.85);
            SetLeg(leg8,.05);
            leg8->SetHeader("Ptmin=40 GeV");
            leg8->Draw();
        }
        else if(i==24){
            TLegend* leg9 = new TLegend(0.7,0.8,0.85,0.85);
            SetLeg(leg9,.05);
            leg9->SetHeader("Ptmin=45 GeV");
            leg9->Draw();
        }
        else if(i==27){
            TLegend* leg10 = new TLegend(0.7,0.8,0.85,0.85);
            SetLeg(leg10,.05);
            leg10->SetHeader("Ptmin=50 GeV");
            leg10->Draw();
        }
        for (int j=1;j<=150;j++){
            if(array[i]->GetBinContent(j)<5)
                array[i]->SetBinContent(j,0);
        }
        scale= ((carray[i]->Integral(0,50))/(array[i]->Integral(0,50)));
        array[i]->Scale(scale);
        array[i]->SetLineColor(kRed);
        array[i]->Draw("same");
      //  cout<<scale<<endl;
    }
    for(int i=0;i<30;i++)
        cout<<subtracted[i]<<endl;
    
    
    
    
    /*TCanvas* c2 = new TCanvas("c2","",1000,1000);
    gPad->SetLeftMargin(0.15);
    gPad->SetRightMargin(0.0);
    gPad->SetTopMargin(0.0);
    gPad->SetBottomMargin(0.0);
    c2->Divide(3,5);
    for(int i=15;i<30;i++){
        c2->cd(i-14);
        carray[i]->Draw("colz");
        gPad->SetLogz();
        gPad->SetLeftMargin(0.1);
        gPad->SetRightMargin(0.1);
        gPad->SetTopMargin(0.1);
        gPad->SetBottomMargin(0.1);
        if(i==15){
            TLegend* leg = new TLegend(0.6,0.7,0.85,0.85);
            SetLeg(leg,.05);
            leg->SetHeader("Ptmin=5 GeV");
            leg->AddEntry("array[0]","R=0.2","");
            leg->AddEntry("array[0]","PYTHIA+Background-rho jets","");
            leg->Draw();
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
        }
        else if(i==16){
            TLegend* leg2 = new TLegend(0.6,0.7,0.85,0.85);
            SetLeg(leg2,.05);
            leg2->SetHeader("R=0.3");
            leg2->Draw();
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
            array[i]->GetYaxis()->SetLabelOffset(999);
            array[i]->GetYaxis()->SetLabelSize(0);
        }
        else if(i==17){
            TLegend* leg3 = new TLegend(0.6,0.7,0.85,0.85);
            SetLeg(leg3,.05);
            leg3->SetHeader("R=0.4");
            leg3->Draw();
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
            array[i]->GetYaxis()->SetLabelOffset(999);
            array[i]->GetYaxis()->SetLabelSize(0);
        }
        else if(i==18){
            TLegend* leg4 = new TLegend(0.6,0.7,0.85,0.85);
            SetLeg(leg4,.05);
            leg4->SetHeader("Ptmin=15 GeV");
            leg4->Draw();
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
        }
        else if(i==19){
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
            array[i]->GetYaxis()->SetLabelOffset(999);
            array[i]->GetYaxis()->SetLabelSize(0);
        }
        else if(i==20){
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
            array[i]->GetYaxis()->SetLabelOffset(999);
            array[i]->GetYaxis()->SetLabelSize(0);
        }
        else if(i==21){
            TLegend* leg5 = new TLegend(0.7,0.8,0.85,0.85);
            SetLeg(leg5,.05);
            leg5->SetHeader("Ptmin=25 GeV");
            leg5->Draw();
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
        }
        else if(i==22){
            array[i]->GetYaxis()->SetLabelOffset(999);
            array[i]->GetYaxis()->SetLabelSize(0);
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
        }
        else if(i==23){
            array[i]->GetYaxis()->SetLabelOffset(999);
            array[i]->GetYaxis()->SetLabelSize(0);
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
        }
        else if(i==24){
            TLegend* leg5 = new TLegend(0.7,0.8,0.85,0.85);
            SetLeg(leg5,.05);
            leg5->SetHeader("Ptmin=35 GeV");
            leg5->Draw();
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
        }
        else if(i==25){
            array[i]->GetYaxis()->SetLabelOffset(999);
            array[i]->GetYaxis()->SetLabelSize(0);
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
        }
        else if(i==26){
            array[i]->GetYaxis()->SetLabelOffset(999);
            array[i]->GetYaxis()->SetLabelSize(0);
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
        }
        else if(i==27){
            TLegend* leg5 = new TLegend(0.7,0.8,0.85,0.85);
            SetLeg(leg5,.05);
            leg5->SetHeader("Ptmin=45 GeV");
            leg5->Draw();
        }
        else if(i==28){
            array[i]->GetYaxis()->SetLabelOffset(999);
            array[i]->GetYaxis()->SetLabelSize(0);
        }
        else if(i==29){
            array[i]->GetYaxis()->SetLabelOffset(999);
            array[i]->GetYaxis()->SetLabelSize(0);
        }
        
    }
    
    TCanvas *c3= new TCanvas("c3","",1000,1000);
    TH1* Projection[30];
    for(int i=0;i<30;i++){
        Projection[i]=array[i]->ProjectionY("Projection[i]",1,-1);
        cout<<Projection[i]->GetRMS(1)<<endl;
        //cout<<Projection[i]->GetMean()<<endl;
    }
    Double_t jpt5[3]={0.469616,0.528041,0.566678};
    Double_t jpt15[3]={0.558344,0.627056,0.641796};
    Double_t jpt25[3]={0.6521,0.710176,0.719287};
    Double_t jpt35[3]={0.701202,0.753099,0.757408};
    Double_t jpt45[3]={0.742131,0.792112,0.806184};
    Double_t spt5[3]={1.09789,1.40334,1.90479};
    Double_t spt15[3]={0.648738,0.805447,1.05616};
    Double_t spt25[3]={0.699613,0.815683,0.985538};
    Double_t spt35[3]={0.735253,0.831829,0.95974};
    Double_t spt45[3]={0.760689,0.841417,0.946005};
    Double_t ejpt5[3]={0.243201,0.287315,0.330208};
    Double_t ejpt15[3]={0.264054,0.302826,0.342976};
    Double_t ejpt25[3]={0.254102,0.277335,0.316553};
    Double_t ejpt35[3]={0.234616,0.249164,0.287426};
    Double_t ejpt45[3]={0.207817,0.211231,0.238832};
    Double_t espt5[3]={0.331098,0.443326,0.52885};
    Double_t espt15[3]={0.228333,0.260963,0.307121};
    Double_t espt25[3]={0.23027,0.235426,0.248455};
    Double_t espt35[3]={0.218582,0.211284,0.215638};
    Double_t espt45[3]={0.202461,0.19085,0.191792};
    Double_t count[3]={0.21,0.31,0.41};
    Double_t count2[3]={0.19,0.29,0.39};
    Double_t ex[3]={0,0,0};
    TGraphErrors *f = new TGraphErrors(3,count,jpt5,ex,ejpt5);
    f->GetYaxis()->SetRangeUser(0,3);
    f->GetXaxis()->SetRangeUser(.15,.42);
    f->SetMarkerStyle(23);
    f->SetMarkerSize(2);
    f->SetMarkerColor(kAzure);
    f->SetLineColor(kAzure);
    f->GetYaxis()->SetTitle("Mean XJG");
    f->GetXaxis()->SetTitle("Jet Radius");
    f->Draw("APsame");
    TGraphErrors *g = new TGraphErrors(3,count2,jpt15,ex,ejpt15);
    //g->GetYaxis()->SetRangeUser(0,2);
    g->SetMarkerStyle(23);
    g->SetMarkerSize(2);
    g->SetMarkerColor(kMagenta);
    g->SetLineColor(kMagenta);
    g->Draw("Psame");
    TGraphErrors *h = new TGraphErrors(3,count,jpt25,ex,ejpt25);
    //h->GetYaxis()->SetRangeUser(0,2);
    h->SetMarkerStyle(23);
    h->SetMarkerSize(2);
    h->SetMarkerColor(kRed);
    h->SetLineColor(kRed);
    h->Draw("P");
    TGraphErrors *w = new TGraphErrors(3,count2,jpt35,ex,ejpt35);
    //g->GetYaxis()->SetRangeUser(0,2);
    w->SetMarkerStyle(23);
    w->SetMarkerSize(2);
    w->SetMarkerColor(kOrange);
    w->SetLineColor(kOrange);
    w->Draw("P");
    TGraphErrors *q = new TGraphErrors(3,count,jpt45,ex,ejpt45);
    //h->GetYaxis()->SetRangeUser(0,2);
    q->SetMarkerStyle(23);
    q->SetMarkerSize(2);
    q->SetMarkerColor(kGreen);
    q->SetLineColor(kGreen);
    q->Draw("P");
    TGraphErrors *j = new TGraphErrors(3,count,spt5,ex,espt5);
    //h->GetYaxis()->SetRangeUser(0,2);
    j->SetMarkerStyle(28);
    j->SetMarkerSize(2);
    j->SetMarkerColor(kAzure);
    j->SetLineColor(kAzure);
    j->Draw("P");
    TGraphErrors *k = new TGraphErrors(3,count2,spt15,ex,espt15);
    //h->GetYaxis()->SetRangeUser(0,2);
    k->SetMarkerStyle(28);
    k->SetMarkerSize(2);
    k->SetMarkerColor(kMagenta);
    k->SetLineColor(kMagenta);
    k->Draw("P");
    TGraphErrors *l = new TGraphErrors(3,count,spt25,ex,espt25);
    //h->GetYaxis()->SetRangeUser(0,2);
    l->SetMarkerStyle(28);
    l->SetMarkerSize(2);
    l->SetMarkerColor(kRed);
    l->SetLineColor(kRed);
    l->Draw("P");
    TGraphErrors *r = new TGraphErrors(3,count2,spt35,ex,espt35);
    //g->GetYaxis()->SetRangeUser(0,2);
    r->SetMarkerStyle(28);
    r->SetMarkerSize(2);
    r->SetMarkerColor(kOrange);
    r->SetLineColor(kOrange);
    r->Draw("P");
    TGraphErrors *y = new TGraphErrors(3,count,spt45,ex,espt45);
    //h->GetYaxis()->SetRangeUser(0,2);
    y->SetMarkerStyle(28);
    y->SetMarkerSize(2);
    y->SetMarkerColor(kGreen);
    y->SetLineColor(kGreen);
    y->Draw("P");
    TLegend* leg6 = new TLegend(0.7,0.8,0.85,0.85);
    SetLeg(leg6,.03);
    leg6->SetTextColor(kAzure);
    leg6->AddEntry("f","ptmin=5 GeV","");
    leg6->Draw();
    TLegend* leg7 = new TLegend(0.7,0.8,0.85,0.85);
    SetLeg(leg7,.03);
    leg7->SetTextColor(kMagenta);
    leg7->AddEntry("f","ptmin=15 GeV","");
    leg7->Draw();
    TLegend* leg8 = new TLegend(0.7,0.8,0.85,0.85);
    SetLeg(leg8,.03);
    leg8->SetTextColor(kRed);
    leg8->AddEntry("f","ptmin=25 GeV","");
    leg8->Draw();
    TLegend* leg10 = new TLegend(0.7,0.8,0.85,0.85);
    SetLeg(leg10,.03);
    leg10->SetTextColor(kOrange);
    leg10->AddEntry("f","ptmin=35 GeV","");
    leg10->Draw();
    TLegend* leg11 = new TLegend(0.7,0.8,0.85,0.85);
    SetLeg(leg11,.03);
    leg11->SetTextColor(kGreen);
    leg11->AddEntry("f","ptmin=45 GeV","");
    leg11->Draw();
    TLegend* leg9 = new TLegend(0.7,0.8,0.85,0.85);
    SetLeg(leg9,.03);
    leg9->AddEntry(f,"PYTHIA","P");
    leg9->AddEntry(y,"PYTHIA-Rho","P");
    leg9->Draw();

    TCanvas *c4= new TCanvas("c4","",1000,1000);
    
    TGraph*f1 = new TGraph(3,count,ejpt5);
    f1->GetYaxis()->SetRangeUser(0,1);
    f1->GetXaxis()->SetRangeUser(.15,.42);
    f1->SetMarkerStyle(23);
    f1->SetMarkerSize(2);
    f1->SetMarkerColor(kAzure);
    f1->SetLineColor(kAzure);
    f1->GetYaxis()->SetTitle("RMS");
    f1->GetXaxis()->SetTitle("Jet Radius");
    f1->Draw("APsame");
    TGraph *g1 = new TGraph(3,count2,ejpt15);
    //g->GetYaxis()->SetRangeUser(0,2);
    g1->SetMarkerStyle(23);
    g1->SetMarkerSize(2);
    g1->SetMarkerColor(kMagenta);
    g1->SetLineColor(kMagenta);
    g1->Draw("P");
    TGraph *h1 = new TGraph(3,count,ejpt25);
    //h->GetYaxis()->SetRangeUser(0,2);
    h1->SetMarkerStyle(23);
    h1->SetMarkerSize(2);
    h1->SetMarkerColor(kRed);
    h1->SetLineColor(kRed);
    h1->Draw("P");
    TGraph *w1 = new TGraph(3,count2,ejpt35);
    //g->GetYaxis()->SetRangeUser(0,2);
    w1->SetMarkerStyle(23);
    w1->SetMarkerSize(2);
    w1->SetMarkerColor(kOrange);
    w1->SetLineColor(kOrange);
    w1->Draw("P");
    TGraph *q1 = new TGraph(3,count,ejpt45);
    //h->GetYaxis()->SetRangeUser(0,2);
    q1->SetMarkerStyle(23);
    q1->SetMarkerSize(2);
    q1->SetMarkerColor(kGreen);
    q1->SetLineColor(kGreen);
    q1->Draw("P");
    TGraph *j1 = new TGraph(3,count,espt5);
    //h->GetYaxis()->SetRangeUser(0,2);
    j1->SetMarkerStyle(28);
    j1->SetMarkerSize(2);
    j1->SetMarkerColor(kAzure);
    j1->SetLineColor(kAzure);
    j1->Draw("P");
    TGraph *k1 = new TGraph(3,count2,espt15);
    //h->GetYaxis()->SetRangeUser(0,2);
    k1->SetMarkerStyle(28);
    k1->SetMarkerSize(2);
    k1->SetMarkerColor(kMagenta);
    k1->SetLineColor(kMagenta);
    k1->Draw("P");
    TGraph *l1 = new TGraph(3,count,espt25);
    //h->GetYaxis()->SetRangeUser(0,2);
    l1->SetMarkerStyle(28);
    l1->SetMarkerSize(2);
    l1->SetMarkerColor(kRed);
    l1->SetLineColor(kRed);
    l1->Draw("P");
    TGraph *r1 = new TGraph(3,count2,espt35);
    //g->GetYaxis()->SetRangeUser(0,2);
    r1->SetMarkerStyle(28);
    r1->SetMarkerSize(2);
    r1->SetMarkerColor(kOrange);
    r1->SetLineColor(kOrange);
    r1->Draw("P");
    TGraph *y1 = new TGraph(3,count,espt45);
    //h->GetYaxis()->SetRangeUser(0,2);
    y1->SetMarkerStyle(28);
    y1->SetMarkerSize(2);
    y1->SetMarkerColor(kGreen);
    y1->SetLineColor(kGreen);
    y1->Draw("P");
    TLegend* leg6 = new TLegend(0.7,0.8,0.85,0.85);
    SetLeg(leg6,.03);
    leg6->SetTextColor(kAzure);
    leg6->AddEntry("f","ptmin=5 GeV","");
    leg6->Draw();
    TLegend* leg7 = new TLegend(0.7,0.8,0.85,0.85);
    SetLeg(leg7,.03);
    leg7->SetTextColor(kMagenta);
    leg7->AddEntry("f","ptmin=15 GeV","");
    leg7->Draw();
    TLegend* leg8 = new TLegend(0.7,0.8,0.85,0.85);
    SetLeg(leg8,.03);
    leg8->SetTextColor(kRed);
    leg8->AddEntry("f","ptmin=25 GeV","");
    leg8->Draw();
    TLegend* leg10 = new TLegend(0.7,0.8,0.85,0.85);
    SetLeg(leg10,.03);
    leg10->SetTextColor(kOrange);
    leg10->AddEntry("f","ptmin=35 GeV","");
    leg10->Draw();
    TLegend* leg11 = new TLegend(0.7,0.8,0.85,0.85);
    SetLeg(leg11,.03);
    leg11->SetTextColor(kGreen);
    leg11->AddEntry("f","ptmin=45 GeV","");
    leg11->Draw();
    TLegend* leg9 = new TLegend(0.7,0.8,0.85,0.85);
    SetLeg(leg9,.03);
    leg9->AddEntry(f,"PYTHIA","P");
    leg9->AddEntry(y,"PYTHIA-Rho","P");
    leg9->Draw();
*/
}
Ejemplo n.º 12
0
void xjgeven(TString infile = "histos.root"){
    set_plot_style();
    gStyle->SetOptStat(0);
    gStyle->SetOptTitle(0);

    TH2* array[30];
    TFile *_file0 = TFile::Open("evenplots.root");
    TH2* xjgjetone = (TH2*)gROOT->FindObject("j10p2");
    array[0]= xjgjetone;
    
    TFile *_file1 = TFile::Open("evenplots.root");
    TH2* xjgjettwo = (TH2*)gROOT->FindObject("j10p3");
    array[1]= xjgjettwo;

    TFile *_file2 = TFile::Open("evenplots.root");
    TH2* xjgjetthree = (TH2*)gROOT->FindObject("j10p4");
    array[2]= xjgjetthree;
    
    TFile *_file3 = TFile::Open("evenplots.root");
    TH2* xjgjetfour = (TH2*)gROOT->FindObject("j20p2");
    array[3]= xjgjetfour;
    
    TFile *_file4 = TFile::Open("evenplots.root");
    TH2* xjgjetfive = (TH2*)gROOT->FindObject("j20p3");
    array[4]= xjgjetfive;

    TFile *_file5 = TFile::Open("evenplots.root");
    TH2* xjgjetsix = (TH2*)gROOT->FindObject("j20p4");
    array[5]= xjgjetsix;
    
    TFile *_file6 = TFile::Open("evenplots.root");
    TH2* xjgjetseven = (TH2*)gROOT->FindObject("j30p2");
    array[6]= xjgjetseven;
    
    TFile *_file7 = TFile::Open("evenplots.root");
    TH2* xjgjeteight = (TH2*)gROOT->FindObject("j30p3");
    array[7]= xjgjeteight;
    
    TFile *_file8 = TFile::Open("evenplots.root");
    TH2* xjgjetnine = (TH2*)gROOT->FindObject("j30p4");
    array[8]= xjgjetnine;
    
    TFile *_file0 = TFile::Open("evenplots.root");
    TH2* xjgjetonea = (TH2*)gROOT->FindObject("j40p2");
    array[9]= xjgjetonea;
    
    TFile *_file1 = TFile::Open("evenplots.root");
    TH2* xjgjettwoa = (TH2*)gROOT->FindObject("j40p3");
    array[10]= xjgjettwoa;
    
    TFile *_file2 = TFile::Open("evenplots.root");
    TH2* xjgjetthreea = (TH2*)gROOT->FindObject("j40p4");
    array[11]= xjgjetthreea;
    
    TFile *_file3 = TFile::Open("evenplots.root");
    TH2* xjgjetfoura = (TH2*)gROOT->FindObject("j50p2");
    array[12]= xjgjetfoura;
    
    TFile *_file4 = TFile::Open("evenplots.root");
    TH2* xjgjetfivea = (TH2*)gROOT->FindObject("j50p3");
    array[13]= xjgjetfivea;
    
    TFile *_file5 = TFile::Open("evenplots.root");
    TH2* xjgjetsixa = (TH2*)gROOT->FindObject("j50p4");
    array[14]= xjgjetsixa;
    
    
    TCanvas* c1 = new TCanvas("c1","",1000,1000);
    gPad->SetLeftMargin(0.15);
    gPad->SetRightMargin(0.0);
    gPad->SetTopMargin(0.0);
    gPad->SetBottomMargin(0.0);
    c1->Divide(3,5);
    for(int i=0;i<15;i++){
        c1->cd(i+1);
        array[i]->Draw("colz");
        gPad->SetLogz();
        gPad->SetLeftMargin(0.1);
        gPad->SetRightMargin(0.1);
        gPad->SetTopMargin(0.1);
        gPad->SetBottomMargin(0.1);
        if(i==0){
            TLegend* leg = new TLegend(0.6,0.7,0.85,0.85);
            SetLeg(leg,.05);
            leg->SetHeader("Ptmin=10 GeV");
            leg->AddEntry("array[0]","R=0.2","");
            leg->AddEntry("array[0]","PYTHIA jets","");
            leg->Draw();
             array[i]->GetXaxis()->SetLabelOffset(999);
             array[i]->GetXaxis()->SetLabelSize(0);
        }
        else if(i==1){
            TLegend* leg2 = new TLegend(0.6,0.7,0.85,0.85);
            SetLeg(leg2,.05);
            leg2->SetHeader("R=0.3");
            leg2->Draw();
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
            array[i]->GetYaxis()->SetLabelOffset(999);
            array[i]->GetYaxis()->SetLabelSize(0);
        }
        else if(i==2){
            TLegend* leg3 = new TLegend(0.6,0.7,0.85,0.85);
            SetLeg(leg3,.05);
            leg3->SetHeader("R=0.4");
            leg3->Draw();
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
            array[i]->GetYaxis()->SetLabelOffset(999);
            array[i]->GetYaxis()->SetLabelSize(0);
        }
        else if(i==3){
            TLegend* leg4 = new TLegend(0.6,0.7,0.85,0.85);
            SetLeg(leg4,.05);
            leg4->SetHeader("Ptmin=20 GeV");
            leg4->Draw();
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
        }
        else if(i==4){
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
            array[i]->GetYaxis()->SetLabelOffset(999);
            array[i]->GetYaxis()->SetLabelSize(0);
        }
        else if(i==5){
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
            array[i]->GetYaxis()->SetLabelOffset(999);
            array[i]->GetYaxis()->SetLabelSize(0);
        }
        else if(i==6){
            TLegend* leg5 = new TLegend(0.7,0.8,0.85,0.85);
            SetLeg(leg5,.05);
            leg5->SetHeader("Ptmin=30 GeV");
            leg5->Draw();
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
        }
        else if(i==7){
            array[i]->GetYaxis()->SetLabelOffset(999);
            array[i]->GetYaxis()->SetLabelSize(0);
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
        }
        else if(i==8){
            array[i]->GetYaxis()->SetLabelOffset(999);
            array[i]->GetYaxis()->SetLabelSize(0);
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
        }
        else if(i==9){
            TLegend* leg5 = new TLegend(0.7,0.8,0.85,0.85);
            SetLeg(leg5,.05);
            leg5->SetHeader("Ptmin=40 GeV");
            leg5->Draw();
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
        }
        else if(i==10){
            array[i]->GetYaxis()->SetLabelOffset(999);
            array[i]->GetYaxis()->SetLabelSize(0);
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
        }
        else if(i==11){
            array[i]->GetYaxis()->SetLabelOffset(999);
            array[i]->GetYaxis()->SetLabelSize(0);
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
        }
        else if(i==12){
            TLegend* leg5 = new TLegend(0.7,0.8,0.85,0.85);
            SetLeg(leg5,.05);
            leg5->SetHeader("Ptmin=50 GeV");
            leg5->Draw();
        }
        else if(i==13){
            array[i]->GetYaxis()->SetLabelOffset(999);
            array[i]->GetYaxis()->SetLabelSize(0);
        }
        else if(i==14){
            array[i]->GetYaxis()->SetLabelOffset(999);
            array[i]->GetYaxis()->SetLabelSize(0);
        }

    }
    TFile *_file0 = TFile::Open("evenplots.root");
    TH2* xjgjetone = (TH2*)gROOT->FindObject("s10p2");
    array[15]= xjgjetone;
    
    TFile *_file1 = TFile::Open("evenplots.root");
    TH2* xjgjettwo = (TH2*)gROOT->FindObject("s10p3");
    array[16]= xjgjettwo;
    
    TFile *_file2 = TFile::Open("evenplots.root");
    TH2* xjgjetthree = (TH2*)gROOT->FindObject("s10p4");
    array[17]= xjgjetthree;
    
    TFile *_file3 = TFile::Open("evenplots.root");
    TH2* xjgjetfour = (TH2*)gROOT->FindObject("s20p2");
    array[18]= xjgjetfour;
    
    TFile *_file4 = TFile::Open("evenplots.root");
    TH2* xjgjetfive = (TH2*)gROOT->FindObject("s20p3");
    array[19]= xjgjetfive;
    
    TFile *_file5 = TFile::Open("evenplots.root");
    TH2* xjgjetsix = (TH2*)gROOT->FindObject("s20p4");
    array[20]= xjgjetsix;
    
    TFile *_file6 = TFile::Open("evenplots.root");
    TH2* xjgjetseven = (TH2*)gROOT->FindObject("s30p2");
    array[21]= xjgjetseven;
    
    TFile *_file7 = TFile::Open("evenplots.root");
    TH2* xjgjeteight = (TH2*)gROOT->FindObject("s30p3");
    array[22]= xjgjeteight;
    
    TFile *_file8 = TFile::Open("evenplots.root");
    TH2* xjgjetnine = (TH2*)gROOT->FindObject("s30p4");
    array[23]= xjgjetnine;
    TFile *_file0 = TFile::Open("evenplots.root");
    TH2* xjgjetone = (TH2*)gROOT->FindObject("s40p2");
    array[24]= xjgjetone;
    
    TFile *_file1 = TFile::Open("evenplots.root");
    TH2* xjgjettwo = (TH2*)gROOT->FindObject("s40p3");
    array[25]= xjgjettwo;
    
    TFile *_file2 = TFile::Open("evenplots.root");
    TH2* xjgjetthree = (TH2*)gROOT->FindObject("s40p4");
    array[26]= xjgjetthree;
    
    TFile *_file3 = TFile::Open("evenplots.root");
    TH2* xjgjetfour = (TH2*)gROOT->FindObject("s50p2");
    array[27]= xjgjetfour;
    
    TFile *_file4 = TFile::Open("evenplots.root");
    TH2* xjgjetfive = (TH2*)gROOT->FindObject("s50p3");
    array[28]= xjgjetfive;
    
    TFile *_file5 = TFile::Open("evenplots.root");
    TH2* xjgjetsix = (TH2*)gROOT->FindObject("s50p4");
    array[29]= xjgjetsix;
    
    TCanvas* c2 = new TCanvas("c2","",1000,1000);
    gPad->SetLeftMargin(0.15);
    gPad->SetRightMargin(0.0);
    gPad->SetTopMargin(0.0);
    gPad->SetBottomMargin(0.0);
    c2->Divide(3,5);
    for(int i=15;i<30;i++){
        c2->cd(i-14);
        array[i]->Draw("colz");
        gPad->SetLogz();
        gPad->SetLeftMargin(0.1);
        gPad->SetRightMargin(0.1);
        gPad->SetTopMargin(0.1);
        gPad->SetBottomMargin(0.1);
        if(i==15){
            TLegend* leg = new TLegend(0.6,0.7,0.85,0.85);
            SetLeg(leg,.05);
            leg->SetHeader("Ptmin=10 GeV");
            leg->AddEntry("array[0]","R=0.2","");
            leg->AddEntry("array[0]","PYTHIA+Background-rho jets","");
            leg->Draw();
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
        }
        else if(i==16){
            TLegend* leg2 = new TLegend(0.6,0.7,0.85,0.85);
            SetLeg(leg2,.05);
            leg2->SetHeader("R=0.3");
            leg2->Draw();
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
            array[i]->GetYaxis()->SetLabelOffset(999);
            array[i]->GetYaxis()->SetLabelSize(0);
        }
        else if(i==17){
            TLegend* leg3 = new TLegend(0.6,0.7,0.85,0.85);
            SetLeg(leg3,.05);
            leg3->SetHeader("R=0.4");
            leg3->Draw();
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
            array[i]->GetYaxis()->SetLabelOffset(999);
            array[i]->GetYaxis()->SetLabelSize(0);
        }
        else if(i==18){
            TLegend* leg4 = new TLegend(0.6,0.7,0.85,0.85);
            SetLeg(leg4,.05);
            leg4->SetHeader("Ptmin=20 GeV");
            leg4->Draw();
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
        }
        else if(i==19){
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
            array[i]->GetYaxis()->SetLabelOffset(999);
            array[i]->GetYaxis()->SetLabelSize(0);
        }
        else if(i==20){
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
            array[i]->GetYaxis()->SetLabelOffset(999);
            array[i]->GetYaxis()->SetLabelSize(0);
        }
        else if(i==21){
            TLegend* leg5 = new TLegend(0.7,0.8,0.85,0.85);
            SetLeg(leg5,.05);
            leg5->SetHeader("Ptmin=30 GeV");
            leg5->Draw();
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
        }
        else if(i==22){
            array[i]->GetYaxis()->SetLabelOffset(999);
            array[i]->GetYaxis()->SetLabelSize(0);
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
        }
        else if(i==23){
            array[i]->GetYaxis()->SetLabelOffset(999);
            array[i]->GetYaxis()->SetLabelSize(0);
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
        }
        else if(i==24){
            TLegend* leg5 = new TLegend(0.7,0.8,0.85,0.85);
            SetLeg(leg5,.05);
            leg5->SetHeader("Ptmin=40 GeV");
            leg5->Draw();
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
        }
        else if(i==25){
            array[i]->GetYaxis()->SetLabelOffset(999);
            array[i]->GetYaxis()->SetLabelSize(0);
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
        }
        else if(i==26){
            array[i]->GetYaxis()->SetLabelOffset(999);
            array[i]->GetYaxis()->SetLabelSize(0);
            array[i]->GetXaxis()->SetLabelOffset(999);
            array[i]->GetXaxis()->SetLabelSize(0);
        }
        else if(i==27){
            TLegend* leg5 = new TLegend(0.7,0.8,0.85,0.85);
            SetLeg(leg5,.05);
            leg5->SetHeader("Ptmin=50 GeV");
            leg5->Draw();
        }
        else if(i==28){
            array[i]->GetYaxis()->SetLabelOffset(999);
            array[i]->GetYaxis()->SetLabelSize(0);
        }
        else if(i==29){
            array[i]->GetYaxis()->SetLabelOffset(999);
            array[i]->GetYaxis()->SetLabelSize(0);
        }
        
    }
    
    TCanvas *c3= new TCanvas("c3","",1000,1000);
    TH1* Projection[30];
    for(int i=0;i<30;i++){
        Projection[i]=array[i]->ProjectionY("Projection[i]",1,-1);
        cout<<Projection[i]->GetRMS(1)<<endl;
        //cout<<Projection[i]->GetMean()<<endl;
    }
    Double_t jpt10[3]={0.496099,0.577304,0.604262};
    Double_t jpt20[3]={0.61097,0.674566,0.681365};
    Double_t jpt30[3]={0.681712,0.734251,0.744046};
    Double_t jpt40[3]={0.728408,0.780619,0.792677};
    Double_t jpt50[3]={0.75418,0.804495,0.815444};
    Double_t spt10[3]={0.701405,0.892986,1.24353};
    Double_t spt20[3]={0.673904,0.80738,1.00034};
    Double_t spt30[3]={0.724249,0.826071,0.969782};
    Double_t spt40[3]={0.751304,0.838823,0.952558};
    Double_t spt50[3]={0.769957,0.84622,0.942272};
    Double_t ejpt10[3]={0.255846,0.299941,0.337053};
    Double_t ejpt20[3]={0.259329,0.291999,0.332003};
    Double_t ejpt30[3]={0.246683,0.266093,0.298417};
    Double_t ejpt40[3]={0.2144,0.223676,0.255009};
    Double_t ejpt50[3]={0.198518,0.194969,0.226226};
    Double_t espt10[3]={0.220521,0.286525,0.367507};
    Double_t espt20[3]={0.233455,0.251319,0.280164};
    Double_t espt30[3]={0.225364,0.219934,0.227235};
    Double_t espt40[3]={0.205521,0.197867,0.201941};
    Double_t espt50[3]={0.196179,0.185749,0.184484};
    Double_t count[3]={0.19,0.29,0.39};
    Double_t count2[3]={0.2,0.3,0.4};
    Double_t count3[3]={.21,.31,.41};
    Double_t ex[3]={0,0,0};
    TGraphErrors *f = new TGraphErrors(3,count,jpt10,ex,ejpt10);
    f->GetYaxis()->SetRangeUser(0,3);
    f->GetXaxis()->SetRangeUser(.15,.42);
    f->SetMarkerStyle(23);
    f->SetMarkerSize(2);
    f->SetMarkerColor(kAzure);
    f->SetLineColor(kAzure);
    f->GetYaxis()->SetTitle("Mean XJG");
    f->GetXaxis()->SetTitle("Jet Radius");
    f->Draw("APsame");
    TGraphErrors *g = new TGraphErrors(3,count2,jpt20,ex,ejpt20);
    //g->GetYaxis()->SetRangeUser(0,2);
    g->SetMarkerStyle(23);
    g->SetMarkerSize(2);
    g->SetMarkerColor(kMagenta);
    g->SetLineColor(kMagenta);
    g->Draw("Psame");
    TGraphErrors *h = new TGraphErrors(3,count3,jpt30,ex,ejpt30);
    //h->GetYaxis()->SetRangeUser(0,2);
    h->SetMarkerStyle(23);
    h->SetMarkerSize(2);
    h->SetMarkerColor(kRed);
    h->SetLineColor(kRed);
    h->Draw("P");
    TGraphErrors *w = new TGraphErrors(3,count,jpt40,ex,ejpt40);
    //g->GetYaxis()->SetRangeUser(0,2);
    w->SetMarkerStyle(23);
    w->SetMarkerSize(2);
    w->SetMarkerColor(kOrange);
    w->SetLineColor(kOrange);
    w->Draw("P");
    TGraphErrors *q = new TGraphErrors(3,count2,jpt50,ex,ejpt50);
    //h->GetYaxis()->SetRangeUser(0,2);
    q->SetMarkerStyle(23);
    q->SetMarkerSize(2);
    q->SetMarkerColor(kGreen);
    q->SetLineColor(kGreen);
    q->Draw("P");
    TGraphErrors *j = new TGraphErrors(3,count,spt10,ex,espt10);
    //h->GetYaxis()->SetRangeUser(0,2);
    j->SetMarkerStyle(28);
    j->SetMarkerSize(2);
    j->SetMarkerColor(kAzure);
    j->SetLineColor(kAzure);
    j->Draw("P");
    TGraphErrors *k = new TGraphErrors(3,count2,spt20,ex,espt20);
    //h->GetYaxis()->SetRangeUser(0,2);
    k->SetMarkerStyle(28);
    k->SetMarkerSize(2);
    k->SetMarkerColor(kMagenta);
    k->SetLineColor(kMagenta);
    k->Draw("P");
    TGraphErrors *l = new TGraphErrors(3,count3,spt30,ex,espt30);
    //h->GetYaxis()->SetRangeUser(0,2);
    l->SetMarkerStyle(28);
    l->SetMarkerSize(2);
    l->SetMarkerColor(kRed);
    l->SetLineColor(kRed);
    l->Draw("P");
    TGraphErrors *r = new TGraphErrors(3,count,spt40,ex,espt40);
    //g->GetYaxis()->SetRangeUser(0,2);
    r->SetMarkerStyle(28);
    r->SetMarkerSize(2);
    r->SetMarkerColor(kOrange);
    r->SetLineColor(kOrange);
    r->Draw("P");
    TGraphErrors *y = new TGraphErrors(3,count2,spt50,ex,espt50);
    //h->GetYaxis()->SetRangeUser(0,2);
    y->SetMarkerStyle(28);
    y->SetMarkerSize(2);
    y->SetMarkerColor(kGreen);
    y->SetLineColor(kGreen);
    y->Draw("P");
    TLegend* leg6 = new TLegend(0.7,0.8,0.85,0.85);
    SetLeg(leg6,.03);
    leg6->SetTextColor(kAzure);
    leg6->AddEntry("f","ptmin=10 GeV","");
    leg6->Draw();
    TLegend* leg7 = new TLegend(0.7,0.8,0.85,0.85);
    SetLeg(leg7,.03);
    leg7->SetTextColor(kMagenta);
    leg7->AddEntry("f","ptmin=20 GeV","");
    leg7->Draw();
    TLegend* leg8 = new TLegend(0.7,0.8,0.85,0.85);
    SetLeg(leg8,.03);
    leg8->SetTextColor(kRed);
    leg8->AddEntry("f","ptmin=30 GeV","");
    leg8->Draw();
    TLegend* leg10 = new TLegend(0.7,0.8,0.85,0.85);
    SetLeg(leg10,.03);
    leg10->SetTextColor(kOrange);
    leg10->AddEntry("f","ptmin=40 GeV","");
    leg10->Draw();
    TLegend* leg11 = new TLegend(0.7,0.8,0.85,0.85);
    SetLeg(leg11,.03);
    leg11->SetTextColor(kGreen);
    leg11->AddEntry("f","ptmin=50 GeV","");
    leg11->Draw();
    TLegend* leg9 = new TLegend(0.7,0.8,0.85,0.85);
    SetLeg(leg9,.03);
    leg9->AddEntry(f,"PYTHIA","P");
    leg9->AddEntry(y,"PYTHIA-Rho","P");
    leg9->Draw();

    TCanvas *c4= new TCanvas("c4","",1000,1000);
    
    TGraph*f1 = new TGraph(3,count,ejpt10);
    f1->GetYaxis()->SetRangeUser(0,1);
    f1->GetXaxis()->SetRangeUser(.15,.42);
    f1->SetMarkerStyle(23);
    f1->SetMarkerSize(2);
    f1->SetMarkerColor(kAzure);
    f1->SetLineColor(kAzure);
    f1->GetYaxis()->SetTitle("RMS");
    f1->GetXaxis()->SetTitle("Jet Radius");
    f1->Draw("APsame");
    TGraph *g1 = new TGraph(3,count2,ejpt20);
    //g->GetYaxis()->SetRangeUser(0,2);
    g1->SetMarkerStyle(23);
    g1->SetMarkerSize(2);
    g1->SetMarkerColor(kMagenta);
    g1->SetLineColor(kMagenta);
    g1->Draw("P");
    TGraph *h1 = new TGraph(3,count3,ejpt30);
    //h->GetYaxis()->SetRangeUser(0,2);
    h1->SetMarkerStyle(23);
    h1->SetMarkerSize(2);
    h1->SetMarkerColor(kRed);
    h1->SetLineColor(kRed);
    h1->Draw("P");
    TGraph *w1 = new TGraph(3,count,ejpt40);
    //g->GetYaxis()->SetRangeUser(0,2);
    w1->SetMarkerStyle(23);
    w1->SetMarkerSize(2);
    w1->SetMarkerColor(kOrange);
    w1->SetLineColor(kOrange);
    w1->Draw("P");
    TGraph *q1 = new TGraph(3,count2,ejpt50);
    //h->GetYaxis()->SetRangeUser(0,2);
    q1->SetMarkerStyle(23);
    q1->SetMarkerSize(2);
    q1->SetMarkerColor(kGreen);
    q1->SetLineColor(kGreen);
    q1->Draw("P");
    TGraph *j1 = new TGraph(3,count,espt10);
    //h->GetYaxis()->SetRangeUser(0,2);
    j1->SetMarkerStyle(28);
    j1->SetMarkerSize(2);
    j1->SetMarkerColor(kAzure);
    j1->SetLineColor(kAzure);
    j1->Draw("P");
    TGraph *k1 = new TGraph(3,count2,espt20);
    //h->GetYaxis()->SetRangeUser(0,2);
    k1->SetMarkerStyle(28);
    k1->SetMarkerSize(2);
    k1->SetMarkerColor(kMagenta);
    k1->SetLineColor(kMagenta);
    k1->Draw("P");
    TGraph *l1 = new TGraph(3,count3,espt30);
    //h->GetYaxis()->SetRangeUser(0,2);
    l1->SetMarkerStyle(28);
    l1->SetMarkerSize(2);
    l1->SetMarkerColor(kRed);
    l1->SetLineColor(kRed);
    l1->Draw("P");
    TGraph *r1 = new TGraph(3,count,espt40);
    //g->GetYaxis()->SetRangeUser(0,2);
    r1->SetMarkerStyle(28);
    r1->SetMarkerSize(2);
    r1->SetMarkerColor(kOrange);
    r1->SetLineColor(kOrange);
    r1->Draw("P");
    TGraph *y1 = new TGraph(3,count2,espt50);
    //h->GetYaxis()->SetRangeUser(0,2);
    y1->SetMarkerStyle(28);
    y1->SetMarkerSize(2);
    y1->SetMarkerColor(kGreen);
    y1->SetLineColor(kGreen);
    y1->Draw("P");
    TLegend* leg6 = new TLegend(0.7,0.8,0.85,0.85);
    SetLeg(leg6,.03);
    leg6->SetTextColor(kAzure);
    leg6->AddEntry("f","ptmin=10 GeV","");
    leg6->Draw();
    TLegend* leg7 = new TLegend(0.7,0.8,0.85,0.85);
    SetLeg(leg7,.03);
    leg7->SetTextColor(kMagenta);
    leg7->AddEntry("f","ptmin=20 GeV","");
    leg7->Draw();
    TLegend* leg8 = new TLegend(0.7,0.8,0.85,0.85);
    SetLeg(leg8,.03);
    leg8->SetTextColor(kRed);
    leg8->AddEntry("f","ptmin=30 GeV","");
    leg8->Draw();
    TLegend* leg10 = new TLegend(0.7,0.8,0.85,0.85);
    SetLeg(leg10,.03);
    leg10->SetTextColor(kOrange);
    leg10->AddEntry("f","ptmin=40 GeV","");
    leg10->Draw();
    TLegend* leg11 = new TLegend(0.7,0.8,0.85,0.85);
    SetLeg(leg11,.03);
    leg11->SetTextColor(kGreen);
    leg11->AddEntry("f","ptmin=50 GeV","");
    leg11->Draw();
    TLegend* leg9 = new TLegend(0.7,0.8,0.85,0.85);
    SetLeg(leg9,.03);
    leg9->AddEntry(f,"PYTHIA","P");
    leg9->AddEntry(y,"PYTHIA-Rho","P");
    leg9->Draw();

}
void spectraSysTrig_dNdetashift() {

  // === General Settings ===

  // Note centrality is by 2.5% bins, low bin is inclusive, high bin is exclusive
  // i.e. for 0-10% use minCent=0, maxCent=4. 


  int minCent[12] = {0,2,4,6,8,10,12,14,16,20,24,28};
  int maxCent[12] = {2,4,6,8,10,12,14,16,20,24,28,32};
  
  // absolute values of eta are used, negative eta values are included
  // for full eta range set etaMin=0 etaMax=2.4
  Double_t  etaMin = 0.0;
  Double_t  etaMax = 0.4;

double dndeta[12]= {1612,1313,1082,893.9,731.6,596.8, 482.3,383.9, 266.5, 153.2,79.5, 36.3 };
double dndetaerr[12] = {55,45, 38, 31.4, 26.3, 23.1, 18.7, 16.2, 14.2, 9.7, 6.57, 3.99};

  double ptbins[20]={0.3,0.4,0.5,0.6,0.8,1.0,1.2,1.6,2.0,2.5,3.0,3.5,4.0,5.0,6.0,8.0,10.0,12.0,16.,22.};

  
  // Input File
  TFile *f = new TFile("LowPtSpectrum_fine_Full_d.root");
  TFile *fcorr = new TFile("validation3D_HydjetNoWedge_100k_flowSQ_vertexZ10.root");
  TFile *fcorrAMPT;
  TFile *fcorrDataMix = new TFile("validation3D_20pionBadWedge_SQ12_vertexZ10.root");
  // =========================

  gStyle->SetErrorX(0);
  gStyle->SetOptStat(0);


  set_plot_style();

  char dirname[256] = "spectrumGoodTightdz10chi40";
  TH1D * spec[10][12];
  TH1D * eff[10][12];
  TH1D * fak[10][12];
  TH1D * sim[10][12];
  TH1D * rec[10][12];

  TGraphErrors * gSpectrum[10][12];
  TF1 * f1[10][12];

  Double_t  meanpt[10][12];
  Double_t  meanpterr[10][12];

  double integral[4][12];
  
    Double_t px[100],py[100],pxe[100],pye[100];
  for( int c=0; c<12; c++)
  {
    for( int j=0; j<4; j++)
    {
      if ( j==0) spec[j][c] = getSpectrum( f, Form("%s/tracks3D",dirname), minCent[c], maxCent[c], etaMin, etaMax ); 
      if ( j==1) spec[j][c] = getSpectrum( f, Form("%s/tracks3D_c94",dirname), minCent[c], maxCent[c], etaMin, etaMax ); 
      if ( j==2) spec[j][c] = getSpectrum( f, Form("%s/tracks3D_c97",dirname), minCent[c], maxCent[c], etaMin, etaMax ); 
      if ( j==3) spec[j][c] = getSpectrum( f, Form("%s/tracks3D_c100",dirname), minCent[c], maxCent[c], etaMin, etaMax ); 
      eff[j][c] = getSpectrum( fcorr, "hitrkPixelEffAnalyzer/heff3D", minCent[c], maxCent[c], etaMin, etaMax );
      sim[j][c] = getSpectrum( fcorr, "hitrkPixelEffAnalyzer/hsim3D", minCent[c], maxCent[c], etaMin, etaMax );
      fak[j][c] = getSpectrum( fcorr, "hitrkPixelEffAnalyzer/hfak3D", minCent[c], maxCent[c], etaMin, etaMax );
      rec[j][c] = getSpectrum( fcorr, "hitrkPixelEffAnalyzer/hrec3D", minCent[c], maxCent[c], etaMin, etaMax );

      // determine correction factors


      TH1F * nevts;

      if( j==0)  nevts = (TH1F *) f->Get(Form("%s/nevts",dirname));
      if( j==1)  nevts = (TH1F *) f->Get(Form("%s/nevts_c94",dirname));
      if( j==2)  nevts = (TH1F *) f->Get(Form("%s/nevts_c97",dirname));
      if( j==3)  nevts = (TH1F *) f->Get(Form("%s/nevts_c100",dirname));
      double Nevt = nevts->Integral( nevts->GetXaxis()->FindBin(minCent[c]+0.001), 
                                     nevts->GetXaxis()->FindBin(maxCent[c]-0.001) );


      Double_t maxy = 0.;
      Double_t miny = 100000.;
    integral[j][c] = 0;
    for( int i=0; i<=19;i++)
    {
      double ptmin = ptbins[i]; double ptmax = ptbins[i+1];

      double iptmin = spec[j][c]->FindBin(ptmin+1e-3);
      double iptmax = spec[j][c]->FindBin(ptmax-1e-3);
      double icptmin = eff[j][c]->FindBin(ptmin+1e-3);
      double icptmax = eff[j][c]->FindBin(ptmax-1e-3);
      double pt = 0.;
      for( int k=iptmin;k<=iptmax;k++) pt += spec[j][c]->GetBinCenter(k) * spec[j][c]->GetBinContent(k);
      pt /= spec[j][c]->Integral(iptmin,iptmax);

      double yielderr;
      double yield = spec[j][c]->IntegralAndError(iptmin,iptmax,yielderr);
      yield /= (ptmax-ptmin) * Nevt * 2 * (etaMax-etaMin);
      yielderr /= (ptmax-ptmin) * Nevt * 2 * (etaMax-etaMin);

      double efmin = eff[j][c]->GetBinContent(icptmin)/sim[j][c]->GetBinContent(icptmin);
      double efmax = eff[j][c]->GetBinContent(icptmax)/sim[j][c]->GetBinContent(icptmax);
      double famin = fak[j][c]->GetBinContent(icptmin)/rec[j][c]->GetBinContent(icptmin);
      double famax = fak[j][c]->GetBinContent(icptmax)/rec[j][c]->GetBinContent(icptmax);

      double ef = (pt-ptmin)*(efmax-efmin)/(ptmax-ptmin)+efmin;
      double fa = (pt-ptmin)*(famax-famin)/(ptmax-ptmin)+famin;
      yield *= (1-fa)/ef;

      px[i] = pt;
      py[i] = yield;
      if( py[i] > maxy ) maxy = py[i];
      if( py[i] < miny ) miny = py[i];
      pxe[i] = 0.;
      pye[i] = yielderr;
      if ( yield > -1. ) integral[j][c] += yield;
    }


      gSpectrum[j][c] = new TGraphErrors( 19, px, py, pxe, pye );
      gSpectrum[j][c]->SetMarkerStyle(20);
      f1[j][c] = new TF1(Form("f1_%d_%d",c,j),"6.28318531 * x * [2]*pow((1+sqrt(0.01947978 + x*x)-0.13957) /[1],-[0])",0.3,3.1);
     f1[j][c]->SetParameters(10.8327,2.221289,dndeta[c]);
     if(j==3) f1[j][c]->SetParameters(10.8327,2.221289,dndeta[c]*2);
     f1[j][c]->SetParameters(10.8327,2.221289,dndeta[c]);
      f1[j][c]->SetLineColor(kBlue);
      f1[j][c]->SetLineWidth(1);
      f1[j][c]->SetLineStyle(1);
       gSpectrum[j][c]->Fit(Form("f1_%d_%d",c,j),"0RQNS");
      TF1 * fitptmx = new TF1("fitptmx","6.28318531 * x * x * [2]*pow((1+sqrt(0.01947978 + x*x)-0.13957) /[1],-[0])",0.0,3.1);
      fitptmx->SetParameters(f1[j][c]->GetParameter(0),f1[j][c]->GetParameter(1), f1[j][c]->GetParameter(2) );
    double numerator = fitptmx->Integral(0.0,0.3);
    double denominator = f1[j][c]->Integral(0.0,0.3);
    for( int p = 0; p<gSpectrum[j][c]->GetN(); p++)
    {
       Double_t  ppx, ppy;
       gSpectrum[j][c]->GetPoint(p,ppx,ppy);
       if ( 0.3 < ppx && ppx < 0.6 ) numerator += ppx * ppy * 0.1;
       if ( 0.6 < ppx && ppx < 1.2 ) numerator += ppx * ppy * 0.2;
       if ( 1.2 < ppx && ppx < 2.0 ) numerator += ppx * ppy * 0.4;
       if ( 2.0 < ppx && ppx < 4.0 ) numerator += ppx * ppy * 0.5;
       if ( 4.0 < ppx && ppx < 6.0 ) numerator += ppx * ppy * 1.0;
       if ( 0.3 < ppx && ppx < 0.6 ) denominator += ppy * 0.1;
       if ( 0.6 < ppx && ppx < 1.2 ) denominator += ppy * 0.2;
       if ( 1.2 < ppx && ppx < 2.0 ) denominator += ppy * 0.4;
       if ( 2.0 < ppx && ppx < 4.0 ) denominator += ppy * 0.5;
       if ( 4.0 < ppx && ppx < 6.0 ) denominator += ppy * 1.0;
    }
    meanpt[j][c] = numerator / denominator;


      meanpterr[j][c] = 0.;
    }
    
  }

 
  TH1D* hDumCen = new TH1D("hDumCen",";Centrality (%);<p_{T}> Ratio",40,0.,80.); 
  hDumCen->GetXaxis()->CenterTitle(); hDumCen->GetYaxis()->SetTitleOffset(1.1);
  hDumCen->SetMaximum(1.5); hDumCen->SetMinimum(0.5);

  TCanvas *c1 = new TCanvas("c1","Mean Pt",600,600);
 
  c1->cd();
  hDumCen->Draw();

  TGraphErrors * gmean[4];
  
  int colors[4] = {0,kRed, kBlack, kBlue};

  for( int j=1; j<4; j++)
  {
    Double_t mx[12], mxe[12], my[12], mye[12];
    for(int i=0;i<12;i++) 
    { 
      mx[i] = (double)(maxCent[i]+minCent[i]) * 1.25;
      mxe[i] = 0; 
      my[i] = meanpt[j][i] / meanpt[0][i];
      mye[i] = my[i] * sqrt( meanpterr[j][i]*meanpterr[j][i]/meanpt[j][i]/meanpt[j][i] 
                           + meanpterr[0][i]*meanpterr[0][i]/meanpt[0][i]/meanpt[0][i] );
    
    }  

    gmean[j] = new TGraphErrors(12, mx, my, mxe, mye);
    gmean[j]->SetMarkerStyle(20);
    gmean[j]->SetMarkerColor(colors[j]);
    gmean[j]->SetLineColor(colors[j]);
    gmean[j]->Draw("p");
  
  }
  TLegend *legPt = new TLegend(0.45,0.7,0.89,0.89);
  legPt->SetFillColor(0); legPt->SetBorderSize(0);
  legPt->AddEntry(gmean[1],"Trig 94","lp");
  legPt->AddEntry(gmean[2],"Trig 97","lp");
  legPt->AddEntry(gmean[3],"Trig 100","lp");

  legPt->Draw();

  TLatex *  tex = new TLatex(20,0.8,Form( "GoodTightMergedTracks, %4.1f < |#eta| < %4.1f",etaMin, etaMax ));
    tex->SetTextSize(0.035);
    tex->Draw();

  TH1D* hDumPt = new TH1D("hDumPt",";p_{T} [GeV/c];ratio 1/N_{evt} d^{2}N_{ch}/d#etadp_{T}",40,0.,6.); hDumPt->SetMaximum(1.5);
  hDumPt->GetXaxis()->CenterTitle(); hDumPt->GetYaxis()->SetTitleOffset(1.1);

  hDumPt->SetMaximum(1.25); hDumPt->SetMinimum(0.75);

  TCanvas *c8 = new TCanvas("c8","Spectrum",1000,800);
  c8->Divide(4,3,0,0);

  TGraphErrors * gRatio[4][12]; 

  for( int q=0;q<12; q++)
  {
    c8->cd(q+1);
    int i = q;
    hDumPt->Draw();
    for( int j=0; j<4; j++)
    { 
      Double_t rx[100],ry[100],rxe[100],rye[100];
      Double_t dx, nx, ny, dy, dye, nye; 
      for( int p=0;p<gSpectrum[0][i]->GetN();p++)
      {
        gSpectrum[0][i]->GetPoint(p,dx,dy);
        dye = gSpectrum[0][i]->GetErrorY(p);
        gSpectrum[j][i]->GetPoint(p,nx,ny);
        nye = gSpectrum[j][i]->GetErrorY(p);
        rx[p] = nx; rxe[p]=0;
        ry[p] = ny / dy;
        rye[p] = ry[p] * sqrt ( nye*nye/ny/ny + dye*dye/dy/dy);        
      }
      gRatio[j][i] = new TGraphErrors(gSpectrum[0][i]->GetN(), rx, ry, rxe, rye);
      gRatio[j][i]->SetMarkerStyle(20);
      gRatio[j][i]->SetMarkerColor(colors[j]);
      gRatio[j][i]->SetLineColor(colors[j]);
      gRatio[j][i]->Draw("p"); 
    tex = new TLatex(1,0.87,Form("%d-%d Cent.",(int)(minCent[i]*2.5),(int)(maxCent[i]*2.5)));
    tex->SetTextSize(0.045);
    tex->Draw();

    if( i==0) legPt->Draw();
  
    tex = new TLatex(1,0.85,Form("%4.1f < |#eta| < %4.1f",etaMin,etaMax));
    tex->SetTextSize(0.045);
    if( i==0) tex->Draw();
    tex = new TLatex(1,0.83,Form("GoodTightMergedTracks",etaMin,etaMax));
    tex->SetTextSize(0.045);
    if( i==0) tex->Draw();
    }
  } 

  cout << "Normalization Errors from Integrals\n\n\n";

  for( int c=0; c<12; c++)
  {
    cout << Form("%d-%d Cent.",(int)(minCent[c]*2.5),(int)(maxCent[c]*2.5)) << "  ";
    for( int j = 1; j<4; j++)
    {
      cout << integral[j][c] / integral[0][c] << "  ";
    }
    cout << endl;
  }

}
Ejemplo n.º 14
0
void make( string charge = "p", bool lines = false, int iCen = 0, string cs = "Pi", string hFile = "histograms.root" ){

	Bichsel bgen;
	gStyle->SetPadLeftMargin(0.16);
	gStyle->SetPadBottomMargin(0.12);
	gStyle->SetPadRightMargin(0.12);

	set_plot_style();

	RooPlotLib rpl;
	string rpName = "rp_" + charge + "_dedx_beta_lines.pdf";
	if ( false == lines )
		rpName = "rp_" + charge + "_dedx_beta.pdf";

	string chargeName = "Positive Tracks : ";
	if ( "n" == charge )
		chargeName = "Negative Tracks : ";

	Reporter rp( rpName, 600, 800 );

	TFile * f = new TFile( hFile.c_str(), "READ" );

	TH1D * nlBeta = (TH1D*)f->Get( "nlBeta" );


	for ( int iPt = 0; iPt < 100; iPt ++ ){
		if ( iPt != 16 ) continue;


		TAxis * x = nlBeta->GetXaxis();
		double lpT = x->GetBinLowEdge( iPt + 1 );
		double hpT = x->GetBinLowEdge( iPt + 1 ) + x->GetBinWidth( iPt + 1 );
		double avgP = (lpT + hpT) / 2.0;

		string name = "dedx_tof/dedx_tof_" + cs + "_" + charge + "_" + ts(iCen) + "_" + ts( iPt);
		TH2D * h2 = (TH2D*)f->Get( name.c_str() );

		if ( !h2 )
			break;
		if ( iPt == 5 ) // what went wrong?
			continue;


		double x1 = h2->GetXaxis()->GetBinLowEdge( 1 );
		double x2 = h2->GetXaxis()->GetBinLowEdge( h2->GetNbinsX() ) + h2->GetXaxis()->GetBinWidth( h2->GetNbinsX() );
		double y1 = h2->GetYaxis()->GetBinLowEdge( 1 );
		double y2 = h2->GetYaxis()->GetBinLowEdge( h2->GetNbinsY() ) + h2->GetYaxis()->GetBinWidth( h2->GetNbinsY() );

		  

		rpl.style( h2 ).set( "draw", "col" )
			.set( "optstat", 0 ).set( "logz", 1 )
			.set( "title", " ; ln(dE/dx) - ln(dE/dx)_{#pi}  ; #beta^{-1} - #beta^{-1}_{#pi} " )
			.set( "ts", 0.16 )
			.set( "xts", 0.06 )
			.set( "xto", 0.75 )
			.set( "yts", 0.07 )
			.set( "yto", 0.85 )
			.set( "yoffset", 0.01 ).draw(); 



		if ( 16 == iPt ){
			gStyle->SetTitleFontSize( 0.45 );
			rpl.style(h2)
				.set( "xr", -0.3, 0.95 )
				.set( "yr", -0.15, 0.6 ).draw();
		}
		TLatex *text = new TLatex( -0.5, 0.64, (chargeName + dts(lpT) + " < p_{T} [GeV/c] < " + dts(hpT)).c_str() );
		text->SetTextSize(0.055);
		text->Draw("");


		if ( lines  ){
			double bKaon = one_beta( mK, avgP ) - one_beta( mPi, avgP );
			double bProton = one_beta( mP, avgP ) - one_beta( mPi, avgP );

			double dKaon = bgen.meanLog( avgP, mK, -1, 1000 ) - bgen.meanLog( avgP, mPi, -1, 1000 );
			double dProton = bgen.meanLog( avgP, mP, -1, 1000 ) - bgen.meanLog( avgP, mPi, -1, 1000 );

			drawTofLines( 0, kRed+1, x1, x2 );		
			drawTpcLines( 0, kRed + 1, y1, y2);
			// around Kaons
			drawTofLines( bKaon, kOrange+1, x1, x2 );	
			drawTpcLines( dKaon, kOrange + 1, y1, y2);
			// around Protons
			drawTofLines( bProton, kBlack, x1, x2 );	
			drawTpcLines( dProton, kBlack, y1, y2);
		}

		// double dElec = bgen.meanLog( avgP, mE, -1, 1000 ) - bgen.meanLog( avgP, mPi, -1, 1000 );
		// double bElec = one_beta( mE, avgP ) - one_beta( mPi, avgP );
		// //drawTpcLines( dMerged, kBlack, y1, y2);
		// TEllipse * ell = new TEllipse( dElec,bElec, sigTpc * 3, sigTof * 3 );
		// ell->SetFillColorAlpha( kBlack, 0 );
		// ell->Draw();
		// 
		
		gPad->SetRightMargin( 0.01 );
		gPad->SetBottomMargin( 0.10 );
		gPad->SetLeftMargin( 0.14 );

		rp.savePage();
		rp.saveImage( ("img/dedx_tof_" + ts(iPt) + ".pdf").c_str() );
		rp.saveImage( ("img/dedx_tof_" + ts(iPt) + ".png").c_str() );
	}

}
Ejemplo n.º 15
0
TStyle* setT2KStyle() {

  TStyle *t2kStyle= new TStyle("T2K","T2K approved plots style");

  gStyle->SetPalette(1);

  // use plain black on white colors
  gStyle->SetFrameBorderMode(0);
  gStyle->SetCanvasBorderMode(0);
  gStyle->SetPadBorderMode(0);
  gStyle->SetPadColor(0);
  gStyle->SetCanvasColor(0);
  gStyle->SetStatColor(0);
  gStyle->SetFillColor(0);
  gStyle->SetLegendBorderSize(1); 

  // set the paper & margin sizes
  gStyle->SetPaperSize(20,26);
  gStyle->SetPadTopMargin(0.05);
  gStyle->SetPadRightMargin(0.05);
  gStyle->SetPadBottomMargin(0.16);
  gStyle->SetPadLeftMargin(0.12);

  // use large Times-Roman fonts
  gStyle->SetTextFont(132);
  gStyle->SetTextSize(0.08);
  gStyle->SetLabelFont(132,"x");
  gStyle->SetLabelFont(132,"y");
  gStyle->SetLabelFont(132,"z");
  gStyle->SetLabelSize(0.06,"x");
  gStyle->SetTitleSize(0.08,"x");
  gStyle->SetLabelSize(0.06,"y");
  gStyle->SetTitleSize(0.08,"y");
  gStyle->SetTitleOffset(1.0,"y");
  gStyle->SetLabelSize(0.05,"z");
  gStyle->SetTitleSize(0.06,"z");
  gStyle->SetLabelFont(132,"t");
  gStyle->SetTitleFont(132,"x");
  gStyle->SetTitleFont(132,"y");
  gStyle->SetTitleFont(132,"z");
  gStyle->SetTitleFont(132,"t"); 
  gStyle->SetTitleFillColor(0);
  gStyle->SetTitleX(0.25);
  gStyle->SetTitleFontSize(0.08);
  gStyle->SetTitleFont(132,"pad");

  // use bold lines and markers
  gStyle->SetMarkerStyle(20);
  gStyle->SetHistLineWidth(1.85);
  gStyle->SetLineStyleString(2,"[12 12]"); // postscript dashes

  // get rid of X error bars and y error bar caps
  //gStyle->SetErrorX(0.001);

  // do not display any of the standard histogram decorations
  gStyle->SetOptTitle(0);
  gStyle->SetOptStat(0);
  gStyle->SetOptFit(0);

  // put tick marks on top and RHS of plots
  gStyle->SetPadTickX(1);
  gStyle->SetPadTickY(1);


  // Add a greyscale palette for 2D plots
//   int ncol=50;
//   double dcol = 1./float(ncol);
//   double gray = 1;
//   TColor **theCols = new TColor*[ncol];
//   for (int i=0;i<ncol;i++) theCols[i] = new TColor(999-i,0.0,0.7,0.7);
//   for (int j = 0; j < ncol; j++) {
//     theCols[j]->SetRGB(gray,gray,gray);
//     gray -= dcol;
//   }
//   int ColJul[100];
//   for  (int i=0; i<100; i++) ColJul[i]=999-i;
//   gStyle->SetPalette(ncol,ColJul);

  // End of definition of gStyle
  set_plot_style();
  return gStyle;
}
Ejemplo n.º 16
0
int main() {
    // Don't associate histograms with TFiles so we can delete them
    TH1::AddDirectory(false);

    // Set our style
    set_plot_style();

    // Get the histograms
    const std::string INPUT_FILE =
        "/data/whybee0a/user/gude_2/IDPlots/20150416/2012_ALL_hadded.root";
    const std::string INPUT_MC_FILE =
        "/data/whybee0a/user/gude_2/IDPlots/20150416/MadGraph_hadded.root";

    // Load the histograms
    // Data
    std::unique_ptr<TH1D> h_r9 = get_histogram(INPUT_FILE, "IDPlotter/r9");
    std::unique_ptr<TH1D> h_sigma_ieta_ieta_eb = get_histogram(INPUT_FILE, "IDPlotter/sieie_eb");
    std::unique_ptr<TH1D> h_sigma_ieta_ieta_ee = get_histogram(INPUT_FILE, "IDPlotter/sieie_ee");
    std::unique_ptr<TH1D> h_he = get_histogram(INPUT_FILE, "IDPlotter/he");
    std::unique_ptr<TH1D> h_deta = get_histogram(INPUT_FILE, "IDPlotter/deta");
    std::unique_ptr<TH1D> h_dphi = get_histogram(INPUT_FILE, "IDPlotter/dphi");
    std::unique_ptr<TH1D> h_track_iso = get_histogram(INPUT_FILE, "IDPlotter/track_iso");
    std::unique_ptr<TH1D> h_ecal_iso = get_histogram(INPUT_FILE, "IDPlotter/ecal_iso");
    std::unique_ptr<TH1D> h_hcal_iso = get_histogram(INPUT_FILE, "IDPlotter/hcal_iso");
    std::unique_ptr<TH1D> h_1oe_1op = get_histogram(INPUT_FILE, "IDPlotter/1oe_1op");
    std::unique_ptr<TH1D> h_d0 = get_histogram(INPUT_FILE, "IDPlotter/d0");
    std::unique_ptr<TH1D> h_dz = get_histogram(INPUT_FILE, "IDPlotter/dz");
    std::unique_ptr<TH1D> h_mhits = get_histogram(INPUT_FILE, "IDPlotter/mhits");
    std::unique_ptr<TH1D> h_iso = get_histogram(INPUT_FILE, "IDPlotter/iso");
    std::unique_ptr<TH1D> h_nmiss = get_histogram(INPUT_FILE, "IDPlotter/mhits");
    // MC
    std::unique_ptr<TH1D> h_r9_mc = get_histogram(INPUT_MC_FILE, "IDPlotter/r9");
    std::unique_ptr<TH1D> h_sigma_ieta_ieta_eb_mc = get_histogram(INPUT_MC_FILE, "IDPlotter/sieie_eb");
    std::unique_ptr<TH1D> h_sigma_ieta_ieta_ee_mc = get_histogram(INPUT_MC_FILE, "IDPlotter/sieie_ee");
    std::unique_ptr<TH1D> h_he_mc = get_histogram(INPUT_MC_FILE, "IDPlotter/he");
    std::unique_ptr<TH1D> h_deta_mc = get_histogram(INPUT_MC_FILE, "IDPlotter/deta");
    std::unique_ptr<TH1D> h_dphi_mc = get_histogram(INPUT_MC_FILE, "IDPlotter/dphi");
    std::unique_ptr<TH1D> h_track_iso_mc = get_histogram(INPUT_MC_FILE, "IDPlotter/track_iso");
    std::unique_ptr<TH1D> h_ecal_iso_mc = get_histogram(INPUT_MC_FILE, "IDPlotter/ecal_iso");
    std::unique_ptr<TH1D> h_hcal_iso_mc = get_histogram(INPUT_MC_FILE, "IDPlotter/hcal_iso");
    std::unique_ptr<TH1D> h_1oe_1op_mc = get_histogram(INPUT_MC_FILE, "IDPlotter/1oe_1op");
    std::unique_ptr<TH1D> h_d0_mc = get_histogram(INPUT_MC_FILE, "IDPlotter/d0");
    std::unique_ptr<TH1D> h_dz_mc = get_histogram(INPUT_MC_FILE, "IDPlotter/dz");
    std::unique_ptr<TH1D> h_mhits_mc = get_histogram(INPUT_MC_FILE, "IDPlotter/mhits");
    std::unique_ptr<TH1D> h_iso_mc = get_histogram(INPUT_MC_FILE, "IDPlotter/iso");
    std::unique_ptr<TH1D> h_nmiss_mc = get_histogram(INPUT_MC_FILE, "IDPlotter/mhits");

    // Write pdfs
    const std::string NO_CHANGE = "";
    const double NO_LINE = -100;
    write_plot(h_r9, h_r9_mc, "r9.pdf", 50, "R9", NO_LINE, 0.94, 0, 1);
    write_plot(h_sigma_ieta_ieta_eb, h_sigma_ieta_ieta_eb_mc, "sigma_ieta_ieta_eb.pdf", 20, "#sigma_{i #eta i #eta} in EB", NO_LINE, 0.01, 0, 0.03);
    write_plot(h_sigma_ieta_ieta_ee, h_sigma_ieta_ieta_ee_mc, "sigma_ieta_ieta_ee.pdf", 50, "#sigma_{i #eta i #eta} in EB", NO_LINE, 0.03, 0, 0.09);
    write_plot(h_he, h_he_mc, "he.pdf", 10, "H / E", NO_LINE, 0.12, 0, 0.14);
    write_plot(h_deta, h_deta_mc, "deta.pdf", 20, NO_CHANGE, 0.007, 0.005, -0.018, 0.018);
    write_plot(h_dphi, h_dphi_mc, "dphi.pdf", 20, NO_CHANGE, 0.06, 0.03, -0.14, 0.14);
    //write_plot(h_track_iso, h_track_iso_mc, "track_iso.pdf", 200);
    write_plot(h_ecal_iso, h_ecal_iso_mc, "ecal_iso.pdf", 50, NO_CHANGE, NO_LINE, 0.15, 0, 1);
    write_plot(h_hcal_iso, h_hcal_iso_mc, "hcal_iso.pdf", 50, NO_CHANGE, NO_LINE, 0.1, 0, 0.2);
    write_plot(h_1oe_1op, h_1oe_1op_mc, "1oe_1op.pdf", 50, NO_CHANGE, NO_LINE, 0.05, -0.15, 0.15);
    write_plot(h_d0, h_d0_mc, "d0.pdf", 400, NO_CHANGE, NO_LINE, 0.02, -0.06, 0.06);
    write_plot(h_dz, h_dz_mc, "dz.pdf", 20, NO_CHANGE, NO_LINE, 0.1, -0.3, 0.3);
    write_plot(h_iso, h_iso_mc, "iso.pdf", 100, NO_CHANGE, 0.15, 0.10, 0, 0.5);
    write_plot(h_nmiss, h_nmiss_mc, "nmiss.pdf", 1, NO_CHANGE, 2, 1, 0, 3);

    return EXIT_SUCCESS;
}
Ejemplo n.º 17
0
void plotHistHi() {



  gStyle->SetOptStat(0);

  set_plot_style();

  TFile *f = new TFile("./../root_files/hists.root");


  // sim-to-reco hists
  TH2F *hSim = (TH2F*) f->Get("hitrkEffAnalyzer/hsim"); hSim->GetYaxis()->SetRangeUser(0,10);
  TH2F *hAcc = (TH2F*) f->Get("hitrkEffAnalyzer/hacc"); hAcc->GetYaxis()->SetRangeUser(0,10);
  TH2F *hEff = (TH2F*) f->Get("hitrkEffAnalyzer/heff"); hEff->GetYaxis()->SetRangeUser(0,10);
  TH2F *hMul = (TH2F*) f->Get("hitrkEffAnalyzer/hmul"); hMul->GetYaxis()->SetRangeUser(0,10);

  // reco-to-sim hists
  TH2F *hRec = (TH2F*) f->Get("hitrkEffAnalyzer/hrec"); hRec->GetYaxis()->SetRangeUser(0,10);
  TH2F *hFak = (TH2F*) f->Get("hitrkEffAnalyzer/hfak"); hFak->GetYaxis()->SetRangeUser(0,10);
  TH2F *hSec = (TH2F*) f->Get("hitrkEffAnalyzer/hsec"); hSec->GetYaxis()->SetRangeUser(0,10);

  // ratio histograms
  TH2F *rAcc = (TH2F*) hAcc->Clone("rAcc");
  TH2F *rEff = (TH2F*) hEff->Clone("rEff");
  TH2F *rMul = (TH2F*) hMul->Clone("rMul");
  TH2F *rFak = (TH2F*) hFak->Clone("rFak");
  TH2F *rSec = (TH2F*) hSec->Clone("rSec");
  //TH2F *rDec = (TH2F*) hDec->Clone("rDec");

  //---------------------------------------------

  // acceptance fraction
  TCanvas *c1 = new TCanvas("c1","Acceptance Fraction",600,500);
  gPad->SetRightMargin(0.15);
  rAcc->Divide(hAcc,hSim,1,1,"B");
  rAcc->SetStats(0);
  rAcc->SetMaximum(1.0); rAcc->SetMinimum(0.0);
  rAcc->SetTitle("Geometrical Acceptance");
  rAcc->Draw("colz");

  // reco efficiency fraction
  TCanvas *c2 = new TCanvas("c2","Reco Efficiency Fraction",600,500);
  gPad->SetRightMargin(0.15);
  rEff->Divide(hEff,hAcc,1,1,"B");
  rEff->SetStats(0);
  rEff->SetMaximum(1.0); rEff->SetMinimum(0.0);
  rEff->SetTitle("Algorithmic Efficiency");
  rEff->Draw("colz");

  // multiple reco fraction
  TCanvas *c3 = new TCanvas("c3","Multiple Reco Fraction",600,500);
  gPad->SetRightMargin(0.15);
  rMul->Divide(hMul,hAcc,1,1,"B");
  rMul->SetStats(0);
  rMul->SetMaximum(0.00049); rMul->SetMinimum(0.0);
  rMul->SetTitle("Multiple Reconstruction Fraction");
  rMul->Draw("colz");

  // fake reco fraction
  TCanvas *c4 = new TCanvas("c4","Fake Reco Fraction",600,500);
  gPad->SetRightMargin(0.15);
  rFak->Divide(hFak,hRec,1,1,"B");
  rFak->SetStats(0);
  rFak->SetMaximum(0.1); rFak->SetMinimum(0.0);
  rFak->SetTitle("Fake Reconstruction Fraction");
  rFak->Draw("colz");

  // secondary reco fraction
  TCanvas *c5 = new TCanvas("c5","Secondary Fraction",600,500);  
  gPad->SetRightMargin(0.15);
  rSec->Divide(hSec,hRec,1,1,"B");
  rSec->SetStats(0);
  rSec->SetMaximum(0.05); rSec->SetMinimum(0.0);
  rSec->SetTitle("Non-Primary Reconstruction Fraction");
  rSec->Draw("colz");

  //---------------------------------------------

  // find bins corresponding to projections for below
  Int_t ptbin04=hSim->GetYaxis()->FindBin(0.91);
  Int_t ptbin20=hSim->GetYaxis()->FindBin(2.01);
  Int_t ptbins=hSim->GetYaxis()->GetNbins();
  Int_t etabin24m=hSim->GetXaxis()->FindBin(-2.39);
  Int_t etabin24p=hSim->GetXaxis()->FindBin(2.39);
  Int_t etabin10m=hSim->GetXaxis()->FindBin(-0.99);
  Int_t etabin10p=hSim->GetXaxis()->FindBin(0.99);

  cout << "etabin10m: " << etabin10m << " etabin10p: " << etabin10p << endl;
  cout << "etabin10m: " << etabin24m << " etabin10p: " << etabin24p << endl;

  // projected hists: pt > 0.9 GeV/c
  TH1D* hSimEta = (TH1D*) hSim->ProjectionX("hSimEta",ptbin04,ptbins,"e");
  TH1D* hAccEta = (TH1D*) hAcc->ProjectionX("hAccEta",ptbin04,ptbins,"e");
  TH1D* hEffEta = (TH1D*) hEff->ProjectionX("hEffEta",ptbin04,ptbins,"e");
  TH1D* hMulEta = (TH1D*) hMul->ProjectionX("hMulEta",ptbin04,ptbins,"e");
  TH1D* hRecEta = (TH1D*) hRec->ProjectionX("hRecEta",ptbin04,ptbins,"e");
  TH1D* hFakEta = (TH1D*) hFak->ProjectionX("hFakEta",ptbin04,ptbins,"e");
  TH1D* hSecEta = (TH1D*) hSec->ProjectionX("hSecEta",ptbin04,ptbins,"e");

  // projected hists: pt > 2.0 GeV/c
  TH1D* hSimEta2 = (TH1D*) hSim->ProjectionX("hSimEta2",ptbin20,ptbins,"e");
  TH1D* hAccEta2 = (TH1D*) hAcc->ProjectionX("hAccEta2",ptbin20,ptbins,"e");
  TH1D* hEffEta2 = (TH1D*) hEff->ProjectionX("hEffEta2",ptbin20,ptbins,"e");
  TH1D* hMulEta2 = (TH1D*) hMul->ProjectionX("hMulEta2",ptbin20,ptbins,"e");
  TH1D* hRecEta2 = (TH1D*) hRec->ProjectionX("hRecEta2",ptbin20,ptbins,"e");
  TH1D* hFakEta2 = (TH1D*) hFak->ProjectionX("hFakEta2",ptbin20,ptbins,"e");
  TH1D* hSecEta2 = (TH1D*) hSec->ProjectionX("hSecEta2",ptbin20,ptbins,"e");

  TH1D* hDumEta = new TH1D("hDumEta",";#eta",60,-2.4,2.4); hDumEta->SetMaximum(1.0);
  hDumEta->GetXaxis()->CenterTitle(); hDumEta->GetYaxis()->SetTitleOffset(1.8);
  TH1D* hDumEta2 = (TH1D*) hDumEta->Clone("hDumEta2"); hDumEta2->SetMaximum(0.1); 
  TH1D* hDumEta3 = (TH1D*) hDumEta->Clone("hDumEta3"); hDumEta3->SetMaximum(0.00049); 


  // projected hists: abs(eta) < 1.0
  TH1D* hSimPt  = (TH1D*) hSim->ProjectionY("hSimPt",etabin10m,etabin10p,"e");
  TH1D* hAccPt  = (TH1D*) hAcc->ProjectionY("hAccPt",etabin10m,etabin10p,"e");
  TH1D* hEffPt  = (TH1D*) hEff->ProjectionY("hEffPt",etabin10m,etabin10p,"e");
  TH1D* hMulPt  = (TH1D*) hMul->ProjectionY("hMulPt",etabin10m,etabin10p,"e");
  TH1D* hRecPt  = (TH1D*) hRec->ProjectionY("hRecPt",etabin10m,etabin10p,"e");
  TH1D* hFakPt  = (TH1D*) hFak->ProjectionY("hFakPt",etabin10m,etabin10p,"e");
  TH1D* hSecPt  = (TH1D*) hSec->ProjectionY("hSecPt",etabin10m,etabin10p,"e");

  // projected hists: abs(eta) < 2.4
  TH1D* hSimPt2  = (TH1D*) hSim->ProjectionY("hSimPt2",etabin24m,etabin24p,"e");
  TH1D* hAccPt2  = (TH1D*) hAcc->ProjectionY("hAccPt2",etabin24m,etabin24p,"e");
  TH1D* hEffPt2  = (TH1D*) hEff->ProjectionY("hEffPt2",etabin24m,etabin24p,"e");
  TH1D* hMulPt2  = (TH1D*) hMul->ProjectionY("hMulPt2",etabin24m,etabin24p,"e");
  TH1D* hRecPt2  = (TH1D*) hRec->ProjectionY("hRecPt2",etabin24m,etabin24p,"e");
  TH1D* hFakPt2  = (TH1D*) hFak->ProjectionY("hFakPt2",etabin24m,etabin24p,"e");
  TH1D* hSecPt2  = (TH1D*) hSec->ProjectionY("hSecPt2",etabin24m,etabin24p,"e");
  
  TH1D* hDumPt = new TH1D("hDumPt",";p_{T} [GeV/c]",80,0.0,10.0); hDumPt->SetMaximum(1.0);
  hDumPt->GetXaxis()->CenterTitle(); hDumPt->GetYaxis()->SetTitleOffset(1.8);
  TH1D* hDumPt2 = (TH1D*) hDumPt->Clone("hDumPt2"); hDumPt2->SetMaximum(0.1); 
  TH1D* hDumPt3 = (TH1D*) hDumPt->Clone("hDumPt3"); hDumPt3->SetMaximum(0.00049); 

  // Acceptance
  TGraphAsymmErrors *gAccEta = new TGraphAsymmErrors(); gAccEta->SetName("gAccEta");
  gAccEta->BayesDivide(hAccEta,hSimEta);
  gAccEta->SetMarkerStyle(25);
  gAccEta->SetLineStyle(2);
  gAccEta->SetLineColor(2);
  gAccEta->SetMarkerColor(2);

  TGraphAsymmErrors *gAccPt = new TGraphAsymmErrors(); gAccPt->SetName("gAccPt");
  gAccPt->BayesDivide(hAccPt,hSimPt);
  gAccPt->SetMarkerStyle(24);
  gAccPt->SetLineColor(4);
  gAccPt->SetMarkerColor(4);

  TGraphAsymmErrors *gAccEta2 = new TGraphAsymmErrors(); gAccEta2->SetName("gAccEta2");
  gAccEta2->BayesDivide(hAccEta2,hSimEta2);
  gAccEta2->SetMarkerStyle(24);
  gAccEta2->SetLineColor(4);
  gAccEta2->SetMarkerColor(4);

  TGraphAsymmErrors *gAccPt2 = new TGraphAsymmErrors(); gAccPt2->SetName("gAccPt2");
  gAccPt2->BayesDivide(hAccPt2,hSimPt2);
  gAccPt2->SetMarkerStyle(25);
  gAccPt2->SetLineStyle(2);
  gAccPt2->SetLineColor(2);
  gAccPt2->SetMarkerColor(2);

  TLegend *legEta = new TLegend(0.35,0.3,0.65,0.5);
  legEta->SetFillColor(0); legEta->SetBorderSize(0);
  legEta->AddEntry(gAccEta,"p_{T} > 0.9 GeV/c","lp");
  legEta->AddEntry(gAccEta2,"p_{T} > 2.0 GeV/c","lp");

  TLegend *legPt = new TLegend(0.4,0.3,0.6,0.5);
  legPt->SetFillColor(0); legPt->SetBorderSize(0);
  legPt->AddEntry(gAccPt2,"|#eta| < 2.4","lp");
  legPt->AddEntry(gAccPt,"|#eta| < 1.0","lp");

  TCanvas *c6 = new TCanvas("c6","Acceptance Fraction",900,500);
  c6->Divide(2,1);
  hDumEtaAcc=(TH1F*) hDumEta->Clone("hDumEtaAcc");
  hDumEtaAcc->GetYaxis()->SetTitle("Geometrical acceptance");
  hDumPtAcc=(TH1F*) hDumPt->Clone("hDumPtAcc");
  hDumPtAcc->GetYaxis()->SetTitle("Geometrical acceptance");
  c6->cd(1); hDumEtaAcc->Draw(); gAccEta->Draw("pc"); gAccEta2->Draw("pc"); legEta->Draw();
  c6->cd(2); hDumPtAcc->Draw(); gAccPt->Draw("pc"); gAccPt2->Draw("pc"); legPt->Draw();


  // Efficiency
  TGraphAsymmErrors *gEffEta = new TGraphAsymmErrors(); gEffEta->SetName("gEffEta");
  gEffEta->BayesDivide(hEffEta,hAccEta);
  gEffEta->SetMarkerStyle(25);
  gEffEta->SetLineStyle(2);
  gEffEta->SetLineColor(2);
  gEffEta->SetMarkerColor(2);

  TGraphAsymmErrors *gEffPt = new TGraphAsymmErrors(); gEffPt->SetName("gEffPt");
  gEffPt->BayesDivide(hEffPt,hAccPt);
  gEffPt->SetMarkerStyle(24);
  gEffPt->SetLineColor(4);
  gEffPt->SetMarkerColor(4);

  TGraphAsymmErrors *gEffEta2 = new TGraphAsymmErrors(); gEffEta2->SetName("gEffEta2");
  gEffEta2->BayesDivide(hEffEta2,hAccEta2);
  gEffEta2->SetMarkerStyle(24);
  gEffEta2->SetLineColor(4);
  gEffEta2->SetMarkerColor(4);

  TGraphAsymmErrors *gEffPt2 = new TGraphAsymmErrors(); gEffPt2->SetName("gEffPt2");
  gEffPt2->BayesDivide(hEffPt2,hAccPt2);
  gEffPt2->SetMarkerStyle(25);
  gEffPt2->SetLineStyle(2);
  gEffPt2->SetLineColor(2);
  gEffPt2->SetMarkerColor(2);

  TCanvas *c7 = new TCanvas("c7","Efficiency Fraction",900,500);
  c7->Divide(2,1);
  hDumEtaEff=(TH1F*) hDumEta->Clone("hDumEtaEff");
  hDumEtaEff->GetYaxis()->SetTitle("Algorithmic efficiency");
  hDumPtEff=(TH1F*) hDumPt->Clone("hDumPtEff");
  hDumPtEff->GetYaxis()->SetTitle("Algorithmic efficiency");
  c7->cd(1); hDumEtaEff->Draw(); gEffEta->Draw("pc"); gEffEta2->Draw("pc"); legEta->Draw();
  c7->cd(2); hDumPtEff->Draw(); gEffPt->Draw("pc"); gEffPt2->Draw("pc"); legPt->Draw();

  // Multiple Reco
  TGraphAsymmErrors *gMulEta = new TGraphAsymmErrors(); gMulEta->SetName("gMulEta");
  gMulEta->BayesDivide(hMulEta,hAccEta);
  gMulEta->SetMarkerStyle(25);
  gMulEta->SetLineStyle(2);
  gMulEta->SetLineColor(2);
  gMulEta->SetMarkerColor(2);

  TGraphAsymmErrors *gMulPt = new TGraphAsymmErrors(); gMulPt->SetName("gMulPt");
  gMulPt->BayesDivide(hMulPt,hAccPt);
  gMulPt->SetMarkerStyle(24);
  gMulPt->SetLineColor(4);
  gMulPt->SetMarkerColor(4);

  TGraphAsymmErrors *gMulEta2 = new TGraphAsymmErrors(); gMulEta2->SetName("gMulEta2");
  gMulEta2->BayesDivide(hMulEta2,hAccEta2);
  gMulEta2->SetMarkerStyle(24);
  gMulEta2->SetLineColor(4);
  gMulEta2->SetMarkerColor(4);

  TGraphAsymmErrors *gMulPt2 = new TGraphAsymmErrors(); gMulPt2->SetName("gMulPt2");
  gMulPt2->BayesDivide(hMulPt2,hAccPt2);
  gMulPt2->SetMarkerStyle(25);
  gMulPt2->SetLineStyle(2);
  gMulPt2->SetLineColor(2);
  gMulPt2->SetMarkerColor(2);

  TCanvas *c8 = new TCanvas("c8","Multiple Fraction",900,500);
  c8->Divide(2,1);
  hDumEtaMul=(TH1F*) hDumEta3->Clone("hDumEtaMul");
  hDumEtaMul->GetYaxis()->SetTitle("Multiple Reconstruction Fraction");
  hDumPtMul=(TH1F*) hDumPt3->Clone("hDumPtMul");
  hDumPtMul->GetYaxis()->SetTitle("Multiple Reconstruction Fraction");
  legEta2 = (TLegend*) legEta->Clone(); legEta2->SetY1(0.65); legEta2->SetY2(0.85);
  legPt2 = (TLegend*) legPt->Clone(); legPt2->SetY1(0.65); legPt2->SetY2(0.85);
  c8->cd(1); hDumEtaMul->Draw(); gMulEta->Draw("pc"); gMulEta2->Draw("pc"); legEta2->Draw();
  c8->cd(2); hDumPtMul->Draw(); gMulPt->Draw("pc"); gMulPt2->Draw("pc"); legPt2->Draw();

  // Fakes
  TGraphAsymmErrors *gFakEta = new TGraphAsymmErrors();  gFakEta->SetName("gFakEta");
  gFakEta->BayesDivide(hFakEta,hRecEta);
  gFakEta->SetMarkerStyle(25);
  gFakEta->SetLineStyle(2);
  gFakEta->SetLineColor(2);
  gFakEta->SetMarkerColor(2);

  TGraphAsymmErrors *gFakPt = new TGraphAsymmErrors(); gFakPt->SetName("gFakPt");
  gFakPt->BayesDivide(hFakPt,hRecPt);
  gFakPt->SetMarkerStyle(24);
  gFakPt->SetLineColor(4);
  gFakPt->SetMarkerColor(4);

  TGraphAsymmErrors *gFakEta2 = new TGraphAsymmErrors(); gFakEta2->SetName("gFakEta2");
  gFakEta2->BayesDivide(hFakEta2,hRecEta2);
  gFakEta2->SetMarkerStyle(24);
  gFakEta2->SetLineColor(4);
  gFakEta2->SetMarkerColor(4);

  TGraphAsymmErrors *gFakPt2 = new TGraphAsymmErrors();  gFakPt2->SetName("gFakPt2");
  gFakPt2->BayesDivide(hFakPt2,hRecPt2);
  gFakPt2->SetMarkerStyle(25);
  gFakPt2->SetLineStyle(2);
  gFakPt2->SetLineColor(2);
  gFakPt2->SetMarkerColor(2);

  TCanvas *c9 = new TCanvas("c9","Fake Fraction",900,500);
  c9->Divide(2,1);
  hDumEtaFak=(TH1F*) hDumEta2->Clone("hDumEtaMul");
  hDumEtaFak->GetYaxis()->SetTitle("Fake Reconstruction Fraction");
  hDumPtFak=(TH1F*) hDumPt2->Clone("hDumPtMul");
  hDumPtFak->GetYaxis()->SetTitle("Fake Reconstruction Fraction");
  c9->cd(1); hDumEtaFak->Draw(); gFakEta->Draw("pc"); gFakEta2->Draw("pc"); legEta2->Draw();
  c9->cd(2); hDumPtFak->Draw(); gFakPt->Draw("pc"); gFakPt2->Draw("pc"); legPt2->Draw();

  // Secondaries
  TGraphAsymmErrors *gSecEta = new TGraphAsymmErrors(); gSecEta->SetName("gSecEta");
  gSecEta->BayesDivide(hSecEta,hRecEta);
  gSecEta->SetMarkerStyle(25);
  gSecEta->SetLineStyle(2);
  gSecEta->SetLineColor(2);
  gSecEta->SetMarkerColor(2);

  TGraphAsymmErrors *gSecPt = new TGraphAsymmErrors(); gSecPt->SetName("gSecPt");
  gSecPt->BayesDivide(hSecPt,hRecPt);
  gSecPt->SetMarkerStyle(24);
  gSecPt->SetLineColor(4);
  gSecPt->SetMarkerColor(4);

  TGraphAsymmErrors *gSecEta2 = new TGraphAsymmErrors(); gSecEta2->SetName("gSecEta2");
  gSecEta2->BayesDivide(hSecEta2,hRecEta2);
  gSecEta2->SetMarkerStyle(24);
  gSecEta2->SetLineColor(4);
  gSecEta2->SetMarkerColor(4);

  TGraphAsymmErrors *gSecPt2 = new TGraphAsymmErrors();  gSecPt2->SetName("gSecPt2");
  gSecPt2->BayesDivide(hSecPt2,hRecPt2);
  gSecPt2->SetMarkerStyle(25);
  gSecPt2->SetLineStyle(2);
  gSecPt2->SetLineColor(2);
  gSecPt2->SetMarkerColor(2);

  TCanvas *c10 = new TCanvas("c10","Secondary Fraction",900,500);
  c10->Divide(2,1);
  hDumEtaSec=(TH1F*) hDumEta2->Clone("hDumEtaMul");
  hDumEtaSec->GetYaxis()->SetTitle("Non-Primary Reconstruction Fraction");
  hDumPtSec=(TH1F*) hDumPt2->Clone("hDumPtMul");
  hDumPtSec->GetYaxis()->SetTitle("Non-Primary Reconstruction Fraction");
  c10->cd(1); hDumEtaSec->Draw(); gSecEta->Draw("pc"); gSecEta2->Draw("pc"); legEta2->Draw();
  c10->cd(2); hDumPtSec->Draw(); gSecPt->Draw("pc"); gSecPt2->Draw("pc"); legPt2->Draw();

  /*
  printCanvases(c1,"hitrk_can1",0,1);
  printCanvases(c2,"hitrk_can2",0,1);
  printCanvases(c3,"hitrk_can3",0,1);
  printCanvases(c4,"hitrk_can4",0,1);
  printCanvases(c5,"hitrk_can5",0,1);
  printCanvases(c6,"hitrk_can6",0,1);
  printCanvases(c7,"hitrk_can7",0,1);
  printCanvases(c8,"hitrk_can8",0,1);
  printCanvases(c9,"hitrk_can9",0,1);
  printCanvases(c10,"hitrk_can10",0,1);
  */


  /*
  TFile *f = new TFile("trkEffPY8.root","RECREATE");
  gAccPt->Write(); gAccPt2->Write(); gAccEta->Write(); gAccEta2->Write();
  gEffPt->Write(); gEffPt2->Write(); gEffEta->Write(); gEffEta2->Write();
  gMulPt->Write(); gMulPt2->Write(); gMulEta->Write(); gMulEta2->Write();
  gFakPt->Write(); gFakPt2->Write(); gFakEta->Write(); gFakEta2->Write();
  gSecPt->Write(); gSecPt2->Write(); gSecEta->Write(); gSecEta2->Write();
  f->Close();
  */
}
Ejemplo n.º 18
0
int EvtDisplay(){//main  

  //const unsigned nS = 7;
  //TString scenario[nS] = {"0","1","2","3","4","5","6"};
  //TString scenario = "VBFH/concept/";
  //TString scenario = "ZHtautau/concept/";
  //TString scenario = "ZH125/concept/";
  TString scenario = "GluGlu/concept/";
  bool doAll = false;
  TString version = "20";
  unsigned mipThresh = 1;

  double minRadius = 316;//mm

  ////double minX=-150,maxX=150;
  //double minX=-700,maxX=700;
  ////double minY=420,maxY=720;
  ////double minY=1150,maxY=1450;
  //double minY=-1100,maxY=500;

  std::ostringstream ltitleBase;
  //ltitle << "#gamma 200 GeV"
  //ltitleBase << "VBF H,H#rightarrow#gamma#gamma";
  //ltitleBase << "ZH,H#rightarrow#tau#tau";
  ltitleBase << "pp #rightarrow gg";
    //<< " Event #" << event[ievt]
    //	     << ", E_{1#times1 cm^{2}} > "
    //	     << mipThresh << " Mips";


  const unsigned nLayers = 64;
  const unsigned nEcalLayers = 31;

  //VBFH
  //const unsigned nEvts = 7;//1000;
  //unsigned event[nEvts]={4,5,6,7,9,11,12};//,6,12};//103,659,875};
  //Htautau 1000
  //const unsigned nEvts = 7;//1000;
  //unsigned event[nEvts]={1,2,5,8,10,11,12};//,6,12};//103,659,875};
  //Htautau 125
  //const unsigned nEvts = 5;//1000;
  //unsigned event[nEvts]={0,1,2,10,14};//,6,12};//103,659,875};
  //gluons
  const unsigned nEvts = 3;//1000;
  unsigned event[nEvts]={7,16,22};//,2,3,4};//,6,12};//103,659,875};

  //  const unsigned nEvts = 13;//1000;
  //unsigned event[nEvts];//={1,6,12};//103,659,875};
  //for (unsigned ievt(0); ievt<nEvts; ++ievt){//loop on events
  //event[ievt] = ievt;
  //}

  double minZ=3170,maxZ=5000;


  //VBFH
  //double minX[nEvts] = {-700,-600,-400,-400,0,0,0};
  //double maxX[nEvts] = {-100,0,200,100,700,700,500};
  //double minY[nEvts] = {100,-600,-1100,-800,-100,-200,-700};
  //double maxY[nEvts] = {480,0,0,0,400,300,0};

  //Htautau 1000
  /*double minX[nEvts] = {0,-500,0,-400,0,-500,-700};
  double maxX[nEvts] = {600,0,700,500,700,0,600};
  double minY[nEvts] = {0,-700,-100,-700,-400,0,-400};
  double maxY[nEvts] = {500,0,400,900,200,700,700};*/

  //Htautau 125
  /*double minX[nEvts] = {-300,-850,-200,-450,-550};
  double maxX[nEvts] = {100,-450,300,0,-150};
  double minY[nEvts] = {-900,-280,200,-950,-800};
  double maxY[nEvts] = {-500,150,650,-550,-400};*/

  //pp to gg
  double minX[nEvts] = {100,100,-200};
  double maxX[nEvts] = {700,700,500};
  double minY[nEvts] = {100,100,200};
  double maxY[nEvts] = {700,700,900};

  if (doAll){
    for (unsigned ievt(0); ievt<nEvts; ++ievt){//loop on events
      minX[ievt]=-1700;maxX[ievt]=1700;
      minY[ievt]=-1700;maxY[ievt]=1700;
    }
  }

  //if (doAll){
  //minX=-1700,maxX=1700;
  //minY=-1700,maxY=1700;
  //}

  std::ostringstream lName;

  const unsigned nCanvas = nEvts;  
  TCanvas *myc[nCanvas];
  //TPad *pad1 = 0;

  for (unsigned iC(0);iC<nCanvas;++iC){
    lName.str("");
    lName << "myc" << iC;
    myc[iC] = new TCanvas(lName.str().c_str(),lName.str().c_str(),1400,1000);
    //myc[iC]->Divide(2,1);
  }

  std::ostringstream saveName;
  
  TString inputDir = "../PLOTS/version_"+version+"/"+scenario+"/";
  if (doAll) inputDir += "Overview/";

  for (unsigned ievt(0); ievt<nEvts; ++ievt){//loop on events
    lName.str("");
    lName << inputDir ;
    lName << "CalibHistos_E200_evt" << event[ievt] << ".root";
    TFile *inputFile = TFile::Open(lName.str().c_str());
    if (!inputFile) {
      std::cout << " -- Error, input file " << lName.str() << " cannot be opened. Going to next..." << std::endl;
      continue;
      //return 1;
    }


    TString plotDir = inputDir;
    //if (doAll) plotDir += "Overview/";

    inputFile->cd();
    TH3F *p_xyz = 0;
    p_xyz = (TH3F*)gDirectory->Get("p_xyz")->Clone();
      
    if (!p_xyz) {
      std::cout << " -- ERROR, pointer for XYZ histogram is null. Exiting..." << std::endl;
      return 1;
    }
    p_xyz->Sumw2();
    p_xyz->RebinY(2);
    p_xyz->RebinZ(2);

    std::cout << " --bins, min and max of hist = " 
	      << p_xyz->GetNbinsY() << " " 
	      << p_xyz->GetMinimum() << " " 
	      << p_xyz->GetMaximum() 
	      << std::endl;

    set_plot_style();

    std::ostringstream ltitle;
    ltitle << ltitleBase.str();


    const unsigned nSlices = 6;
    int lColor[nSlices] = {1,4,7,3,5,2};
    TH3F *p_slice[nSlices];
    double val[nSlices+1] = {1,5,20,100,300,500,10000};
    for (unsigned iS(0); iS<nSlices; ++iS){
      lName.str("");
      lName << "slice_" << iS ; 
      p_slice[iS] = new TH3F(lName.str().c_str(),";z(mm);x(mm);y(mm)",
			     p_xyz->GetNbinsX(),p_xyz->GetXaxis()->GetBinLowEdge(1),p_xyz->GetXaxis()->GetBinLowEdge(p_xyz->GetNbinsX()+1),
			     p_xyz->GetNbinsY(),p_xyz->GetYaxis()->GetBinLowEdge(1),p_xyz->GetYaxis()->GetBinLowEdge(p_xyz->GetNbinsY()+1),
			     p_xyz->GetNbinsZ(),p_xyz->GetZaxis()->GetBinLowEdge(1),p_xyz->GetZaxis()->GetBinLowEdge(p_xyz->GetNbinsZ()+1)
			     );
      p_slice[iS]->SetMarkerColor(lColor[iS]);
      //p_slice[iS]->SetLineColor(iS+1);
      //p_slice[iS]->SetFillColor(iS+1);
      //p_slice[iS]->SetMarkerStyle(7);
      p_slice[iS]->GetXaxis()->SetRangeUser(minZ,maxZ);
      p_slice[iS]->GetYaxis()->SetRangeUser(minX[ievt],maxX[ievt]);
      p_slice[iS]->GetZaxis()->SetRangeUser(minY[ievt],maxY[ievt]);
    
      p_slice[iS]->GetXaxis()->SetLabelSize(0.05);
      p_slice[iS]->GetYaxis()->SetLabelSize(0.05);
      p_slice[iS]->GetZaxis()->SetLabelSize(0.05);
      p_slice[iS]->GetXaxis()->SetTitleSize(0.05);
      p_slice[iS]->GetYaxis()->SetTitleSize(0.05);
      p_slice[iS]->GetZaxis()->SetTitleSize(0.05);
      p_slice[iS]->SetTitle(ltitle.str().c_str());

      //val[iS]= exp(iS*log(p_xyz->GetMaximum())/nSlices);
    }

    //val[nSlices] = p_xyz->GetMaximum();

    double lmin = 10;
    double lmax = p_xyz->GetBinContent(1,1,1);

    for (int xb(1); xb<p_xyz->GetNbinsX()+1;++xb){
      //std::cout << "--- xb=" << xb << "" << std::endl;
      for (int yb(1); yb<p_xyz->GetNbinsY()+1;++yb){
	double xTmp = p_xyz->GetYaxis()->GetBinCenter(yb);
	for (int zb(1); zb<p_xyz->GetNbinsZ()+1;++zb){
	  double yTmp = p_xyz->GetZaxis()->GetBinCenter(zb);
	  double radius = sqrt(yTmp*yTmp+xTmp*xTmp);
	  if (radius < minRadius){
	    p_xyz->SetBinContent(xb,yb,zb,0);
	    continue;
	  }
	  double ltmp = p_xyz->GetBinContent(xb,yb,zb);
	  if (ltmp<lmin && ltmp>0) lmin=ltmp;
	  if (ltmp>lmax) lmax=ltmp;

	  if (ltmp<1) continue;
	  //std::cout << xb << " " << yb << " " << zb << " " << p_xyz->GetBinContent(xb,yb,zb) << std::endl;
	  if (ltmp < mipThresh) {
		  p_xyz->SetBinContent(xb,yb,zb,0);
	  }
	  else {
	    p_xyz->SetBinContent(xb,yb,zb,ltmp);
	    for (unsigned iS(0); iS<nSlices; ++iS){
	      if (ltmp<=val[iS+1] && ltmp>val[iS])
		p_slice[iS]->SetBinContent(xb,yb,zb,ltmp);
	    }
	  }
	}
      }
    }

    std::cout << " --min and max by hand = " 
	      << lmin << " " 
	      << lmax 
	      << std::endl;

    gStyle->SetOptStat(0);

    myc[ievt]->cd();
    //TPad *pad1 = new TPad("pad1","This is pad1",0.01,0.01,0.83,0.99);
    //pad1->Draw();
    //pad1->cd();    
    //myc[ievt]->cd(1);
    for (unsigned iS(0); iS<nSlices; ++iS){
      std::cout << " -- slice " << iS << std::endl;
      //set artificially the boundaries: min and max in dummy bins
      //p_slice[iS]->SetBinContent(1,1,1,1);
      //p_slice[iS]->SetBinContent(2,1,1,lmax);
      p_slice[iS]->Draw(iS==0? "" : "same");
    }
    //myc[ievt]->cd(2);
    //TPad *pad2 = new TPad("pad2","This is pad2",0.85,0.01,0.99,0.99);
    //pad2->Draw();
    //pad2->cd();
    TLatex lat;
    lat.SetTextAlign(31);
    //lat.SetTextSize(0.2);
    for (unsigned iS(0); iS<nSlices; iS++){
      //std::cout << iS << std::endl;
      char buf[500];
      sprintf(buf,"%3.1f < Mips < %3.1f",val[iS],val[iS+1]);
      lat.SetTextColor(lColor[iS]);
      lat.DrawLatexNDC(1.,(iS*1.0/nSlices)/2.+0.5,buf);
    }

    myc[ievt]->Update();
    saveName.str("");
    saveName << plotDir << "/evtDisplay_evt" << event[ievt] << "_mipThresh" << mipThresh;
    myc[ievt]->Print((saveName.str()+".png").c_str());
    myc[ievt]->Print((saveName.str()+".pdf").c_str());
    
  }//loop on events

  return 0;
  
  
}//main