Esempio n. 1
0
File: pthat.C Progetto: XuQiao/HI
TH1* maniTH(TH1* histo){
histo->SetMarkerStyle(20);
histo->SetMarkerSize(1);
histo->SetMarkerColor(1);
histo->SetLineColor(1);
normalizeByBinWidth(histo);
return histo;
}
void CombineSpectra_FullTrackTrigger_Track20_NoOLDAlignmentRuns()
{
   //Plan: trigger efficiencies (up to a plateau): Not sure though if this would work
   // Jet40: from MB
   // Jet60: from MB or Jet40
   // Jet80: from MB or Jet40 or Jet60

   gROOT->Reset();
   gROOT->ProcessLine(".x rootlogonChristof.C");
   gROOT->ForceStyle();
   gStyle->SetPalette(1);
   gStyle->SetTitleYOffset(1.30);
   gStyle->SetPadRightMargin(0.16);

   bool doSave = false;
   TFile * f_output = new TFile("CombineSpectra_FullTrackTrigger_Track20_NoOLDAlignmentRuns.root","recreate");

   TrackCorrector corr("../trackCorrections_HIN12017v1_HijingCombined.root");
   corr.load("trkCorr_HIN12017");

   // Define the input file and HiForest
   char *infName_FullTrackTrigger_Track20 = "root://eoscms//eos/cms/store/group/phys_heavyions/krajczar/FullTrack20/PA2013_HiForest_PromptReco_highPtTrack20_JSonPPb_forestv84.root";
   HiForest *c_FullTrackTrigger_Track20 = new HiForest(infName_FullTrackTrigger_Track20,"",cPPb);
//   c_FullTrackTrigger_Track20->doTrackCorrections=1;
//   c_FullTrackTrigger_Track20->InitTree();

   std::vector<Double_t> ptBins;
   const Double_t small = 1e-3;
   Double_t pt;
   for(pt = 0.2; pt < 20.0-small; pt += 0.1 ) { ptBins.push_back(pt); std::cerr<<" pt: " << pt << std::endl; }
   for(pt = 20.0; pt < 40.0-small; pt += 0.2 ) { ptBins.push_back(pt); std::cerr<<" pt: " << pt << std::endl; }
   for(pt = 40.0; pt < 103.6-small; pt += 0.4 ) { ptBins.push_back(pt); std::cerr<<" pt: " << pt << std::endl; }
   ptBins.push_back(103.6);
   std::cerr<<" ptBins.size()-1: " << ptBins.size()-1 << std::endl;

   //orig
//   Int_t NumOfPtBins_part = 34;
//   double ptBins_part[] = {0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 3.2, 4.0, 4.8, 5.6, 6.4, 7.2, 9.6, 12.0, 14.4, 19.2, 24.0, 28.8, 35.2, 41.6, 48.0, 60.8, 73.6, 86.4, 103.6};
   //extended pt bins, binwidth at the end: 17.2
   Int_t NumOfPtBins_part = 40;
   double ptBins_part[] = {0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 3.2, 4.0, 4.8, 5.6, 6.4, 7.2, 9.6, 12.0, 14.4, 19.2, 24.0, 28.8, 35.2, 41.6, 48.0, 60.8, 73.6, 86.4, 103.6, 120.8, 138., 155.2, 172.4, 189.6, 206.8};

   TTree * t = new TTree("t","whatever");
   JetData data(t,1);

   //For trigger
   TH1D * hPartPt_FullTrack20_trkCorr = new TH1D("hPartPt_FullTrack20_trkCorr","hPartPt_FullTrack20_trkCorr",NumOfPtBins_part-1,&ptBins_part[0]);
   TH1D * hPartPt_FullTrack20_trkCorr_trigCorr = new TH1D("hPartPt_FullTrack20_trkCorr_trigCorr","hPartPt_FullTrack20_trkCorr_trigCorr",NumOfPtBins_part-1,&ptBins_part[0]);
   TH1D * hPartPt_FullTrack20_trkCorr_smallerBins = new TH1D("hPartPt_FullTrack20_trkCorr_smallerBins","hPartPt_FullTrack20_trkCorr_smallerBins",ptBins.size()-1,&ptBins[0]);
   TH1D * hPartPt_FullTrack20_trkCorr_trigCorr_smallerBins = new TH1D("hPartPt_FullTrack20_trkCorr_trigCorr_smallerBins","hPartPt_FullTrack20_trkCorr_trigCorr_smallerBins",ptBins.size()-1,&ptBins[0]);

   //For spectra combination
   TH1D * hPartPt_FullTrack20_22_32_trkCorr_trigCorr = new TH1D("hPartPt_FullTrack20_22_32_trkCorr_trigCorr","hPartPt_FullTrack20_SpectCombt_rkCorr_trigCorr",NumOfPtBins_part-1,&ptBins_part[0]);
   TH1D * hNumEv_FullTrack20_22_32_trigCorr = new TH1D("hNumEv_FullTrack20_22_32_trigCorr","hNumEv_FullTrack20_22_32_trigCorr",1,0.,1.);
   TH1D * hNumEv_FullTrack20_32_X_trigCorr = new TH1D("hNumEv_FullTrack20_32_X_trigCorr","hNumEv_FullTrack20_32_X_trigCorr",1,0.,1.);

   hPartPt_FullTrack20_trkCorr->Sumw2();
   hPartPt_FullTrack20_trkCorr_trigCorr->Sumw2();
   hPartPt_FullTrack20_trkCorr_smallerBins->Sumw2();
   hPartPt_FullTrack20_trkCorr_trigCorr_smallerBins->Sumw2();

   hPartPt_FullTrack20_22_32_trkCorr_trigCorr->Sumw2();

   int numev_FullTrack20_22_32_trigCorr = 0;
   int numev_FullTrack20_32_X_trigCorr = 0;

   for (int i=0;i<c_FullTrackTrigger_Track20->GetEntries();i++) {
//   for (int i=0;i<1000000;i++) {

      c_FullTrackTrigger_Track20->GetEntry(i);

      data.leadingJetPt = -1;
      data.leadingJetIt = -1;
      data.leadingJetTrackMax = -1;

      if (i % 2000 == 0) cout <<i<<" / "<<c_FullTrackTrigger_Track20->GetEntries()<<endl;

      if(c_FullTrackTrigger_Track20->evt.run<210676 || c_FullTrackTrigger_Track20->evt.run>211256) //211256: last pPb run (Pb goes to +eta)
         continue;

      //event selection
      bool event_accepted = true;
      if(!(c_FullTrackTrigger_Track20->skim.phfPosFilter1 && c_FullTrackTrigger_Track20->skim.phfNegFilter1
          && c_FullTrackTrigger_Track20->skim.pBeamScrapingFilter
          && c_FullTrackTrigger_Track20->skim.pprimaryvertexFilter
          && c_FullTrackTrigger_Track20->skim.pVertexFilterCutGplus
          && TMath::Abs(c_FullTrackTrigger_Track20->evt.vz)<15.
          )
        ) event_accepted = false;

      if(event_accepted == false)
         continue;

      //Jets
      for (int j=0;j<c_FullTrackTrigger_Track20->akPu3PF.nref;j++) {
         if (fabs(c_FullTrackTrigger_Track20->akPu3PF.jteta[j])>2.5) continue;
//         if (fabs(c_FullTrackTrigger_Track20->akPu3PF.jtpt[j])<30) continue;
//         if (c_FullTrackTrigger_Track20->akPu3PF.trackMax[j]<4) continue; //Do we need this?
         if (c_FullTrackTrigger_Track20->akPu3PF.rawpt[j]<15) continue;
         if (c_FullTrackTrigger_Track20->akPu3PF.jtpt[j]>data.leadingJetPt) {
            data.leadingJetPt = c_FullTrackTrigger_Track20->akPu3PF.jtpt[j];
            data.leadingJetEta = c_FullTrackTrigger_Track20->akPu3PF.jteta[j];
            data.leadingJetPhi = c_FullTrackTrigger_Track20->akPu3PF.jtphi[j];
            data.leadingJetTrackMax = c_FullTrackTrigger_Track20->akPu3PF.trackMax[j];
            data.leadingJetIt = j;
         }
      }

      //Tracks for event weights; eta-pt cut removed
      int trackMult = 0;
      for(int j=0;j<c_FullTrackTrigger_Track20->track.nTrk;j++) {
         if(!((c_FullTrackTrigger_Track20->track.highPurity[j])
             && (fabs(c_FullTrackTrigger_Track20->track.trkDz1[j]/c_FullTrackTrigger_Track20->track.trkDzError1[j])<3)
             && (fabs(c_FullTrackTrigger_Track20->track.trkDxy1[j]/c_FullTrackTrigger_Track20->track.trkDxyError1[j])<3)
             && (c_FullTrackTrigger_Track20->track.trkPtError[j]/c_FullTrackTrigger_Track20->track.trkPt[j]<0.1)
            ))
            continue;
         trackMult++;
      }
      // Don't analyze 0 multiplicity events; add correction later if needed
      if(trackMult==0)
        { std::cerr<<" FullTrack20 but 0 multiplicity!!" << std::endl; continue; }
      double evtWeight = 1.;
      evtWeight = corr.getEventWeight(trackMult);

      //Tracks for event classification: same as for analysis
      bool FullTrack20_trackAbove22 = false;
      bool FullTrack20_trackAbove32 = false;
      for(int j=0;j<c_FullTrackTrigger_Track20->track.nTrk;j++) {
         if(!((c_FullTrackTrigger_Track20->track.trkPt[j]>0.2) 
             && (c_FullTrackTrigger_Track20->track.trkEta[j]<0.535)
             && (c_FullTrackTrigger_Track20->track.trkEta[j]>-1.465)
             && (c_FullTrackTrigger_Track20->track.highPurity[j])
             && (fabs(c_FullTrackTrigger_Track20->track.trkDz1[j]/c_FullTrackTrigger_Track20->track.trkDzError1[j])<3)
             && (fabs(c_FullTrackTrigger_Track20->track.trkDxy1[j]/c_FullTrackTrigger_Track20->track.trkDxyError1[j])<3)
             && (c_FullTrackTrigger_Track20->track.trkPtError[j]/c_FullTrackTrigger_Track20->track.trkPt[j]<0.1)
           ))
            continue;            
           if(c_FullTrackTrigger_Track20->track.trkPt[j]>22.)
              FullTrack20_trackAbove22 = true; 
           if(c_FullTrackTrigger_Track20->track.trkPt[j]>32.)
              FullTrack20_trackAbove32 = true;
      }


      //Tracks
      for(int j=0;j<c_FullTrackTrigger_Track20->track.nTrk;j++) {
         if(!((c_FullTrackTrigger_Track20->track.trkPt[j]>0.2) 
             && (c_FullTrackTrigger_Track20->track.trkEta[j]<0.535)
             && (c_FullTrackTrigger_Track20->track.trkEta[j]>-1.465)
             && (c_FullTrackTrigger_Track20->track.highPurity[j])
             && (fabs(c_FullTrackTrigger_Track20->track.trkDz1[j]/c_FullTrackTrigger_Track20->track.trkDzError1[j])<3)
             && (fabs(c_FullTrackTrigger_Track20->track.trkDxy1[j]/c_FullTrackTrigger_Track20->track.trkDxyError1[j])<3)
             && (c_FullTrackTrigger_Track20->track.trkPtError[j]/c_FullTrackTrigger_Track20->track.trkPt[j]<0.1)
           ))
            continue;            

         // trk corrections
         if(data.leadingJetPt==-1) //for corrections
            data.leadingJetPt=10.;
         double trkWeight = 1.;
         trkWeight = corr.getWeight(c_FullTrackTrigger_Track20->track.trkPt[j],c_FullTrackTrigger_Track20->track.trkEta[j],data.leadingJetPt);

         //Trigger
         //v1 version of the trigger is not stored in HLTAnalysis, rely on skimming (so don't require HLT path here)
         hPartPt_FullTrack20_trkCorr->Fill(c_FullTrackTrigger_Track20->track.trkPt[j],trkWeight);
         hPartPt_FullTrack20_trkCorr_trigCorr->Fill(c_FullTrackTrigger_Track20->track.trkPt[j],trkWeight*evtWeight);
         hPartPt_FullTrack20_trkCorr_smallerBins->Fill(c_FullTrackTrigger_Track20->track.trkPt[j],trkWeight);
         hPartPt_FullTrack20_trkCorr_trigCorr_smallerBins->Fill(c_FullTrackTrigger_Track20->track.trkPt[j],trkWeight*evtWeight);

         //Spectra combination
         if(FullTrack20_trackAbove22 && !FullTrack20_trackAbove32) {
            hPartPt_FullTrack20_22_32_trkCorr_trigCorr->Fill(c_FullTrackTrigger_Track20->track.trkPt[j],trkWeight*evtWeight);
         }
      } //Tracks end
 
      // event number
      if(FullTrack20_trackAbove22 && !FullTrack20_trackAbove32)
         numev_FullTrack20_22_32_trigCorr += evtWeight;
      if(FullTrack20_trackAbove32)
         numev_FullTrack20_32_X_trigCorr += evtWeight;
   }//event

   hNumEv_FullTrack20_22_32_trigCorr->SetBinContent(1,numev_FullTrack20_22_32_trigCorr);
   hNumEv_FullTrack20_32_X_trigCorr->SetBinContent(1,numev_FullTrack20_32_X_trigCorr);
   normalizeByBinWidth(hPartPt_FullTrack20_trkCorr);
   normalizeByBinWidth(hPartPt_FullTrack20_trkCorr_trigCorr);
   normalizeByBinWidth(hPartPt_FullTrack20_trkCorr_smallerBins);
   normalizeByBinWidth(hPartPt_FullTrack20_trkCorr_trigCorr_smallerBins);
   normalizeByBinWidth(hPartPt_FullTrack20_22_32_trkCorr_trigCorr);
/*
   TCanvas *c1 = new TCanvas("c1","c1");
   c1->SetLogy();

   hJetPt_minbias->GetXaxis()->CenterTitle();
   hJetPt_minbias->GetYaxis()->CenterTitle();
   hJetPt_minbias->GetXaxis()->SetTitle("Offline jet p_{T} [GeV/c]");
   hJetPt_minbias->GetYaxis()->SetTitle("N_{Leading jet} (|#eta|<2) / GeV/c");
   hJetPt_minbias->SetNdivisions(505);
   hJetPt_minbias->SetMarkerColor(1);
   hJetPt_minbias->SetLineColor(1);
   hJetPt_minbias->SetMarkerStyle(20);
   hJetPt_minbias->Draw();

   hJetPt_Jet40->SetMarkerColor(3);
   hJetPt_Jet40->SetLineColor(3);
   hJetPt_Jet40->SetMarkerStyle(28);
   hJetPt_Jet40->Draw();

   hJetPt_Jet60->SetMarkerColor(5);
   hJetPt_Jet60->SetLineColor(5);
   hJetPt_Jet60->SetMarkerStyle(30);
   hJetPt_Jet60->Draw("same");

   hJetPt_Jet80->SetMarkerColor(4);
   hJetPt_Jet80->SetLineColor(4);
   hJetPt_Jet80->SetMarkerStyle(24);
   hJetPt_Jet80->Draw("same");

   hJetPt_Jet100->SetMarkerColor(6);
   hJetPt_Jet100->SetLineColor(6);
   hJetPt_Jet100->SetMarkerStyle(25);
   hJetPt_Jet100->Draw("same");

   hJetPt_Jet120->SetMarkerColor(2);
   hJetPt_Jet120->SetLineColor(2);
   hJetPt_Jet120->SetMarkerStyle(27);
   hJetPt_Jet120->Draw("same");

   TLegend *leg1 = new TLegend(0.50,0.75,0.82,0.89,NULL,"brNDC");
//   leg1->AddEntry(hJetPt_minbias,"MinBias","pl");
   leg1->AddEntry(hJetPt_Jet40,"Jet40","pl");
   leg1->AddEntry(hJetPt_Jet60,"Jet60","pl");
//   leg1->AddEntry(hJetPt_Jet80,"Jet80","pl");
//   leg1->AddEntry(hJetPt_Jet100,"Jet100","pl");
//   leg1->AddEntry(hJetPt_Jet120,"Jet120","pl");
   leg1->SetFillStyle(0);
   leg1->SetFillColor(0);
   leg1->SetBorderSize(0);
   leg1->Draw();
   if(doSave) {
      c1->SaveAs("Figs/c1.gif");
      c1->SaveAs("Figs/c1.eps");
      c1->SaveAs("Figs/c1.C");
   }


   TCanvas *c2 = new TCanvas("c2","c2");
   TH1D *hJetPt_Jet40_copy1 = (TH1D*)hJetPt_Jet40->Clone("hJetPt_Jet40_copy1");
   TH1D *hJetPt_Jet60_copy1 = (TH1D*)hJetPt_Jet60->Clone("hJetPt_Jet60_copy1");
   TH1D *hJetPt_Jet80_copy1 = (TH1D*)hJetPt_Jet80->Clone("hJetPt_Jet80_copy1");
   TH1D *hJetPt_Jet100_copy1 = (TH1D*)hJetPt_Jet100->Clone("hJetPt_Jet100_copy1");
   TH1D *hJetPt_Jet120_copy1 = (TH1D*)hJetPt_Jet120->Clone("hJetPt_Jet120_copy1");

//   hJetPt_Jet40_copy1->Divide(hJetPt_Jet40,hJetPt_minbias,1,1,"B");
//   hJetPt_Jet60_copy1->Divide(hJetPt_Jet60,hJetPt_minbias,1,1,"B");
//   hJetPt_Jet80_copy1->Divide(hJetPt_Jet80,hJetPt_minbias,1,1,"B");
//   hJetPt_Jet100_copy1->Divide(hJetPt_Jet100,hJetPt_minbias,1,1,"B");
//   hJetPt_Jet120_copy1->Divide(hJetPt_Jet120,hJetPt_minbias,1,1,"B");
   hJetPt_Jet60_copy1->Divide(hJetPt_Jet60,hJetPt_Jet40,1,1,"B");

//   hJetPt_Jet40_copy1->GetYaxis()->SetTitle("Trigger efficiency");
//   hJetPt_Jet40_copy1->Draw();
   hJetPt_Jet60_copy1->Draw();
//   hJetPt_Jet80_copy1->Draw("same");
//   hJetPt_Jet100_copy1->Draw("same");
//   hJetPt_Jet120_copy1->Draw("same");

   TLegend *leg2 = new TLegend(0.50,0.75,0.82,0.89,NULL,"brNDC");
   leg2->AddEntry(hJetPt_Jet40_copy1,"Jet40","pl");
   leg2->AddEntry(hJetPt_Jet60_copy1,"Jet60","pl");
   leg2->AddEntry(hJetPt_Jet80_copy1,"Jet80","pl");
   leg2->AddEntry(hJetPt_Jet100_copy1,"Jet100","pl");
   leg2->AddEntry(hJetPt_Jet120_copy1,"Jet120","pl");
   leg2->SetFillStyle(0);
   leg2->SetFillColor(0);
   leg2->SetBorderSize(0);
   leg2->Draw();
   if(doSave) {
      c2->SaveAs("Figs/c2.gif");
      c2->SaveAs("Figs/c2.eps");
      c2->SaveAs("Figs/c2.C");
   }
*/
   f_output->cd();
   hPartPt_FullTrack20_trkCorr->Write();
   hPartPt_FullTrack20_trkCorr_trigCorr->Write();
   hPartPt_FullTrack20_trkCorr_smallerBins->Write();
   hPartPt_FullTrack20_trkCorr_trigCorr_smallerBins->Write();
   hPartPt_FullTrack20_22_32_trkCorr_trigCorr->Write();
   hNumEv_FullTrack20_22_32_trigCorr->Write();
   hNumEv_FullTrack20_32_X_trigCorr->Write();
   f_output->Close();
}
Esempio n. 3
0
void CompareHong(){
gStyle->SetOptStat(kFALSE);
gStyle->SetErrorX(0);

//double binbound_pt[]={30,40,50,60,70,80,90,100,110,120,140,160,180,200,220,260,300,350,500};
//const double binbound_pt[]={0,5,10,15,20,30,45,60,75,90,105,120,140,160,180,200,220,260,300,400,600,1000};
const double binbound_pt[]={ 3, 4, 5, 7, 9, 12, 15, 18, 22, 27, 33, 39, 47, 55, 64,74, 84, 97, 114, 133, 153, 174, 196, 220, 245, 272, 300, 429, 692, 1000};
int Nbin_pt=sizeof(binbound_pt)/sizeof(double)-1;


TString filename1="Datacombined.root";
TString filename2="AllEtaLumiCombinedSpectraAllEtaBin.root";

TString dir1="/scratch/xuq7/RpA/TreeAna";
TString dir2="/scratch/xuq7/RpA/TreeAna";

TString histoname1="jetptCombinedSpectraInEtaBin-3_3";
TString histoname2="CombinedSpectraInEtaBin-3_3";
//TString histoname1=Form("jetpt%s_0-100%%",JetIDName.Data());

TFile *file1=TFile::Open(Form("%s/%s",dir1.Data(),filename1.Data()));
TFile *file2=TFile::Open(Form("%s/%s",dir2.Data(),filename2.Data()));

TH1F* histo1=(TH1F*)file1->Get(histoname1);
TH1F* histo2=(TH1F*)file2->Get(histoname2);

histo1=(TH1F*)histo1->Rebin(Nbin_pt,"histo1",binbound_pt);
histo2=(TH1F*)histo2->Rebin(Nbin_pt,"histo2",binbound_pt);
normalizeByBinWidth(histo1);
normalizeByBinWidth(histo2);
//histo1->Scale(1/histo1->Integral());
//histo2->Scale(1/histo2->Integral());
histo1->SetMarkerStyle(24);
histo1->SetMarkerSize(1.2);
histo1->SetMarkerColor(1);
histo2->SetMarkerStyle(20);
histo2->SetMarkerSize(1.2);
histo2->SetMarkerColor(2);

c1 = new TCanvas("c1"," ",400,600);
makeMultiPanelCanvas(c1,1,2,-0.08,0,0.14,0.16,0.03);

TH1F* hFrame=new TH1F("","",20000,-1000,1000);
fixedFontHist(hFrame,2,2.2);
hFrame->SetTitle("");
hFrame->GetXaxis()->SetTitle("");
hFrame->GetYaxis()->SetTitle("Event Probability");
hFrame->GetXaxis()->SetLimits(0,100);
//hFrame->GetXaxis()->SetLimits(-3,3);
//hFrame->GetYaxis()->SetRangeUser(1.01e-10,1e-1);
hFrame->GetYaxis()->SetRangeUser(1,1e8);
c1->cd(1)->SetLogy();
hFrame->DrawCopy();
histo1->Draw("E1same");
histo2->Draw("E1same");
TLegend *leg1=new TLegend(0.60,0.75,0.85,0.90);
leg1->SetBorderSize(0);
leg1->SetFillColor(0);
leg1->SetTextSize(0.06);
leg1->AddEntry(histo1,"Qiao","lp");
leg1->AddEntry(histo2,"Hong","lp");
leg1->Draw("same");
c1->cd(2);
TLatex *T1=new TLatex(0.5,0.92,"|#eta|<1  Data");
T1->SetNDC();
T1->SetTextAlign(12);
T1->SetTextSize(0.05);
T1->SetTextColor(1);
T1->SetTextFont(42);
TH1D* ratio=(TH1D*)histo2->Clone("ratio");
hFrame->GetXaxis()->SetTitle("p_{T}^{jet} (GeV/c)");
hFrame->GetYaxis()->SetTitle("Ratio: Hong/Qiao");
hFrame->GetYaxis()->SetRangeUser(0.6,1.39);
hFrame->DrawCopy();
ratio->Divide(histo1);
ratio->SetMarkerStyle(20);
ratio->SetMarkerSize(1.2);
ratio->SetMarkerColor(1);
ratio->SetTitle("");
ratio->Draw("E1same");
TLine *l =new TLine(0,1,600,1);
l->SetLineStyle(2);
l->SetLineColor(1);
l->Draw("same");
T1->Draw("same");
}
Esempio n. 4
0
File: DrawVz.C Progetto: XuQiao/HI
void DrawVz(){

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

TFile *f=TFile::Open("output/Hijing_vz.root","ReadOnly");
TH1F* hVz_MC=(TH1F*)f->Get("hVz_MC");
TH2F* hVzHF4=(TH2F*)f->Get("hVzHF4");
TH2F* hVzHFPlus4=(TH2F*)f->Get("hVzHFPlus4");
TH2F* hVzHFPlus=(TH2F*)f->Get("hVzHFPlus");
fixedFontHist(hVz_MC);
fixedFontHist(hVzHF4);
fixedFontHist(hVzHFPlus4);
fixedFontHist(hVzHFPlus);
TString Data_file="/home/xuq7/CMSSW_6_2_3_patch1/src/jetRpA/RpA/output/JetTrig/DataMC/FromYX/latest/PPbCombinedJetTrigakPu3PFJetTrkEffHIN12017v5TrkCorr2DCutAllHistHFsumEta4Bin1.root";
TFile *fdata=TFile::Open(Data_file);
c1 = new TCanvas("c1","",800,800);
c2 = new TCanvas("c2","",600,600);
c3 = new TCanvas("c3","",600,600);
c4 = new TCanvas("c4","",600,600);
makeMultiPanelCanvas(c1,1,2,0.03,0.03,0.12,0.12,0.03);
makeMultiPanelCanvas(c2,1,1,0.03,0.04,0.02,0.04,0.03);
makeMultiPanelCanvas(c3,1,1,0.03,0.04,0.02,0.04,0.03);
makeMultiPanelCanvas(c4,1,1,0.03,0.04,0.02,0.04,0.03);
c1->cd(1);
hVz_MC->SetFillStyle(3004);
hVz_MC->SetFillColor(2);
hVz_MC->SetTitle("");
hVz_MC->SetMaximum(1);
hVz_MC->GetXaxis()->SetTitle("Vz (cm)");
hVz_MC->GetXaxis()->SetTitleOffset(1.1);
hVz_MC->GetYaxis()->SetTitle("Event Fraction");
hVz_Data=(TH1F*)fdata->Get("pfjet_Vz");
hVz_Data->GetYaxis()->SetTitle("Event Fraction");
hVz_Data->SetMarkerStyle(20);
hVz_Data->SetMarkerSize(1.2);
hVz_Data->SetMarkerColor(1);
normalizeByBinWidth(hVz_MC);
normalizeByBinWidth(hVz_Data);
hVz_MC->Scale(1/hVz_MC->Integral());
hVz_Data->Scale(1/hVz_Data->Integral());
hVz_Data->Draw();
hVz_MC->Draw("HIST same");
TLegend *leg=new TLegend(0.8,0.8,0.95,0.9);
leg->AddEntry(hVz_Data,"Data","lp");
leg->SetBorderSize(0);
leg->SetFillColor(0);
leg->SetTextSize(0.05);
leg->AddEntry(hVz_MC,"MC","lp");
leg->Draw("same");
c1->cd(2);

TF1 * fVz = new TF1("fVx","[0]+[1]*x+[2]*TMath::Power(x,2)+[3]*TMath::Power(x,3)+[4]*TMath::Power(x,4)", -15., 15.);
fVz->SetParameters(1.60182e+00,1.08425e-03,-1.29156e-02,-7.24899e-06,2.80750e-05);
fVz->SetLineColor(2);

hVz_ratio=(TH1F*)hVz_Data->Clone("hVz_ratio");
hVz_ratio->GetYaxis()->SetTitle("Data/MC");
hVz_ratio->GetXaxis()->SetTitle("Vz (cm)");
hVz_ratio->Divide(hVz_MC);
fixedFontHist(hVz_ratio);
hVz_ratio->GetXaxis()->SetRangeUser(-20,20);
hVz_ratio->SetMaximum(2.49);
hVz_ratio->SetMinimum(0);
hVz_ratio->Draw();
fVz->Draw("same");
TLegend *leg1=new TLegend(0.7,0.75,0.9,0.9);
leg1->SetBorderSize(0);
leg1->SetFillColor(0);
leg1->SetTextSize(0.05);
leg1->AddEntry(hVz_ratio,"ratio","lp");
leg1->AddEntry(fVz,"#splitline{reweighting}{function}","lp");
leg1->Draw("same");
c1->Print("pic/Hijing_VzWeighting.png");

c2->cd();
hVzHF4->SetTitle("");
hVzHF4->GetYaxis()->SetTitleOffset(0.9);
hVzHF4->GetXaxis()->SetTitle("Vz (cm)");
hVzHF4->GetYaxis()->SetTitle("HF E_{T} |#eta|>4 (GeV/c)");
hVzHF4->Draw("colz");
c2->Print("pic/Hijing_VzHF4.png");

c3->cd();
hVzHFPlus4->SetTitle("");
hVzHFPlus4->GetYaxis()->SetTitleOffset(0.9);
hVzHFPlus4->GetXaxis()->SetTitle("Vz (cm)");
hVzHFPlus4->GetYaxis()->SetTitle("HF E_{T} #eta>4 (GeV/c)");
hVzHFPlus4->Draw("colz");

c4->cd();
hVzHFPlus->SetTitle("");
hVzHFPlus->GetYaxis()->SetTitleOffset(0.9);
hVzHFPlus->GetXaxis()->SetTitle("Vz (cm)");
hVzHFPlus->GetYaxis()->SetTitle("HF E_{T} #eta>0 (GeV/c)");
hVzHFPlus->Draw("colz");

}
Esempio n. 5
0
void Draw3paneleff() {
    gStyle->SetOptStat(kFALSE);
    TString outG="G1.root";
    TCanvas *c1  = new TCanvas("","",1000,400);
    c1->Divide(3);
    gStyle->SetErrorX(0);
    double hfbin[]= {0,1,2,3,4,6,8,10,13,16,20,25,30,40,55,70,90};
    int nhfbin = 16;
    TString name, dirname;
    TFile *fDSeff = TFile::Open("/scratch/xuq7/Centrality/pPbHijing_EffCorr_forNBD.root");
    TFile *ftreff = TFile::Open("/scratch/xuq7/Centrality/pPbHist_Hijing_TrandEs.root");
    TH1D* hbef = (TH1D*)ftreff->Get("hHFEnergy4");
    TH1D* rehbef = (TH1D*)hbef->Rebin(nhfbin,"rehHFEnergy4",hfbin);
    TH1D* haft = (TH1D*)ftreff->Get("hHFEnergy4_tr");
    TH1D* rehaft = (TH1D*)haft->Rebin(nhfbin,"rehHFEnergy4_tr",hfbin);
    TGraphAsymmErrors *gtreff = new TGraphAsymmErrors();
    gtreff->BayesDivide(rehaft,rehbef);

    TGraphAsymmErrors *geff = (TGraphAsymmErrors*)fDSeff->Get("regEffHF4");
    for(int i=0; i<geff->GetN(); i++) {
        geff->SetPointEXlow(i,0);
        geff->SetPointEXhigh(i,0);
        gtreff->SetPointEXlow(i,0);
        gtreff->SetPointEXhigh(i,0);
    }

    geff->SetTitle("");
    geff->SetMarkerStyle(33);
    geff->SetMarkerColor(5);
    geff->SetMarkerSize(1.3);

    gtreff->SetTitle("");
    gtreff->SetMarkerStyle(21);
    gtreff->SetMarkerColor(6);
    gtreff->SetMarkerSize(1.3);

    for(int cenvar=0; cenvar<3; cenvar++) {
        TFile *f = TFile::Open(Form("%s/%s",cenvardir[cenvar].Data(),outG.Data()));
        c1->cd(cenvar+1);
        TObjString* dataname = (TObjString*)f->Get(Form("dataname"));
        TObjString* histoname = (TObjString*)f->Get(Form("histoname"));
        TFile *fdata = TFile::Open(dataname->GetString());
        TH1D *histo_obs = (TH1D*)fdata->Get(histoname->GetString());
        histo_obs->Sumw2();
        TH1D* hFrame = histo_obs->Clone();
        hFrame->Reset();
        hFrame->SetTitle("");
        hFrame->SetMaximum(1.2);
        hFrame->SetMinimum(0);
        if(cenvar==0)hFrame->GetYaxis()->SetTitle("ratio");
        else hFrame->GetYaxis()->SetTitle("");
        hFrame->GetXaxis()->SetRangeUser(0,100);
        hFrame->GetXaxis()->CenterTitle(0);
        hFrame->GetYaxis()->CenterTitle(1);
        hFrame->GetYaxis()->SetTitleOffset(1.1);
        hFrame->GetXaxis()->SetTitleOffset(1.1);
        hFrame->GetXaxis()->SetTitleSize(0.056);
        hFrame->GetYaxis()->SetTitleSize(0.056);
        hFrame->GetXaxis()->SetLabelSize(0.05);
        hFrame->GetYaxis()->SetLabelSize(0.05);

        int binnum = histo_obs->GetNbinsX();
        double Minx = histo_obs->GetXaxis()->GetXmin();
        double Maxx = histo_obs->GetXaxis()->GetXmax();
        double binsize = (Double_t)(Maxx-Minx)/binnum;
        hFrame->Draw();
        TLegend *leg = new TLegend(0.40, 0.2, 0.65, 0.4);

        for(int sth=0; sth<3; sth++) {
            int Gth=0;
            if(sth==0) {
                dirname = "std";
            }
            else if(sth==1) {
                dirname ="Gri055";
            }
            else {
                dirname ="Gri101";
            }
            hFrame->GetXaxis()->SetTitle(cenvariable[cenvar]);

            if(Gth==0)
                name = "G0";
            else if(Gth<nGlau)
                name = Form("Glau_%d",Gth);
            else
                name = Form("bin_%d",Gth-nGlau+1);
            TObjString* Glaubername = (TObjString*)f->Get(Form("%s/%s/Glaubername",dirname.Data(),name.Data()));
            TVectorD* xmin = (TVectorD*)f->Get(Form("%s/%s/xmin",dirname.Data(),name.Data()));
            TVectorD* xmax = (TVectorD*)f->Get(Form("%s/%s/xmax",dirname.Data(),name.Data()));
            TVectorD* mubest = (TVectorD*)f->Get(Form("%s/%s/mubest",dirname.Data(),name.Data()));
            TVectorD* kbest = (TVectorD*)f->Get(Form("%s/%s/kbest",dirname.Data(),name.Data()));
            TVectorD* Ndf = (TVectorD*)f->Get(Form("%s/%s/Ndf",dirname.Data(),name.Data()));
            TVectorD* chis = (TVectorD*)f->Get(Form("%s/%s/chis",dirname.Data(),name.Data()));
            TVectorD *kpoint = (TVectorD*)f->Get(Form("%s/%s/kpoint",dirname.Data(),name.Data()));
            int xbinmin=(int)(((*xmin)[0]-Minx)/binsize);
            int xbinmax=(int)(((*xmax)[0]-Minx)/binsize);
            TFile *fGlauber = TFile::Open(Glaubername->GetString());
            TH1D *histo_exp = new TH1D("histo_exp","Simulated distribution;Multiplicity;Event Fraction",binnum,Minx,Maxx);
            histo_exp->Sumw2();
            Int_t ibin;

            TH1D *histo_obs_norm = (TH1D*)histo_obs->Clone();
            histo_obs_norm->Scale(1/histo_obs->Integral(xbinmin,xbinmax));

            TF1 *NBD_fun = new
            TF1("NBD_fun","[0]*TMath::Gamma(x+[1])/(TMath::Gamma(x+1)*TMath::Gamma([1]))*TMath::Power([2]/[1],x)/TMath::Power([2]/[1]+1,x+[1])",0,100);
            NBD_fun->SetParameter(0,1);	//[0]: Normalized constant
            NBD_fun->SetParameter(1,(*kbest)[0]);	//[1]: k value
            NBD_fun->SetParameter(2,(*mubest)[0]);	//[2]: mu value

            TTree *t = (TTree*) fGlauber->Get("nt_p_Pb");
            Long_t Nevent;

            Nevent = (Long_t) t->GetEntries();

            Long_t Ev;
            Int_t Bino;
            Double_t Para, Bi_Para, Mult;
            Float_t Ncoll;
            t->SetBranchAddress("Ncoll",&Ncoll);

            for(Ev=0; Ev<Nevent; Ev++) {
                if(Ev%100000==0)	 cout<<"Have run "<<Ev<<" events"<<endl;
                t->GetEntry(Ev);
                Para = 0; //make sure that Para doesn't accumulate through loops
                for(Bino=0; Bino<Ncoll; Bino++) {
                    Bi_Para = NBD_fun->GetRandom();
                    Para += Bi_Para;
                }
                histo_exp->Fill(Para);
            }
            Double_t SumEvent, scale;
            SumEvent = histo_exp->Integral(xbinmin,xbinmax);
            scale = 1/SumEvent;
            TH1D *histo_exp_norm = (TH1D*) histo_exp->Clone();
            histo_exp_norm->Scale(scale);


            rehisto_obs_norm = (TH1D*)histo_obs_norm->Rebin(nhfbin,"rehisto_obs_norm",hfbin);
            normalizeByBinWidth(rehisto_obs_norm);
            rehisto_exp_norm = (TH1D*)histo_exp_norm->Rebin(nhfbin,"rehisto_exp_norm",hfbin);
            normalizeByBinWidth(rehisto_exp_norm);
            TH1D* ratio = (TH1D*)rehisto_obs_norm->Clone("ratio");
            ratio->Divide(rehisto_exp_norm);

            ratio->SetTitle("");
            ratio->SetLineColor(1);
            ratio->SetMarkerStyle(20);
            ratio->SetMarkerColor(color_[sth]);
            ratio->SetMarkerSize(1.3);
            ratio->Draw("Psame");
            geff->Draw("Psame");
            gtreff->Draw("Psame");
            leg->AddEntry(ratio,Form("data/fit %s",Grilist[sth].Data()),"p");
        }

        leg->SetFillColor(10);
        leg->SetFillStyle(0);
        leg->SetBorderSize(0.035);
        leg->SetTextFont(42);
        leg->SetTextSize(0.045);
        leg->AddEntry(geff,"DS efficiency","p");
        leg->AddEntry(gtreff,"Event selection efficiency","p");
        if(cenvar==2) leg->Draw("same");

        TLine *l = new TLine(0,1,90,1);
        l->SetLineStyle(2);
        l->Draw("same");
    }
    c1->SaveAs(Form("ratiovseff.png"));
    c1->SaveAs(Form("ratiovseff.pdf"));
}
Esempio n. 6
0
void overlayDataMC(){
int ilist=atoi(getenv("LIST"));
TString JetIDNameList[18]={"chMax", "chSum", "neuMax", "neuSum", "phoMax", "phoSum", "chMaxpt", "chSumpt", "neuMaxpt", "neuSumpt", "phoMaxpt", "phoSumpt","SumSumpt","SumSumrawpt","neuMaxr","chN","neuN","phoN"};
const double binbound_pt[]={ 3, 4, 5, 7, 9, 12, 15, 18, 22, 27, 33, 39, 47, 55, 64,74, 84, 97, 114, 133, 153, 174, 196, 220, 245, 272, 300, 429, 692, 1000};
int Nbin_pt=sizeof(binbound_pt)/sizeof(double)-1;
double xrange_pt[2]={30+1e-4,600-1e-4};
TString JetID, Unit;
TString JetIDName = JetIDNameList[ilist];

gStyle->SetOptStat(kFALSE);
gStyle->SetErrorX(0);
if(ilist== 0)   JetID = "Max p_{T}^{charged}";
else if(ilist== 1)      JetID = "#Sigma p_{T}^{charged}";
else if(ilist== 2)      JetID = "Max p_{T}^{neutral}";
else if(ilist== 3) JetID = "#Sigma p_{T}^{neutral}";
else if(ilist== 4) JetID = "Max p_{T}^{photon}";
else if(ilist== 5) JetID = "#Sigma p_{T}^{photon}";
else if(ilist== 6)      JetID = "Max p_{T}^{charged}/p_{T}^{jet}";
else if(ilist== 7)      JetID = "#Sigma p_{T}^{charged}/p_{T}^{jet}";
else if(ilist== 8)      JetID = "Max p_{T}^{neutral}/p_{T}^{jet}";
else if(ilist== 9)      JetID = "#Sigma p_{T}^{neutral}/p_{T}^{jet}";
else if(ilist== 10)     JetID = "Max p_{T}^{photon}/p_{T}^{jet}";
else if(ilist== 11)     JetID = "#Sigma p_{T}^{photon}/p_{T}^{jet}";
else if(ilist== 12)     JetID = "(#Sigma p_{T}^{charged}+#Sigma p_{T}^{photon} +#Sigma p_{T}^{neutral}+#Sigma p_{T}^{#mu}+#Sigma p_{T}^{e})/p_{T}^{jet}";
else if(ilist== 13)     JetID = "(#Sigma p_{T}^{charged}+#Sigma p_{T}^{photon} +#Sigma p_{T}^{neutral}+#Sigma p_{T}^{#mu}+#Sigma p_{T}^{e})/p_{T}^{raw}";
else if(ilist== 14)     JetID = "Max /(Max p_{T}^{neutral}+Max p_{T}^{charged}+Max p_{T}^{photon})";
else if(ilist== 15)     JetID = "charged Multiplicity";
else if(ilist== 16)     JetID = "neutral Multiplicity";
else if(ilist== 17)     JetID = "photon Multiplicity";
else{   exit();}

if(JetIDName.Contains("pt") || JetIDName=="neuMaxr"){
if(ilist==12 || ilist==13){
double binbound_JetID[]={0,0.2,0.4,0.6,0.7,0.8,0.84,0.86,0.88,0.9,0.92,0.94,0.96,0.98,1.0,1.02,1.04,1.06,1.1,1.15,1.2,1.3,1.4,1.6,1.8,2.};}
else if(ilist==6){
double binbound_JetID[]={0,0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.65,0.7,0.75,0.8,0.85,0.9,1.};}
else{
double binbound_JetID[]={0,0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.65,0.7,0.75,0.8,0.85,0.9,0.95,1.};}
Unit="";
}
else if(JetIDName.Contains("N")){
if(ilist==17){
double binbound_JetID[]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,20,30};}
else if(ilist==16){
double binbound_JetID[]={0,1,2,3,4,5,6,7,8,10};}
else if(ilist==15){
double binbound_JetID[]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,20,24,30,40};}
Unit="";
}
else{
//double binbound_JetID[]={0,15,30,45,60,75,90,105,120,135,150,165,180,195,210,225,240,255,270,285,300};
double binbound_JetID[]={0,10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200};
Unit="(GeV/c)";
}
int Nbin_JetID=sizeof(binbound_JetID)/sizeof(double)-1;

