void plotAnaMult3(char *infname="ana.root") { TFile *inf = new TFile(infname); TTree *tData = (TTree*) inf->Get("Data_tree"); TTree *tMC = (TTree*) inf->Get("MC_tree"); TTree *tPP = (TTree*) inf->Get("PP_tree"); TCanvas *c1 = new TCanvas("c","",1200,700); // c->Divide(4,1); TCut recoCut = "leadingJetPt>120&&subleadingJetPt>50&&dphi>2*3.14159265358979/3.&&abs(leadingJetEta)<1.6&&abs(subleadingJetEta)<1.6"; TCut genCut = "genleadingJetPt>120&&gensubleadingJetPt>50&&genDphi>2*3.14159265358979/3.&&abs(genleadingJetEta)<1.6&&abs(gensubleadingJetEta)<1.6"; const int nPtBin=5; Float_t PtBins[nPtBin+1] = {2.1,2.6,2.8,2.9,3.0,3.15}; Int_t centBin[5] = {200,100,60,20,0}; makeMultiPanelCanvas(c1,4,2,0.0,0.0,0.2,0.2,0.02); for (int i=0;i<4;i++) { c1->cd(i+1); TH1D * empty=new TH1D("empty","",100,2.1,3.15); empty->Fill(0.5,1000); empty->SetMaximum(39.99); empty->SetMinimum(0.001); empty->SetNdivisions(105,"X"); empty->GetXaxis()->SetTitleSize(28); empty->GetXaxis()->SetTitleFont(43); empty->GetXaxis()->SetTitleOffset(1.8); empty->GetXaxis()->SetLabelSize(22); empty->GetXaxis()->SetLabelFont(43); empty->GetYaxis()->SetTitleSize(28); empty->GetYaxis()->SetTitleFont(43); empty->GetYaxis()->SetTitleOffset(1.8); empty->GetYaxis()->SetLabelSize(22); empty->GetYaxis()->SetLabelFont(43); empty->GetXaxis()->CenterTitle(); empty->GetYaxis()->CenterTitle(); empty->SetXTitle("#Delta#phi_{1,2}"); empty->SetYTitle("Multiplicity Difference"); TProfile *pData = new TProfile(Form("pData%d",i),"",nPtBin,PtBins); TProfile *pMC = new TProfile(Form("pMC%d",i),"",nPtBin,PtBins); TProfile *pPP = new TProfile(Form("pPP%d",i),"",nPtBin,PtBins); TProfile *pGen = new TProfile(Form("pGen%d",i),"",nPtBin,PtBins); TCut centCut = Form("hiBin>=%d&&hiBin<%d",centBin[i+1],centBin[i]); tData->Draw(Form("-multDiff:dphi>>pData%d",i),recoCut&¢Cut); tPP->Draw(Form("-multDiff:dphi>>pPP%d",i),recoCut); tMC->Draw(Form("-multDiff:dphi>>pMC%d",i),recoCut&¢Cut); tMC->Draw(Form("-genMultDiff:genDphi>>pGen%d",i),genCut&¢Cut); pMC->SetLineColor(2); pMC->SetMarkerColor(2); pPP->SetLineColor(4); pPP->SetMarkerColor(4); // pData->SetAxisRange(0,50,"Y"); // pData->SetAxisRange(0,0.49,"X"); empty->Draw(); double diff=0; if (i==0) diff=0.1; drawText(Form("%d-%d %%",(int)(0.5*centBin[i+1]),(int)(0.5*centBin[i])),0.22+diff,0.65); if (i==0) drawText("PbPb #sqrt{s_{NN}}=2.76 TeV 150/#mub",0.22+diff,0.85); if (i==0) drawText("pp #sqrt{s_{NN}}=2.76 TeV 5.3/pb",0.22+diff,0.75); if (i==3) drawText("CMS Preliminary",0.3+diff,0.85); Float_t sys[4]={1,1,2.5,3}; for (int j=1;j<=pData->GetNbinsX();j++) { TBox *b = new TBox(pData->GetBinLowEdge(j),pData->GetBinContent(j)-sys[i],pData->GetBinLowEdge(j+1),pData->GetBinContent(j)+sys[i]); //b->SetFillColor(kGray); b->SetFillStyle(0); b->SetLineColor(1); b->Draw(); TBox *b2 = new TBox(pPP->GetBinLowEdge(j),pPP->GetBinContent(j)-1,pPP->GetBinLowEdge(j+1),pPP->GetBinContent(j)+1); //b2->SetFillColor(65); b2->SetFillStyle(0); b2->SetLineColor(4); b2->Draw(); } pData->Draw("same"); pMC->Draw("same"); pPP->Draw("same"); pGen->SetMarkerColor(4); pGen->SetMarkerStyle(24); pData->Draw("same"); // pGen->Draw(" same"); c1->cd(5+i); TH1D *empty2 = (TH1D*)empty->Clone("empty2"); empty2->SetYTitle("PbPb - pp"); empty2->SetMinimum(-5); empty2->SetMaximum(+29.99); empty2->Draw(); // TProfile *pDiff = (TProfile*)pData->Clone("pDiff"); TH1D *pDiff = new TH1D("pDiff","",nPtBin,PtBins); for (int j=1;j<=pData->GetNbinsX();j++) { pDiff->SetBinContent(j,pData->GetBinContent(j)-pPP->GetBinContent(j)); pDiff->SetBinError(j,sqrt(pData->GetBinError(j)*pData->GetBinError(j)+pPP->GetBinError(j)*pPP->GetBinError(j))); TBox *b = new TBox(pDiff->GetBinLowEdge(j),pDiff->GetBinContent(j)-sys[i],pDiff->GetBinLowEdge(j+1),pDiff->GetBinContent(j)+sys[i]); TBox *b2 = new TBox(pDiff->GetBinLowEdge(j),pDiff->GetBinContent(j)-sys[i],pDiff->GetBinLowEdge(j+1),pDiff->GetBinContent(j)+sys[i]); b->SetFillColor(TColor::GetColor("#FFEE00")); b2->SetLineColor(1); b2->SetFillStyle(0); b->Draw(); b2->Draw(); } pDiff->Draw("p same"); TLegend *leg = new TLegend(0.3,0.6,0.9,0.9); leg->SetFillStyle(0); leg->SetBorderSize(0); leg->AddEntry(pData,"PbPb","pl"); leg->AddEntry(pPP,"pp","pl"); leg->AddEntry(pMC,"PYTHIA+HYDJET","pl"); if (i==0) leg->Draw(); if (i==1) drawText("p_{T,1} > 120 GeV/c",0.22+diff,0.85); if (i==1) drawText("p_{T,2} > 50 GeV/c",0.22+diff,0.75); if (i==1) drawText("#Delta#phi_{1,2} > 5#pi/6",0.22+diff,0.65); } /* TCanvas *c1 = new TCanvas("c1","",(ncent+1)*300,700); makeMultiPanelCanvas(c1,ncent+1,2,0.0,0.0,0.2,0.2,0.02); TH1D * empty=new TH1D("empty",Form(";%s;<#slash{p}_{T}^{#parallel}> (GeV)",axistitle[index_var].Data()),nalpha/2+1,frac); TH1D * empty2=new TH1D("empty2",Form(";%s;<#slash{p}_{T}^{#parallel}> (GeV)",axistitle[index_var].Data()),nalpha/2+1,frac); empty->Fill(0.5,1000); empty2->Fill(0.5,1000); if(doIntegrate){ if(index_var==0){ empty->SetMaximum(30); empty->SetMinimum(-70); }else{ empty->SetMaximum(35); empty->SetMinimum(-45); } }else{ empty->SetMaximum(15); empty->SetMinimum(-10); empty2->SetMaximum(15); empty2->SetMinimum(-10); } empty->GetXaxis()->SetTitleSize(28); empty->GetXaxis()->SetTitleFont(43); empty->GetXaxis()->SetTitleOffset(2.2); empty->GetXaxis()->SetLabelSize(22); empty->GetXaxis()->SetLabelFont(43); empty->GetYaxis()->SetTitleSize(28); empty->GetYaxis()->SetTitleFont(43); empty->GetYaxis()->SetTitleOffset(2.2); empty->GetYaxis()->SetLabelSize(22); empty->GetYaxis()->SetLabelFont(43); empty2->GetXaxis()->SetTitleSize(28); empty2->GetXaxis()->SetTitleFont(43); empty2->GetXaxis()->SetTitleOffset(2.2); empty2->GetXaxis()->SetLabelSize(22); empty2->GetXaxis()->SetLabelFont(43); empty2->GetYaxis()->SetTitleSize(28); empty2->GetYaxis()->SetTitleFont(43); empty2->GetYaxis()->SetTitleOffset(2.2); empty2->GetYaxis()->SetLabelSize(22); empty2->GetYaxis()->SetLabelFont(43); c1->cd(ncent+2); */ c1->SaveAs("results/MultiplicityDifference-DeltaPhi.C"); c1->SaveAs("results/MultiplicityDifference-DeltaPhi.gif"); c1->SaveAs("results/MultiplicityDifference-DeltaPhi.eps"); c1->SaveAs("results/MultiplicityDifference-DeltaPhi.pdf"); }
void tauStudy(const TString inputfile = "/afs/cern.ch/work/k/klawhorn/HHToBBTT/Conf4_10GeV/HHToBBTT_10GeVJets_14TeV.root") { // set up input tree LorentzVector *genTau1=0, *genTau2=0, *genJetTau1=0, *genJetTau2=0, *jetTau1=0, *jetTau2=0; Float_t genTau1pt, genTau2pt, genJetTau1pt, genJetTau2pt, jetTau1pt, jetTau2pt, corrJetTau1pt, corrJetTau2pt; Float_t genTau1eta, genTau2eta, genJetTau1eta, genJetTau2eta, jetTau1eta, jetTau2eta; TFile *infile = new TFile(inputfile, "READ"); assert(infile); TTree *intree = (TTree*) infile->Get("Events"); assert(intree); intree->SetBranchAddress("genTau1", &genTau1); intree->SetBranchAddress("genTau2", &genTau2); intree->SetBranchAddress("genJetTau1", &genJetTau1); intree->SetBranchAddress("genJetTau2", &genJetTau2); intree->SetBranchAddress("jetTau1", &jetTau1); intree->SetBranchAddress("jetTau2", &jetTau2); const Float_t PT_MAX = 500; const Float_t PT_MIN = 0; const Int_t PT_BINS = 50; const Float_t ETA_MAX = 2.4; const Float_t ETA_MIN = -2.4; const Int_t ETA_BINS = 16; TProfile *tauTagEffWithPT = new TProfile("tauTagEffWithPT", "Tau Tagging Efficiency", PT_BINS, PT_MIN, PT_MAX); TProfile *tauTagEffWithEta = new TProfile("tauTagEffWithEta", "Tau Tagging Efficiency", ETA_BINS, ETA_MIN, ETA_MAX); //TProfile *ptScaleWithPT = new TProfile("ptScaleWithPT", "P_{T} Scale Factor between gen Tau and reco Jet", PT_BINS, PT_MIN, PT_MAX); //TProfile *ptJetScaleWithPT = new TProfile("ptJetScaleWithPT", "P_{T} Scale Factor between gen Jet and reco Jet", PT_BINS, PT_MIN, PT_MAX); //TProfile *ptScaleWithEta = new TProfile("ptScaleWithEta", "P_{T} Scale Factor between gen Tau and reco Jet", ETA_BINS, ETA_MIN, ETA_MAX); //TProfile *ptJetScaleWithEta = new TProfile("ptJetScaleWithEta", "P_{T} Scale Factor between gen Jet and reco Jet", ETA_BINS, ETA_MIN, ETA_MAX); //TProfile *ptResWithPT = new TProfile("ptResWithPT", "P_{T} Resolution between gen Tau and reco Jet", PT_BINS, PT_MIN, PT_MAX); TProfile *ptJetResWithPT = new TProfile("ptJetResWithPT", "P_{T} Resolution: (genJet-recoJet)/(genJet)", PT_BINS, PT_MIN, PT_MAX); TProfile *ptJetResCorrWithPT = new TProfile("ptJetResCorrWithPT", "P_{T} Resolution: (genJet-recoJet)/(genJet)", PT_BINS, PT_MIN, PT_MAX); //TProfile *ptResWithEta = new TProfile("ptResWithEta", "P_{T} Resolution between gen Tau and reco Jet", ETA_BINS, ETA_MIN, ETA_MAX); TProfile *ptJetResWithEta = new TProfile("ptJetResWithEta", "P_{T} Resolution: (genJet-recoJet)/(genJet)", ETA_BINS, ETA_MIN, ETA_MAX); TProfile *ptJetResCorrWithEta = new TProfile("ptJetResCorrWithEta", "P_{T} Resolution: (genJet-recoJet)/(genJet)", ETA_BINS, ETA_MIN, ETA_MAX); for (Int_t iEntry=0; iEntry<intree->GetEntries(); iEntry++) { intree->GetEntry(iEntry); genTau1pt = genTau1->Pt(); genTau1eta = genTau1->Eta(); genTau2pt = genTau2->Pt(); genTau2eta = genTau2->Eta(); genJetTau1pt = genJetTau1->Pt(); genJetTau1eta = genJetTau1->Eta(); genJetTau2pt = genJetTau2->Pt(); genJetTau2eta = genJetTau2->Eta(); jetTau1pt = jetTau1->Pt(); jetTau1eta = jetTau1->Eta(); jetTau2pt = jetTau2->Pt(); jetTau2eta = jetTau2->Eta(); // jet corrections //if ( (jetTau1pt != 999) ) cout << "eta " << jetTau1eta << " pt " << jetTau1pt << " scaleCorr " << getJetScaleFactor(jetTau1pt, jetTau1eta) << endl; corrJetTau1pt = jetTau1pt*getJetScaleFactor(jetTau1pt, jetTau1eta); corrJetTau2pt = jetTau2pt*getJetScaleFactor(jetTau2pt, jetTau2eta); if ( (genTau1pt != 999) && (jetTau1pt != 999) ) { tauTagEffWithPT->Fill(genTau1pt, 1); //ptScaleWithPT->Fill(genTau1pt, jetTau1pt/genTau1pt); //ptJetScaleWithPT->Fill(genJetTau1pt, jetTau1pt/genJetTau1pt); //ptResWithPT->Fill(genTau1pt, (genTau1pt-jetTau1pt)/genTau1pt); ptJetResWithPT->Fill(genJetTau1pt, (genJetTau1pt-jetTau1pt)/genJetTau1pt); ptJetResCorrWithPT->Fill(genJetTau1pt, (genJetTau1pt-corrJetTau1pt)/genJetTau1pt); tauTagEffWithEta->Fill(genTau1eta, 1); //ptScaleWithEta->Fill(genTau1eta, jetTau1pt/genTau1pt); //ptJetScaleWithEta->Fill(genJetTau1eta, jetTau1pt/genJetTau1pt); //ptResWithEta->Fill(genTau1eta, (genTau1pt-jetTau1pt)/genTau1pt); ptJetResWithEta->Fill(genJetTau1eta, (genJetTau1pt-jetTau1pt)/genJetTau1pt); ptJetResCorrWithEta->Fill(genJetTau1eta, (genJetTau1pt-corrJetTau1pt)/genJetTau1pt); } else if ( (genTau1pt != 999) && (jetTau1pt == 999) ) { tauTagEffWithPT->Fill(genTau1pt, 0); tauTagEffWithEta->Fill(genTau1eta, 0); } if ( (genTau2pt != 999) && (jetTau2pt != 999) ) { tauTagEffWithPT->Fill(genTau2pt, 1); //ptScaleWithPT->Fill(genTau2pt, jetTau2pt/genTau2pt); //ptJetScaleWithPT->Fill(genJetTau2pt, jetTau2pt/genJetTau2pt); //ptResWithPT->Fill(genTau2pt, (genTau2pt-jetTau2pt)/genTau2pt); ptJetResWithPT->Fill(genJetTau2pt, (genJetTau2pt-jetTau2pt)/genJetTau2pt); ptJetResCorrWithPT->Fill(genJetTau2pt, (genJetTau2pt-corrJetTau2pt)/genJetTau2pt); tauTagEffWithEta->Fill(genTau2eta, 1); //ptScaleWithEta->Fill(genTau2eta, jetTau2pt/genTau2pt); //ptJetScaleWithEta->Fill(genJetTau2eta, jetTau2pt/genJetTau2pt); //ptResWithEta->Fill(genTau2eta, (genTau2pt-jetTau2pt)/genTau2pt); ptJetResWithEta->Fill(genJetTau2eta, (genJetTau2pt-jetTau2pt)/genJetTau2pt); ptJetResCorrWithEta->Fill(genJetTau2eta, (genJetTau2pt-corrJetTau2pt)/genJetTau2pt); } else if ( (genTau2pt != 999) && (jetTau2pt == 999) ) { tauTagEffWithPT->Fill(genTau2pt, 0); tauTagEffWithEta->Fill(genTau2eta, 0); } } TCanvas *c1 = MakeCanvas("c1", "Tau Tagging Efficiency", 800, 600); tauTagEffWithPT->SetMarkerStyle(1); tauTagEffWithPT->GetXaxis()->SetTitle("P_{T} of Generator Tau"); tauTagEffWithPT->GetYaxis()->SetTitle("Efficiency"); tauTagEffWithPT->Draw(); c1->SaveAs("tauTagEffWithPT.png"); TCanvas *c2 = MakeCanvas("c2", "Tau Tagging Efficiency", 800, 600); tauTagEffWithEta->SetMarkerStyle(1); tauTagEffWithEta->GetXaxis()->SetTitle("Eta of Generator Tau"); tauTagEffWithEta->GetYaxis()->SetTitle("Efficiency"); tauTagEffWithEta->Draw(); c2->SaveAs("tauTagEffWithEta.png"); /* TCanvas *c3 = MakeCanvas("c3", "Tau P_{T} Scale (reco Tau Jet P_{T}/gen Tau P_{T})", 800, 600); ptScaleWithPT->SetMarkerStyle(1); ptScaleWithPT->GetXaxis()->SetTitle("P_{T} of Generator Tau"); ptScaleWithPT->GetYaxis()->SetTitle("P_{T} Scale"); ptScaleWithPT->Draw(); c3->SaveAs("ptScaleWithPT.png"); TCanvas *c4 = MakeCanvas("c4", "Tau P_{T} Scale (reco Tau Jet P_{T}/gen Tau P_{T})", 800, 600); ptScaleWithEta->SetMarkerStyle(1); ptScaleWithEta->GetXaxis()->SetTitle("Eta of Generator Tau"); ptScaleWithEta->GetYaxis()->SetTitle("P_{T} Scale"); ptScaleWithEta->Draw(); c4->SaveAs("ptScaleWithEta.png"); TCanvas *c5 = MakeCanvas("c5", "Tau P_{T} Scale (reco Tau Jet P_{T}/gen Tau Jet P_{T})", 800, 600); ptJetScaleWithPT->SetMarkerStyle(1); ptJetScaleWithPT->GetXaxis()->SetTitle("P_{T} of Generator Tau Jet"); ptJetScaleWithPT->GetYaxis()->SetTitle("P_{T} Scale"); ptJetScaleWithPT->Draw(); c5->SaveAs("ptJetScaleWithPT.png"); TCanvas *c6 = MakeCanvas("c6", "Tau P_{T} Scale (reco Tau Jet P_{T}/gen Tau Jet P_{T})", 800, 600); ptJetScaleWithEta->SetMarkerStyle(1); ptJetScaleWithEta->GetXaxis()->SetTitle("Eta of Generator Tau Jet"); ptJetScaleWithEta->GetYaxis()->SetTitle("P_{T} Scale"); ptJetScaleWithEta->Draw(); c6->SaveAs("ptJetScaleWithEta.png"); TCanvas *c7 = MakeCanvas("c7", "Tau P_{T} Resolution ((reco Tau Jet P_{T} - gen Tau P_{T})/gen Tau P_{T})", 800, 600); ptResWithPT->SetMarkerStyle(1); ptResWithPT->GetXaxis()->SetTitle("P_{T} of Generator Tau"); ptResWithPT->GetYaxis()->SetTitle("P_{T} Resolution"); ptResWithPT->Draw(); c7->SaveAs("ptResWithPT.png"); TCanvas *c8 = MakeCanvas("c8", "Tau P_{T} Resolution", 800, 600); ptResWithEta->SetMarkerStyle(1); ptResWithEta->GetXaxis()->SetTitle("Eta of Generator Tau"); ptResWithEta->GetYaxis()->SetTitle("P_{T} Resolution"); ptResWithEta->Draw(); c8->SaveAs("ptResWithEta.png"); TCanvas *c9 = MakeCanvas("c9", "Tau P_{T} Resolution", 800, 600); ptJetResWithPT->SetMarkerStyle(1); ptJetResWithPT->GetXaxis()->SetTitle("P_{T} of Generator Tau Jet"); ptJetResWithPT->GetYaxis()->SetTitle("P_{T} Resolution"); ptJetResWithPT->Draw(); ptJetResCorrWithPT->SetMarkerStyle(1); ptJetResCorrWithPT->SetLineColor(2); ptJetResCorrWithPT->Draw("same"); c9->SaveAs("ptJetResWithPT.png"); TCanvas *c10 = MakeCanvas("c10", "Tau P_{T} Resolution ((reco Tau Jet P_{T} - gen Tau Jet P_{T})/gen Tau Jet P_{T})", 800, 600); ptJetResWithEta->SetMarkerStyle(1); ptJetResWithEta->GetXaxis()->SetTitle("Eta of Generator Tau Jet"); ptJetResWithEta->GetYaxis()->SetTitle("P_{T} Resolution"); ptJetResWithEta->Draw(); ptJetResCorrWithEta->SetMarkerStyle(1); ptJetResCorrWithEta->SetLineColor(2); ptJetResCorrWithEta->Draw("same"); c10->SaveAs("ptJetResWithEta.png"); */ }
void extractFlowVZERO(Int_t icentr,const char *type,Int_t arm,Float_t pTh,Bool_t isMC,Int_t addbin){ LoadLib(); char name[100]; snprintf(name,100,"AnalysisResults%s.root",type); if(!fo) fo = new TFile(name); new TCanvas(); Int_t cMin[] = {0,5,10,20,30,40,50,60,70}; Int_t cMax[] = {5,10,20,30,40,50,60,70,80}; if(kNUOcorr){ // Compute correction for NUO in TOF compareTPCTOF(icentr,0,arm,pTh,addbin); // compareTPCTOF(icentr,1,arm,pTh,addbin); // compareTPCTOF(icentr,2,arm,pTh,addbin); // compareTPCTOF(icentr,3,arm,pTh,addbin); // compareTPCTOF(icentr,4,arm,pTh,addbin); } TProfile *pAll; pAll=extractFlowVZEROsingle(icentr,0,arm,0,pTh,addbin,"all",0,1); pAll->SetMarkerStyle(24); TProfile *pPiTOF,*pPiTPC,*pPiTPC2; pPiTOF=extractFlowVZEROsingle(icentr,1,arm,0,pTh,addbin,"piTOF",1,1); pPiTPC=extractFlowVZEROsingle(icentr,1,arm,0,pTh,addbin,"piTPC",0,0); pPiTPC2=extractFlowVZEROsingle(icentr,1,arm,0,pTh,addbin,"piTPC2",2,2); pPiTPC->Add(pPiTPC2); TH1D *hPi = pPiTOF->ProjectionX("hPi"); hPi->SetLineColor(4); hPi->SetMarkerColor(4); hPi->SetMarkerStyle(20); for(Int_t i=1;i <=hPi->GetNbinsX();i++){ Float_t x = hPi->GetBinCenter(i); if(x < 0.2){ hPi->SetBinContent(i,0); hPi->SetBinError(i,0); } else if(x < 0.5){ hPi->SetBinContent(i,pPiTPC->GetBinContent(i)); hPi->SetBinError(i,pPiTPC->GetBinError(i)); } else{ if(kNUOcorr){ hPi->SetBinContent(i,pPiTOF->GetBinContent(i) + hNUO[0]->GetBinContent(i)); hPi->SetBinError(i,pPiTOF->GetBinError(i)); } else{ hPi->SetBinContent(i,pPiTOF->GetBinContent(i)); hPi->SetBinError(i,pPiTOF->GetBinError(i)); } } } TProfile *pElTOF,*pElTPC,*pElTPC2; pElTOF=extractFlowVZEROsingle(icentr,4,arm,0,pTh,addbin,"piTOF",1,1); pElTPC=extractFlowVZEROsingle(icentr,4,arm,0,pTh,addbin,"piTPC",0,0); pElTPC2=extractFlowVZEROsingle(icentr,4,arm,0,pTh,addbin,"piTPC2",2,2); pElTPC->Add(pElTPC2); TH1D *hEl = pElTOF->ProjectionX("hEl"); hEl->SetLineColor(6); hEl->SetMarkerColor(6); hEl->SetMarkerStyle(20); for(Int_t i=1;i <=hEl->GetNbinsX();i++){ Float_t x = hEl->GetBinCenter(i); if(x < 0.2){ hEl->SetBinContent(i,0); hEl->SetBinError(i,0); } else if(x < 0.3){ hEl->SetBinContent(i,pElTPC->GetBinContent(i)); hEl->SetBinError(i,pElTPC->GetBinError(i)); } else{ if(kNUOcorr){ hEl->SetBinContent(i,pElTOF->GetBinContent(i) + hNUO[0]->GetBinContent(i)); hEl->SetBinError(i,pElTOF->GetBinError(i)); } else{ hEl->SetBinContent(i,pElTOF->GetBinContent(i)); hEl->SetBinError(i,pElTOF->GetBinError(i)); } } } TProfile *pKTOF,*pKTPC,*pKTPC2; pKTOF=extractFlowVZEROsingle(icentr,2,arm,0,pTh,addbin,"kaTOF",1,1); pKTPC=extractFlowVZEROsingle(icentr,2,arm,0,pTh,addbin,"kaTPC",0,0); pKTPC2=extractFlowVZEROsingle(icentr,2,arm,0,pTh,addbin,"kaTPC2",2,2); pKTPC->Add(pKTPC2); TH1D *hK = pKTOF->ProjectionX("hKa"); hK->SetLineColor(1); hK->SetMarkerColor(1); hK->SetMarkerStyle(21); for(Int_t i=1;i <=hK->GetNbinsX();i++){ Float_t x = hK->GetBinCenter(i); if(x < 0.25){ hK->SetBinContent(i,0); hK->SetBinError(i,0); } else if(x < 0.45){ hK->SetBinContent(i,pKTPC->GetBinContent(i)); hK->SetBinError(i,pKTPC->GetBinError(i)); } else{ if(kNUOcorr){ hK->SetBinContent(i,pKTOF->GetBinContent(i) + hNUO[0]->GetBinContent(i)); hK->SetBinError(i,pKTOF->GetBinError(i)); } else{ hK->SetBinContent(i,pKTOF->GetBinContent(i)); hK->SetBinError(i,pKTOF->GetBinError(i)); } } } TProfile *pPrTOF,*pPrTOF2,*pPrTPC,*pPrTPC2; pPrTOF=extractFlowVZEROsingle(icentr,3,arm,0,pTh,addbin,"prTOF",1,1,-1,-1); pPrTOF2=extractFlowVZEROsingle(icentr,3,arm,0,pTh,addbin,"prTOF2",1,1,-1,1); pPrTPC=extractFlowVZEROsingle(icentr,3,arm,0,pTh,addbin,"prTPC",0,0,-1,-1); pPrTPC2=extractFlowVZEROsingle(icentr,3,arm,0,pTh,addbin,"prTPC2",2,2,-1,-1); pPrTPC->Add(pPrTPC2); TH1D *hPr = pPrTOF->ProjectionX("hPr"); hPr->SetLineColor(2); hPr->SetMarkerColor(2); hPr->SetMarkerStyle(22); for(Int_t i=1;i <=hPr->GetNbinsX();i++){ Float_t x = hPr->GetBinCenter(i); if(x < 0.3){ hPr->SetBinContent(i,0); hPr->SetBinError(i,0); } else if(x < 1.0){ hPr->SetBinContent(i,pPrTPC->GetBinContent(i)); hPr->SetBinError(i,pPrTPC->GetBinError(i)); } else{ if(x < 3){ if(kNUOcorr){ hPr->SetBinContent(i,pPrTOF->GetBinContent(i) + hNUO[0]->GetBinContent(i)); hPr->SetBinError(i,pPrTOF->GetBinError(i)); } else{ hPr->SetBinContent(i,pPrTOF->GetBinContent(i)); hPr->SetBinError(i,pPrTOF->GetBinError(i)); } } else{ if(kNUOcorr){ hPr->SetBinContent(i,pPrTOF2->GetBinContent(i) + hNUO[0]->GetBinContent(i)); hPr->SetBinError(i,pPrTOF2->GetBinError(i)); } else{ hPr->SetBinContent(i,pPrTOF2->GetBinContent(i)); hPr->SetBinError(i,pPrTOF2->GetBinError(i)); } } } } pAll->Draw(); hPi->Draw("SAME"); hK->Draw("SAME"); hPr->Draw("SAME"); char name[100]; // PID correction if(kPIDcorr){ TFile *fPidTOF = new TFile("$ALICE_ROOT/PWGCF/FLOW/other/BayesianPIDcontTPCTOF.root"); TFile *fPidTPC = new TFile("$ALICE_ROOT/PWGCF/FLOW/other/BayesianPIDcontTPC.root"); // pi histos sprintf(name,"Pi_IDas_Picentr%i_pth%4.2f",icentr,pTh); TH1D *hPidPiPi=(TH1D *) fPidTOF->Get(name); sprintf(name,"Pi_IDas_Elcentr%i_pth%4.2f",icentr,pTh); TH1D *hPidPiEl=(TH1D *) fPidTOF->Get(name); sprintf(name,"Pi_IDas_Kacentr%i_pth%4.2f",icentr,pTh); TH1D *hPidPiKa=(TH1D *) fPidTOF->Get(name); sprintf(name,"Pi_IDas_Prcentr%i_pth%4.2f",icentr,pTh); TH1D *hPidPiPr=(TH1D *) fPidTOF->Get(name); TH1D *hPidAll = new TH1D(*hPidPiPi); hPidAll->Add(hPidPiKa); hPidAll->Add(hPidPiPr); hPidAll->Add(hPidPiEl); hPidPiPi->Divide(hPidAll); hPidPiKa->Divide(hPidAll); hPidPiPr->Divide(hPidAll); hPidPiEl->Divide(hPidAll); sprintf(name,"Pi_IDas_Picentr%i_pth%4.2f",icentr,pTh); TH1D *hPidPiPiTPC=(TH1D *) fPidTPC->Get(name); sprintf(name,"Pi_IDas_Elcentr%i_pth%4.2f",icentr,pTh); TH1D *hPidPiElTPC=(TH1D *) fPidTPC->Get(name); sprintf(name,"Pi_IDas_Kacentr%i_pth%4.2f",icentr,pTh); TH1D *hPidPiKaTPC=(TH1D *) fPidTPC->Get(name); sprintf(name,"Pi_IDas_Prcentr%i_pth%4.2f",icentr,pTh); TH1D *hPidPiPrTPC=(TH1D *) fPidTPC->Get(name); hPidAll->Reset(); hPidAll->Add(hPidPiPiTPC); hPidAll->Add(hPidPiKaTPC); hPidAll->Add(hPidPiPrTPC); hPidAll->Add(hPidPiElTPC); hPidPiPiTPC->Divide(hPidAll); hPidPiKaTPC->Divide(hPidAll); hPidPiPrTPC->Divide(hPidAll); hPidPiElTPC->Divide(hPidAll); // K histos sprintf(name,"Ka_IDas_Picentr%i_pth%4.2f",icentr,pTh); TH1D *hPidKaPi=(TH1D *) fPidTOF->Get(name); sprintf(name,"Ka_IDas_Elcentr%i_pth%4.2f",icentr,pTh); TH1D *hPidKaEl=(TH1D *) fPidTOF->Get(name); sprintf(name,"Ka_IDas_Kacentr%i_pth%4.2f",icentr,pTh); TH1D *hPidKaKa=(TH1D *) fPidTOF->Get(name); sprintf(name,"Ka_IDas_Prcentr%i_pth%4.2f",icentr,pTh); TH1D *hPidKaPr=(TH1D *) fPidTOF->Get(name); hPidAll->Reset(); hPidAll->Add(hPidKaPi); hPidAll->Add(hPidKaKa); hPidAll->Add(hPidKaPr); hPidAll->Add(hPidKaEl); hPidKaPi->Divide(hPidAll); hPidKaKa->Divide(hPidAll); hPidKaPr->Divide(hPidAll); hPidKaEl->Divide(hPidAll); sprintf(name,"Ka_IDas_Picentr%i_pth%4.2f",icentr,pTh); TH1D *hPidKaPiTPC=(TH1D *) fPidTPC->Get(name); sprintf(name,"Ka_IDas_Elcentr%i_pth%4.2f",icentr,pTh); TH1D *hPidKaElTPC=(TH1D *) fPidTPC->Get(name); sprintf(name,"Ka_IDas_Kacentr%i_pth%4.2f",icentr,pTh); TH1D *hPidKaKaTPC=(TH1D *) fPidTPC->Get(name); sprintf(name,"Ka_IDas_Prcentr%i_pth%4.2f",icentr,pTh); TH1D *hPidKaPrTPC=(TH1D *) fPidTPC->Get(name); hPidAll->Reset(); hPidAll->Add(hPidKaPiTPC); hPidAll->Add(hPidKaKaTPC); hPidAll->Add(hPidKaPrTPC); hPidAll->Add(hPidKaElTPC); hPidKaPiTPC->Divide(hPidAll); hPidKaKaTPC->Divide(hPidAll); hPidKaPrTPC->Divide(hPidAll); hPidKaElTPC->Divide(hPidAll); // pr histos sprintf(name,"Pr_IDas_Picentr%i_pth%4.2f",icentr,pTh); TH1D *hPidPrPi=(TH1D *) fPidTOF->Get(name); sprintf(name,"Pr_IDas_Elcentr%i_pth%4.2f",icentr,pTh); TH1D *hPidPrEl=(TH1D *) fPidTOF->Get(name); sprintf(name,"Pr_IDas_Kacentr%i_pth%4.2f",icentr,pTh); TH1D *hPidPrKa=(TH1D *) fPidTOF->Get(name); sprintf(name,"Pr_IDas_Prcentr%i_pth%4.2f",icentr,pTh); TH1D *hPidPrPr=(TH1D *) fPidTOF->Get(name); hPidAll->Reset(); hPidAll->Add(hPidPrPi); hPidAll->Add(hPidPrKa); hPidAll->Add(hPidPrPr); hPidAll->Add(hPidPrEl); hPidPrPi->Divide(hPidAll); hPidPrKa->Divide(hPidAll); hPidPrPr->Divide(hPidAll); hPidPrEl->Divide(hPidAll); sprintf(name,"Pr_IDas_Picentr%i_pth%4.2f",icentr,pTh); TH1D *hPidPrPiTPC=(TH1D *) fPidTPC->Get(name); sprintf(name,"Pr_IDas_Elcentr%i_pth%4.2f",icentr,pTh); TH1D *hPidPrElTPC=(TH1D *) fPidTPC->Get(name); sprintf(name,"Pr_IDas_Kacentr%i_pth%4.2f",icentr,pTh); TH1D *hPidPrKaTPC=(TH1D *) fPidTPC->Get(name); sprintf(name,"Pr_IDas_Prcentr%i_pth%4.2f",icentr,pTh); TH1D *hPidPrPrTPC=(TH1D *) fPidTPC->Get(name); hPidAll->Reset(); hPidAll->Add(hPidPrPiTPC); hPidAll->Add(hPidPrKaTPC); hPidAll->Add(hPidPrPrTPC); hPidAll->Add(hPidPrElTPC); hPidPrPiTPC->Divide(hPidAll); hPidPrKaTPC->Divide(hPidAll); hPidPrPrTPC->Divide(hPidAll); hPidPrElTPC->Divide(hPidAll); for(Int_t k=1;k <=hPi->GetNbinsX();k++){ Float_t pt = hPi->GetBinCenter(k); Float_t xPi=hPi->GetBinContent(k)*hPidPiPi->Interpolate(pt) + hK->GetBinContent(k)*hPidPiKa->Interpolate(pt) + hPr->GetBinContent(k)*hPidPiPr->Interpolate(pt) + hEl->GetBinContent(k)*hPidPiEl->Interpolate(pt); if(pt < 0.5) xPi=hPi->GetBinContent(k)*hPidPiPiTPC->Interpolate(pt) + hK->GetBinContent(k)*hPidPiKaTPC->Interpolate(pt) + hPr->GetBinContent(k)*hPidPiPrTPC->Interpolate(pt) + hEl->GetBinContent(k)*hPidPiElTPC->Interpolate(pt); Float_t xKa=hPi->GetBinContent(k)*hPidKaPi->Interpolate(pt) + hK->GetBinContent(k)*hPidKaKa->Interpolate(pt) + hPr->GetBinContent(k)*hPidKaPr->Interpolate(pt) + hEl->GetBinContent(k)*hPidKaEl->Interpolate(pt); if(pt < 0.45) xKa=hPi->GetBinContent(k)*hPidKaPiTPC->Interpolate(pt) + hK->GetBinContent(k)*hPidKaKaTPC->Interpolate(pt) + hPr->GetBinContent(k)*hPidKaPrTPC->Interpolate(pt) + hEl->GetBinContent(k)*hPidKaElTPC->Interpolate(pt); Float_t xPr=hPi->GetBinContent(k)*hPidPrPi->Interpolate(pt) + hK->GetBinContent(k)*hPidPrKa->Interpolate(pt) + hPr->GetBinContent(k)*hPidPrPr->Interpolate(pt) + hEl->GetBinContent(k)*hPidPrEl->Interpolate(pt); if(pt < 1) xPr=hPi->GetBinContent(k)*hPidPrPiTPC->Interpolate(pt) + hK->GetBinContent(k)*hPidPrKaTPC->Interpolate(pt) + hPr->GetBinContent(k)*hPidPrPrTPC->Interpolate(pt) + hEl->GetBinContent(k)*hPidPrElTPC->Interpolate(pt); hPi->SetBinContent(k,hPi->GetBinContent(k)*2 - xPi); hK->SetBinContent(k,hK->GetBinContent(k)*2 - xKa); hPr->SetBinContent(k,hPr->GetBinContent(k)*2 - xPr); } } // antiproton Feed down TProfile *pFromLambda = extractFlowVZEROsingle(icentr,11,arm,0,pTh,addbin,"pFromLambda",1,1); TProfile *piFromK = extractFlowVZEROsingle(icentr,12,arm,0,pTh,addbin,"piFromK",1,1,1,1); TProfile *pFromLambda2 = extractFlowVZEROsingle(icentr,11,arm,0,0.6,addbin,"pFromLambdanoPID",0,1); TProfile *piFromK2 = extractFlowVZEROsingle(icentr,12,arm,0,0.6,addbin,"piFromKnoPID",0,1); TProfile *piFromK3 = extractFlowVZEROsingle(icentr,12,arm,0,0.6,addbin,"piFromKnoPIDtof",1,1); TH1D *hFeedSyst = NULL; if(kFEEDcorr){ hFeedSyst = new TH1D(*hPr); hFeedSyst->SetName("hFeedSyst"); hFeedSyst->Reset(); for(Int_t k=1;k <=hPr->GetNbinsX();k++){ Float_t contam = 3.23174e-01 * TMath::Exp(- 9.46743e-01 * hPr->GetBinCenter(k)); Float_t corr = contam * pFromLambda->GetBinContent(k)/(1-contam); Float_t corrErr = contam * pFromLambda->GetBinError(k)/(1-contam); Float_t value = hPr->GetBinContent(k)/(1-contam) - corr; Float_t valueErr = hPr->GetBinError(k)/(1-contam); hFeedSyst->SetBinContent(k,hPr->GetBinContent(k) - value); hFeedSyst->SetBinContent(k,sqrt(corrErr*corrErr + valueErr*valueErr - hPr->GetBinError(k)*hPr->GetBinError(k))); hPr->SetBinContent(k,value); hPr->SetBinError(k,sqrt(corrErr*corrErr + valueErr*valueErr)); } hFeedSyst->Divide(hPr); } // write output snprintf(name,100,"results%03i-%03iv%i_pTh%3.1f%s.root",cMin[icentr],cMax[icentr+addbin],arm,pTh,type); TFile *fout = new TFile(name,"RECREATE"); pAll->ProjectionX()->Write(); hPi->Write(); hK->Write(); hPr->Write(); if(isMC){ TH1D *pTmp = extractFlowVZEROsingle(icentr,0,arm,1,pTh,addbin,"allMC",1,1,-1,1)->ProjectionX(); pTmp->SetLineColor(6); pTmp->SetMarkerColor(6); pTmp->SetMarkerStyle(24); pTmp->Write(); pTmp = extractFlowVZEROsingle(icentr,1,arm,1,pTh,addbin,"piMC",1,1,-1,1)->ProjectionX(); pTmp->SetLineColor(4); pTmp->SetMarkerColor(4); pTmp->SetMarkerStyle(24); pTmp->Write(); pTmp = extractFlowVZEROsingle(icentr,2,arm,1,pTh,addbin,"kaMC",1,1,-1,1)->ProjectionX(); pTmp->SetLineColor(1); pTmp->SetMarkerColor(1); pTmp->SetMarkerStyle(25); pTmp->Write(); pTmp = extractFlowVZEROsingle(icentr,3,arm,1,pTh,addbin,"prMC",1,1,-1,-1)->ProjectionX(); pTmp->SetLineColor(2); pTmp->SetMarkerColor(2); pTmp->SetMarkerStyle(26); pTmp->Write(); } extractFlowVZEROsingle(icentr,2,arm,0,pTh,addbin,"kProf")->Write(); extractFlowVZEROsingle(icentr,9,arm,0,pTh,addbin,"ks",0,1,1,1)->Write(); extractFlowVZEROsingle(icentr,9,arm,0,pTh,addbin,"ksMy",0,1,-1,-1)->Write(); extractFlowVZEROsingle(icentr,10,arm,0,pTh,addbin,"lambda")->Write(); pFromLambda->Write(); piFromK->Write(); pFromLambda2->Write(); piFromK2->Write(); piFromK3->Write(); if(hFeedSyst) hFeedSyst->Write(); fout->Close(); }
void makePlot(char* canv) { t->SetBranchAddress("LM_PX1", &intree.LM_PX1); t->SetBranchAddress("LM_PX2", &intree.LM_PX2); t->SetBranchAddress("LM_PY1", &intree.LM_PY1); t->SetBranchAddress("LM_PY2", &intree.LM_PY2); t->SetBranchAddress("LM_P2_Integral", &intree.LM_P2_Integral); t->SetBranchAddress("time", &intree.timeline); t->Print(); if(entries<=0) entries = t->GetEntries(); char title[100]=0; sprintf(title,"%s runs 1100-1107",canv); TProfile *prof = new TProfile(title,title,24,0,entries); TProfile *prof1 = new TProfile(title,title,24,0,entries); TProfile *prof2 = new TProfile(title,title,24,0,entries); /************************************** * read entries ************************************** */ Double_t *ratio = new Double_t[entries]; Double_t *parmean = new Double_t[entries]; Double_t *p1 = new Double_t[entries]; Double_t *p2 = new Double_t[entries]; for (int j = 0; j < entries; ++j){ gSystem->Sleep (sleep); t->GetEntry(j); ratio[j] = intree.LM_PY1/intree.LM_PY2; p1[j] = intree.LM_PY1; p2[j] = intree.LM_PY2; //cout<<"entry "<<j<<" peak2 "<<intree.LM_PY2<<endl; } Double_t mean = TMath::Mean(entries,ratio); Double_t mean1 = TMath::Mean(entries,p1); Double_t mean2 = TMath::Mean(entries,p2); for (int j = 0; j < entries; ++j){ prof->Fill(j,(ratio[j]/mean-1)*100); prof1->Fill(j,(p1[j]/mean1-1)*100); prof2->Fill(j,(p2[j]/mean2-1)*100); } TCanvas *c1 = new TCanvas(canv,"frascatirun",900,700); c1->cd(); char axisXname[100]; sprintf(axisXname,"Time (Entries) (total: %i)",entries); prof->SetXTitle(axisXname); prof->SetYTitle("Variation (%)"); prof->SetMaximum(1); prof->SetMinimum(-1); prof->SetMarkerColor(4); prof->SetMarkerSize(1); prof->SetMarkerStyle(8); prof->SetStats(kFALSE); prof->Draw(); prof1->SetMarkerColor(5); prof1->SetMarkerSize(1); prof1->SetMarkerStyle(6); prof1->Draw("same"); prof2->SetMarkerColor(1); prof2->SetMarkerSize(1); prof2->SetMarkerStyle(7); prof2->Draw("same"); /* TLegend leg = new TLegend(0.1,0.7,0.48,0.9); leg->SetHeader("The Legend Title"); leg->AddEntry(h1,"Histogram filled with random numbers","f"); leg->AddEntry("f1","Function abs(#frac{sin(x)}{x})","l"); leg->AddEntry("gr","Graph with error bars","lep"); leg->Draw("same"); */ }
void ntuple1() { //Small tree analysis script // To see the output of this macro, click begin_html <a href="gif/ntuple1.gif">here</a> end_html //Author:: Rene Brun //just in case this script is executed multiple times delete gROOT->GetListOfFiles()->FindObject("hsimple.root"); delete gROOT->GetListOfCanvases()->FindObject("c1"); gBenchmark->Start("ntuple1"); // // Connect ROOT histogram/ntuple demonstration file // generated by example $ROOTSYS/tutorials/hsimple.C. TFile *f1 = TFile::Open("hsimple.root"); if (!f1) return; // // Create a canvas, with 4 pads // TCanvas *c1 = new TCanvas("c1","The Ntuple canvas",200,10,700,780); TPad *pad1 = new TPad("pad1","This is pad1",0.02,0.52,0.48,0.98,21); TPad *pad2 = new TPad("pad2","This is pad2",0.52,0.52,0.98,0.98,21); TPad *pad3 = new TPad("pad3","This is pad3",0.02,0.02,0.48,0.48,21); TPad *pad4 = new TPad("pad4","This is pad4",0.52,0.02,0.98,0.48,1); pad1->Draw(); pad2->Draw(); pad3->Draw(); pad4->Draw(); // // Change default style for the statistics box gStyle->SetStatW(0.30); gStyle->SetStatH(0.20); gStyle->SetStatColor(42); // // Display a function of one ntuple column imposing a condition // on another column. pad1->cd(); pad1->SetGrid(); pad1->SetLogy(); pad1->GetFrame()->SetFillColor(15); TNtuple *ntuple = (TNtuple*)f1->Get("ntuple"); ntuple->SetLineColor(1); ntuple->SetFillStyle(1001); ntuple->SetFillColor(45); ntuple->Draw("3*px+2","px**2+py**2>1"); ntuple->SetFillColor(38); ntuple->Draw("2*px+2","pz>2","same"); ntuple->SetFillColor(5); ntuple->Draw("1.3*px+2","(px^2+py^2>4) && py>0","same"); pad1->RedrawAxis(); // // Display the profile of two columns // The profile histogram produced is saved in the current directory with // the name hprofs pad2->cd(); pad2->SetGrid(); pad2->GetFrame()->SetFillColor(32); ntuple->Draw("pz:px>>hprofs","","goffprofs"); TProfile *hprofs = (TProfile*)gDirectory->Get("hprofs"); hprofs->SetMarkerColor(5); hprofs->SetMarkerSize(0.7); hprofs->SetMarkerStyle(21); hprofs->Fit("pol2"); // Get pointer to fitted function and modify its attributes TF1 *fpol2 = hprofs->GetFunction("pol2"); fpol2->SetLineWidth(4); fpol2->SetLineColor(2); // // Display a scatter plot of two columns with a selection. // Superimpose the result of another cut with a different marker color pad3->cd(); pad3->GetFrame()->SetFillColor(38); pad3->GetFrame()->SetBorderSize(8); ntuple->SetMarkerColor(1); ntuple->Draw("py:px","pz>1"); ntuple->SetMarkerColor(2); ntuple->Draw("py:px","pz<1","same"); // // Display a 3-D scatter plot of 3 columns. Superimpose a different selection. pad4->cd(); ntuple->Draw("pz:py:px","(pz<10 && pz>6)+(pz<4 && pz>3)"); ntuple->SetMarkerColor(4); ntuple->Draw("pz:py:px","pz<6 && pz>4","same"); ntuple->SetMarkerColor(5); ntuple->Draw("pz:py:px","pz<4 && pz>3","same"); TPaveText *l4 = new TPaveText(-0.9,0.5,0.9,0.95); l4->SetFillColor(42); l4->SetTextAlign(12); l4->AddText("You can interactively rotate this view in 2 ways:"); l4->AddText(" - With the RotateCube in clicking in this pad"); l4->AddText(" - Selecting View with x3d in the View menu"); l4->Draw(); // c1->cd(); c1->Update(); gStyle->SetStatColor(19); gBenchmark->Show("ntuple1"); }
void plotMETVsJetPhi(int num=-1) { char *title=""; if (num!=-1) { title = Form("%d",num); } TFile *inf = new TFile("nt_dj_mix100_Gen.root"); TTree *tGen = (TTree*) inf->FindObjectAny("ntjt"); tGen->SetName("gen"); TFile *inf2 = new TFile("nt_dj_mix100.root"); TTree *tReco = (TTree*) inf2->FindObjectAny("ntjt"); tReco->SetName("reco"); TFile *inf3 = new TFile("nt_dj_HyUQ80v4_djcalo_genp_100_50.root"); TTree *tGen2 = (TTree*) inf3->FindObjectAny("ntjt"); tGen2->SetName("gen2"); TFile *inf4 = new TFile("dj_HyUQ80v4_djcalo_genp_100_50.root"); TTree *tDj = (TTree*) inf4->FindObjectAny("djTree"); tDj->SetName("dj"); TFile *inf5 = new TFile("nt_dj_data100_cor.root"); TTree *tRecoData = (TTree*) inf5->FindObjectAny("ntjt"); tRecoData->SetName("data"); TFile *inf6 = new TFile("dj_HCPR-J50U-hiGoodMergedTracks_OfficialSelv2_Final0_djcalo_100_50.root"); TTree *tDjData = (TTree*) inf6->FindObjectAny("djTree"); tDjData->SetName("djdata"); tGen->AddFriend(tReco); tGen->AddFriend(tGen2); tGen->AddFriend(tDj); tRecoData->AddFriend(tDjData); setupAlias(tGen); setupAlias(tReco); const int nBin = 10; double delta = 0.0; //shift // double Bins[nBin+1] = {0,1,2,2.2,2.4,2.6,2.8,3,PI}; // double BinsMC[nBin+1] = {0+delta,1+delta,2+delta,2.2+delta,2.4+delta,2.6+delta,2.8+delta,3+delta,PI+delta}; double Bins[nBin+1]; double BinsMC[nBin+1]; for (int i=0;i<nBin+1;i++) { Bins[i]=-PI+2*PI/(double)nBin*i; BinsMC[i]=-PI+2*PI/(double)nBin*i+delta; cout <<Bins[i]<<endl; } const int nPtBin = 6; double ptBins[nPtBin+1] = {0.5,1.0,1.5,4,8,20,1000}; TCanvas *c = new TCanvas("c","",600,600); TProfile *p = new TProfile("p","",nBin,BinsMC); TProfile *p2 = new TProfile("p2","",nBin,BinsMC); TProfile *p3 = new TProfile("p3","",nBin,BinsMC); TProfile *p4 = new TProfile("p4","",nBin,Bins); TCut evtCut = "nljet>120&&abs(nljetacorr)<1.6&&aljet>50&&abs(aljetacorr)<1.6&&!maskEvt&¢<30&&abs(jdphi)>2./3.*3.14159"; tGen->Draw(Form("-gen.metOutOfConex%s:nljphi+0.0>>p",title),"weight"*evtCut); tGen->Draw(Form("-gen2.metOutOfConex%s:nljphi+0.0>>p2",title),"weight"*evtCut); tGen->Draw(Form("-reco.metOutOfConex%s:nljphi+0.0>>p3",title),"weight"*evtCut); tRecoData->Draw(Form("-metOutOfConex%s:nljphi>>p4",title),"1"*evtCut); p->SetMarkerStyle(24); p2->SetMarkerStyle(25); p3->SetMarkerStyle(26); p4->SetMarkerStyle(20); p->SetAxisRange(-80,120,"Y"); p->Draw(); p2->SetMarkerColor(2); p2->SetLineColor(2); p3->SetMarkerColor(4); p3->SetLineColor(4); p2->Draw("same"); p3->Draw("same"); p4->Draw("same"); TLine *l = new TLine(Bins[0],0,PI,0); l->Draw(); p->SetXTitle("#phi_{Leading Jet}"); p->SetYTitle("<#slash{p}_{T}^{#parallel}> (GeV/c)"); // ==================== TLegend *leg = new TLegend(0.45,0.68,0.92,0.9); leg->SetFillStyle(0); leg->SetBorderSize(0); leg->SetTextFont(63); leg->SetTextSize(16); leg->AddEntry("p","Jets with |#eta|<1.6",""); if (num!=-1) { leg->AddEntry("p",Form("Tracks with %.1f<p_{T}<%.1f GeV/c",ptBins[num],ptBins[num+1]),""); } else { leg->AddEntry("p",Form("Tracks with %.1f<p_{T}<%.1f GeV/c",ptBins[0],ptBins[nPtBin]),""); } leg->AddEntry("p","#slash{p}_{T}^{#parallel} PYTHIA+HYDJET GEN Signal","pl"); leg->AddEntry("p2","#slash{p}_{T}^{#parallel} PYTHIA+HYDJET GEN S+B","pl"); leg->AddEntry("p3","#slash{p}_{T}^{#parallel} PYTHIA+HYDJET RECO","pl"); leg->AddEntry("p4","#slash{p}_{T}^{#parallel} Data RECO","pl"); leg->Draw(); c->SaveAs(Form("metOutOfCone%sVsJetPhi.gif",title)); c->SaveAs(Form("metOutOfCone%sVsJetPhi.eps",title)); }
void draw_clouds_profiles() { // gROOT->ProcessLine(".L ../utils.C"); // gROOT->ProcessLine(".L AliLRCFit.cxx"); TFile *f[8]; // f[0] = new TFile( "output_classesByV0M_LHC10h.root" ); // f[0] = new TFile( "output_classesByV0M_LHC10h_c10_5_1.root" ); f[0] = new TFile( "output_classesByV0M_LHC10h_c10_5_25_1_05.root" ); // f[0] = new TFile( "output_classesByV0M_LHC11h_FemtoPlus_c10_5_CUT_OUTLIERS.root" ); // f[0] = new TFile( "output_classesByV0M_LHC15o_fieldMM_c10_5_CUT_OUTLIERS.root" ); // f[0] = new TFile( "output_classesByV0M_LHC15o_fieldPP_c10_5_CUT_OUTLIERS.root" ); // const int nCW = 2; //nCentrWidths // const double cWidths[nCW] = { 10, 5 }; //width of the centrality bins // const double cStep[nCW] = { 5, 2.5 }; //centrality bins step // const int nCentrBins[nCW] = { 17, 35 }; //n centrality bins // const int nCW = 3; //nCentrWidths // const double cWidths[nCW] = { 10, 5, 1.0 }; //width of the centrality bins // const double cStep[nCW] = { 5, 2.5, 1.0 }; //centrality bins step // const int nCentrBins[nCW] = { 17, 35, 90 }; //n centrality bins // const int nCW = 4; //nCentrWidths // const double cWidths[nCW] = { 10, 5, 1.0, 0.5 }; //width of the centrality bins // const double cStep[nCW] = { 5, 2.5, 1.0, 1.0 }; //centrality bins step // const int nCentrBins[nCW] = { 17, 35, 90, 90 }; //n centrality bins const int nCW = 5; //nCentrWidths const double cWidths[nCW] = { 10, 5, 2.5, 1.0, 0.5 }; //width of the centrality bins const double cStep[nCW] = { 5, 2.5, 2.5, 1.0, 1.0 }; //centrality bins step const int nCentrBins[nCW] = { 17, 35, 36, 90, 90 }; //n centrality bins TH2D *hist2D;//[200][3]; TProfile *profile;//[200][3]; int cW = 2; int etaW = 1; int phiW = 0; const int kCorrType = 1; //0-NN, 1-PtPt, 2-PtN TCanvas *canv_tmp_for_fit = new TCanvas("canv_tmp_for_fit","canv_tmp_for_fit",50,50,300,300 ); TCanvas *canv_2D_clouds = new TCanvas("canv_2D_clouds","canv_2D_clouds",150,250,1400,600 ); tuneCanvas(canv_2D_clouds); canv_2D_clouds->Divide(2,1); gStyle->SetOptStat( kFALSE ); TGraph *grFromFit2D = new TGraph; bool firstDraw = true; // for ( int cBin = 0; cBin < nCentrBins[cW]; cBin++ ) for ( int cBin = nCentrBins[cW]-1; cBin >= 0; cBin-- ) { if (cBin%2!=0) continue; // cout << "cBin=" << cBin << endl; float cBinMin = cStep[cW] * cBin; float cBinMax = cWidths[cW] + cStep[cW] * cBin; // ##### pad 1 - clouds tunePad( canv_2D_clouds->cd(1) ); if ( kCorrType == 0 ) { hist2D = (TH2D*)f[0]->Get( Form("hist2D_NN_c%.1f-%.1f_etaW_%d_phiW_%d", cBinMin, cBinMax, etaW, phiW) ); hist2D->SetTitle( ""); hist2D->GetXaxis()->SetTitle( "N_{ch} Forward"); hist2D->GetYaxis()->SetTitle( "N_{ch} Backward"); hist2D->GetXaxis()->SetRangeUser(0,650); hist2D->GetYaxis()->SetRangeUser(0,650); } else if ( kCorrType == 1 ) { hist2D = (TH2D*)f[0]->Get( Form("hist2D_PtPt_c%.1f-%.1f_etaW_%d_phiW_%d", cBinMin, cBinMax, etaW, phiW) ); hist2D->SetTitle( ""); hist2D->GetXaxis()->SetTitle( "#LTp_{T}#GT Forward"); hist2D->GetYaxis()->SetTitle( "#LTp_{T}#GT Backward"); } hist2D->SetMarkerColor(kOrange-9+cBin); tuneHist2D_onPad(hist2D); hist2D->GetXaxis()->CenterTitle(); hist2D->GetYaxis()->CenterTitle(); // removeBinsWithFewEntries(hist2D); hist2D->DrawCopy( firstDraw ? "" : "same" ); // ##### pad 2 - profiles tunePad( canv_2D_clouds->cd(2) ); profile = hist2D->ProfileX(); //(TProfile*)f[0]->Get( Form("hist2D_c%.1f-%.1f_etaW_%d_phiW_%d_pfx", cBinMin, cBinMax, etaW, phiW) ); if ( kCorrType == 0 ) { profile->SetTitle( ""); profile->GetYaxis()->SetTitle( "#LTN_{ch}#GT Backward"); profile->GetXaxis()->SetRangeUser(0,650); profile->GetYaxis()->SetRangeUser(0,650); } else if ( kCorrType == 1 ) { profile->SetTitle( ""); profile->GetYaxis()->SetTitle( "#LT#LTp_{T}#GT#GT Backward"); } profile->SetLineColor(kOrange-9+cBin); profile->SetMarkerStyle(7); tuneProfile_onPad( profile ); profile->GetYaxis()->CenterTitle(); deleteProfileEmptyBinErrors(profile); canv_tmp_for_fit->cd(); profile->Fit("pol1","Q");//,"",0.25,1.2);//,"N"); canv_2D_clouds->cd(2); TF1 *fit = profile->GetFunction("pol1"); Double_t p0 = fit->GetParameter(0); Double_t p1 = fit->GetParameter(1); grFromFit2D->SetPoint(grFromFit2D->GetN(), (cBinMax+cBinMin)/2, p1); double meanX = hist2D->ProjectionX()->GetMean(); double rmsX = hist2D->ProjectionX()->GetRMS(); fit->SetRange( meanX-3*rmsX, meanX+3*rmsX ); fit->SetLineColorAlpha( kRed, 0.6 ); fit->Draw("same"); profile->DrawCopy( firstDraw ? "" : "same" ); firstDraw = false; } TGraphErrors *grByFormula; /*[cW][etaW]*/ if ( kCorrType == 0 ) { grByFormula = (TGraphErrors*)f[0]->Get( Form( "grNN_c%d_eta%d", cW, etaW ) ); } else if ( kCorrType == 1 ) { grByFormula = (TGraphErrors*)f[0]->Get( Form( "grPtPt_c%d_eta%d", cW, etaW ) ); } TCanvas *canv_GrCoeff = new TCanvas("canv_GrCoeff","canv_GrCoeff",20,150,900,700 ); grByFormula->Draw("APL"); grFromFit2D->SetLineColor(kRed); grFromFit2D->DrawClone("PL"); return; TGraphErrors *gr[10][10]; for ( int cW = 0; cW < 2; cW++ ) for ( int etaW = 0; etaW < 3; etaW++ ) gr[cW][etaW] = (TGraphErrors*)f[0]->Get( Form( "grPtPt_c%d_eta%d", cW, etaW ) ); drawGraph( gr[1][0], 24, kBlack, "APL" ); drawGraph( gr[0][0], 20, kBlack, "PL" ); // drawGraph( gr[1][1], 24, kBlue, "PL" ); // drawGraph( gr[0][1], 20, kBlue, "PL" ); // drawGraph( gr[1][2], 24, kGreen, "PL" ); // drawGraph( gr[0][2], 20, kGreen, "PL" ); //// drawGraph( gr[6], 24, kRed, "PL" ); // drawGraph( gr[7], 20, kRed, "PL" ); f[1] = new TFile( "output_histos_graphs_LHC15o_fieldMM.root" ); TGraphErrors *grMM[10][10]; for ( int cW = 0; cW < 2; cW++ ) for ( int etaW = 0; etaW < 3; etaW++ ) grMM[cW][etaW] = (TGraphErrors*)f[1]->Get( Form( "grPtPt_c%d_eta%d", cW, etaW ) ); drawGraph( grMM[1][0], 24, kGreen, "PL" ); drawGraph( grMM[0][0], 20, kGreen, "PL" ); // drawGraph( grMM[1][1], 24, kRed, "PL" ); // drawGraph( grMM[0][1], 20, kRed, "PL" ); // drawGraph( grMM[1][2], 24, kGreen, "PL" ); // drawGraph( grMM[0][2], 20, kGreen, "PL" ); // gROOT->ProcessLine( ".q"); }