void stack_zMuTrkMu() { /// cuts common.... TCut kin_common("zMuTrkMuDau1Pt> 20 && zMuTrkMuDau2Pt>20 && zMuTrkMuDau1Iso03SumPt<3.0 && zMuTrkMuDau2Iso03SumPt < 3.0 && abs(zMuTrkMuDau1Eta)<2.4 && abs(zMuTrkMuDau2Eta)<2.4 && (zMuTrkMuDau1HLTBit==1 || zMuTrkMuDau2HLTBit==1) && abs(zMuTrkMuDau1dxyFromBS)<0.2 && abs(zMuTrkMuDau2dxyFromBS)<0.2"); TCut dau1Loose("zMuTrkMuDau1GlobalMuonBit==0 && zMuTrkMuDau1TrkChi2<10 && (zMuTrkMuDau1TrkNofStripHits + zMuTrkMuDau1TrkNofPixelHits)>10 && zMuTrkMuDau1TrkNofPixelHits > 0"); TCut dau2Loose("zMuTrkMuDau2GlobalMuonBit==0 && zMuTrkMuDau2TrkChi2<10 && (zMuTrkMuDau2TrkNofStripHits + zMuTrkMuDau2TrkNofPixelHits)>10 && zMuTrkMuDau2TrkNofPixelHits > 0"); TCut dau1TightWP2_hltAlso("zMuTrkMuDau1GlobalMuonBit==1 && zMuTrkMuDau1Chi2<10 && (zMuTrkMuDau1NofStripHits + zMuTrkMuDau1NofPixelHits)>10 && zMuTrkMuDau1NofMuonHits>0 && zMuTrkMuDau1NofMuMatches>1 && zMuTrkMuDau1TrackerMuonBit==1 && zMuTrkMuDau1HLTBit==1"); TCut dau2TightWP2_hltAlso("zMuTrkMuDau2GlobalMuonBit==1 && zMuTrkMuDau2Chi2<10 && (zMuTrkMuDau2NofStripHits + zMuTrkMuDau2NofPixelHits)>10 && zMuTrkMuDau2NofMuonHits>0 && zMuTrkMuDau2NofMuMatches>1 && zMuTrkMuDau2TrackerMuonBit==1 && zMuTrkMuDau2HLTBit==1"); TCut massCut("zMuTrkMuMass>60 && zMuTrkMuMass<120 "); makePlots("zMuTrkMuMass", "", kin_common + (( dau1TightWP2_hltAlso && dau2Loose ) || (dau2TightWP2_hltAlso + dau1Loose)), 5, "zMuTrkMu", 0.0001, 200, 0 ,200, true, true); // makePlots("zMuTrkMuMass", "", kin_common + dau1TightWP1_hltAlso , 5, "zMuTrkMu", 0.001, 200, 0 ,200, true); //makePlots("zMuTrkMuMass", "", kin_common, 5, "zMuTrkMu", 0.001, 200, 0 ,200, true); }
void stack_zMuTrk() { /// cuts common.... TCut kin_common("zMuTrkDau1Pt>20 && zMuTrkDau2Pt>20 && zMuTrkDau1TrkIso<3.0 && zMuTrkDau2TrkIso<3.0 && abs(zMuTrkDau1Eta)<2.1 && abs(zMuTrkDau2Eta)<2.1 && (zMuTrkDau1HLTBit==1) && abs(zMuTrkDau1dxyFromBS)<0.2 && abs(zMuTrkDau2dxyFromBS)<0.2"); TCut dau2Loose("zMuTrkDau2TrkChi2<10 && (zMuTrkDau2TrkNofStripHits + zMuTrkDau2TrkNofPixelHits)>10 && zMuTrkDau2TrkNofPixelHits > 0"); TCut dau1TightWP2_hltAlso("zMuTrkDau1GlobalMuonBit==1 && zMuTrkDau1Chi2<10 && (zMuTrkDau1NofStripHits + zMuTrkDau1NofPixelHits)>10 && zMuTrkDau1NofMuonHits>0 && zMuTrkDau1NofMuMatches>1 && zMuTrkDau1TrackerMuonBit==1 && zMuTrkDau1HLTBit==1"); TCut massCut("zMuTrkMass>60 && zMuTrkMass<120 "); makePlots("zMuTrkMass", "", kin_common + dau1TightWP2_hltAlso + dau2Loose, 5 , "zMuTrk" , 0.0001, 200, 0 ,200, true); makePlots("zMuTrkMass", "", kin_common , 5 , "zMuTrk" , 0.0001, 200, 0 ,200, true, true); }
void oniaTreeMassCut(int oniamode=1) { TChain* myTree = new TChain("hionia/myTree",""); myTree->Add("OniaTree_DoubleMu_Run2015E-PromptReco-v1_Run_262157_262328_noCUT.root"); Double_t massmin = -1; Double_t massmax = -1; TString signame; if (oniamode==1) { signame = TString("Jpsi"); massmin = 2.0; massmax = 5.0; } else if (oniamode==2) { signame = TString("Upsilon"); massmin = 9; massmax = 10; } TFile *fout = new TFile("OniaTree_Reduced.root","RECREATE"); TTree *myNewTree = massCut((TChain*)myTree , massmin, massmax); fout->cd(); TDirectory *cdtof = myNewTree->mkdir("hionia"); cdtof->cd(); myNewTree->Write("myTree"); fout->Write(); fout->Close(); }
void plots_for_config(string toyfile, string smsfile, string massGlu, string massLSP) { gROOT->SetStyle("Plain"); bool do_fat_line=false; // if you want to have HistLineWidth=1 and FuncWidth=1 as it was before instead of 2 setTDRStyle(do_fat_line); gStyle->SetTextFont(42); string massCut_ = "MassGlu==" + massGlu + "&&MassLSP==" + massLSP; string massCut2_ = "massGlu==" + massGlu + "&&massLSP==" + massLSP; TCut massCut(massCut_.c_str()); TCut massCut2(massCut2_.c_str()); string comp = "comparison_" + massGlu + "_" + massLSP; TFile *_file = TFile::Open(smsfile.c_str()); TTree *point = (TTree*)_file->Get("events"); TH1F *jzb = new TH1F("jzb", "", 50, -600, 800); point->Project("jzb", "jzb[1]", "id1==id2&&pfJetGoodNum>2&&abs(mll-91.2)<20" + massCut, "gof"); TFile *_filepa = TFile::Open(toyfile.c_str()); TTree *pointpa = (TTree*)_filepa->Get("events"); TH1F *jzbpa = new TH1F("jzbpa", "", 50, -600, 800); pointpa->Project("jzbpa", "jzb", "njets>2 && nleptons==2" + massCut2); jzbpa->SetLineColor(kRed); jzbpa->GetXaxis()->SetTitle("JZB [GeV]"); jzb->GetXaxis()->SetTitle("JZB [GeV]"); TLegend *l1 = new TLegend(0.7, 0.75, 0.9, 0.85); l1->SetFillColor(kWhite); l1->SetTextFont(42); l1->SetLineWidth(0); l1->SetBorderSize(0); l1->AddEntry(jzb, "SMS", "L"); l1->AddEntry(jzbpa, "SMS TOY", "L"); TCanvas *m1 = new TCanvas("m1"); m1->GetPad(0)->SetLogy(1); m1->cd(); jzb->DrawNormalized(); jzbpa->DrawNormalized("SAME"); l1->Draw(); CompleteSave(m1,"Plots/" + comp); delete m1; return; }
void makeEfficiency_74X_setBr(bool isPrompt=false, bool isPair=true, bool isEmbedded=true, bool isPtCut = false, bool doWeight = false) { gROOT->Macro("./JpsiStyle.C"); gStyle->SetPaintTextFormat(".3f"); // for text colz //string strDir = "eff_74X_setBr"; // directory name //string strDir = "eff_74X_setBr_wDetached"; // directory name string strDir = "eff_74X_noRegitMuDetached"; // directory name int initev =0; int nevt = -1; //all //int nevt = 1000; int ptbin = 11.; double ptmin = 0.; double ptmax = 11.; if (isEmbedded && !isPrompt) { ptbin = 22.; ptmax = 22.; } int rapbin = 12; double rapmin = -2.4; double rapmax = 2.4; int lxybin = 10; double lxymin = 0.; double lxymax = 1.; string strPrompt; string strEmbd; string strPair; if(isPrompt){ strPrompt = "prompt"; } else { strPrompt = "nonprompt"; } if(isEmbedded){ strEmbd = "embd"; } else { strEmbd = "nonembd"; } if(isPair){ strPair = "Pair"; } else { strPair = "Trk"; } cout << "strPrompt = " << strPrompt.c_str() << endl; cout << "strEmbd = " << strEmbd.c_str() << endl; cout << "strPair = " << strPair.c_str() << endl; ////// read-in file & tree TFile * refFile; if (isEmbedded){ ////// 740pre3 -embd //if (isPrompt){ refFile = new TFile("/home/songkyo/kyo/regitSample/tot_Pythiagun_PromptJpsi_step2nMatch_KYO_regit_embd_20150211.root");} //else { refFile = new TFile("/home/songkyo/kyo/regitSample/tot_Pythiagun_B2JpsiMuMu_step2nMatch_KYO_regit_embd_20150211.root");} ////// 740pre3 -embd with HiDetachedTripletStep //if (isPrompt){ refFile = new TFile("/home/songkyo/kyo/regitSample/tot_Pythiagun_PromptJpsi_step2nMatch_KYO_regit_wDetached_embd_20150224.root");} //else { refFile = new TFile("/home/songkyo/kyo/regitSample/tot_Pythiagun_B2JpsiMuMu_step2nMatch_KYO_regit_wDetached_embd_20150224.root");} ////// 740pre3 - remove some regit : noRegitMuDetached if (isPrompt){ refFile = new TFile("/home/songkyo/kyo/regitSample/tot_Pythiagun_PromptJpsi_step2nMatch_KYO_regit_noRegitMuDetached_embd_20150310.root");} else { refFile = new TFile("/home/songkyo/kyo/regitSample/tot_Pythiagun_B2JpsiMuMu_step2nMatch_KYO_regit_noRegitMuDetached_embd_20150310.root");} } else { //730pre2 -nonembd if (isPrompt){ refFile = new TFile("/home/songkyo/kyo/regitSample/tot_Pythiagun_PromptJpsi_step2nMatch_KYO_regit_20141121.root");} else { refFile = new TFile("/home/songkyo/kyo/regitSample/tot_Pythiagun_B2Jpsi_step2nMatch_KYO_regit_20141203_no9_32_90.root");} } TTree *tr = new TTree(); if(isPair) { tr = (TTree*)refFile->Get("mcmatchanalysis/pnSimRecoPairType1");} else { tr = (TTree*)refFile->Get("mcmatchanalysis/pnSimRecoTrkType1"); } /* //for pT-|y| weight TFile *fWeight; if (isPrompt){ fWeight = new TFile("./pTdist_diffY/pTdist_diffY_prompt.root");} else {fWeight = new TFile("./pTdist_diffY/pTdist_diffY_nonprompt.root");} const int nYBin = 4; TH1D* hWeight[nYBin]; for (int i=0; i< nYBin; i++){ if (isPair) { hWeight[i] = (TH1D*)fWeight->Get(Form("hPairRatio_%d",i)); } else { hWeight[i] = (TH1D*)fWeight->Get(Form("hTrkRatio_%d",i)); }; //cout << i << "th hWeight = " << hWeight[i] << endl; cout << i << "th hWeight Name= " << hWeight[i]->GetName() << endl; } */ /////////////////////////////////////// ////// Pair ////// //gen Float_t pt; Float_t y; Float_t pt1; Float_t eta1; Float_t npixelhits1; Float_t nmuonhits1; Float_t pt2; Float_t eta2; Float_t npixelhits2; Float_t nmuonhits2; //reco Float_t ptreco; Float_t yreco; Float_t minvreco; Float_t ptreco1; Float_t etareco1; Float_t nvalidpixelhitsreco1; Float_t nvalidmuonhitsreco1; Float_t nmatch1; Float_t chi2ndofreco1; Float_t ptreco2; Float_t etareco2; Float_t nvalidpixelhitsreco2; Float_t nvalidmuonhitsreco2; Float_t nmatch2; Float_t chi2ndofreco2; // for lxy Float_t vtxz1; Float_t vtxy1; Float_t bx; Float_t by; ////// Trk (additional)////// //gen Float_t eta; Float_t idparent; Float_t npixelhits; Float_t nmuonhits; //reco Float_t etareco; Float_t nvalidpixelhitsreco; Float_t nvalidmuonhitsreco; Float_t nmatch; Float_t chi2ndofreco; // for lxy Float_t vtxz; Float_t vtxy; /////////////////////////////////////// //Branches /////////////////////////////////////// TBranch *b_pt; TBranch *b_y; TBranch *b_pt1; TBranch *b_eta1; TBranch *b_npixelhits1; TBranch *b_nmuonhits1; TBranch *b_pt2; TBranch *b_eta2; TBranch *b_npixelhits2; TBranch *b_nmuonhits2; //reco TBranch *b_ptreco; TBranch *b_yreco; TBranch *b_minvreco; TBranch *b_ptreco1; TBranch *b_etareco1; TBranch *b_nvalidpixelhitsreco1; TBranch *b_nvalidmuonhitsreco1; TBranch *b_nmatch1; TBranch *b_chi2ndofreco1; TBranch *b_ptreco2; TBranch *b_etareco2; TBranch *b_nvalidpixelhitsreco2; TBranch *b_nvalidmuonhitsreco2; TBranch *b_nmatch2; TBranch *b_chi2ndofreco2; // for lxy TBranch *b_vtxz1; TBranch *b_vtxy1; TBranch *b_bx; TBranch *b_by; ////// Trk (additional)////// //gen TBranch *b_eta; TBranch *b_idparent; TBranch *b_npixelhits; TBranch *b_nmuonhits; //reco TBranch *b_etareco; TBranch *b_nvalidpixelhitsreco; TBranch *b_nvalidmuonhitsreco; TBranch *b_nmatch; TBranch *b_chi2ndofreco; // for lxy TBranch *b_vtxz; TBranch *b_vtxy; /////////////////////////////////////// //BranchAddress /////////////////////////////////////// tr->SetBranchAddress("pt",&pt,&b_pt); tr->SetBranchAddress("ptreco",&ptreco,&b_ptreco); tr->SetBranchAddress("bx",&bx,&b_bx); tr->SetBranchAddress("by",&by,&b_by); if (isPair) { tr->SetBranchAddress("y",&y,&b_y); tr->SetBranchAddress("pt1",&pt1,&b_pt1); tr->SetBranchAddress("eta1",&eta1,&b_eta1); tr->SetBranchAddress("npixelhits1",&npixelhits1,&b_npixelhits1); tr->SetBranchAddress("nmuonhits1",&nmuonhits1,&b_nmuonhits1); tr->SetBranchAddress("pt2",&pt2,&b_pt2); tr->SetBranchAddress("eta2",&eta2,&b_eta2); tr->SetBranchAddress("npixelhits2",&npixelhits2,&b_npixelhits2); tr->SetBranchAddress("nmuonhits2",&nmuonhits2,&b_nmuonhits2); tr->SetBranchAddress("yreco",&yreco,&b_yreco); tr->SetBranchAddress("minvreco",&minvreco,&b_minvreco); tr->SetBranchAddress("ptreco1",&ptreco1,&b_ptreco1); tr->SetBranchAddress("etareco1",&etareco1,&b_etareco1); tr->SetBranchAddress("nvalidpixelhitsreco1",&nvalidpixelhitsreco1,&b_nvalidpixelhitsreco1); tr->SetBranchAddress("nvalidmuonhitsreco1",&nvalidmuonhitsreco1,&b_nvalidmuonhitsreco1); tr->SetBranchAddress("nmatch1",&nmatch1,&b_nmatch1); tr->SetBranchAddress("chi2ndofreco1",&chi2ndofreco1,&b_chi2ndofreco1); tr->SetBranchAddress("ptreco2",&ptreco2,&b_ptreco2); tr->SetBranchAddress("etareco2",&etareco2,&b_etareco2); tr->SetBranchAddress("nvalidpixelhitsreco2",&nvalidpixelhitsreco2,&b_nvalidpixelhitsreco2); tr->SetBranchAddress("nvalidmuonhitsreco2",&nvalidmuonhitsreco2,&b_nvalidmuonhitsreco2); tr->SetBranchAddress("nmatch2",&nmatch2,&b_nmatch2); tr->SetBranchAddress("chi2ndofreco2",&chi2ndofreco2,&b_chi2ndofreco2); tr->SetBranchAddress("vtxz1",&vtxz1,&b_vtxz1); tr->SetBranchAddress("vtxy1",&vtxy1,&b_vtxy1); } else { tr->SetBranchAddress("eta",&eta,&b_eta); tr->SetBranchAddress("etareco",&etareco,&b_etareco); tr->SetBranchAddress("idparent",&idparent,&b_idparent); tr->SetBranchAddress("npixelhits",&npixelhits,&b_npixelhits); tr->SetBranchAddress("nmuonhits",&nmuonhits,&b_nmuonhits); tr->SetBranchAddress("nvalidpixelhitsreco",&nvalidpixelhitsreco,&b_nvalidpixelhitsreco); tr->SetBranchAddress("nvalidmuonhitsreco",&nvalidmuonhitsreco,&b_nvalidmuonhitsreco); tr->SetBranchAddress("nmatch",&nmatch,&b_nmatch); tr->SetBranchAddress("chi2ndofreco",&chi2ndofreco,&b_chi2ndofreco); tr->SetBranchAddress("vtxz",&vtxz,&b_vtxz); tr->SetBranchAddress("vtxy",&vtxy,&b_vtxy); } //2D hist. just check TH2D* hGenPtY = new TH2D("hGenPtY","hGenPtY",50,rapmin,rapmax,50,ptmin,ptmax); TH2D* hRecoPtY = new TH2D("hRecoPtY","hRecoPtY",50,rapmin,rapmax,50,ptmin,ptmax); TH2D* hEffPtY = new TH2D("hEffPtY","hEffPtY",50,rapmin,rapmax,50,ptmin,ptmax); TH1D* hGenPt = new TH1D("hGenPt","hGenPt",ptbin,ptmin,ptmax); TH1D* hRecoPt = new TH1D("hRecoPt","hRecoPt",ptbin,ptmin,ptmax); TH1D* hEffPt = new TH1D("hEffPt","hEffPt",ptbin,ptmin,ptmax); TH1D* hGenRap = new TH1D("hGenRap","hGenRap",rapbin,rapmin,rapmax); TH1D* hRecoRap = new TH1D("hRecoRap","hRecoRap",rapbin,rapmin,rapmax); TH1D* hEffRap = new TH1D("hEffRap","hEffRap",rapbin,rapmin,rapmax); TH1D* hGenLxy = new TH1D("hGenLxy","hGenLxy",lxybin,lxymin,lxymax); TH1D* hRecoLxy = new TH1D("hRecoLxy","hRecoLxy",lxybin,lxymin,lxymax); TH1D* hEffLxy = new TH1D("hEffLxy","hEffLxy",lxybin,lxymin,lxymax); hGenPtY->Sumw2(); hRecoPtY->Sumw2(); hEffPtY->Sumw2(); hGenPt->Sumw2(); hRecoPt->Sumw2(); hEffPt->Sumw2(); hGenRap->Sumw2(); hRecoRap->Sumw2(); hEffRap->Sumw2(); hGenLxy->Sumw2(); hRecoLxy->Sumw2(); hEffLxy->Sumw2(); //event loop start if(nevt == -1) nevt = tr->GetEntries(); for (int iev=initev; iev<nevt; iev++){ tr->GetEntry(iev); bool yngen = false; bool ynreco = false; float weightF = 1.; float lxy = -531.; /// give a cut to Gen and Reco separately if (isPair) { if (isPtCut) { if ( !(pt<15.) ) continue; } /// define IP lxy = TMath::Sqrt((vtxz1-bx)*(vtxz1-bx)+(vtxy1-by)*(vtxy1-by)); if (kineCut(pt1,eta1) && kineCut(pt2,eta2) && idCut(npixelhits1,nmuonhits1) && idCut(npixelhits2,nmuonhits2) ) { yngen=true; } if (kineCut(ptreco1,etareco1) && kineCut(ptreco2,etareco2) && idCut(nvalidpixelhitsreco1,nvalidmuonhitsreco1) && idCut(nvalidpixelhitsreco2,nvalidmuonhitsreco2) //&& idRecoCut(nmatch1, chi2ndofreco1) //&& idRecoCut(nmatch2, chi2ndofreco2) && chi2ndofreco1 < 4. && chi2ndofreco2 < 4. && massCut(minvreco) ) { ynreco=true;} } else { if (isPtCut) { if (!(pt >1. && pt<15. ) ) continue; } /// define IP lxy = TMath::Sqrt((vtxz-bx)*(vtxz-bx)+(vtxy-by)*(vtxy-by)); if ( (!isEmbedded) && TMath::Abs(eta) < 2.4 && TMath::Abs(idparent)>442 && TMath::Abs(idparent)<550 && idCut(npixelhits,nmuonhits) ) { yngen=true; } else if ( isEmbedded && TMath::Abs(eta) < 2.4 //&& TMath::Abs(idparent)>442 //&& TMath::Abs(idparent)<550 && idCut(npixelhits,nmuonhits) ) { yngen=true; } if ( (!isEmbedded) //TMath::Abs(etareco) < 2.4 && TMath::Abs(eta) < 2.4 && TMath::Abs(idparent)>442 && TMath::Abs(idparent)<550 && idCut(nvalidpixelhitsreco,nvalidmuonhitsreco) && idRecoCut(nmatch, chi2ndofreco) ) { ynreco=true;} else if ( isEmbedded //TMath::Abs(etareco) < 2.4 && TMath::Abs(eta) < 2.4 //&& TMath::Abs(idparent)>442 //&& TMath::Abs(idparent)<550 && idCut(nvalidpixelhitsreco,nvalidmuonhitsreco) && idRecoCut(nmatch, chi2ndofreco) ) { ynreco=true;} } /// weight if "doWeight" && fill the histogram if (isPair){ if (doWeight) {weightF = getWeight(isPrompt, isPair, pt,y);} // cout << "weightF = " <<weightF << endl; if (yngen) { hGenPtY->Fill(y,pt,weightF); hGenPt->Fill(pt,weightF); hGenRap->Fill(y,weightF); hGenLxy->Fill(lxy,weightF); } if (ynreco) { hRecoPtY->Fill(yreco,ptreco,weightF); hRecoPt->Fill(ptreco, weightF); hRecoRap->Fill(yreco, weightF); hRecoLxy->Fill(lxy, weightF); } }else { if (doWeight) {weightF = getWeight(isPrompt, isPair, pt,eta);} // cout << "weightF = " <<weightF << endl; if (yngen) { hGenPtY->Fill(eta,pt,weightF); hGenPt->Fill(pt,weightF); hGenRap->Fill(eta,weightF); hGenLxy->Fill(lxy,weightF); } if (ynreco) { hRecoPtY->Fill(etareco,ptreco,weightF); hRecoPt->Fill(ptreco,weightF); hRecoRap->Fill(etareco,weightF); hRecoLxy->Fill(lxy, weightF); } } }// end of event loop cout << "hGenPt integral = " << hGenPt->Integral() << endl; cout << "hRecoPt integral = " << hRecoPt->Integral() << endl; cout << "hGenRap integral = " << hGenRap->Integral() << endl; cout << "hRecoRap integral = " << hRecoRap->Integral() << endl; cout << "hGenLxy integral = " << hGenLxy->Integral() << endl; cout << "hRecoLxy integral = " << hRecoLxy->Integral() << endl; //calculate efficiency hEffPtY->Divide(hRecoPtY,hGenPtY,1,1,"b"); hEffPt->Divide(hRecoPt,hGenPt,1,1,"b"); hEffRap->Divide(hRecoRap,hGenRap,1,1,"b"); hEffLxy->Divide(hRecoLxy,hGenLxy,1,1,"b"); //Legend TLegend *legUR = new TLegend(0.56,0.68,0.90,0.90,NULL,"brNDC"); TLegend *legUL = new TLegend(0.17,0.68,0.51,0.90,NULL,"brNDC"); TLegend *legBM = new TLegend(0.40,0.20,0.75,0.35,NULL,"brNDC"); TLegend *legBR = new TLegend(0.56,0.20,0.90,0.42,NULL,"brNDC"); SetLegendStyle(legUR); SetLegendStyle(legUL); SetLegendStyle(legBM); SetLegendStyle(legBR); TCanvas *c1 = new TCanvas("c1","c1",600,600); //draw 2D Pt-y TPaletteAxis* pal; hEffPtY->SetMinimum(0.0); hEffPtY->SetMaximum(1.0); if (isPair) hEffPtY->GetXaxis()->SetTitle("y"); else hEffPtY->GetXaxis()->SetTitle("#eta"); hEffPtY->GetXaxis()->CenterTitle(); hEffPtY->GetYaxis()->SetTitle("p_{T} (GeV)"); hEffPtY->Draw("colz"); c1->Update(); pal = (TPaletteAxis*)hEffPtY->GetListOfFunctions()->FindObject("palette"); pal->SetX2NDC(0.92); c1->Modified(); c1->Update(); c1->SaveAs(Form("%s/EffPtY_isPtCut%d_doWeight%d_isEmbedded%d_%s_%s_%s.pdf",strDir.c_str(),(int)isPtCut,(int)doWeight,(int)isEmbedded,strPrompt.c_str(),strEmbd.c_str(),strPair.c_str())); c1->Clear(); //draw EffPt SetHistStyle(hEffPt,3,0); hEffPt->SetMinimum(0.0); hEffPt->SetMaximum(1.0); if (isPair) hEffPt->GetXaxis()->SetTitle("Pair p_{T} (GeV)"); else hEffPt->GetXaxis()->SetTitle("Trk p_{T} (GeV)"); hEffPt->GetYaxis()->SetTitle("Efficiency"); hEffPt->Draw("pe"); c1->SaveAs(Form("%s/EffPt_isPtCut%d_doWeight%d_isEmbedded%d_%s_%s_%s.pdf",strDir.c_str(),(int)isPtCut,(int)doWeight,(int)isEmbedded,strPrompt.c_str(),strEmbd.c_str(),strPair.c_str())); c1->Clear(); //draw EffRap SetHistStyle(hEffRap,3,0); hEffRap->SetMinimum(0.0); hEffRap->SetMaximum(1.0); if (isPair) hEffRap->GetXaxis()->SetTitle("y"); else hEffRap->GetXaxis()->SetTitle("#eta"); hEffRap->GetXaxis()->CenterTitle(); hEffRap->GetYaxis()->SetTitle("Efficiency"); hEffRap->Draw("pe"); c1->SaveAs(Form("%s/EffRap_isPtCut%d_doWeight%d_isEmbedded%d_%s_%s_%s.pdf",strDir.c_str(),(int)isPtCut,(int)doWeight,(int)isEmbedded,strPrompt.c_str(),strEmbd.c_str(),strPair.c_str())); c1->Clear(); //draw EffLxy SetHistStyle(hEffLxy,3,0); hEffLxy->SetMinimum(0.0); hEffLxy->SetMaximum(1.0); hEffLxy->GetXaxis()->SetTitle("Lxy"); hEffLxy->GetYaxis()->SetTitle("Efficiency"); hEffLxy->Draw("pe"); c1->SaveAs(Form("%s/EffLxy_isPtCut%d_doWeight%d_isEmbedded%d_%s_%s_%s.pdf",strDir.c_str(),(int)isPtCut,(int)doWeight,(int)isEmbedded,strPrompt.c_str(),strEmbd.c_str(),strPair.c_str())); c1->Clear(); //save as a root file TFile* outFile = new TFile(Form("%s/Eff_isPtCut%d_doWeight%d_isEmbedded%d_%s_%s_%s.root",strDir.c_str(),(int)isPtCut,(int)doWeight,(int)isEmbedded,strPrompt.c_str(),strEmbd.c_str(),strPair.c_str()),"RECREATE"); outFile->cd(); hGenPtY->Write(); hRecoPtY->Write(); hEffPtY->Write(); hGenPt->Write(); hGenRap->Write(); hGenLxy->Write(); hRecoPt->Write(); hRecoRap->Write(); hRecoLxy->Write(); hEffPt->Write(); hEffRap->Write(); hEffLxy->Write(); outFile->Close(); return; }