TString filename="/scratch/xuq7/RpA/TreeAna/Datacombined.root";
TString PPbfilename="/scratch/xuq7/RpA/TreeAna/MCPPbakPu3PF.root";

TString histoname=Form("jetpt%sCombinedSpectra",JetIDName.Data());
TString PPbhistoname=Form("jetpt%s",JetIDName.Data());

TFile *file=TFile::Open(filename);
TFile *PPbfile=TFile::Open(PPbfilename);

TH2F* hdata2F=(TH2F*)file->Get(histoname);
TH2F* hPPb2F=(TH2F*)PPbfile->Get(PPbhistoname);

TH1D* hdata=(TH1D*)hdata2F->ProjectionY("hdata",hdata2F->GetXaxis()->FindBin(xrange_pt[0]),hdata2F->GetXaxis()->FindBin(xrange_pt[1]));
TH1D* hPPb=(TH1D*)hPPb2F->ProjectionY("hPPb",hPPb2F->GetXaxis()->FindBin(xrange_pt[0]),hPPb2F->GetXaxis()->FindBin(xrange_pt[1]));

rehdata=(TH1D*)hdata->Clone("rehdata");
rehPPb=(TH1D*)hPPb->Clone("rehPPb");
rehdata=(TH1D*)hdata->Rebin(Nbin_JetID,"rehdata",binbound_JetID);
rehPPb=(TH1D*)hPPb->Rebin(Nbin_JetID,"rehPPb",binbound_JetID);
normalizeByBinWidth(rehdata);
normalizeByBinWidth(rehPPb);
rehdata->Scale(1./rehdata->Integral(rehdata->FindBin(binbound_JetID[0]),rehdata->FindBin(binbound_JetID[Nbin_JetID])));
rehPPb->Scale(1./rehPPb->Integral(rehPPb->FindBin(binbound_JetID[0]),rehPPb->FindBin(binbound_JetID[Nbin_JetID])));
rehdata->SetMarkerStyle(20);
rehdata->SetMarkerColor(1);
rehdata->SetLineColor(1);
rehdata->SetMarkerSize(1.2);
rehdata->GetYaxis()->SetTitle("Event Fraction");
rehPPb->SetMarkerStyle(0);
rehPPb->SetFillStyle(3004);
rehPPb->SetFillColor(2);
rehPPb->SetLineColor(2);
fixedFontHist(rehdata,1.8,2.6);
fixedFontHist(rehPPb,1.8,2.6);

c1 = new TCanvas("c1","",400,700);
makeMultiPanelCanvas(c1,1,2,-0.12,0,0.18,0.16,0.05);

c1->cd(1)->SetLogy();
rehdata->GetXaxis()->SetTitle(JetID.Data());
rehdata->GetXaxis()->SetRangeUser(binbound_JetID[0],binbound_JetID[Nbin_JetID]);
//if(ilist==12 || ilist==13) 
//rehdata->GetXaxis()->SetRangeUser(0.8,1.2);
rehdata->SetMinimum(TMath::Min(rehdata->GetMinimum(),rehPPb->GetMinimum())/3);
rehdata->SetMaximum(1.5);
rehdata->SetTitle("");
rehdata->Draw("E1");
rehPPb->Draw("HIST E1same");
TLegend *leg1=new TLegend(0.60,0.70,0.80,0.85);
leg1->SetBorderSize(0);
leg1->SetFillColor(0);
leg1->SetTextSize(0.05);
leg1->AddEntry(rehdata,"Data","lpf");
leg1->AddEntry(rehPPb,"PYTHIA+HIJING","lpf");
leg1->Draw("same");
TLatex *T=new TLatex();
T->SetNDC();
T->SetTextAlign(12);
T->SetTextSize(0.05);
T->SetTextColor(1);
T->SetTextFont(42);
T->DrawLatex(0.40,0.90,Form("p_{T}^{jet}: %.f-%.f (GeV/c)",xrange_pt[0],xrange_pt[1]));
T->DrawLatex(0.40,0.20,Form("|#eta < 1|"));
c1->cd(2);
TH1D* ratio=(TH1D*)rehdata->Clone("ratio");
ratio->Divide(rehPPb);
ratio->SetMarkerStyle(20);
ratio->SetMarkerSize(1.2);
ratio->SetMarkerColor(1);
ratio->SetMinimum(0);
ratio->SetMaximum(1.9);
ratio->SetTitle("");
ratio->GetYaxis()->SetTitle("Data/MC");
ratio->Draw("E1");
TLine *l =new TLine(binbound_JetID[0],1,binbound_JetID[Nbin_JetID],1);
l->SetLineStyle(2);
l->SetLineColor(1);
l->Draw("same");

c1->Print(Form("/home/xuq7/CMSSW_6_2_3_patch1/src/jetRpA/RpA/TreeAna/JetID/pic/%s/overlay_DataMC.png",JetIDName.Data()));

}
Esempio n. 7
0
void P3overlayDataMCetabin(){
gStyle->SetOptStat(kFALSE);
gStyle->SetErrorX(0);
int ietac=0;
TString coll="PbP";
TString listsvarALL[6]={"Max","Sum","Mult","Maxpt","Sumpt","other"};
double binbound_JetID[100];
c1 = new TCanvas("c1"," ",1000,400);
makeMultiPanelCanvas(c1,3,1,0,0,0.18,0.16,0.03);

for(int ieta=0;ieta<Neta;ieta++){
if(ieta==0 || ieta==7 || ieta==6){
if(ieta==0) ietac=1;
if(ieta==6) ietac=3;
if(ieta==7) ietac=2;
//cout<<ieta<<endl;
for(int j=0;j<6;j++){
if(j!=5) continue;
TString svar=listsvarALL[j];
if(svar=="Max"){
int listsvar[]={0,2,4};
double ymin=1e-7,ymax=10;
double margin=8;
}

else if(svar=="Maxpt"){
int listsvar[]={6,8,10};
double ymin=1e-7,ymax=10;
double margin=3e-2;
}
else if(svar=="Sum"){
int listsvar[]={1,3,5};
double ymin=1e-7,ymax=10;
double margin=8;
}

else if(svar=="Sumpt"){
int listsvar[]={7,9,11};
double ymin=1e-7,ymax=10;
double margin=3e-2;
}

else if(svar=="Mult"){
int listsvar[]={15,16,17};
double ymin=1e-7;ymax=10;
double margin=1;
}

else if(svar=="other"){
int listsvar[]={0,12,6,14};
double ymin=1e-7,ymax=10;
double margin=3e-2;
}
else exit();

int N=sizeof(listsvar)/sizeof(int);

//for(int k=0;k<N;k++)
int ilist=listsvar[0];
TString JetIDName=JetIDNameList[ilist];
TString JetID, Unit;
if(ilist== 0)   JetID = "Max p_{T}^{charged}";
else if(ilist== 1)      JetID = "#Sigma p_{T}^{charged}";
else if(ilist== 2)      JetID = "Max p_{T}^{neutral}";
else if(ilist== 3) JetID = "#Sigma p_{T}^{neutral}";
else if(ilist== 4) JetID = "Max p_{T}^{photon}";
else if(ilist== 5) JetID = "#Sigma p_{T}^{photon}";
else if(ilist== 6)      JetID = "Max p_{T}^{charged}/p_{T}^{jet}";
else if(ilist== 7)      JetID = "#Sigma p_{T}^{charged}/p_{T}^{jet}";
else if(ilist== 8)      JetID = "Max p_{T}^{neutral}/p_{T}^{jet}";
else if(ilist== 9)      JetID = "#Sigma p_{T}^{neutral}/p_{T}^{jet}";
else if(ilist== 10)     JetID = "Max p_{T}^{photon}/p_{T}^{jet}";
else if(ilist== 11)     JetID = "#Sigma p_{T}^{photon}/p_{T}^{jet}";
else if(ilist== 12)     JetID = "(#Sigma p_{T}^{charged}+#Sigma p_{T}^{photon} +#Sigma p_{T}^{neutral}+#Sigma p_{T}^{#mu}+#Sigma p_{T}^{e})/p_{T}^{jet}";
else if(ilist== 13)     JetID = "(#Sigma p_{T}^{charged}+#Sigma p_{T}^{photon} +#Sigma p_{T}^{neutral}+#Sigma p_{T}^{#mu}+#Sigma p_{T}^{e})/p_{T}^{raw}";
else if(ilist== 14)     JetID = "Max p_{T}^{neutral}/Max(#Sigma p_{T}^{charged}, #Sigma p_{T}^{neutral})";
else if(ilist== 15)     JetID = "charged Multiplicity";
else if(ilist== 16)     JetID = "neutral Multiplicity";
else if(ilist== 17)     JetID = "photon Multiplicity";
else{   exit();}
if(JetIDName.Contains("pt") || JetIDName=="neuMaxr"){
if(ilist==12 || ilist==13){
double binbound_JetID[]={0,0.84,0.86,0.88,0.9,0.92,0.94,0.96,0.98,1.0,1.02,1.04,1.06,1.1,1.15,1.2,1.3,1.4,1.6,1.8,2.}; int Nbin_JetID=20;}
else if(ilist==6){
double binbound_JetID[]={0,0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.65,0.7,0.75,0.8,0.85,0.9,1.}; int Nbin_JetID=19;}
else{
double binbound_JetID[]={0,0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.65,0.7,0.75,0.8,0.85,0.9,0.95,1.}; int Nbin_JetID=20;}
Unit="";
}
else if(JetIDName.Contains("N")){
if(ilist==17){
double binbound_JetID[]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,20,30}; int Nbin_JetID=17;}
else if(ilist==16){
double binbound_JetID[]={0,1,2,3,4,5,6,7,8,10}; int Nbin_JetID=9;}
else if(ilist==15){
double binbound_JetID[]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,20,24,30,40}; int Nbin_JetID=22;}
Unit="";
}
else{
//double binbound_JetID[]={0,15,30,45,60,75,90,105,120,135,150,165,180,195,210,225,240,255,270,285,300};
double binbound_JetID[]={0,10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200};
int Nbin_JetID=20;
Unit="(GeV/c)";
}

if(coll=="PPb"){
TString histoname=Form("jetpt%sEtaBin%s",JetIDName.Data(),etabinnameswap[ieta].Data());
TH2F* hdata2F=(TH2F*)fDataPPbJetID->Get(histoname);
TH2F* hPPb2F=(TH2F*)fMCPPbJetID->Get(histoname);
}
if(coll=="PbP"){
TString histoname=Form("jetpt%sEtaBin%s",JetIDName.Data(),etabinname[ieta].Data());
TH2F* hdata2F=(TH2F*)fDataPbPJetIDOld->Get(histoname);
TH2F* hPPb2F=(TH2F*)fMCPbPJetID->Get(histoname);
}

TH1D* hdata = (TH1D*)hdata2F->ProjectionY("hdata",hdata2F->GetXaxis()->FindBin(xrange_pt[0]),hdata2F->GetXaxis()->FindBin(xrange_pt[1]));
TH1D* hPPb = (TH1D*)hPPb2F->ProjectionY("hPPb",hPPb2F->GetXaxis()->FindBin(xrange_pt[0]),hPPb2F->GetXaxis()->FindBin(xrange_pt[1]));

rehdata=(TH1D*)hdata->Clone("rehdata");
rehPPb=(TH1D*)hPPb->Clone("rehPPb");
rehdata=(TH1D*)hdata->Rebin(Nbin_JetID,"rehdata",binbound_JetID);
rehPPb=(TH1D*)hPPb->Rebin(Nbin_JetID,"rehPPb",binbound_JetID);
normalizeByBinWidth(rehdata);
normalizeByBinWidth(rehPPb);
rehdata->Scale(1./rehdata->Integral(rehdata->FindBin(binbound_JetID[0]),rehdata->FindBin(binbound_JetID[Nbin_JetID])));
rehPPb->Scale(1./rehPPb->Integral(rehPPb->FindBin(binbound_JetID[0]),rehPPb->FindBin(binbound_JetID[Nbin_JetID])));
rehdata->SetMarkerStyle(20);
rehdata->SetMarkerColor(1);
rehdata->SetLineColor(1);
rehdata->SetMarkerSize(1.2);
rehPPb->SetMarkerStyle(0);
rehPPb->SetFillStyle(3004);
rehPPb->SetFillColor(2);
rehPPb->SetLineColor(2);
c1->cd(ietac)->SetLogy();
TH1F* hFrame=new TH1F("","",100000,0,1000);
hFrame->GetYaxis()->SetRangeUser(ymin,ymax);
fixedFontHist(hFrame,1.2,1.5);
hFrame->GetXaxis()->SetTitleSize(0.05);
hFrame->GetXaxis()->SetLabelSize(0.05);
hFrame->GetYaxis()->SetTitleSize(0.05);
hFrame->GetYaxis()->SetLabelSize(0.05);
//if(k==0)	
hFrame->GetYaxis()->SetTitle("Event Fraction");
//else hFrame->GetYaxis()->SetTitle(""); 
hFrame->SetTitle("");
if(svar=="other")
hFrame->GetXaxis()->SetTitleSize(0.04);
hFrame->GetXaxis()->SetTitle(Form("%s %s",JetID.Data(),Unit.Data()));
hFrame->GetXaxis()->SetLimits(binbound_JetID[0]-margin,binbound_JetID[Nbin_JetID]+margin);
hFrame->DrawCopy();
//if(ilist==12 || ilist==13) 
//rehdata->GetXaxis()->SetRangeUser(0.8,1.2);
rehdata->Draw("E1same");
rehPPb->Draw("HIST E1same");
TLegend *leg1=new TLegend(0.08,0.85,0.25,0.95);
leg1->SetBorderSize(0);
leg1->SetFillColor(0);
leg1->SetTextSize(0.048);
if(coll=="PPb"){
leg1->AddEntry(rehdata,"Pb going positive Data","lpf");
leg1->AddEntry(rehPPb,"PYTHIA+HIJING","lpf");
}
else if(coll=="PbP"){
leg1->AddEntry(rehdata,"Proton going positive Data","lpf");
leg1->AddEntry(rehPPb,"HIJING+PYTHIA","lpf");
}
TLatex *T=new TLatex();
T->SetNDC();
T->SetTextAlign(12);
T->SetTextColor(1);
T->SetTextFont(42);

T->SetTextSize(0.048);
if(ietac==1)
T->DrawLatex(0.25,0.88,Form("%.f < p_{T}^{jet} < %.f (GeV/c)",xrange_pt[0],xrange_pt[1]));
if(ietac==3)
leg1->Draw("same");
T->SetTextSize(0.055);
T->DrawLatex(0.65,0.80,etastring[ieta]);
//if(k==1)
//T->DrawLatex(0.25,0.92,Form("|#eta_{CM}| < 1"));
//if(k==2)
//leg1->Draw("same");
/*c1->cd(2);
TH1D* ratio=(TH1D*)rehdata->Clone("ratio");
ratio->Divide(rehPPb);
ratio->SetMarkerStyle(20);
ratio->SetMarkerSize(1.2);
ratio->SetMarkerColor(1);
ratio->SetMinimum(0);
ratio->SetMaximum(1.9);
ratio->SetTitle("");
ratio->GetYaxis()->SetTitle("Data/MC");
ratio->Draw("E1");
TLine *l =new TLine(binbound_JetID[0],1,binbound_JetID[Nbin_JetID],1);
l->SetLineStyle(2);
l->SetLineColor(1);
l->Draw("same");
*/
}
}
}
c1->Print(Form("pic/%soverlay_%s_DataMC_etabin.png",coll.Data(),JetIDName.Data()));
c1->Print(Form("pic/%soverlay_%s_DataMC_etabin.pdf",coll.Data(),JetIDName.Data()));
}
Esempio n. 8
0
File: Draweff.C Progetto: XuQiao/HI
void Draweff(){
	int sth=0, Gth=0;
	TFile *f = TFile::Open(outG);
	if(sth==0){TString dirname = "std";}
        else if(sth==1){TString dirname ="Gri055";}
        else {TString dirname ="Gri101";}
	gStyle->SetErrorX(0);
	TString name;
        TObjString* dataname = (TObjString*)f->Get(Form("dataname"));
        TObjString* histoname = (TObjString*)f->Get(Form("histoname"));
        if(Gth==0)
                name = "G0";
        else if(Gth<nGlau)
                name = Form("Glau_%d",Gth);
        else
                name = Form("bin_%d",Gth-nGlau+1);
        TObjString* Glaubername = (TObjString*)f->Get(Form("%s/%s/Glaubername",dirname.Data(),name.Data()));
        TVectorD* xmin = (TVectorD*)f->Get(Form("%s/%s/xmin",dirname.Data(),name.Data()));
        TVectorD* xmax = (TVectorD*)f->Get(Form("%s/%s/xmax",dirname.Data(),name.Data()));
        TVectorD* mubest = (TVectorD*)f->Get(Form("%s/%s/mubest",dirname.Data(),name.Data()));
        TVectorD* kbest = (TVectorD*)f->Get(Form("%s/%s/kbest",dirname.Data(),name.Data()));
        TVectorD* Ndf = (TVectorD*)f->Get(Form("%s/%s/Ndf",dirname.Data(),name.Data()));
        TVectorD* chis = (TVectorD*)f->Get(Form("%s/%s/chis",dirname.Data(),name.Data()));
	TVectorD *kpoint = (TVectorD*)f->Get(Form("%s/%s/kpoint",dirname.Data(),name.Data()));
	TFile *fdata = TFile::Open(dataname->GetString());
	TH1D *histo_obs = (TH1D*)fdata->Get(histoname->GetString());
	histo_obs->Sumw2();
	TFile *fGlauber = TFile::Open(Glaubername->GetString());
        int binnum = histo_obs->GetNbinsX();
        double Minx = histo_obs->GetXaxis()->GetXmin();
        double Maxx = histo_obs->GetXaxis()->GetXmax();
	double binsize = (Double_t)(Maxx-Minx)/binnum;
        int xbinmin=(int)(((*xmin)[0]-Minx)/binsize);
        int xbinmax=(int)(((*xmax)[0]-Minx)/binsize);
	TH1D *histo_exp = new TH1D("histo_exp","Simulated distribution;Multiplicity;Event Fraction",binnum,Minx,Maxx);
	histo_exp->Sumw2();
	Int_t ibin;
		
	TH1D *histo_obs_norm = (TH1D*)histo_obs->Clone();
        histo_obs_norm->Scale(1/histo_obs->Integral(xbinmin,xbinmax));

	TF1 *NBD_fun = new 
	TF1("NBD_fun","[0]*TMath::Gamma(x+[1])/(TMath::Gamma(x+1)*TMath::Gamma([1]))*TMath::Power([2]/[1],x)/TMath::Power([2]/[1]+1,x+[1])",0,100);
	NBD_fun->SetParameter(0,1);	//[0]: Normalized constant
	NBD_fun->SetParameter(1,(*kbest)[0]);	//[1]: k value
	NBD_fun->SetParameter(2,(*mubest)[0]);	//[2]: mu value
		
	TTree *t = (TTree*) fGlauber->Get("nt_Pb_Pb");
	Long_t Nevent;

	Nevent = (Long_t) t->GetEntries();

	Long_t Ev;	Int_t Bino;	Double_t Para, Bi_Para, Mult;
	Float_t Ncoll;
	t->SetBranchAddress("Ncoll",&Ncoll);

	for(Ev=0; Ev<Nevent; Ev++){
		if(Ev%100000==0)	 cout<<"Have run "<<Ev<<" events"<<endl;
		t->GetEntry(Ev);
		Para = 0; //make sure that Para doesn't accumulate through loops
		for(Bino=0; Bino<Ncoll; Bino++){
                         Bi_Para = NBD_fun->GetRandom();
                         Para += Bi_Para;
		}	
		histo_exp->Fill(Para);
	}
	Double_t SumEvent, scale;
	SumEvent = histo_exp->Integral(xbinmin,xbinmax);
	scale = 1/SumEvent;
	TH1D *histo_exp_norm = (TH1D*) histo_exp->Clone();
	histo_exp_norm->Scale(scale);

	TCanvas *c1 = new TCanvas();
        gStyle->SetOptStat(kFALSE);

	double hfbin[]={0,1,2,3,4,6,8,10,13,16,20,25,30,40,55,70,90};
	int nhfbin = 16;
	rehisto_obs_norm = (TH1D*)histo_obs_norm->Rebin(nhfbin,"rehisto_obs_norm",hfbin);
	normalizeByBinWidth(rehisto_obs_norm);
	rehisto_exp_norm = (TH1D*)histo_exp_norm->Rebin(nhfbin,"rehisto_exp_norm",hfbin);
	normalizeByBinWidth(rehisto_exp_norm);
	TH1D* ratio = (TH1D*)rehisto_obs_norm->Clone("ratio");
	ratio->Divide(rehisto_exp_norm);
        ratio->SetMaximum(1.2);
        ratio->SetMinimum(0);
        ratio->GetXaxis()->SetTitle("HF #Sigma E_{T}");
       	ratio->GetYaxis()->SetTitle("ratio");
/*
Esempio n. 9
0
void overlayoneJetIDcut(){
gStyle->SetErrorX(0);
gStyle->SetOptStat(kFALSE);
int ilist=12;
int ilistw;
TString JetID, Unit;
double JetIDcut[2];
if(ilist== 6)  {    JetID = "Max p_{T}^{charged}/p_{T}^{jet}"; JetIDcut[0]=0.05; JetIDcut[1]=1; ilistw=1;}
else if(ilist== 7)  {    JetID = "#Sum p_{T}^{charged}/p_{T}^{jet}"; JetIDcut[0] = 0; JetIDcut[1]=0.6;}
else if(ilist== 8)  {   JetID = "Max p_{T}^{neutral}/p_{T}^{jet}"; JetIDcut[0] = 0;  JetIDcut[1]=0.08;}
else if(ilist== 9)  {    JetID = "#Sum p_{T}^{neutral}/p_{T}^{jet}"; JetIDcut[0] = 0; JetIDcut[1]=0.15;}
else if(ilist== 10)  {   JetID = "Max p_{T}^{photons}/p_{T}^{jet}";     JetIDcut[0] = 0; JetIDcut[1]=0.50;}
else if(ilist== 11) {    JetID = "#Sum p_{T}^{photons}/p_{T}^{jet}";     JetIDcut[0] = 0; JetIDcut[1]=0.3;}
else if(ilist== 12) {    JetID = "(#Sigma p_{T}^{charged}+#Sigma p_{T}^{photons}+#Sigma p_{T}^{neutral}+#Sigma p_{T}^{#mu}+#Sigma p_{T}^{e})/p_{T}^{jet}";JetIDcut[0]=0; JetIDcut[1]=1.01; ilistw=3;}
else if(ilist== 13) {    JetID = "(#Sigma p_{T}^{charged}+#Sigma p_{T}^{photons}+#Sigma p_{T}^{neutral}+#Sigma p_{T}^{#mu}+#Sigma p_{T}^{e})/p_{T}^{raw}"; JetIDcut[0]=0;JetIDcut[1]=1.13;}
else if(ilist== 14)   {  JetID = "Max p_{T}^{neutral} /Max(#Sigma p_{T}^{charged},#Sigma p_{T}^{neutral})";JetIDcut[0]=0;JetIDcut[1]=0.975;ilistw=2;}

if(ilist==12 || ilist==13 || ilist==14 ){
double binbound_JetID[]={0,0.2,0.4,0.6,0.7,0.8,0.84,0.86,0.88,0.9,0.92,0.94,0.96,0.98,1.0,1.02,1.04,1.06,1.1,1.15,1.2,1.3,1.4,1.6,1.8,2.};}
else{
double binbound_JetID[]={0,0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.65,0.7,0.75,0.8,0.85,0.9,0.95,1.};}
//double binbound_JetID[]={0,0.025,0.05,0.075,0.1,0.125,0.15,0.175,0.2,0.225,0.25,0.275,0.3,0.325,0.35,0.375,0.4,0.425,0.45,0.475,0.5};

int Nbin_JetID=sizeof(binbound_JetID)/sizeof(double)-1;
const int Neta=8;
const TString etabinname[Neta]={"12_22","7_12","3_7","-3_3","-7_-3","-12_-7","-22_-12","-10_10"};
const double etabin[Neta]={1.0,0.5,0.4,0.6,0.4,0.5,1,2};
const TString etastring[Neta]={"-2.2<#eta_{CM}<-1.2","-1.2<#eta_{CM}<-0.7","-0.7<#eta_{CM}<-0.3","-0.3<#eta_{CM}<0.3","0.3<#eta_{CM}<0.7","0.7<#eta_{CM}<1.2","1.2<#eta_{CM}<2.2","-1.0<#eta_{CM}<1.0"};
int ieta=7;

TString JetIDName=JetIDNameList[ilist];
TString histonameID=Form("jetpt%sEtaBin%s",JetIDName.Data(),etabinname[ieta].Data());
TH2F* hdata2F=(TH2F*)fDataPPbJetID->Get(histonameID);

const double xrange_JetID[2]={binbound_JetID[0]+1e-4,binbound_JetID[Nbin_JetID]-1e-4};
xrange_JetIDcut[0]=JetIDcut[0]+1e-4;
xrange_JetIDcut[1]=JetIDcut[1]-1e-4;

TGraphAsymmErrors *g = new TGraphAsymmErrors();
TH1D* histo1=(TH1D*)hdata2F->ProjectionX("histo1",hdata2F->GetYaxis()->FindBin(xrange_JetIDcut[0]),hdata2F->GetYaxis()->FindBin(xrange_JetIDcut[1]));
TH1D* histo2=(TH1D*)hdata2F->ProjectionX("histo2");
histo1=(TH1D*)histo1->Rebin(Nbin_pt,"histo1",binbound_pt);
histo2=(TH1D*)histo2->Rebin(Nbin_pt,"histo2",binbound_pt);
normalizeByBinWidth(histo1);
normalizeByBinWidth(histo2);
histo1->SetMarkerStyle(20);
histo1->SetMarkerSize(1.5);
histo1->SetMarkerColor(1);
histo1->SetLineColor(1);
histo2->SetMarkerStyle(24);
histo2->SetMarkerSize(1.5);
histo2->SetMarkerColor(2);
histo2->SetLineColor(2);
g=makegraph(histo1,histo2);
g->SetMarkerSize(1.5);

c1 = new TCanvas("c1","",400,700);
makeMultiPanelCanvas(c1,1,2,-0.15,0,0.22,0.16,0.03);
TLatex *T=new TLatex();
T->SetNDC();
T->SetTextAlign(12);
T->SetTextSize(0.03);
T->SetTextColor(1);
T->SetTextFont(42);
T->DrawLatex(0.22,0.98-ilistw*0.05,Form("Cut: %.2f<%s<%.2f",JetID.Data(),xrange_JetIDcut[0],xrange_JetIDcut[1]));
TH1F* hFrame=new TH1F("","",1000,0,1000);
c1->cd(1)->SetLogy();
hFrame->SetLineColor(0);
hFrame->GetXaxis()->SetRangeUser(25,600);
hFrame->GetYaxis()->SetTitle("#frac{dN}{dp_{T}}");
hFrame->GetXaxis()->SetTitle("");
hFrame->GetYaxis()->SetRangeUser(0.11,1e8);
fixedFontHist(hFrame,1.7,2.8);
hFrame->DrawCopy();
histo1->Draw("same");
histo2->Draw("same");
TLegend *leg1=new TLegend(0.65,0.72,0.85,0.85);
leg1->SetBorderSize(0);
leg1->SetFillColor(0);
leg1->SetTextSize(0.04);
leg1->AddEntry(histo2,"Before Cut","lp");
leg1->AddEntry(histo1,"After Cut","lp");
leg1->Draw("same");

c1->cd(2);
g->SetMarkerStyle(20);
g->SetMarkerColor(1);
g->SetLineColor(1);
T->SetTextSize(0.06);
hFrame->GetYaxis()->SetTitle("Cut Efficiency");
hFrame->GetYaxis()->SetRangeUser(0.82,1.025);
hFrame->GetXaxis()->SetTitle("p_{T}^{jet} (GeV/c)");
hFrame->DrawCopy();
g->Draw("Psame");
T->DrawLatex(0.5,0.25,etastring[ieta]);
TLine *l =new TLine(25,1,600,1);
l->SetLineStyle(2);
l->SetLineColor(1);
l->Draw("same");

c1->Print(Form("pic/overlay_best_JetIDcut.png"));
c1->Print(Form("pic/overlay_best_JetIDcut.pdf"));
}
Esempio n. 10
0
TGraphAsymmErrors* makeJetIDcut(int ilist, int dataType){
int ilistw;
if(ilist== 6)       {   JetID = "Max p_{T}^{charged}/p_{T}^{jet}"; JetIDcut[0]=0.05; JetIDcut[1]=1; ilistw=1;}
else if(ilist== 7)  {    JetID = "#Sum p_{T}^{charged}/p_{T}^{jet}"; JetIDcut[0] = 0; JetIDcut[1]=0.6;}
else if(ilist== 8)  {   JetID = "Max p_{T}^{neutral}/p_{T}^{jet}"; JetIDcut[0] = 0;  JetIDcut[1]=0.08;}
else if(ilist== 9)  {    JetID = "#Sum p_{T}^{neutral}/p_{T}^{jet}"; JetIDcut[0] = 0; JetIDcut[1]=0.15;}
else if(ilist== 10) {   JetID = "Max p_{T}^{photons}/p_{T}^{jet}";     JetIDcut[0] = 0; JetIDcut[1]=0.50;}
else if(ilist== 11) {    JetID = "#Sum p_{T}^{photons}/p_{T}^{jet}";     JetIDcut[0] = 0; JetIDcut[1]=0.3;}
else if(ilist== 12) {    JetID = "(#Sigma p_{T}^{charged}+#Sigma p_{T}^{photons}+#Sigma p_{T}^{neutral}+#Sigma p_{T}^{#mu}+#Sigma p_{T}^{e})/p_{T}^{jet}";JetIDcut[0]=0; JetIDcut[1]=1.01; ilistw=3;}
else if(ilist== 13) {    JetID = "(#Sigma p_{T}^{charged}+#Sigma p_{T}^{photons}+#Sigma p_{T}^{neutral}+#Sigma p_{T}^{#mu}+#Sigma p_{T}^{e})/p_{T}^{raw}"; JetIDcut[0]=0;JetIDcut[1]=1.13;}
else if(ilist== 14) {  JetID = "Max p_{T}^{neutral} /Max(#Sigma p_{T}^{charged},#Sigma p_{T}^{neutral})";JetIDcut[0]=0;JetIDcut[1]=0.975;ilistw=2;}

if(ilist==12 || ilist==13 || ilist==14 ){
double binbound_JetID[]={0,0.2,0.4,0.6,0.7,0.8,0.84,0.86,0.88,0.9,0.92,0.94,0.96,0.98,1.0,1.02,1.04,1.06,1.1,1.15,1.2,1.3,1.4,1.6,1.8,2.};}
else{
double binbound_JetID[]={0,0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.65,0.7,0.75,0.8,0.85,0.9,0.95,1.};}
//double binbound_JetID[]={0,0.025,0.05,0.075,0.1,0.125,0.15,0.175,0.2,0.225,0.25,0.275,0.3,0.325,0.35,0.375,0.4,0.425,0.45,0.475,0.5};

int Nbin_JetID=sizeof(binbound_JetID)/sizeof(double)-1;

TString JetIDName=JetIDNameList[ilist];
TString histonameIDData=Form("jetpt%s",JetIDName.Data());
TH2F* hdata2F=(TH2F*)fDataPPbJetID->Get(histonameIDData);
TH2F *hPPb2D= (TH2F*)fMCPPb->Get(Form("jetpt%s",JetIDName.Data()));
TH2F *hPPb2D_real= (TH2F*)fMCPPb->Get(Form("jetpt%s_real",JetIDName.Data()));
TH2F *hPPb2D_fake= (TH2F*)fMCPPb->Get(Form("jetpt%s_fake",JetIDName.Data()));

const double binbound_pt_coarse[]={0,30,70,150,200,600};
const int Nbin_pt_coarse=sizeof(binbound_pt_coarse)/sizeof(double)-1;
const double xrange_JetID[2]={binbound_JetID[0]+1e-4,binbound_JetID[Nbin_JetID]-1e-4};
xrange_JetIDcut[0]=JetIDcut[0]+1e-4;
xrange_JetIDcut[1]=JetIDcut[1]-1e-4;

//TH1D* hPPb_pt=hPPb2D->ProjectionX("hPPb_pt",hPPb2D->GetYaxis()->FindBin(xrange_JetID[0]),hPPb2D->GetYaxis()->FindBin(xrange_JetID[1]));
TH1D* hPPb_pt=hPPb2D->ProjectionX("hPPb_pt");
TH1D* hPPb_pt_real=hPPb2D_real->ProjectionX("hPPb_pt_real");
TH1D* hPPb_pt_fake=hPPb2D_fake->ProjectionX("hPPb_pt_fake");
TH1D* hPPb_JetIDcut_pt=hPPb2D->ProjectionX("hPPb_JetIDcut_pt",hPPb2D->GetYaxis()->FindBin(xrange_JetIDcut[0]),hPPb2D->GetYaxis()->FindBin(xrange_JetIDcut[1]));
TH1D* hPPb_JetIDcut_pt_real=hPPb2D_real->ProjectionX("hPPb_JetIDcut_pt_real",hPPb2D_real->GetYaxis()->FindBin(xrange_JetIDcut[0]),hPPb2D_real->GetYaxis()->FindBin(xrange_JetIDcut[1]));
TH1D* hPPb_JetIDcut_pt_fake=hPPb2D_fake->ProjectionX("hPPb_JetIDcut_pt_fake",hPPb2D_fake->GetYaxis()->FindBin(xrange_JetIDcut[0]),hPPb2D_fake->GetYaxis()->FindBin(xrange_JetIDcut[1]));

hPPb_JetIDcut_pt_real = (TH1D*)hPPb_JetIDcut_pt_real->Rebin(Nbin_pt,hPPb_JetIDcut_pt_real->GetName(),binbound_pt);
hPPb_JetIDcut_pt = (TH1D*)hPPb_JetIDcut_pt->Rebin(Nbin_pt,hPPb_JetIDcut_pt->GetName(),binbound_pt);
hPPb_pt_real = (TH1D*)hPPb_pt_real->Rebin(Nbin_pt,hPPb_pt_real->GetName(),binbound_pt);
hPPb_pt = (TH1D*)hPPb_pt->Rebin(Nbin_pt,hPPb_pt->GetName(),binbound_pt);

TGraphAsymmErrors *g = new TGraphAsymmErrors();
TH1D* histo1=(TH1D*)hdata2F->ProjectionX("histo1",hdata2F->GetYaxis()->FindBin(xrange_JetIDcut[0]),hdata2F->GetYaxis()->FindBin(xrange_JetIDcut[1]));
TH1D* histo2=(TH1D*)hdata2F->ProjectionX("histo2");
histo1=(TH1D*)histo1->Rebin(Nbin_pt,"histo1",binbound_pt);
histo2=(TH1D*)histo2->Rebin(Nbin_pt,"histo2",binbound_pt);
normalizeByBinWidth(histo1);
normalizeByBinWidth(histo2);
g=makegraph(histo1,histo2);
g->SetMarkerSize(1.5);

TGraphAsymmErrors *gfake = new TGraphAsymmErrors();
TGraphAsymmErrors *greal = new TGraphAsymmErrors();
TGraphAsymmErrors *ginc = new TGraphAsymmErrors();
TH1D* ratio_hPPb_JetIDcutvsnocut_pt=(TH1D*)hPPb_JetIDcut_pt->Clone("ratio_hPPb_JetIDcut_ptcutvsnocut_pt");
ginc=makegraph(ratio_hPPb_JetIDcutvsnocut_pt,hPPb_pt);
ginc->SetMarkerSize(1.5);

/*TH1D* ratio_hPPb_JetIDcutvsnocut_pt_fake=(TH1D*)hPPb_JetIDcut_pt_fake->Clone("ratio_hPPb_JetIDcutvsnocut_pt_fake");
TH1D* cl_hPPb_pt_fake=(TH1D*)hPPb_pt_fake->Clone("cl_hPPb_pt_fake");
cl_hPPb_pt_fake=(TH1D*)cl_hPPb_pt_fake->Rebin(Nbin_pt_coarse,"cl_hPPb_pt_fake",binbound_pt_coarse);
ratio_hPPb_JetIDcutvsnocut_pt_fake=(TH1D*)ratio_hPPb_JetIDcutvsnocut_pt_fake->Rebin(Nbin_pt_coarse,"ratio_hPPb_JetIDcutvsnocut_pt_fake",binbound_pt_coarse);
normalizeByBinWidth(ratio_hPPb_JetIDcutvsnocut_pt_fake);
normalizeByBinWidth(cl_hPPb_pt_fake);
gfake=makegraph(ratio_hPPb_JetIDcutvsnocut_pt_fake,cl_hPPb_pt_fake);
gfake->SetMarkerSize(1.5);
gfake->SetMarkerStyle(20);
gfake->SetMarkerColor(2);
gfake->SetLineColor(2);

TH1D* ratio_hPPb_JetIDcutvsnocut_pt_real=(TH1D*)hPPb_JetIDcut_pt_real->Clone("ratio_hPPb_JetIDcutvsnocut_pt_real");
greal=makegraph(ratio_hPPb_JetIDcutvsnocut_pt_real,hPPb_pt_real);
greal->SetMarkerSize(1.5);
greal->SetMarkerStyle(29);
greal->SetMarkerColor(4);
greal->SetLineColor(4);
*/
T->SetNDC();
T->SetTextAlign(12);
T->SetTextSize(0.03);
T->SetTextColor(1);
T->SetTextFont(42);
if(ilistw==2){
if(dataType==1) T->DrawLatex(0.22,0.98-ilistw*0.05,Form("Cut %d: %.2f<%s<%.3f",ilistw,JetID.Data(),xrange_JetIDcut[0],xrange_JetIDcut[1]));}
else{
if(dataType==1) T->DrawLatex(0.22,0.98-ilistw*0.05,Form("Cut %d: %.2f<%s<%.2f",ilistw,JetID.Data(),xrange_JetIDcut[0],xrange_JetIDcut[1]));}

if(dataType==1) return g;
else return ginc;
}
Esempio n. 11
0
void ComparePPPPbData(){
gStyle->SetOptStat(kFALSE);
gStyle->SetErrorX(0);

//double binbound_pt[]={30,40,50,60,70,80,90,100,110,120,140,160,180,200,220,260,300,350,500};
//const double binbound_pt[]={0,5,10,15,20,30,45,60,75,90,105,120,140,160,180,200,220,260,300,400,600,1000};
const double binbound_pt[]={ 3, 4, 5, 7, 9, 12, 15, 18, 22, 27, 33, 39, 47, 55, 64,74, 84, 97, 114, 133, 153, 174, 196, 220, 245, 272, 300, 362, 429, 692, 1000};
int Nbin_pt=sizeof(binbound_pt)/sizeof(double)-1;


TString filename1="MCPPbNoGplus_ak3PFDiJetMassJetNoResidualPt30GenChargeTrkEffHIN12017v5TrkCorr2DCut0EtaBin7_HFsumEta4Bin1_merged.root";
TString filename2="MCPPNoGplus_ak3PFDiJetMassJetNoResidualPt30GenChargeTrkEffHIN12017v5TrkCorr2DCut0EtaBin7_HFsumEta4Bin1_merged.root";

TString dir1="~/CMSSW_6_2_3_patch1/src/jetRpA/RpA/output/JetTrig/JetID/ak3PF/NoResidual/NoGplusNewpthat";
TString dir2="~/CMSSW_6_2_3_patch1/src/jetRpA/RpA/output/JetTrig/JetID/ak3PF/NoResidual/NoGplusNewpthat";

TString histoname="jetpt_0-100%";
TString histoname1="jetptEta_0-100%";
//TString histoname1=Form("jetpt%s_0-100%%",JetIDName.Data());

TFile *file1=TFile::Open(Form("%s/%s",dir1.Data(),filename1.Data()));
TFile *file2=TFile::Open(Form("%s/%s",dir2.Data(),filename2.Data()));

TH2F* histo12F=(TH2F*)file1->Get(histoname1);
TH2F* histo22F=(TH2F*)file2->Get(histoname1);
//TH1D* histo1=(TH1D*)histo12F->ProjectionY("histo1",histo12F->GetXaxis()->FindBin(binbound_pt[5]),histo12F->GetXaxis()->FindBin(binbound_pt[Nbin_pt]),"e");
//TH1D* histo2=(TH1D*)histo22F->ProjectionY("histo2",histo22F->GetXaxis()->FindBin(binbound_pt[5]),histo22F->GetXaxis()->FindBin(binbound_pt[Nbin_pt]),"e");
TH1D* histo1=(TH1D*)histo12F->ProjectionX("histo1");
TH1D* histo2=(TH1D*)histo22F->ProjectionX("histo2");

TH1D* histo1=(TH1D*)file1->Get(histoname);
TH1D* histo2=(TH1D*)file2->Get(histoname);

rehisto1=(TH1D*)histo1->Clone("rehisto1");
rehisto2=(TH1D*)histo2->Clone("rehisto2");
rehisto1=(TH1D*)rehisto1->Rebin(Nbin_pt,"rehisto1",binbound_pt);
rehisto2=(TH1D*)rehisto2->Rebin(Nbin_pt,"rehisto2",binbound_pt);
normalizeByBinWidth(rehisto1);
normalizeByBinWidth(rehisto2);
//rehisto1->Scale(1/rehisto1->Integral());
//rehisto2->Scale(1/rehisto2->Integral());
rehisto1->SetMarkerStyle(24);
rehisto1->SetMarkerSize(1.2);
rehisto1->SetMarkerColor(1);
rehisto2->SetMarkerStyle(20);
rehisto2->SetMarkerSize(1.2);
rehisto2->SetMarkerColor(2);

c1 = new TCanvas("c1"," ",500,800);
makeMultiPanelCanvas(c1,1,2,-0.08,0,0.14,0.16,0.03);

TH1F* hFrame=new TH1F("","",1000,0,1000);
fixedFontHist(hFrame,2,2.2);
hFrame->SetTitle("");
hFrame->GetXaxis()->SetTitle("");
hFrame->GetYaxis()->SetTitle("Event Probability");
hFrame->GetXaxis()->SetLimits(30,600);
hFrame->GetYaxis()->SetRangeUser(1.01e-10,1e-1);
c1->cd(1)->SetLogy();
hFrame->DrawCopy();
rehisto1->Draw("E1same");
rehisto2->Draw("E1same");
TLegend *leg1=new TLegend(0.60,0.75,0.85,0.90);
leg1->SetBorderSize(0);
leg1->SetFillColor(0);
leg1->SetTextSize(0.05);
leg1->AddEntry(rehisto1,"PYTHIA+HIJING","lp");
leg1->AddEntry(rehisto2,"PYTHIA","lp");
leg1->Draw("same");
c1->cd(2);
TLatex *T1=new TLatex(0.5,0.92,"|#eta|<1");
T1->SetNDC();
T1->SetTextAlign(12);
T1->SetTextSize(0.05);
T1->SetTextColor(1);
T1->SetTextFont(42);
TH1D* ratio=(TH1D*)rehisto2->Clone("ratio");
hFrame->GetXaxis()->SetTitle("p_{T}^{jet} (GeV/c)");
hFrame->GetYaxis()->SetTitle("Ratio: PYTHIA+HIJING/PYTHIA");
hFrame->GetYaxis()->SetRangeUser(0.6,1.39);
hFrame->DrawCopy();
ratio->Divide(rehisto1);
ratio->SetMarkerStyle(20);
ratio->SetMarkerSize(1.2);
ratio->SetMarkerColor(1);
ratio->SetTitle("");
ratio->Draw("E1same");
TLine *l =new TLine(30,1,600,1);
l->SetLineStyle(2);
l->SetLineColor(1);
l->Draw("same");
T1->Draw("same");
c1->Print("PPPPbCompare.png");
}
Esempio n. 12
0
void overlayJetIDcut(){
gStyle->SetOptStat(kFALSE);
gStyle->SetErrorX(0);
const int Npoint=1000;
TString JetIDNameList[18]={"chMax", "chSum", "neuMax", "neuSum", "phoMax", "phoSum", "chMaxpt", "chSumpt", "neuMaxpt", "neuSumpt", "phoMaxpt", "phoSumpt","SumSumpt","SumSumrawpt","neuMaxr","chN","neuN","phoN"};
const double binbound_pt[]={ 3, 4, 5, 7, 9, 12, 15, 18, 22, 27, 33, 39, 47, 55, 64,74, 84, 97, 114, 133, 153, 174, 196, 220, 245, 272, 300, 429, 692, 1000};
double binbound_JetID[];
int Nbin_pt=sizeof(binbound_pt)/sizeof(double)-1;
double xrange_pt[2]={30+1e-4,600-1e-4};
TString JetID;

int ilist=14;
TString JetIDName = JetIDNameList[ilist];

double cut;
if(ilist== 6){      JetID = "chargedMax/p_{T}";	cut=0.3;}
else if(ilist== 7){      JetID = "chargedSum/p_{T}";	cut=0.6;}
else if(ilist== 8){     JetID = "neutralMax/p_{T}";	cut=0.08;}
else if(ilist== 9){     JetID = "neutralSum/p_{T}";	cut=0.15;}
//else if(ilist== 10){     JetID = "photonMax/p_{T}";	}
else if(ilist== 11){     JetID = "photonSum/p_{T}";	cut=0.3;}
else if(ilist== 12){     JetID = "(#Sigma h^{#pm}+#Sigma #gamma +#Sigma h^{0}+#Sigma #mu+#Sigma e)/p_{T}^{jet}";cut =1.01;}
else if(ilist== 13){     JetID = "(#Sigma h^{#pm}+#Sigma #gamma +#Sigma h^{0}+#Sigma #mu+#Sigma e)/p_{T}^{raw}";cut =1.13;}
else if(ilist== 14){     JetID = "neutralMax/Max(neutralSum,chargedSum)";cut =0.975;}
else{   exit();}

if(ilist==12 || ilist==13 || ilist==14 ){
double binbound_JetID[]={0,0.2,0.4,0.6,0.7,0.8,0.84,0.86,0.88,0.9,0.92,0.94,0.96,0.98,1.0,1.02,1.04,1.06,1.1,1.15,1.2,1.3,1.4,1.6,1.8,2.};}
else{
double binbound_JetID[]={0,0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.65,0.7,0.75,0.8,0.85,0.9,0.95,1.};}


//double binbound_JetID[]={0,0.025,0.05,0.075,0.1,0.125,0.15,0.175,0.2,0.225,0.25,0.275,0.3,0.325,0.35,0.375,0.4,0.425,0.45,0.475,0.5};


int Nbin_JetID=sizeof(binbound_JetID)/sizeof(double)-1;

TString filename="/scratch/xuq7/RpA/TreeAna/Datacombined.root";

TString histoname=Form("jetpt%sCombinedSpectra",JetIDName.Data());
//TString histoname=Form("jetptEtaCombinedSpectra");

TFile *file=TFile::Open(filename);

TH2F* histo2F=(TH2F*)file->Get(histoname);
TH1D* histo1=(TH1D*)histo2F->ProjectionX("histo1",histo2F->GetYaxis()->FindBin(binbound_JetID[0]),histo2F->GetYaxis()->FindBin(cut));
//TH1D* histo1=(TH1D*)histo2F->ProjectionX("histo1");
TH1D* histo2=(TH1D*)histo2F->ProjectionX("histo2");
histo1=(TH1D*)histo1->Rebin(Nbin_pt,"histo1",binbound_pt);
histo2=(TH1D*)histo2->Rebin(Nbin_pt,"histo2",binbound_pt);
normalizeByBinWidth(histo1);
normalizeByBinWidth(histo2);
histo1->SetMarkerStyle(24);
histo1->SetMarkerSize(1.4);
histo1->SetMarkerColor(1);
histo1->GetYaxis()->SetTitle("Number of Events");
histo2->SetMarkerStyle(20);
histo2->SetMarkerSize(1.2);
histo2->SetMarkerColor(2);
fixedFontHist(histo1,1.8,2.0);
fixedFontHist(histo2,1.8,2.0);
cout<<histo1->GetBinCenter(9)<<'\t'<<histo1->GetBinContent(9)<<endl;
TGraphAsymmErrors *g;
TGraphAsymmErrors *g0;
double x[Npoint],y[Npoint],xerrlow[Npoint],xerrhigh[Npoint],yerrlow[Npoint],yerrhigh[Npoint];

TH1F* hFrame=new TH1F("","",1000,0,1000);
c1 = new TCanvas("c1","",600,1000);
makeMultiPanelCanvas(c1,1,2,0.03,0.03,0.1,0.12,0.03);
c1->cd(1)->SetLogy();
fixedFontHist(hFrame,1.2,1.4);
hFrame->SetTitle("");
hFrame->GetXaxis()->SetTitle("");
hFrame->GetYaxis()->SetTitle("Number of Events");
hFrame->GetXaxis()->SetLimits(25,600);
hFrame->GetYaxis()->SetRangeUser(2e-1,5e7);
hFrame->DrawCopy();

histo1->Draw("E1same");
histo2->Draw("E1same");
TLegend *leg1=new TLegend(0.60,0.75,0.85,0.90);
leg1->SetBorderSize(0);
leg1->SetFillColor(0);
leg1->SetTextSize(0.06);
leg1->AddEntry(histo1,"After cut","lp");
leg1->AddEntry(histo2,"Before cut","lp");
leg1->Draw("same");
TLatex *T=new TLatex(0.25,0.30,Form("Cut: %s<%.2f",JetID.Data(),cut));
T->SetNDC();
T->SetTextAlign(12);
T->SetTextSize(0.04);
T->SetTextColor(1);
T->SetTextFont(42);

c1->cd(2);
TH1D* ratio=(TH1D*)histo1->Clone("ratio");
hFrame->GetXaxis()->SetTitle("p_{T}^{jet} (GeV/c)");
hFrame->GetYaxis()->SetTitle("Ratio: After cut/Before cut");
hFrame->GetYaxis()->SetRangeUser(0.7,1.09);
hFrame->DrawCopy();
ratio->Divide(histo2);
ratio->SetMarkerStyle(20);
ratio->SetMarkerSize(1.4);
ratio->SetMarkerColor(1);
ratio->SetMinimum(ratio->GetMinimum()/1.2);
ratio->SetMaximum(1.09);
ratio->SetTitle("");
//ratio->Draw("E1");

g=new TGraphAsymmErrors();
g->BayesDivide(histo1,histo2);
for(int ipoint=0;ipoint<g->GetN();ipoint++){
x[ipoint]=g->GetX()[ipoint];
y[ipoint]=g->GetY()[ipoint];
yerrhigh[ipoint]=g->GetErrorYhigh(ipoint);
yerrlow[ipoint]=g->GetErrorYlow(ipoint);
xerrhigh[ipoint]=0;
xerrlow[ipoint]=0;
}
g0=new TGraphAsymmErrors(g->GetN(),x,y,xerrlow,xerrhigh,yerrlow,yerrhigh);
g0->SetMarkerColor(1);
g0->SetMarkerStyle(20);
g0->SetMarkerSize(1.2);
g0->SetLineColor(1);
g0->Draw("Psame");
TLine *l =new TLine(30,1,600,1);
l->SetLineStyle(2);
l->SetLineColor(1);
l->Draw("same");
T->Draw("same");

c1->Print(Form("/home/xuq7/CMSSW_6_2_3_patch1/src/jetRpA/RpA/Quality/NoGplusNewpthat/newSample/pic/JetIDcut/akPu3PF/%s/overlay_JetIDcut.png",JetIDName.Data()));
}
Esempio n. 13
0
void CompareOldNew() {
    gStyle->SetOptStat(kFALSE);
    gStyle->SetErrorX(0);

    TString histoname="jetptEtaBin-10_10";
    TString histoname1="jetpt";
    TString histoname2F="jetptEta";
    TFile *fMCPPbYX = new TFile("/home/xuq/Documents/HI/RpA/output/TreeAna/MCPPbakPu3PFJetSpectraCombineTriggerJetPtNoJetIDCutNoResidualTrkCorrFile0_8.root");
    TFile *fDataPPbYX = new TFile("/home/xuq/Documents/HI/RpA/output/TreeAna/DATAPPbakPu3PFJetSpectraCombineTriggerJetPtNoJetIDCutNoResidualTrkCorrFile0_0.root");

    TH2F* histo12F=(TH2F*)fMCPPb->Get(histoname2F);
    TH2F* histo22F=(TH2F*)fMCPPbYX->Get(histoname2F);
//TH1D* histo1=(TH1D*)histo12F->ProjectionY("histo1",histo12F->GetXaxis()->FindBin(binbound_pt[5]),histo12F->GetXaxis()->FindBin(binbound_pt[Nbin_pt]),"e");
//TH1D* histo2=(TH1D*)histo22F->ProjectionY("histo2",histo22F->GetXaxis()->FindBin(binbound_pt[5]),histo22F->GetXaxis()->FindBin(binbound_pt[Nbin_pt]),"e");
//TH1D* histo1=(TH1D*)histo12F->ProjectionX("histo1");
//TH1D* histo2=(TH1D*)histo22F->ProjectionX("histo2");

    TH1D* histo1=(TH1D*)fDataPPb->Get(histoname1);
    TH1D* histo2=(TH1D*)fDataPPbYX->Get(histoname);

    histo1=(TH1D*)histo1->Rebin(Nbin_pt,"histo1",binbound_pt);
    histo2=(TH1D*)histo2->Rebin(Nbin_pt,"histo2",binbound_pt);
    normalizeByBinWidth(histo1);
    normalizeByBinWidth(histo2);
//histo1->Scale(1/histo1->Integral());
//histo2->Scale(1/histo2->Integral());
    histo1->SetMarkerStyle(24);
    histo1->SetMarkerSize(1.2);
    histo1->SetMarkerColor(1);
    histo2->SetMarkerStyle(20);
    histo2->SetMarkerSize(1.2);
    histo2->SetMarkerColor(2);

    c1 = new TCanvas("c1"," ",500,800);
    makeMultiPanelCanvas(c1,1,2,-0.14,0,0.2,0.14,0.03);
    TLatex *T1 = new TLatex();
    T1->SetNDC();
    T1->SetTextAlign(12);
    T1->SetTextSize(0.05);
    T1->SetTextColor(1);
    T1->SetTextFont(42);
    TH1F* hFrame=new TH1F("","",20000,-1000,1000);
    fixedFontHist(hFrame,2,3.1);
    hFrame->SetTitle("");
    hFrame->GetXaxis()->SetTitle("");
    hFrame->GetYaxis()->SetTitle("#frac{d^{2}#sigma}{dp_{T}d#eta}");
    hFrame->GetXaxis()->SetLimits(0,1000);
//hFrame->GetYaxis()->SetRangeUser(1.01e-11,1e-1);
    hFrame->GetYaxis()->SetRangeUser(1.01e-1,1e6);
    c1->cd(1)->SetLogy();
    hFrame->DrawCopy();
    histo1->Draw("E1same");
    histo2->Draw("E1same");
    TLegend *leg1=new TLegend(0.70,0.75,0.9,0.90);
    leg1->SetBorderSize(0);
    leg1->SetFillColor(0);
    leg1->SetTextSize(0.06);
    leg1->AddEntry(histo1,"New","lp");
    leg1->AddEntry(histo2,"Old","lp");
    leg1->Draw("same");
    T1->Draw("same");
    for(int ibin=0; ibin<histo1->GetNbinsX(); ibin++)
        if(histo1->GetBinContent(ibin)!=0)
            cout<<(histo1->GetBinContent(ibin)-histo2->GetBinContent(ibin))/histo1->GetBinContent(ibin)<<endl;
    c1->cd(2);
    TLatex *T1=new TLatex(0.5,0.92,"|#eta|<1");
    T1->SetNDC();
    T1->SetTextAlign(12);
    T1->SetTextSize(0.05);
    T1->SetTextColor(1);
    T1->SetTextFont(42);
    TH1D* ratio=(TH1D*)histo2->Clone("ratio");
    hFrame->GetXaxis()->SetTitle("p_{T}^{jet} (GeV/c)");
    hFrame->GetYaxis()->SetTitle("Ratio: New/Old");
    hFrame->GetYaxis()->SetRangeUser(0.6,1.39);
    hFrame->DrawCopy();
    ratio->Divide(histo1);
    ratio->SetMarkerStyle(20);
    ratio->SetMarkerSize(1.2);
    ratio->SetMarkerColor(1);
    ratio->SetTitle("");
    ratio->Draw("E1same");
    TLine *l =new TLine(30,1,600,1);
    l->SetLineStyle(2);
    l->SetLineColor(1);
    l->Draw("same");
    T1->Draw("same");
}
Esempio n. 14
0
void CombineSpectra_minbias()
{

   gROOT->Reset();
   gROOT->ProcessLine(".x rootlogonChristof.C");
   gROOT->ForceStyle();
   gStyle->SetPalette(1);
   gStyle->SetTitleYOffset(1.30);
   gStyle->SetPadRightMargin(0.16);

   bool doSave = true;
   TFile * f_output = new TFile("CombineSpectra_minbias.root","recreate");

   // Define the input file and HiForest
   char *infName_1 = "root://eoscms//eos/cms/store/group/phys_heavyions/yjlee/pPb2013/promptReco/PA2013_HiForest_PromptReco_HLT_SingleTrack_JSonPPb_forestv84.root";
//   char *infName_2 = "root://eoscms//eos/cms/store/group/phys_heavyions/kjung/MinBiasUPCForest_v71/MergedForest_withCones_MinBiasUPC_v71_2.root";
   HiForest *c_minbias_1 = new HiForest(infName_1,"",cPPb);
//   HiForest *c_minbias_2 = new HiForest(infName_2,"",cPPb);
//   c_minbias_1->doTrackCorrections=1;
//   c_minbias_1->InitTree();

   std::vector<Double_t> ptBins;
   const Double_t small = 1e-3;
   Double_t pt;
   for(pt =   0.  ; pt <   48.-small; pt +=  2./2.) ptBins.push_back(pt);
   for(pt =   48.; pt <   60.-small; pt +=  4./2. ) ptBins.push_back(pt); 
   for(pt =   60.; pt <   76.-small; pt +=  8./2. ) ptBins.push_back(pt); 
   for(pt =   76.; pt <   140.-small; pt +=  16./2. ) ptBins.push_back(pt); 
   for(pt =   140.; pt <   364.-small; pt +=  32./2. ) ptBins.push_back(pt); 
   ptBins.push_back(364.0);

   std::vector<Double_t> ptBins_smaller;
   Double_t pt_smaller;
   for(pt_smaller = 0.2; pt_smaller < 20.0-small; pt_smaller += 0.1 ) ptBins_smaller.push_back(pt_smaller);
   for(pt_smaller = 20.0; pt_smaller < 40.0-small; pt_smaller += 0.2 ) ptBins_smaller.push_back(pt_smaller);
   for(pt_smaller = 40.0; pt_smaller < 103.6-small; pt_smaller += 0.4 ) ptBins_smaller.push_back(pt_smaller);
   ptBins_smaller.push_back(103.6);

/*
   std::vector<Double_t> ptBins_part;
   Double_t pt_part;
   for(pt_part =   0.2  ; pt_part <   1.2-small; pt_part +=  0.05) ptBins_part.push_back(pt_part);
   for(pt_part =   1.2; pt_part <   2.4-small; pt_part +=  0.1 ) ptBins_part.push_back(pt_part); //12 bins
   for(pt_part =   2.4; pt_part <   7.2-small; pt_part +=  0.4 ) ptBins_part.push_back(pt_part); //12 bins
   for(pt_part =   7.2; pt_part <  16.8-small; pt_part +=  1.6 ) ptBins_part.push_back(pt_part);//it was 3.2
   for(pt_part =  16.8; pt_part <  30.0-small; pt_part +=  6.6 ) ptBins_part.push_back(pt_part);
   for(pt_part =  30.0; pt_part <  100.0-small; pt_part +=  17.5 ) ptBins_part.push_back(pt_part);
   for(pt_part =  100.0; pt_part <  300.0-small; pt_part += 25. ) ptBins_part.push_back(pt_part);
   ptBins_part.push_back(300.0);
*/
   //orig
//   Int_t NumOfPtBins_part = 34;
//   double ptBins_part[] = {0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 3.2, 4.0, 4.8, 5.6, 6.4, 7.2, 9.6, 12.0, 14.4, 19.2, 24.0, 28.8, 35.2, 41.6, 48.0, 60.8, 73.6, 86.4, 103.6};//, 120.8, 138., 155.2, 172.4};
   Int_t NumOfPtBins_part = 40;
   double ptBins_part[] = {0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 3.2, 4.0, 4.8, 5.6, 6.4, 7.2, 9.6, 12.0, 14.4, 19.2, 24.0, 28.8, 35.2, 41.6, 48.0, 60.8, 73.6, 86.4, 103.6, 120.8, 138., 155.2, 172.4, 189.6, 206.8};

   TTree * t = new TTree("t","whatever");
   JetData data(t,1);

   TH1D * hPartPt_minbias = new TH1D("hPartPt_minbias","hPartPt_minbias",NumOfPtBins_part-1,&ptBins_part[0]);
   TH1D * hPartPt_minbias_trkCorr = new TH1D("hPartPt_minbias_trkCorr","hPartPt_minbias_trkCorr",NumOfPtBins_part-1,&ptBins_part[0]);
   TH1D * hPartPt_minbias_trkCorr_trigCorr = new TH1D("hPartPt_minbias_trkCorr_trigCorr","hPartPt_minbias_trkCorr_trigCorr",NumOfPtBins_part-1,&ptBins_part[0]);
   TH1D * hPartPt_minbias_trkCorr_trigCorr_smallerBins = new TH1D("hPartPt_minbias_trkCorr_trigCorr_smallerBins","hPartPt_minbias_trkCorr_trigCorr_smallerBins",ptBins_smaller.size()-1,&ptBins_smaller[0]);
   TH1D * hPartPt_0_14_minbias = new TH1D("hPartPt_0_14_minbias","hPartPt_0_14_minbias",NumOfPtBins_part-1,&ptBins_part[0]);
   TH1D * hPartPt_0_14_minbias_trkCorr = new TH1D("hPartPt_0_14_minbias_trkCorr","hPartPt_0_14_minbias_trkCorr",NumOfPtBins_part-1,&ptBins_part[0]);
   TH1D * hPartPt_0_14_minbias_trkCorr_trigCorr = new TH1D("hPartPt_0_14_minbias_trkCorr_trigCorr","hPartPt_0_14_minbias_trkCorr_trigCorr",NumOfPtBins_part-1,&ptBins_part[0]);
   TH1D * hNumEv_minbias = new TH1D("hNumEv_minbias","hNumEv_minbias",1,0.,1.);
   TH1D * hNumEv_minbias_trigCorr = new TH1D("hNumEv_minbias_trigCorr","hNumEv_minbias_trigCorr",1,0.,1.);
   TH1D * hNumEv_0_14_minbias = new TH1D("hNumEv_0_14_minbias","hNumEv_0_14_minbias",1,0.,1.);
   TH1D * hNumEv_0_14_minbias_trigCorr = new TH1D("hNumEv_0_14_minbias_trigCorr","hNumEv_0_14_minbias_trigCorr",1,0.,1.);
   TH1D * hNumEv_14_22_minbias = new TH1D("hNumEv_14_22_minbias","hNumEv_14_22_minbias",1,0.,1.);
   TH1D * hNumEv_14_22_minbias_trigCorr = new TH1D("hNumEv_14_22_minbias_trigCorr","hNumEv_14_22_minbias_trigCorr",1,0.,1.);
   TH1D * hNumEv_22_32_minbias = new TH1D("hNumEv_22_32_minbias","hNumEv_22_32_minbias",1,0.,1.);
   TH1D * hNumEv_22_32_minbias_trigCorr = new TH1D("hNumEv_22_32_minbias_trigCorr","hNumEv_22_32_minbias_trigCorr",1,0.,1.);
   TH1D * hNumEv_32_X_minbias = new TH1D("hNumEv_32_X_minbias","hNumEv_32_X_minbias",1,0.,1.);

   TH1D * hRecMultiplicity = new TH1D("hRecMultiplicity","hRecMultiplicity",300.,0.,300.);

   hPartPt_minbias->Sumw2();
   hPartPt_minbias_trkCorr->Sumw2();
   hPartPt_minbias_trkCorr_trigCorr->Sumw2();
   hPartPt_minbias_trkCorr_trigCorr_smallerBins->Sumw2();
   hPartPt_0_14_minbias->Sumw2();
   hPartPt_0_14_minbias_trkCorr->Sumw2();
   hPartPt_0_14_minbias_trkCorr_trigCorr->Sumw2();

   hRecMultiplicity->Sumw2();

   int numev_minbias = 0;
   float numev_minbias_trigCorr = 0;
   int numev_0_14_minbias = 0;
   float numev_0_14_minbias_trigCorr = 0;
   int numev_14_22_minbias = 0;
   float numev_14_22_minbias_trigCorr = 0;
   int numev_22_32_minbias = 0;
   float numev_22_32_minbias_trigCorr = 0;
   int numev_32_X_minbias = 0;

   fillHistograms(c_minbias_1, data, numev_minbias, numev_minbias_trigCorr, numev_0_14_minbias, numev_0_14_minbias_trigCorr, numev_14_22_minbias, numev_14_22_minbias_trigCorr, numev_22_32_minbias, numev_22_32_minbias_trigCorr, numev_32_X_minbias, hPartPt_minbias, hPartPt_minbias_trkCorr, hPartPt_minbias_trkCorr_trigCorr, hPartPt_minbias_trkCorr_trigCorr_smallerBins, hPartPt_0_14_minbias, hPartPt_0_14_minbias_trkCorr, hPartPt_0_14_minbias_trkCorr_trigCorr,hRecMultiplicity);
//   fillHistograms(c_minbias_2, data, numev_minbias, numev_minbias_trigCorr, numev_0_14_minbias, numev_0_14_minbias_trigCorr, numev_14_22_minbias, numev_14_22_minbias_trigCorr, numev_22_32_minbias, numev_22_32_minbias_trigCorr, numev_32_X_minbias, hPartPt_minbias, hPartPt_minbias_trkCorr, hPartPt_minbias_trkCorr_trigCorr, hPartPt_minbias_trkCorr_trigCorr_smallerBins, hPartPt_0_14_minbias, hPartPt_0_14_minbias_trkCorr, hPartPt_0_14_minbias_trkCorr_trigCorr,hRecMultiplicity);

   hNumEv_minbias->SetBinContent(1,numev_minbias);
   hNumEv_minbias_trigCorr->SetBinContent(1,numev_minbias_trigCorr);
   hNumEv_0_14_minbias->SetBinContent(1,numev_0_14_minbias);
   hNumEv_0_14_minbias_trigCorr->SetBinContent(1,numev_0_14_minbias_trigCorr);
   hNumEv_14_22_minbias->SetBinContent(1,numev_14_22_minbias);
   hNumEv_14_22_minbias_trigCorr->SetBinContent(1,numev_14_22_minbias_trigCorr);
   hNumEv_22_32_minbias->SetBinContent(1,numev_22_32_minbias);
   hNumEv_22_32_minbias_trigCorr->SetBinContent(1,numev_22_32_minbias_trigCorr);
   hNumEv_32_X_minbias->SetBinContent(1,numev_32_X_minbias);
   normalizeByBinWidth(hPartPt_minbias);
   normalizeByBinWidth(hPartPt_minbias_trkCorr);
   normalizeByBinWidth(hPartPt_minbias_trkCorr_trigCorr);
   normalizeByBinWidth(hPartPt_minbias_trkCorr_trigCorr_smallerBins);
   normalizeByBinWidth(hPartPt_0_14_minbias);
   normalizeByBinWidth(hPartPt_0_14_minbias_trkCorr);
   normalizeByBinWidth(hPartPt_0_14_minbias_trkCorr_trigCorr);

   f_output->cd();
   hPartPt_minbias->Write();
   hPartPt_minbias_trkCorr->Write();
   hPartPt_minbias_trkCorr_trigCorr->Write();
   hPartPt_minbias_trkCorr_trigCorr_smallerBins->Write();
   hPartPt_0_14_minbias->Write();
   hPartPt_0_14_minbias_trkCorr->Write();
   hPartPt_0_14_minbias_trkCorr_trigCorr->Write();
   hNumEv_minbias->Write();
   hNumEv_minbias_trigCorr->Write();
   hNumEv_0_14_minbias->Write();
   hNumEv_0_14_minbias_trigCorr->Write();
   hNumEv_14_22_minbias->Write();
   hNumEv_14_22_minbias_trigCorr->Write();
   hNumEv_22_32_minbias->Write();
   hNumEv_22_32_minbias_trigCorr->Write();
   hNumEv_32_X_minbias->Write();
   hRecMultiplicity->Write();
   f_output->Close();
}
Esempio n. 15
0
void DrawEffHF(){
gStyle->SetOptStat(kFALSE);
gStyle->SetErrorX(0);
const int Ncut=5;	const int Nhist=3;	const int NGen=2; const int Ncent=6;
const double HFbin[]={0,0.1,0.2,0.4,0.6,0.8,1,2,4,6,9,12,15,20,30,50,75,100};
const double xerr[Ncent]={0,0,0,0,0,0};
const double HFbin_cent[Nhist][Ncent+1]={
{0,2.92,10.1,19.3,23.7,30.2,100},
{0,1.03,5.00,11.6,15.0,20.3,100},
{0,2.7,12.6,28.6,36.9,49.6,100}};
const double cent[Ncent]={5,15,25,45,75,95};
const int nHFbin=sizeof(HFbin)/sizeof(double)-1;
double color[NGen][Nhist]={{2,1,4},{2,1,4}};
double Style[NGen][Nhist]={{20,24,28},{20,24,28}};
//TString cut[Ncut]={"HLT","CutGplus","pPA","pprim","vz",""};
//TString cutName[Ncut]={"HLT","CutG","clean","pprim","vz","All cuts"};
TString cut[Ncut]={"HLT","HLT_CutGplus","HLT_CutGplus_pPA","HLT_CutGplus_pPA_pprim",""};
TString cutName[Ncut]={"HLT","HLT+CutGplus","HLT+CutGplus+clean","HLT+CutG+clean+pprim","All cuts"};
TString Gen[NGen]={"Hijing","Epos"};
TString histoname[Nhist]={"hHFEnergy4","hHFEnergyPlus4","hHFEnergyPlus"};
TString etarange[Nhist]={"HF E_{T} |#eta|>4","HF E_{T} #eta>4","HF E_{T} #eta>0(Pb going side)"};
TString filename[Ncut][NGen];
TFile* f[Ncut][NGen];
TH1F* h_or[Ncut][NGen][Nhist];	TH1F* reh_or[Ncut][NGen][Nhist];
TH1F* h_tr[Ncut][NGen][Nhist];	TH1F* reh_tr[Ncut][NGen][Nhist];
TGraphErrors *g_Eff[Ncut][NGen][Nhist]; double EffValue[Ncut][NGen][Nhist][Ncent];	double EffValueErr[Ncut][NGen][Nhist][Ncent];
TH1F* rehEff[Ncut][NGen][Nhist];	TLatex* T1[Nhist];	TLatex* T2[Ncut];	TLatex* T3[NGen];
c1 = new TCanvas("c1"," ",800,500);
c2 = new TCanvas("c2"," ",800,700);
c4 = new TCanvas("c4"," ",1000,800);
makeMultiPanelCanvas(c1,2,1,0.15,0.15,0.15,0.15,0.03);
makeMultiPanelCanvas(c2,1,1,0.15,0.1,0.15,0.1,0.03);
makeMultiPanelCanvas(c4,3,2,0.15,0.15,0.15,0.15,0.03);

for(int k=0;k<NGen;k++){
T3[k]=new TLatex(0.6,0.9,Gen[k]);
T3[k]->SetNDC();
T3[k]->SetTextAlign(12);
T3[k]->SetTextSize(0.06);
T3[k]->SetTextColor(1);
T3[k]->SetTextFont(42);
}
for(int j=0;j<Nhist;j++){
T1[j]=new TLatex(0.4,0.82,etarange[j]);
T1[j]->SetNDC();
T1[j]->SetTextAlign(12);
T1[j]->SetTextSize(0.06);
T1[j]->SetTextColor(1);
T1[j]->SetTextFont(42);
}
for(int i=0;i<Ncut;i++){
T2[i]=new TLatex(0.7,0.25,cutName[i]);
T2[i]->SetNDC();
T2[i]->SetTextAlign(12);
T2[i]->SetTextSize(0.08);
T2[i]->SetTextColor(1);
T2[i]->SetTextFont(42);
}
for(int k=0;k<NGen;k++){
for(int j=0;j<Nhist;j++){
for(int i=0;i<Ncut;i++){
if(i==Ncut-1)
filename[i][k]=Form("pPbHist_%s%s",Gen[k].Data(),cut[i].Data());
else
filename[i][k]=Form("pPbHist_%s_%s",Gen[k].Data(),cut[i].Data());
f[i][k]=TFile::Open(Form("%s.root",filename[i][k].Data()));
h_or[i][k][j]=(TH1F*)f[i][k]->Get(histoname[j]);
h_tr[i][k][j]=(TH1F*)f[i][k]->Get(Form("%s_tr",histoname[j].Data()));
fixedFontHist(h_or[i][k][j],1.8,2);
fixedFontHist(h_tr[i][k][j],1.8,2);
//reh_or[i][k][j]=(TH1F*)h_or[i][k][j]->Rebin(Ncent,Form("re%s%s_%d",Gen[k].Data(),histoname[j].Data(),i),HFbin_cent[j]);
//reh_tr[i][k][j]=(TH1F*)h_tr[i][k][j]->Rebin(Ncent,Form("re%s%s_tr_%d",Gen[k].Data(),histoname[j].Data(),i),HFbin_cent[j]);
reh_or[i][k][j]=(TH1F*)h_or[i][k][j]->Rebin(nHFbin,Form("re%s%s_%d",Gen[k].Data(),histoname[j].Data(),i),HFbin);
reh_tr[i][k][j]=(TH1F*)h_tr[i][k][j]->Rebin(nHFbin,Form("re%s%s_tr_%d",Gen[k].Data(),histoname[j].Data(),i),HFbin);
normalizeByBinWidth(reh_or[i][k][j]);
normalizeByBinWidth(reh_tr[i][k][j]);
rehEff[i][k][j]=(TH1F*)reh_tr[i][k][j]->Clone(Form("rehEff_%s%s_%d",Gen[k].Data(),histoname[j].Data(),i));
rehEff[i][k][j]->Divide(reh_or[i][k][j]);
//rehEff[i][k][j]->GetXaxis()->SetTitleSize(0.06);
//rehEff[i][k][j]->GetXaxis()->SetLabelSize(0.06);
//rehEff[i][k][j]->GetYaxis()->SetTitleSize(0.06);
//rehEff[i][k][j]->GetYaxis()->SetLabelSize(0.06);
rehEff[i][k][j]->SetMarkerColor(color[k][j]);
rehEff[i][k][j]->SetMarkerStyle(Style[k][j]);
rehEff[i][k][j]->SetMarkerSize(1.5);
rehEff[i][k][j]->GetXaxis()->SetLimits(0.1,99);
rehEff[i][k][j]->SetMaximum(1.09);
rehEff[i][k][j]->SetMinimum(0.4);
rehEff[i][k][j]->SetTitle("");
rehEff[i][k][j]->GetXaxis()->SetTitle("HF E_{T} (GeV/c)");
rehEff[i][k][j]->GetYaxis()->SetTitle("Event Selection Efficiency");
for(int icentbin=0;icentbin<Ncent;icentbin++){
//EffValue[i][k][j][icentbin]=h_tr[i][k][j]->Integral(h_tr[i][k][j]->GetXaxis()->FindBin(HFbin_cent[j][Ncent-icentbin-1]),h_tr[i][k][j]->GetXaxis()->FindBin(HFbin_cent[j][Ncent-icentbin]))/h_or[i][k][j]->Integral(h_or[i][k][j]->GetXaxis()->FindBin(HFbin_cent[j][Ncent-icentbin-1]),h_or[i][k][j]->GetXaxis()->FindBin(HFbin_cent[j][Ncent-icentbin]));
EffValue[i][k][j][icentbin]=rehEff[i][k][j]->GetBinContent(Ncent-icentbin);
EffValueErr[i][k][j][icentbin]=rehEff[i][k][j]->GetBinError(Ncent-icentbin);
}
g_Eff[i][k][j]= new TGraphErrors(Ncent,cent,EffValue[i][k][j],xerr,EffValueErr[i][k][j]);
g_Eff[i][k][j]->SetTitle("");
g_Eff[i][k][j]->GetXaxis()->SetTitleSize(0.06);
g_Eff[i][k][j]->GetXaxis()->SetLabelSize(0.06);
g_Eff[i][k][j]->GetYaxis()->SetTitleSize(0.06);
g_Eff[i][k][j]->GetYaxis()->SetLabelSize(0.06);
g_Eff[i][k][j]->SetMarkerSize(0.06);
g_Eff[i][k][j]->GetYaxis()->SetTitle("Event Selection Efficiency");
g_Eff[i][k][j]->GetXaxis()->SetTitle("Centrality");
g_Eff[i][k][j]->GetXaxis()->CenterTitle();
g_Eff[i][k][j]->GetYaxis()->SetTitleOffset(1.2);
g_Eff[i][k][j]->GetXaxis()->SetTitleOffset(0.9);
g_Eff[i][k][j]->GetXaxis()->SetRangeUser(1,99);
g_Eff[i][k][j]->GetYaxis()->CenterTitle();
g_Eff[i][k][j]->SetMarkerSize(1.2);
g_Eff[i][k][j]->SetMarkerColor(color[k][j]);
g_Eff[i][k][j]->SetMarkerStyle(Style[k][j]);
g_Eff[i][k][j]->SetMinimum(0.4);
g_Eff[i][k][j]->SetMaximum(1.09);
}
}
}
/*
c1->cd(i+1)->SetLogy();
reh_or[i]->SetTitle("");
reh_or[i]->GetXaxis()->SetTitle("");
if(i==0)
reh_or[i]->GetYaxis()->SetTitle("Counts");
else
reh_tr[i]->GetYaxis()->SetTitle("");
reh_or[i]->SetMarkerStyle(24);
reh_or[i]->SetMarkerSize(1.2);
reh_or[i]->SetMarkerColor(1);
reh_or[i]->Draw();
reh_tr[i]->SetTitle("");
reh_tr[i]->SetMarkerSize(1.2);
reh_tr[i]->SetMarkerColor(2);
reh_tr[i]->SetMarkerStyle(20);
reh_tr[i]->Draw("same");
TLegend *leg=new TLegend(0.7,0.7,0.8,0.9);
leg->SetTextSize(0.05);
leg->SetBorderSize(0);
leg->SetFillColor(0);
leg->AddEntry(reh_or[i],"Before Selection","lp");
leg->AddEntry(reh_tr[i],"After Selection","lp");
leg->Draw("same");

T1[i]->Draw("same");
*//*
i=Ncut-1;	//All cut
for(k=0;k<NGen;k++){
c1->cd(k+1);
if(k<1){
rehEff[i][k][j]->GetYaxis()->SetTitle("");
rehEff[i][k][j]->GetYaxis()->SetLabelSize(0);
}
TLegend *leg=new TLegend(0.2,0.2,0.35,0.4);
for(j=0;j<Nhist;j++){
if(j==0)
rehEff[i][k][j]->Draw();
else
rehEff[i][k][j]->Draw("same");
leg->SetTextSize(0.05);
leg->SetBorderSize(0);
leg->SetFillColor(0);
leg->AddEntry(rehEff[i][k][j],etarange[j],"p");
TLine *l=new TLine(cent[0],1,cent[Ncent-1],1);
l->SetLineStyle(2);
}
l->Draw("same");
leg->Draw("same");
T3[k]->Draw("same");
}
c1->Print(Form("pPbHist_%s_HF.png",cut[i].Data()));
*/
i=Ncut-1;j=1;
//c2->cd()->SetLogy();
c2->cd()->SetLogx();
TLegend *leg=new TLegend(0.6,0.2,0.75,0.3);
for(k=0;k<NGen;k++){
rehEff[i][k][j]->GetXaxis()->SetTitleSize(30);
rehEff[i][k][j]->GetXaxis()->SetLabelSize(30);
rehEff[i][k][j]->GetYaxis()->SetTitleSize(30);
rehEff[i][k][j]->GetYaxis()->SetLabelSize(30);
rehEff[i][k][j]->GetYaxis()->SetTitleOffset(0.9);
rehEff[i][k][j]->GetXaxis()->SetTitleOffset(1.1);
rehEff[i][k][j]->GetYaxis()->SetTitleOffset(1);
if(k==0){
rehEff[i][k][j]->Draw();
rehEff[i][k][j]->SetMarkerColor(1);
rehEff[i][k][j]->SetMarkerStyle(20);
}
else{
rehEff[i][k][j]->Draw("same");
rehEff[i][k][j]->SetMarkerColor(2);
rehEff[i][k][j]->SetMarkerStyle(24);
}
leg->SetTextSize(0.05);
leg->SetBorderSize(0);
leg->SetFillColor(0);
leg->AddEntry(rehEff[i][k][j],Gen[k],"p");
TLine *l=new TLine(0,1,cent[Ncent-1],1);
l->SetLineStyle(2);
}
T1[j]->Draw("same");
leg->Draw("same");
l->Draw("same");

//c2->Print(Form("pPbHist_%s%s_HF.png",cut[i].Data(),histoname[j].Data()));

j=1;k=0;
for(i=0;i<Ncut;i++){
//rehEff[i][k][j]->GetYaxis()->SetTitleOffset(2.5);
rehEff[i][k][j]->GetXaxis()->SetTitleOffset(2);
if(i!=0 &&  i!=3){
rehEff[i][k][j]->GetYaxis()->SetTitle("");
rehEff[i][k][j]->GetYaxis()->SetLabelSize(0);
}

if(i<3){
rehEff[i][k][j]->GetXaxis()->SetTitle("");
rehEff[i][k][j]->GetXaxis()->SetLabelSize(0);
}
c4->cd(i+1)->SetLogy();
//c4->cd(i+1)->SetLogx();
rehEff[i][k][j]->Draw();
rehEff[i][k][j]->SetMarkerColor(1);
rehEff[i][k][j]->SetMarkerStyle(20);
T2[i]->Draw("same");
}
T3[k]->Draw("same");
if(Ncut==5){
c4->cd(6);
TH1F *fNull=new TH1F("","",100,0,100);
fNull->GetXaxis()->SetLabelSize(0.06);
fNull->Draw();
}
if(Ncut==5)

//c4->Print(Form("pPbHist_%s_%s_newcut_HF.png",Gen[k].Data(),histoname[j].Data()));
else
//c4->Print(Form("pPbHist_%s_%s_HF.png",Gen[k].Data(),histoname[j].Data()));

}
Esempio n. 16
0
void DivideHFBin(){
gStyle->SetOptStat(kFALSE);
gStyle->SetErrorX(0);
double goal;
bool IsMC=kFALSE, Isweight=kTRUE;
if(IsMC){
if(Isweight){
TString dir="/home/xuq7/CMSSW_6_2_3_patch1/src/jetRpA/RpA/GlobalEvent/CentrDep/RecoHI/VRw";
TString inputfile="Closure.root";
TString inputfileDS="pPbHijing_EffCorr.root";}
else{
TString dir="/home/xuq7/CMSSW_6_2_3_patch1/src/jetRpA/RpA/GlobalEvent/CentrDep/RecoHI/NoVRw";
TString inputfile="Closure_v1.root";
TString inputfileDS="pPbHijing_EffCorr.root";
}
}
else{
TString dir="/home/xuq7/CMSSW_6_2_3_patch1/src/jetRpA/RpA/output/GlobalEvent/CentrDep/";
if(!Isweight)
TString inputfile="MBCen_noweight_RecoHI_v1.root";
else
TString inputfile="MBCen_weight_RecoHI.root";
}
ofstream fstr;
//fstr<<setprecision(2)<<fixed<<endl;
TFile *f=TFile::Open(Form("%s/%s",dir.Data(),inputfile.Data()));
if(IsMC)
TFile *fDS=TFile::Open(Form("%s/%s",dir.Data(),inputfileDS.Data()));
fstr<<dir<<"/"<<inputfile<<endl;
if(IsMC){
TString Var[6]={"HFp4","HFp","HFm4","HFm","HF4","Mult"};
TString corr[9]={"ES","DS","NtrkEric","Ntrk","Ntrkbak","HFp4","HFp4bak","reHFp4","reHFp4bak"};
TH1F* hHF[6][9]; 	TH1F* hHF_tr[6];
}
else{
TString Var[4]={"HF4","HFPlus","HFPlus4","Ntrk"};
TString corr[7]={"Wt","_QiaoNtrkWt","_QiaoNtrkbakWt","_QiaoHFPlus4bakWt","_QiaoHFPlus4Wt","_QiaoReHFPlus4Wt","_QiaoReHFPlus4bakWt"};
TH1F* hHF[4][7];	TH1F* hHF_tr[4];
}

if(IsMC){
if(Isweight)
fstr.open(Form("HFbin_Hijing_weight_bak.txt"));
else
fstr.open(Form("HFbin_Hijing_noweight_bak.txt"));
}
else{
if(Isweight)
fstr.open(Form("HFbin_Data_weight.txt"));
else
fstr.open(Form("HFbin_Data_noweight.txt"));
}

int ncorr=sizeof(corr)/sizeof(TString)-1;
const int N=5;
double cent[N]={0.1,0.2,0.3,0.6,0.9};
double HFcentrbin[N];
double HFbin[]={0,0.23,0.47,0.67,0.87,1.05,1.24,1.43,1.62,1.82,2.03,2.24,2.47,2.7,2.95,3.21,3.48,3.77,4.07,4.38,4.72,5.06,5.41,5.79,6.17,6.57,6.98,7.41,7.85,8.3,8.76,9.24,9.74,10.25,10.79,11.33,11.91,12.51,13.14,13.81,14.51,15.27,16.09,17,17.99,19.14,20.48,22.14,24.35,27.93,90.29};
int nHFbin=sizeof(HFbin)/sizeof(double)-1;
TLine *l[N];
//for(int k=0;k<nVar;k++){
int k=2;
//for(int j=0;j<=ncorr;j++){
int j=6;
if(IsMC){
if(j==0)
hHF[k][j]=(TH1F*)f->Get(Form("demo/h%s%s",Var[k].Data(),corr[j].Data()));
else if(j==1)
hHF[k][j]=(TH1F*)fDS->Get(Form("h%s%s",Var[k].Data(),corr[j].Data()));
else
hHF[k][j]=(TH1F*)f->Get(Form("demo/h%s%s",corr[j].Data(),Var[k].Data()));
hHF_tr[k]=(TH1F*)f->Get(Form("demo/h%s%s",Var[k].Data(),corr[0].Data()));
}
else{
if(j==2){
if(k==1)
corr[j]="_QiaoNtrkbalWt";
else
corr[j]="_QiaoNtrkbakWt";
}
hHF[k][j]=(TH1F*)f->Get(Form("pfjet_%s%s",Var[k].Data(),corr[j].Data()));
hHF_tr[k]=(TH1F*)f->Get(Form("pfjet_%s",Var[k].Data()));
}
fstr<<hHF[k][j]->GetName()<<" Integral="<<hHF_tr[k]->Integral()/hHF[k][j]->Integral()<<endl;
for(int icent=0;icent<N;icent++){
//fstr<<"start from 90-100%:"<<endl;
for(int ibin=1;ibin<hHF[k][j]->GetNbinsX();ibin++){
goal=cent[icent]*hHF[k][j]->Integral();
if(hHF[k][j]->Integral(ibin,hHF[k][j]->GetNbinsX())<=goal){
HFcentrbin[icent]=hHF[k][j]->GetXaxis()->GetBinLowEdge(ibin);
fstr<<icent<<"th: "<<hHF[k][j]->GetXaxis()->GetBinLowEdge(ibin)<<'\t'<<cent[icent]<<endl;
break;
}
}
l[icent]=new TLine(HFcentrbin[icent],0,HFcentrbin[icent],6e-2);
l[icent]->SetLineStyle(2);
l[icent]->SetLineColor(4);
l[icent]->SetLineWidth(2);
}
//}
//}
hHF[k][j]=(TH1F*)hHF[k][j]->Rebin(nHFbin,hHF[k][j]->GetName(),HFbin);
normalizeByBinWidth(hHF[k][j]);
hHF[k][j]->Scale((double)1.0/hHF[k][j]->Integral());
c1 = new TCanvas("c1","",600,600);
makeMultiPanelCanvas(c1,1,1,0,0,0.05,0.05,0.03);
c1->cd()->SetLogy();
c1->cd()->SetLogx();
TH1F* hFrame=new TH1F("","",1000,0,100);
fixedFontHist(hFrame,1.3,1.2);
hFrame->GetXaxis()->SetTitle("HF #Sigma E_{T} #eta>4");
hFrame->GetXaxis()->SetRangeUser(1e-1,30);
hFrame->GetYaxis()->SetTitle("Event Fraction");
hFrame->GetYaxis()->SetRangeUser(1e-3,1e-1);
hFrame->Draw();
TLatex *T1=new TLatex(0.25,0.85,"CMS preliminary pPb #sqrt{s} = 5.02TeV");
T1->SetNDC();
T1->SetTextAlign(12);
T1->SetTextSize(0.04);
T1->SetTextColor(1);
T1->SetTextFont(42);

TLatex T2;
T2.SetNDC();
T2.SetTextAngle(90);
T2.SetTextSize(0.03);
T2.SetTextColor(1);
T2.SetTextFont(42);
T2.DrawLatex(0.27,0.30,"90-100%");
T2.DrawLatex(0.54,0.30,"60-90%");
T2.DrawLatex(0.71,0.30,"30-60%");
T2.DrawLatex(0.79,0.30,"20-30%");
T2.DrawLatex(0.83,0.30,"10-20%");
T2.DrawLatex(0.88,0.30,"0-10%");


hHF[k][j]->SetMarkerStyle(20);
hHF[k][j]->SetMarkerColor(1);
hHF[k][j]->SetLineColor(1);
hHF[k][j]->SetMarkerSize(1);
hHF[k][j]->Draw("same");
T1->Draw("same");
for(int icent=0;icent<N;icent++){
l[icent]->Draw("same");
}
c1->Print("HFbin.png");
}
Esempio n. 17
0
void CompareVz(){
gStyle->SetOptStat(kFALSE);
gStyle->SetErrorX(0);

TString histoname1="pfjet_Vz";
TString histoname2="pfjet_VzWeighted";

TH1F* histo1=(TH1F*)fPPb->Get(histoname1);
TH1F* histo2=(TH1F*)fPPb->Get(histoname2);
TH1F* histodata=(TH1F*)fdata->Get("vz");

//histo1=(TH1F*)histo1->Rebin(Nbin_vz,"histo1",binbound_vz);
//histo2=(TH1F*)histo2->Rebin(Nbin_vz,"histo2",binbound_vz);
histo1->Rebin(5);
histo2->Rebin(5);
histodata->Rebin(5);

histo1->GetXaxis()->SetRangeUser(-15,15);
histo2->GetXaxis()->SetRangeUser(-15,15);
histodata->GetXaxis()->SetRangeUser(-15,15);

normalizeByBinWidth(histo1);
normalizeByBinWidth(histo2);
normalizeByBinWidth(histodata);
histo1->Scale(1/histo1->Integral());
histo2->Scale(1/histo2->Integral());
histodata->Scale(1/histodata->Integral());
histo1->SetMarkerStyle(24);
histo1->SetMarkerSize(1.2);
histo1->SetMarkerColor(2);
histo1->SetLineColor(2);
histo2->SetMarkerStyle(0);
histo2->SetMarkerSize(0);
histo2->SetFillStyle(3004);
histo2->SetFillColor(2);
histo2->SetLineColor(2);
histo2->SetMarkerColor(0);
//histo2->SetMarkerColor(2);
histodata->SetMarkerStyle(20);
histodata->SetMarkerSize(1.2);
histodata->SetMarkerColor(1);
histodata->SetLineColor(1);

c1 = new TCanvas("c1"," ",500,500);
makeMultiPanelCanvas(c1,1,1,-0.1,0,0.16,0.14,0.03);

TH1F* hFrame=new TH1F("","",20000,-1000,1000);
fixedFontHist(hFrame,1.4,1.8);
hFrame->SetTitle("");
hFrame->GetXaxis()->SetTitle("vz (cm)");
hFrame->GetYaxis()->SetTitle("Event Fraction");
hFrame->GetXaxis()->SetLimits(-15,15);
//hFrame->GetXaxis()->SetLimits(-3,3);
hFrame->GetYaxis()->SetRangeUser(0,5e-2);
c1->cd(1);
hFrame->DrawCopy();
histodata->Draw("same");
histo1->Draw("same");
histo2->Draw("HIST same");
TLegend *leg1=new TLegend(0.40,0.80,0.85,0.95);
TLegend *leg2=new TLegend(0.50,0.9,0.80,0.98);
leg1->SetBorderSize(0);
leg2->SetBorderSize(0);
leg1->SetFillColor(0);
leg2->SetFillColor(0);
leg1->SetTextSize(0.04);
leg2->SetTextSize(0.04);
leg1->AddEntry(histo1,"Before Vz weighting","lp");
leg1->AddEntry(histo2,"After Vz weighting","lfp");
leg1->AddEntry(histodata,"Data","lp");
leg1->Draw("same");
TLatex *T1=new TLatex(0.25,0.92,"");
T1->SetNDC();
T1->SetTextAlign(12);
T1->SetTextSize(0.05);
T1->SetTextColor(1);
T1->SetTextFont(42);
T1->Draw("same");
//c1->Print("VzCompare_DataPPb.png");
//c1->Print("VzCompare_DataPPb.pdf");
}