bool CAgencyInfoRetriver::Init(const Stroka& strDoc2AgFile) { if (!strDoc2AgFile.empty() && isexist(strDoc2AgFile.c_str())) m_DocId2AgNameFile = TFile(strDoc2AgFile.c_str(), OpenExisting | RdOnly); return true; }
{ gROOT->Reset(); // Draw histos filled by Geant4 simulation // TFile f = TFile("fanocavity2.root"); TCanvas* c1 = new TCanvas("c1", " "); TH1D* hist1 = (TH1D*)f.Get("1"); hist1->Draw("HIST"); TH1D* hist2 = (TH1D*)f.Get("2"); hist2->Draw("HIST"); TH1D* hist3 = (TH1D*)f.Get("3"); hist3->Draw("HIST"); TH1D* hist4 = (TH1D*)f.Get("4"); hist4->Draw("HIST"); TH1D* hist5 = (TH1D*)f.Get("5"); hist5->Draw("HIST"); TH1D* hist6 = (TH1D*)f.Get("6"); hist6->Draw("HIST"); TH1D* hist7 = (TH1D*)f.Get("7"); hist7->Draw("HIST"); TH1D* hist8 = (TH1D*)f.Get("8"); hist8->Draw("HIST");
bool CleanFolder(KString FolderName, bool bRecursive, bool bSafe) { FolderName = SlashedFolderName(FolderName); bool bSuccess = true; // Files TEST_BLOCK_BEGIN { KStrings Files; EnlistFiles(FolderName + TEXT("*.*"), Files, false); for(KStrings::TConstIterator Iter = Files.GetFirst() ; Iter.IsValid() ; ++Iter) { TEST_BLOCK_BEGIN { TFile(FolderName + *Iter).Remove(); } TEST_BLOCK_EXCEPTION_HANDLER { if(!bSafe) throw 1; EMPTY_DEBUG_FAILURE_MESSAGE; bSuccess = false; } TEST_BLOCK_END } } TEST_BLOCK_EXCEPTION_HANDLER { if(!bSafe) throw 1; EMPTY_DEBUG_FAILURE_MESSAGE; bSuccess = false; } TEST_BLOCK_END // Folders TEST_BLOCK_BEGIN { KStrings Folders; EnlistFolders(FolderName + TEXT("*.*"), Folders, false); if(!Folders.IsEmpty()) { if(!bRecursive) return false; for(KStrings::TConstIterator Iter = Folders.GetFirst() ; Iter.IsValid() ; ++Iter) { if(!DeleteFolder(FolderName + *Iter, bRecursive, bSafe)) bSuccess = false; } } } TEST_BLOCK_EXCEPTION_HANDLER { if(!bSafe) throw 1; EMPTY_DEBUG_FAILURE_MESSAGE; bSuccess = false; } TEST_BLOCK_END return bSuccess; }
void photonTemplateProducer(int cutOpt=3, int ppHI = kHI, int isoChoice = kSumIso, int isoCut = -100, bool onlygjEvents=false, float specialSbCut=10, float mcSigShift=0, float sbBkgShift=0) { CutAndBinCollection cab; cab.setCuts(cutOpt); int nPtBin = cab.getNPtBin(); vector<double> ptBinVector = cab.getPtBin(); double ptBin[100]; for ( int i = 0 ; i<=nPtBin ;i++) { ptBin[i] = ptBinVector[i]; } int nCentBin = cab.getNCentBin(); vector<double> centBinVector = cab.getCentBin(); double centBin[100]; for ( int i = 0 ; i<=nCentBin ;i++) { centBin[i] = centBinVector[i]; } TString pphiLabel = ""; if ( ppHI == kPP) pphiLabel = "pp"; TCanvas* c1[5]; TH1D* hData[5][5]; TH1D* hSig[5][5]; TH1D* hBkg[5][5]; // TH1D* hDatapp[5]; // TH1D* hSigpp[5]; // TH1D* hBkgpp[5]; TH1D* hBkgMCsr[5][5]; TH1D* hBkgMCsb[5][5]; TH1D* rawSpectra[5]; TH1D* finSpectra[5]; TH2D* hPurity2D = new TH2D("hPurity2D",";pT(GeV);Centrality bin",nPtBin,ptBin,nCentBin,centBin); int nCent(-1); if ( ppHI == kHI ) nCent = nCentBin; if ( ppHI == kPP ) nCent = 1; for ( int icent = 1 ; icent<=nCent ; icent++) { rawSpectra[icent] = new TH1D(Form("rawSpec_icent%d_%s",icent,getIsoLabel(isoChoice).Data()),"",nPtBin,ptBin); } for (int ipt = 1; ipt <= nPtBin ; ipt++) { c1[ipt] = new TCanvas(Form("c1_ipt%d",ipt),"",700,700); if ( ppHI == kHI ) makeMultiPanelCanvas(c1[ipt],nCent/2,2,0.0,0.0,0.2,0.15,0.02); TCut ptCut = Form("corrPt>%.2f && corrPt<%.2f",(float)ptBin[ipt-1],(float)ptBin[ipt]); for ( int icent = 1 ; icent<=nCent ; icent++) { int lowCent = centBinVector[icent-1]; int highCent = centBinVector[icent]-1; hData[icent][ipt] = new TH1D(Form("hData_cent%d_pt%d",icent,ipt),";shower shape (#sigma_{#eta#eta});Entries per photon candidate;",25,0,0.025); hSig[icent][ipt] = (TH1D*)hData[icent][ipt]->Clone(Form("hSig_cent%d_pt%d",icent,ipt)); hBkg[icent][ipt] = (TH1D*)hData[icent][ipt]->Clone(Form("hBkg_cent%d_pt%d",icent,ipt)); hBkgMCsr[icent][ipt] = (TH1D*)hData[icent][ipt]->Clone(Form("hBkgMCsr_cent%d_pt%d",icent,ipt)); hBkgMCsb[icent][ipt] =(TH1D*)hData[icent][ipt]->Clone(Form("hBkgMCsb_cent%d_pt%d",icent,ipt)); TString fNamedata = fNameHIdata; if ( ppHI == kPP ) fNamedata = fNamePPdata; getTemplate(ppHI, hSig[icent][ipt],"meaningless",isoChoice,isoCut, kSig,lowCent,highCent,ptCut,onlygjEvents,specialSbCut,mcSigShift); getTemplate(ppHI, hData[icent][ipt],fNamedata ,isoChoice,isoCut, kData,lowCent,highCent,ptCut,onlygjEvents,specialSbCut); if ( ppHI == kHI) { getTemplate(ppHI, hBkg[icent][ipt], fNamedata ,isoChoice,isoCut, kSBB,lowCent,highCent,ptCut,onlygjEvents,specialSbCut,sbBkgShift); } if ( ppHI == kPP) getTemplate(ppHI, hBkg[icent][ipt], fNamedata ,isoChoice,isoCut, kSBBpp,lowCent,highCent,ptCut,onlygjEvents,specialSbCut); } for ( int icent = 1 ; icent<=nCent ; icent++) { int lowerCent = centBinVector[icent-1]; int upperCent =centBinVector[icent]-1; c1[ipt]->cd(nCent - icent+1); fitResult fitr = doFit ( hSig[icent][ipt], hBkg[icent][ipt], hData[icent][ipt], 0.005,0.025); if ( icent== nCent) drawPatch(0,0,0.05,0.14,0,1001, "ndc"); cout << " shift = " << mcSigShift << endl; cout << " purity = " << fitr.purity010 << endl; if ( ptBin[ipt]> 200) drawText(Form(" E_{T}^{#gamma} > %d GeV", (int)ptBin[ipt-1]),0.5680963,0.529118); else drawText(Form("%d - %d GeV", (int)ptBin[ipt-1], (int)ptBin[ipt]),0.5680963,0.529118); if ( ppHI == kHI) { drawText(Form("%.0f%% - %.0f%%", float((float)lowerCent*2.5), float((float)(upperCent+1)*2.5)),0.5680963,0.4369118); } else if ( ppHI == kPP) { drawText("7TeV pp",0.5680963,0.4369118); } if ( (icent == nCent) || (icent == 2)) drawText(Form("Purity(#sigma_{#eta#eta} < 0.01) : %.0f%%", (float)fitr.purity010*100),0.5680963,0.3569118,1,15); else drawText(Form("Purity(#sigma_{#eta#eta} < 0.01) : %.0f%%", (float)fitr.purity010*100),0.4980963,0.3569118,1,15); drawText(Form("#pm %.0f%% (stat)", float( 100. * fitr.purity010 * (float)fitr.nSigErr / (float)fitr.nSig ) ),0.6680963,0.2869118,1,15); hPurity2D->SetBinContent(ipt,icent,fitr.purity010); hPurity2D->SetBinError (ipt,icent,fitr.purity010* fitr.nSigErr/fitr.nSig); rawSpectra[icent]->SetBinContent( ipt, fitr.nSig); rawSpectra[icent]->SetBinError( ipt,fitr.nSigErr); TString aa = ""; if (isoChoice == kSumIso) aa = "Sum Iso Method"; if (isoChoice == k3dIso) aa = "3d Cut Method"; if (isoChoice == kFisher) aa = "Fisher Method"; if ( (ppHI == kHI) && ( icent==nCent -1) ) drawText(aa.Data(),0.1980963,0.8569118,1,20); else if ( ppHI == kPP) drawText(aa.Data(),0.1980963,0.8569118,1,20); if ( icent<= 2) drawPatch(0,0,0.05,0.14,0,1001, ndcOpt); // drawPatch(0.9,0.05,1.01,0.14,0,1001,ndcOpt); if ( (ppHI == kPP) && ( mcSigShift != 0 )) drawText(Form("Signal template shifted by %f",mcSigShift),0.1980963,0.7569118,1,15); if ( (ppHI == kHI) && ( mcSigShift != 0 ) && (icent==3)) drawText(Form("Signal template shifted by %f",mcSigShift),0.1980963,0.7569118,1,15); } TString ppLabel =""; if ( ppHI == kPP) ppLabel = "_pp"; TString shiftLabel=""; if ( mcSigShift != 0 ) shiftLabel = Form("_%fSigShifted",(float)mcSigShift); c1[ipt]->SaveAs(Form("fittingPurity%s_%s_pt%d%s.pdf",ppLabel.Data(), getIsoLabel(isoChoice).Data(),ipt,shiftLabel.Data())); } // efficiency plots TCanvas* c2 = new TCanvas("c2","",700,700); //100 + nCent_std*300,400); if ( ppHI == kHI) makeMultiPanelCanvas(c2,nCent/2,2,0.0,0.0,0.2,0.15,0.02); TH1D* heff[7][5]; TH1D* heffGj[5]; TH1D* heffDphi[5]; TH1D* effSingleBin = new TH1D("effSingleBin","",1,60,100000); TGraphAsymmErrors* geff[7][5]; TGraphAsymmErrors* gSingleBin = new TGraphAsymmErrors(); TGraphAsymmErrors* geffGj[5]; TGraphAsymmErrors* geffDphi[5]; for (int icent = 1; icent <=nCent; icent++) { for ( int iid=1 ; iid<=5; iid++) { heff[icent][iid] = new TH1D(Form("heff_icent%d_id%d",icent,iid),";photon E_{T} (GeV);Efficiency",nPtBin, ptBin); if ( isoChoice == kSumIso2) heff[icent][iid]->SetName(Form("heff_icent%d_id%d_isoCut%d",icent,iid,(int)isoCut)); if ( isoChoice == kSumIso3) heff[icent][iid]->SetName(Form("heff_icent%d_id%d_sbIsoCut%d",icent,iid,(int)specialSbCut)); geff[icent][iid] = new TGraphAsymmErrors(); geff[icent][iid]->SetName(Form("geff_%s",heff[icent][iid]->GetName())); } heffGj[icent] = new TH1D(Form("heff_icent%d_Gj", icent),";x_J#gamma;Efficiency",10,0,2); heffDphi[icent] = new TH1D(Form("heff_icent%d_Dphi",icent),";#Delta#phi of pair;Efficiency",9,0.3141592,3.141592); geffGj[icent] = new TGraphAsymmErrors(); geffDphi[icent] = new TGraphAsymmErrors(); } TCut srIsoCut = getIsoCut(isoChoice,isoCut); int nId=4; for (int icent = 1; icent <=nCent ; icent++) { int lowCent = centBinVector[icent-1]; int highCent = centBinVector[icent]-1; TCut centCut = Form("yEvt.hiBin >= %d && yEvt.hiBin<= %d",lowCent,highCent); if ( ppHI == kPP ) centCut = ""; getEff("genMatchedPt",heff[icent][1],geff[icent][1],centCut, "swissCrx<0.90 && seedTime<4"); getEff("genMatchedPt",heff[icent][2],geff[icent][2],centCut, "swissCrx<0.90 && seedTime<4 && hadronicOverEm<0.1"); getEff("genMatchedPt",heff[icent][3],geff[icent][3],centCut, "swissCrx<0.90 && seedTime<4 && hadronicOverEm<0.1" && srIsoCut); getEff("genMatchedPt",heff[icent][4],geff[icent][4],centCut, "swissCrx<0.90 && seedTime<4 && hadronicOverEm<0.1 && sigmaIetaIeta<0.010"&& srIsoCut); effSingleBin->Reset(); getEff("genMatchedPt",effSingleBin, gSingleBin, centCut, "swissCrx<0.90 && seedTime<4 && hadronicOverEm<0.1" && srIsoCut); cout << " here Gj" << endl; getEff("yJet.jtpt/photonEt",heffGj[icent],geffGj[icent], centCut && " genIso<5 && abs(genMomId)<=22 && photonEt>60 && abs(yJet.jteta)<2 && yJet.jtpt>30 && acos(cos(photonPhi-yJet.jtphi))>2.749", "hovere<0.1 && sigmaIetaIeta<0.010 && (cc4+cr4+ct4PtCut20)/0.9<1",true); getEff("acos(cos(photonPhi-yJet.jtphi))",heffDphi[icent],geffDphi[icent],centCut && " genIso<5 && abs(genMomId)<=22 && photonEt>60 && abs(yJet.jteta)<2 && yJet.jtpt>30", "hovere<0.1 && sigmaIetaIeta<0.010 && (cc4+cr4+ct4PtCut20)/0.9<1",true); } for (int icent = 1; icent <=nCent; icent++) { for ( int iid=1 ; iid<=nId ; iid++) { handsomeTH1(heff[icent][iid],ycolor[iid]); handsomeTGraph(geff[icent][iid],ycolor[iid]); } } TH1D* htmp = (TH1D*)heff[1][1]->Clone("htmp"); htmp->Reset(); htmp->SetAxisRange(0,1.3,"Y"); htmp->SetYTitle("Efficiency"); handsomeTH1(htmp); for (int icent = 1; icent <=nCent; icent++) { int lowerCent = centBinVector[icent-1]; int upperCent = centBinVector[icent]-1; if ( ppHI == kHI) c2->cd(nCent - icent + 1); htmp->DrawCopy(); for ( int iid=1 ; iid<=nId ; iid++) { heff[icent][iid]->Draw("p same"); geff[icent][iid]->Draw("p"); } if ( ( icent == nCent ) || ( ppHI == kPP) ) { TLegend* leg1 = new TLegend(0.25,0.20,0.95,0.55,NULL,"brNDC"); easyLeg(leg1,"Photon ID efficiency"); leg1->AddEntry(heff[icent][1],"spike rejection","lp"); leg1->AddEntry(heff[icent][2],"+ H/E < 0.1","lp"); if (isoChoice == kSumIso) leg1->AddEntry(heff[icent][3],"+ SumIso cut","lp"); if (isoChoice == kFisher) leg1->AddEntry(heff[icent][3],"+ Fisher cut","lp"); leg1->AddEntry(heff[icent][4],"+ #sigma_{#eta#eta} <0.010","lp"); leg1->Draw(); } drawText(Form("%.0f%% - %.0f%%", float((float)lowerCent*2.5), float((float)(upperCent+1)*2.5)),0.5680963,0.8369118); if ( icent<=2) drawPatch(0,0,0.05,0.14,0,1001,ndcOpt); // drawPatch(0.9,0.05,1.01,0.14,0,1001,ndcOpt); } c2->SaveAs(Form("photonID_efficiency_%s.pdf",getIsoLabel(isoChoice).Data())); TCanvas* c2b = new TCanvas("c2b","",1000,500); //100 + nCent_std*300,400); c2b->Divide(2,1); c2b->cd(1); TH1D* htmpG = (TH1D*)heffGj[1]->Clone("htmpG"); htmpG->Reset(); htmpG->SetAxisRange(0,1.3,"Y"); htmpG->SetYTitle("Efficiency"); handsomeTH1(htmpG); TLegend* legCent = new TLegend(0.4657258,0.2245763,1,0.4512712,NULL,"brNDC"); easyLeg(legCent,"Centrality"); if (isoChoice == kSumIso) easyLeg(legCent,"SumIso Method"); if (isoChoice == kFisher) easyLeg(legCent,"Fisher Method"); cout<< " heffGj "<< endl << endl<< endl; for (int icent = 1; icent <=nCent; icent++) { handsomeTH1(heffGj[icent],ycolor[icent]); heffGj[icent]->Fit("pol1"); heffGj[icent]->GetFunction("pol1")->SetLineColor(ycolor[icent]); heffGj[icent]->GetFunction("pol1")->SetLineStyle(7); } htmpG->DrawCopy(); for (int icent = 1; icent <=nCent; icent++) { heffGj[icent]->Draw("same"); int lowerCent = centBinVector[icent-1]; int upperCent = centBinVector[icent]-1; legCent->AddEntry(heffGj[icent],Form("%.0f%% - %.0f%%", float((float)lowerCent*2.5), float((float)(upperCent+1)*2.5)),"pl"); } legCent->Draw(); c2b->cd(2); TH1D* htmpDp = new TH1D("htmpDp",";#Delta#phi of pair;Efficiency",10,0,3.14); htmpDp->Reset(); htmpDp->SetAxisRange(0,1.3,"Y"); htmpDp->SetYTitle("Efficiency"); handsomeTH1(htmpDp); cout << " heffDphi " << endl << endl << endl ; for (int icent = 1; icent <=nCent; icent++) { handsomeTH1(heffDphi[icent],ycolor[icent]); heffDphi[icent]->Fit("pol1"); heffDphi[icent]->GetFunction("pol1")->SetLineColor(ycolor[icent]); heffDphi[icent]->GetFunction("pol1")->SetLineStyle(7); } htmpDp->DrawCopy(); for (int icent = 1; icent <=nCent; icent++) { heffDphi[icent]->Draw("same"); } legCent->Draw(); c2b->SaveAs(Form("photonID_efficiency_%s_2.pdf",getIsoLabel(isoChoice).Data())); TCanvas* c3 = new TCanvas("cPurity","",500,500); TH1D* hPurity[10]; for (int icent = 1; icent <=nCent; icent++) { hPurity[icent] = (TH1D*)hPurity2D->ProjectionX(Form("purity1D_icent%d",icent),icent,icent); hPurity[icent]->Fit("pol1"); hPurity[icent]->GetFunction("pol1")->SetLineColor(ycolor[icent]); hPurity[icent]->GetFunction("pol1")->SetLineStyle(7); } TH1D* tempPurity = (TH1D*)hPurity[1]->Clone("purityTemp"); tempPurity->Reset(); handsomeTH1(tempPurity,1); tempPurity->SetXTitle("pT (Gev)"); tempPurity->SetYTitle("Purity"); tempPurity->SetAxisRange(0.45,1.2,"Y"); tempPurity->Draw(); for (int icent = 1; icent <=nCent; icent++) { handsomeTH1(hPurity[icent],ycolor[icent]); hPurity[icent]->Draw("same"); } TLegend* legPurity = new TLegend(0.4657258,0.2245763,1,0.4512712,NULL,"brNDC"); easyLeg(legPurity,"Purity"); if (isoChoice == kSumIso) easyLeg(legPurity,"SumIso Method"); if (isoChoice == kFisher) easyLeg(legPurity,"Fisher Method"); for (int icent = 1; icent <=nCent; icent++){ int lowerCent = centBinVector[icent-1]; int upperCent = centBinVector[icent]-1; legPurity->AddEntry(hPurity[icent],Form("%.0f%% - %.0f%%", float((float)lowerCent*2.5), float((float)(upperCent+1)*2.5)),"pl"); } legPurity->Draw(); if ( !onlygjEvents) drawText("inclusive photon",0.25,0.2); c3->SaveAs(Form("purity_%s.pdf",getIsoLabel(isoChoice).Data())); TCanvas* c4 = new TCanvas("efficiencyCorrection","",1000,500); c4->Divide(2,1); c4->cd(1); for (int icent = 1; icent <=nCent; icent++) { TH1ScaleByWidth(rawSpectra[icent]); // divide by width finSpectra[icent] = (TH1D*)rawSpectra[icent]->Clone(Form("finSpec_icent%d_%s",icent,getIsoLabel(isoChoice).Data())); if ( isoChoice == kSumIso2) finSpectra[icent]->SetName(Form("finSpec_icent%d_%s_isoCut%d",icent,getIsoLabel(isoChoice).Data(),(int)isoCut)); if ( isoChoice == kSumIso3) finSpectra[icent]->SetName(Form("finSpec_icent%d_%s_sbisoCut%d",icent,getIsoLabel(isoChoice).Data(),(int)specialSbCut)); finSpectra[icent]->Divide(heff[icent][3]); handsomeTH1(finSpectra[icent],ycolor[icent]); } // TAA and centrality // TFile outf = TFile(cab.getPurityFileName(),"recreate"); hPurity2D->Write(); for ( int icent=1 ; icent<=nCent ; icent++) { heff[icent][3]->Write(); heff[icent][4]->Write(); finSpectra[icent]->Write(); hPurity[icent]->Write(); for (int ipt = 1; ipt <= nPtBin ; ipt++) { hData[icent][ipt]->Write(); } // hBkgMCRatioFit[icent][1]->Write(); } outf.Close(); }
void drawInclJetFragSingle( TH1D* htrkPt[3][5], int dataset, int icent, int irj, int fragMode, float trackPtMin, float trackPtMax, int doClosure, bool usingPara, int rewtJet ) { ///////////////////////////////////////////////////////////////// // This function is given the booked histograms // and does the real work of filling the histograms // for each dataset and each analysis setup ///////////////////////////////////////////////////////////////// TString datasetName; if (dataset == kHIDATA) datasetName = "hidata"; else if (dataset == kHIMC) datasetName = "himc"; else if (dataset == kPPDATA) datasetName = "ppdata"; else if (dataset == kPPMC) datasetName = "ppmc"; TString attPara = ( (usingPara == true) ? "Para" : "" ) ; TString suffix = Form("%s_icent%d_irj%d_fragMode%d_closure%d_jtrewt%d_%s",datasetName.Data(),icent,irj,fragMode,doClosure,rewtJet,tag.Data()); TString clsText = "evtMixing"; TString clsText_ = "event mixing method"; if ( doClosure >= 100 ) { clsText = "etaRefl"; clsText_ = "#eta reflection method"; } /////////////////////////////////////////////////////// // Book histograms for Intermediate checks /////////////////////////////////////////////////////// TH1D* hjetPt = new TH1D(Form("hjetPt_%s",suffix.Data()),";Jet p_{T} (GeV/c);Entries;",50,0,500); /////////////////////////////////////////////////////// // Setup cuts /////////////////////////////////////////////////////// float finalEtaCut = 2.0; // float finalEtaCut = 1.2; float finalJetPtMin = 100; float finalJetPtMax = 300; TCut jetSelCut = Form("finalJetPt>=%.0f&&finalJetPt<%.0f",finalJetPtMin,finalJetPtMax); // TCut jetSelCut = Form("finalJetPt>=%.0f&&finalJetPt<%.0f&&jetPtGM>100",finalJetPtMin,finalJetPtMax); // TCut jetSelCut = Form("jetPtGM>=%.0f&&jetPtGM<%.0f",finalJetPtMin,finalJetPtMax); // jetSelCut=jetSelCut&&"abs(vz)<4"; TCut centCut = "1==1"; if ( (icent >= 1) && (icent<=4) ) centCut = Form("cBin>=%d && cBin<%d", (int)centBin1[icent-1], (int)centBin1[icent]); //////////////////////////////////////////////////////// // Jet Selection //////////////////////////////////////////////////////// // inclusive ///////// TString jet1Cut = Form("abs(jetEta)<%.2f",finalEtaCut); // if (doClosure>=100&&doClosure!=101) { if (doClosure>=100) { jet1Cut = Form("%s && abs(jetEta)>0.3",jet1Cut.Data()); } //////////////////////////////////////////////////////// // Weights //////////////////////////////////////////////////////// float jetDrCut = 0.3; TString jetRewt= "1"; if ( rewtJet==1 ) { jetRewt = Form("rewtPt"); // jetRewt = Form("(1+0.5*(rewtPt-1))"); } /////////////////////////////////////////////////////// // Input trees /////////////////////////////////////////////////////// multiTreeUtil* dj = new multiTreeUtil(); if ( dataset == kHIDATA) { // dj->addFile("../ntout/jskim_hltjet80-pt90-v20_akPu3PF_Jan16_4bin_sm18_jetPt_60_jetEtaCut_2.00_noPbin_sm1bin0_akPu3PF_gj0.root", dj->addFile("../ntout/jskim_hltjet80-pt90-v20_akPu3PF_Jan17_4bin_sm18_jetPt_60_jetEtaCut_2.00_noPbin_sm1bin0_akPu3PF_gj0_addedReweight.root","tdj", jetSelCut && centCut,1); // dj->addFile("../ntout/jskim_hltjet80-pt90-v20_akPu3PF_Jan26_4bin_sm18_jetPt_60_jetEtaCut_2.00_noPbin_sm3bin0_akPu3PF_gj0.root","tdj", jetSelCut && centCut,1); } else if ( dataset == kHIMC) { // pythia+hydjet // dj->addFile("../ntout/jskim_hydj80_akPu3PF_Jan17_4bin_sm18_jetPt_60_jetEtaCut_2.00_noPbin_sm1bin0_akPu3PF_gj0.root","tdj", jetSelCut && centCut && "pthat>=80&&pthat<9999", 9.913e-5*1.e9); // dj->addFile("../ntout/jskim_hydj50_akPu3PF_Jan17_4bin_sm18_jetPt_60_jetEtaCut_2.00_noPbin_sm1bin0_akPu3PF_gj0.root","tdj", jetSelCut && centCut && "pthat>=50&&pthat<80", 1.021e-3*1.e9); // dj->addFile("../ntout/jskim_hydj80_akPu3PF_Jan17_4bin_sm18_jetPt_60_jetEtaCut_2.00_noPbin_sm1bin0_akPu3PF_gj0.root", "tdj", jetSelCut && centCut && "pthat>=80&&pthat<100",9.913e-5*1.e9); // dj->addFile("../ntout/jskim_hydj100_akPu3PF_Jan17_4bin_sm18_jetPt_60_jetEtaCut_2.00_noPbin_sm1bin0_akPu3PF_gj0.root", "tdj", jetSelCut && centCut && "pthat>=100&&pthat<120",3.069e-5*1.e9); // dj->addFile("../ntout/jskim_hydj120_akPu3PF_Jan17_4bin_sm18_jetPt_60_jetEtaCut_2.00_noPbin_sm1bin0_akPu3PF_gj0.root", "tdj", jetSelCut && centCut && "pthat>=120&&pthat<9999",1.128e-5*1.e9); // dj->addFile("../ntout/jskim_hydj80_akPu3PF_Jan17_4bin_sm18_jetPt_60_jetEtaCut_2.00_noPbin_sm1bin0_akPu3PF_gj0.root", "tdj", jetSelCut && centCut && "pthat>=80&&pthat<100",9.913e-5*1.e9); // dj->addFile("../ntout/jskim_hydj100_akPu3PF_Jan17_4bin_sm18_jetPt_60_jetEtaCut_2.00_noPbin_sm1bin0_akPu3PF_gj0.root", "tdj", jetSelCut && centCut && "pthat>=100&&pthat<9999",3.069e-5*1.e9); // dj->addFile("../ntout/jskim_hydj80_akPu3PF_Jan17_4bin_sm18_jetPt_60_jetEtaCut_2.00_noPbin_sm1bin0_akPu3PF_gj0.root","tdj", jetSelCut && centCut && "pthat>=80&&pthat<100", 9.913e-5*1.e9); // dj->addFile("../ntout/jskim_hydj80_akPu3PF_Jan17_4bin_sm18_jetPt_60_jetEtaCut_2.00_noPbin_sm1bin0_akPu3PF_gj0.root","tdj", jetSelCut && centCut && "pthat>=80&&pthat<9999", 3.069e-5*1.e9); // pyquen+hydjet dj->addFile("../ntout/jskim_hydj80quenwide_akPu3PF_Jan26_4bin_sm18_jetPt_60_jetEtaCut_2.00_noPbin_sm1bin0_akPu3PF_gj0.root", "tdj", jetSelCut && centCut && "pthat>=80&&pthat<100",9.913e-5*1.e9); dj->addFile("../ntout/jskim_hydj100quenwide_akPu3PF_Jan26_4bin_sm18_jetPt_60_jetEtaCut_2.00_noPbin_sm1bin0_akPu3PF_gj0.root", "tdj", jetSelCut && centCut && "pthat>=100&&pthat<9999",3.069e-5*1.e9); } else if ( dataset == kPPDATA) { // dj->addFile(Form("../ntout/jskim_pp-full_ak3PF_Dec5newsmgt60steps_jetPt_60_jetEtaCut_2.00_noPbin_sm2bin%d_ak3PF_gj0.root",icent), // dj->addFile(Form("../ntout/jskim_pp-full_ak3PF_Jan16_4bin_sm18_jetPt_60_jetEtaCut_2.00_noPbin_sm2bin%d_ak3PF_gj0_addedReweight.root",icent), // dj->addFile(Form("../ntout/jskim_pp-full_ak3PF_Jan16_4bin_sm18_seed2_jetPt_60_jetEtaCut_2.00_noPbin_sm2bin%d_ak3PF_gj0.root",icent), dj->addFile(Form("../ntout/jskim_pp-full_ak3PF_Jan17_4bin_sm18_jetPt_60_jetEtaCut_2.00_noPbin_sm2bin%d_ak3PF_gj0_addedReweight.root",icent), // dj->addFile(Form("../ntout/jskim_pp-full_ak3PF_Jan17_4bin_sm18_jetPt_60_jetEtaCut_2.00_noPbin_sm2bin%d_ak3PF_gj0_addedFitRewt.root",icent), "tdj", jetSelCut, 1); // no centrality cut } else if ( dataset == kPPMC) { // dj->addFile(Form("../ntout/jskim_dj80_ak3PF_Jan17_4bin_sm18_jetPt_60_jetEtaCut_2.00_noPbin_sm0bin0_ak3PF_gj0.root"),"tdj", jetSelCut && "pthat>=80&&pthat<9999", 9.913e-5*1.e9); // no centrality cut // dj->addFile(Form("../ntout/jskim_dj50_ak3PF_Jan17_4bin_sm18_jetPt_60_jetEtaCut_2.00_noPbin_sm0bin0_ak3PF_gj0.root"),"tdj", jetSelCut && "pthat>=50&&pthat<80", 1.021e-3*1.e9); // no centrality cut dj->addFile(Form("../ntout/jskim_dj80_ak3PF_Jan17_4bin_sm18_jetPt_60_jetEtaCut_2.00_noPbin_sm2bin%d_ak3PF_gj0.root",icent),"tdj", jetSelCut && "pthat>=80&&pthat<120", 9.913e-5*1.e9); // no centrality cut dj->addFile(Form("../ntout/jskim_dj120_ak3PF_Jan17_4bin_sm18_jetPt_60_jetEtaCut_2.00_noPbin_sm2bin%d_ak3PF_gj0.root",icent),"tdj", jetSelCut && "pthat>=120&&pthat<9999", 1.128e-5*1.e9); // no centrality cut // dj->addFile(Form("../ntout/jskim_dj80_ak3PF_Jan17_4bin_sm18_jetPt_60_jetEtaCut_2.00_noPbin_sm2bin%d_ak3PF_gj0.root",icent),"tdj", jetSelCut, 1); // no centrality cut // dj->addFile(Form("../ntout/jskim_dj80_ak3PF_Jan17_4bin_sm18_jetPt_60_jetEtaCut_2.00_noPbin_sm2bin%d_ak3PF_gj0_addedReweight.root",icent),"tdj", jetSelCut, 1); // no centrality cut } // pthat scaling normalization if ( dataset == kHIMC || dataset == kPPMC) dj->NormalizeScales(2,"","hEvtCentNoSkim"); // Friend Trees dj->AddFriend("yTrk=yongsunTrack"); // dj->AddFriend("mTrk"); if ( (doClosure > 0) && ( doClosure != 100 ) && doClosure!=200 && doClosure!=210 && doClosure!=240 && doClosure!=250) { dj->AddFriend("genPar"); // dj->AddFriend("mGenPar"); } dj->SetAlias("finalJetPt","jetPt"); // dj->SetAlias("finalJetPt","(jetPt*(0.935+0.065*cBin/40.))"); // systematic check for uncertainty in jes cout << "finalJetPt = " << dj->trees_[0]->GetAlias("finalJetPt") << endl; cout << " ================================================= " << endl; cout << " working on dataset, icent, irj = " << datasetName << ", "<<icent<<", "<<irj<<endl; cout << " doClosure: " << doClosure << " rewtJet: " << rewtJet << endl; cout << " ================================================= " << endl; //////////////////////////////////////////////////////// // Draw From Tree //////////////////////////////////////////////////////// dj->Draw(hjetPt, "finalJetPt" ,jet1Cut.Data() ,jetRewt); double NoE1 = hjetPt->Integral(); //////////////////////////////////////////////////////// // Track Selection //////////////////////////////////////////////////////// TString trkCutJet1 = Form("yTrk.jetMatch==1 && yTrk.jetDr<%.2f && yTrk.pt>%.2f && yTrk.pt<%.2f", jetDrCut,trackPtMin,trackPtMax); TString bkgTrkCutJet1; if (doClosure==0) { bkgTrkCutJet1 = Form("mTrk.jetMatch==1 && mTrk.jetDr<%.2f && mTrk.pt>%.2f && mTrk.pt<%.2f", jetDrCut,trackPtMin,trackPtMax); } else if (doClosure==100) { bkgTrkCutJet1 = Form("yTrk.jetMatch==-1 && yTrk.jetDr<%.2f && yTrk.pt>%.2f && yTrk.pt<%.2f", jetDrCut,trackPtMin,trackPtMax); } else if (doClosure==1 || doClosure==101) { trkCutJet1 = Form("(abs(genPar.chg)>0) && (genPar.jetMatch==1) && (genPar.jetDr<%.2f) && (genPar.pt>%.2f && genPar.pt<%.2f)", jetDrCut,trackPtMin,trackPtMax); bkgTrkCutJet1 = Form("(genPar.sube!=0) && (abs(genPar.chg)>0) && (genPar.jetMatch==1) && (genPar.jetDr<%.2f) && (genPar.pt>%.2f && genPar.pt<%.2f)", jetDrCut,trackPtMin,trackPtMax); } else if (doClosure==102) { trkCutJet1 = Form("(abs(genPar.chg)>0) && (genPar.jetMatch==1) && (genPar.jetDr<%.2f) && (genPar.pt>%.2f && genPar.pt<%.2f)", jetDrCut,trackPtMin,trackPtMax); bkgTrkCutJet1 = Form("(abs(genPar.chg)>0) && (genPar.jetMatch==-1) && (genPar.jetDr<%.2f) && (genPar.pt>%.2f && genPar.pt<%.2f)", jetDrCut,trackPtMin,trackPtMax); } else if (doClosure ==2) { trkCutJet1 = Form("(abs(genPar.chg)>0) && (genPar.jetMatch==1) && (genPar.jetDr<%.2f) && (genPar.pt>%.2f && genPar.pt<%.2f)", jetDrCut,trackPtMin,trackPtMax); bkgTrkCutJet1 = Form("(abs(mGenPar.chg)>0) && (mGenPar.jetMatch==1) && (mGenPar.jetDr<%.2f) && (mGenPar.pt>%.2f && mGenPar.pt<%.2f)", jetDrCut,trackPtMin,trackPtMax); } //////////////////////////////////////////////////////// // Track Weights //////////////////////////////////////////////////////// TString trackWeight[3]; TString matchedTrackWeight[3]; TString genpWeight[3]; // initialize for (int j=0; j<3; ++j) { // trackWeight[j] = jetRewt; // matchedTrackWeight[j] = jetRewt; trackWeight[j] = jetRewt+"*(yTrk.trkWeight*(yTrk.trkWeight<3.5)+1.47*(yTrk.trkWeight>=3.5))"; matchedTrackWeight[j] = jetRewt+"*(mTrk.trkWeight*(mTrk.trkWeight<3.5)+1.47*(mTrk.trkWeight>=3.5))"; genpWeight[j] = jetRewt; if (weightMode==1) { trackWeight[j]+="*yTrk.pt*"; matchedTrackWeight[j]+="*mTrk.pt"; genpWeight[j] += "*genPar.pt"; } else if (weightMode==2) { trackWeight[j]+="*yTrk.pt/finalJetPt"; matchedTrackWeight[j]+="*mTrk.pt/finalJetPt"; genpWeight[j] += "*genPar.pt/finalJetPt"; } } for (int j=0; j<1; ++j) { if ( fragMode == 1 ) { if (doClosure == 0) { dj->Draw(htrkPt[j][kRAW],"yTrk.pt", Form("%s && %s", jet1Cut.Data(), trkCutJet1.Data()), trackWeight[j] ); dj->Draw(htrkPt[j][kBKG],"mTrk.pt", Form("%s && %s", jet1Cut.Data(), bkgTrkCutJet1.Data()), matchedTrackWeight[j]); } else if ( doClosure == 100 ) { dj->Draw(htrkPt[j][kRAW],"yTrk.pt", Form("%s && %s", jet1Cut.Data(), trkCutJet1.Data()), trackWeight[j]); dj->Draw(htrkPt[j][kBKG], "yTrk.pt", Form("%s && %s", jet1Cut.Data(), bkgTrkCutJet1.Data()), trackWeight[j]); } else if ( doClosure == 1 || doClosure == 101 || doClosure == 102) { dj->Draw(htrkPt[j][kRAW], "genPar.pt", Form("%s && %s", jet1Cut.Data(), trkCutJet1.Data()), genpWeight[j]); dj->Draw(htrkPt[j][kBKG], "genPar.pt", Form("%s && %s", jet1Cut.Data(), bkgTrkCutJet1.Data()), genpWeight[j]); } // else if ( doClosure == 2 ) { // dj->Draw(htrkPt[j][kRAW], "genPar.pt", Form("%s && %s", jet1Cut.Data(), trkCutJet1.Data()), genpWeight[j]); // dj->Draw(htrkPt[j][kBKG], "mGenPar.pt",Form("%s && %s", jet1Cut.Data(), bkgTrkCutJet1.Data()), genpWeight[j]); // } } else if ( fragMode == 2 ) { if (doClosure == 0) { dj->Draw(htrkPt[j][kRAW],"-log(yTrk.pt * cos(yTrk.jetDr) *(cosh(yTrk.eta)/cosh(jetEta)) /finalJetPt )", Form("%s && %s", jet1Cut.Data(), trkCutJet1.Data()), trackWeight[j]); dj->Draw(htrkPt[j][kBKG],"-log(mTrk.pt * cos(mTrk.jetDr) * (cosh(mTrk.eta)/cosh(jetEta)) /finalJetPt )", Form("%s && %s", jet1Cut.Data(), bkgTrkCutJet1.Data()), matchedTrackWeight[j]); } else if ( doClosure == 100 ) { dj->Draw(htrkPt[j][kRAW],"-log(yTrk.pt * cos(yTrk.jetDr) *(cosh(yTrk.eta)/cosh(jetEta)) /finalJetPt)", Form("%s && %s", jet1Cut.Data(), trkCutJet1.Data()), trackWeight[j]); dj->Draw(htrkPt[j][kBKG], "-log(yTrk.pt * cos(yTrk.jetDr) * (cosh(yTrk.eta)/cosh(jetEta)) /finalJetPt)", Form("%s && %s", jet1Cut.Data(), bkgTrkCutJet1.Data()), trackWeight[j]); } else if ( doClosure == 1|| doClosure == 101 || doClosure == 102) { dj->Draw(htrkPt[j][kRAW], "-log( genPar.pt * cos(genPar.jetDr) *(cosh(genPar.eta)/cosh(jetEta)) /finalJetPt)", Form("%s && %s", jet1Cut.Data(), trkCutJet1.Data()), genpWeight[j]); dj->Draw(htrkPt[j][kBKG], "-log( genPar.pt * cos(genPar.jetDr) *(cosh(genPar.eta)/cosh(jetEta)) /finalJetPt)", Form("%s && %s", jet1Cut.Data(), bkgTrkCutJet1.Data()), genpWeight[j]); } // else if ( doClosure == 2 ) { // dj->Draw(htrkPt[j][kRAW], "-log( genPar.pt * cos(genPar.jetDr) *(cosh(genPar.eta)/cosh(jetEta)) /finalJetPt)", Form("%s && %s", // jet1Cut.Data(), trkCutJet1.Data()), genpWeight[j]); // dj->Draw(htrkPt[j][kBKG], "-log(mGenPar.pt * cos(mGenPar.jetDr) *(cosh(mGenPar.eta)/cosh(jetEta)) /finalJetPt)", Form("%s && %s", // jet1Cut.Data(), bkgTrkCutJet1.Data()), genpWeight[j]); // } } // Rockets! // else if ( fragMode == 10 ) { // if (doClosure <= 0) { // dj->Draw(htrkPt[j][kRAW],"yTrk.jetDr", Form("%s && %s", jet1Cut.Data(), trkCutJet1.Data()), trackWeight[j]); // dj->Draw(htrkPt[j][kBKG],"mTrk.jetDr", Form("%s && %s", jet1Cut.Data(), bkgTrkCutJet1.Data()), matchedTrackWeight[j]); // } // else if ( doClosure == 100 ) { // dj->Draw(htrkPt[j][kRAW],"yTrk.jetDr", Form("%s && %s", jet1Cut.Data(), trkCutJet1.Data()), trackWeight[j]); // dj->Draw(htrkPt[j][kBKG], "yTrk.jetDr", Form("%s && %s", jet1Cut.Data(), bkgTrkCutJet1.Data()), trackWeight[j]); // } // else if ( doClosure == 1 || doClosure == 101 || doClosure == 102) { // dj->Draw(htrkPt[j][kRAW], "genPar.jetDr", Form("%s && %s", jet1Cut.Data(), trkCutJet1.Data()), genpWeight[j]); // dj->Draw(htrkPt[j][kBKG], "genPar.jetDr", Form("%s && %s", jet1Cut.Data(), bkgTrkCutJet1.Data()), genpWeight[j]); // } // else if ( doClosure == 2 ) { // dj->Draw(htrkPt[j][kRAW], "genPar.jetDr", Form("%s && %s", jet1Cut.Data(), trkCutJet1.Data()), genpWeight[j]); // dj->Draw(htrkPt[j][kBKG], "mGenPar.jetDr",Form("%s && %s", jet1Cut.Data(), bkgTrkCutJet1.Data()), genpWeight[j]); // } // } // Normalize Histograms if (fragMode<10) { TH1ScaleByWidth(htrkPt[j][kRAW]); TH1ScaleByWidth(htrkPt[j][kBKG]); } // Signal htrkPt[j][kRAW]->Scale(1./NoE1); // Background if ( (doClosure == 1) || (doClosure>99) ) { htrkPt[j][kBKG]->Scale(1./(NoE1)); } else { htrkPt[j][kBKG]->Scale(1./(NoE1*nMixing1)); } htrkPt[j][kSIG]->Add(htrkPt[j][kRAW]); htrkPt[j][kSIG]->Add(htrkPt[j][kBKG],-1); handsomeTH1(htrkPt[j][kRAW],1,1,24); handsomeTH1(htrkPt[j][kBKG],1); handsomeTH1(htrkPt[j][kSIG],1,1,20); } // Inspect TCanvas* c1 = new TCanvas(Form("c1_icent%d_irj%d",icent,irj),"",900,450); int iJetInsp=0; c1->Divide(2,1); c1->cd(1); if (fragMode<10) { gPad->SetLogy(); htrkPt[iJetInsp][kRAW]->SetAxisRange(1e-5,10000,"Y"); } else { gPad->SetLogy(); if (weightMode==0) htrkPt[iJetInsp][kRAW]->SetAxisRange(1e-4,100,"Y"); if (weightMode==1) htrkPt[iJetInsp][kRAW]->SetAxisRange(1e-4,1e5,"Y"); if (weightMode==2) htrkPt[iJetInsp][kRAW]->SetAxisRange(1e-4,10,"Y"); } htrkPt[iJetInsp][kRAW]->Draw(); htrkPt[iJetInsp][kBKG]->Draw("same hist"); htrkPt[iJetInsp][kSIG]->Draw("same"); TLegend* l1 = new TLegend(0.3678213,0.7702352,0.9162483,0.9296714,NULL,"brNDC"); easyLeg(l1,clsText_.Data()) ; l1->AddEntry(htrkPt[iJetInsp][kRAW],"All tracks in jet cone","p"); l1->AddEntry(htrkPt[iJetInsp][kBKG], "tracks from underlying events","l"); l1->AddEntry(htrkPt[iJetInsp][kSIG], "After subtraction","p"); l1->Draw(); drawText("jet p_{T} > 100GeV/c, |#eta|<2", 0.26,0.3,1,17); drawText(Form("%d jets",(int)hjetPt->GetEntries()), 0.26,0.23,1,17); if ( fragMode == 1 ) gPad->SetLogx(); if ( dataset == kHIDATA) drawText("PbPb DATA", 0.2,0.8,1,15); else if ( dataset == kHIMC) drawText("MC", 0.2,0.8,1); else if ( dataset == kPPDATA) drawText("pp DATA", 0.2,0.8,1,15); else if ( dataset == kPPMC) drawText("pp MC", 0.2,0.8,1,15); if ( (icent>=1) && (icent<=4) ) { int lowCent = centBin1[icent-1]; int highCent = centBin1[icent]-1; drawText(Form("%.0f%% - %.0f%%", float((float)lowCent*2.5), float((float)(highCent+1)*2.5)), 0.2,0.73,1); } if ( (irj>=1) && (irj<=4) ) { drawText("0-30%", 0.2,0.73,1); drawText(Form("%.2f < pt_{2}/pt_{1} < %.2f %.0f < p_{T}^{track} < %.0f", float(rjBin1[irj-1]), float(rjBin1[irj]),trackPtMin,trackPtMax), 0.2,0.66,1); } if (fragMode==10) { drawText(Form("%.0f < p_{T}^{track} < %.0f GeV/c", trackPtMin,trackPtMax), 0.5,0.66,1); } c1->cd(2); cleverRange(hjetPt,10,1e-1); handsomeTH1(hjetPt,1); hjetPt->Draw(); gPad->SetLogy(); drawText("Jet p_{T}", 0.55,0.63,1); TString outnameTag=Form("trackPtCut%.0f_FinalJetPt%.0fto%.0feta%.2f_Jan17mcquenwide80and100_hi",ptranges[0],finalJetPtMin,finalJetPtMax,finalEtaCut); if ( fragMode==2) { c1->SaveAs(Form("plotsOfInclJetFF/inclJetFF_xi_doClosure%d_icent%d_irj%d_%s_%s%s_%s.pdf",doClosure,icent,irj,datasetName.Data(),clsText.Data(),tag.Data(),outnameTag.Data())); } else if ( fragMode==1) { c1->SaveAs(Form("plotsOfInclJetFF/inclJetFF_pt_doClosure%d_icent%d_irj%d_%s_%s%s_%s.pdf",doClosure,icent,irj,datasetName.Data(),clsText.Data(),tag.Data(),outnameTag.Data())); } else if ( fragMode==10) { c1->SaveAs(Form("plotsOfInclJetFF/inclJetFF_dr_pt%.0fto%.0f_doClosure%d_wtMode%d_icent%d_irj%d_%s_%s%s_%s.pdf",trackPtMin,trackPtMax,doClosure,weightMode,icent,irj,datasetName.Data(),clsText.Data(),tag.Data(),outnameTag.Data())); } // All Done, write output TFile outf = TFile(Form("inclJetFF_output_%s.root",outnameTag.Data()),"update"); hjetPt->Write(); htrkPt[0][kRAW]->Write(); htrkPt[0][kSIG]->Write(); htrkPt[0][kBKG]->Write(); outf.Close(); // clean up delete dj; }
void gammaTrkSingle( GjSpectra* gSpec, multiTreeUtil* tObj[3], corrFunctionTrk* corr, float purity, sampleType collision, TString var, TCut cut, TString theWeight, TCut phoCandCut, TCut phoDecayCut, TH1D* hTemplate, TString outfName) { TH1::SetDefaultSumw2(); TCanvas* c1 = new TCanvas(Form("canvas_%s",hTemplate->GetName()),"",800,650); makeMultiPanelCanvas(c1,2,2,0.0,0.0,0.2,0.15,0.02); c1->cd(1); corr->init(gSpec, collision, purity, hTemplate); cout << "Filling raw jets" << endl; tObj[kTrkRaw]->Draw2(corr->Func[kPhoCand][kTrkRaw], var, phoCandCut && cut, theWeight); if ( tObj[kTrkBkg]!=0) { cout << "Filling mixed jets" << endl; tObj[kTrkBkg]->Draw2(corr->Func[kPhoCand][kTrkBkg], var, phoCandCut && cut, theWeight); } if ( (collision==kHIDATA) || (collision==kPPDATA) || (collision==kPADATA) ) { cout << "Filling decay photon-jet correlation" << endl; tObj[kTrkRaw]->Draw2(corr->Func[kPhoDecay][kTrkRaw], var, phoDecayCut && cut, theWeight); if (tObj[kTrkBkg]!=0) { cout << "Filling decay photon- mixed jet correlation" << endl; tObj[kTrkBkg]->Draw2(corr->Func[kPhoDecay][kTrkBkg], var, phoDecayCut && cut, theWeight); } } TH1ScaleByWidth( corr->Func[kPhoCand][kTrkRaw]); TH1ScaleByWidth( corr->Func[kPhoCand][kTrkBkg]); TH1ScaleByWidth( corr->Func[kPhoDecay][kTrkRaw]); TH1ScaleByWidth( corr->Func[kPhoDecay][kTrkBkg]); corr->calCorr(); c1->cd(1); handsomeTH1(corr->Func[kPhoCand][kTrkRaw],1); handsomeTH1(corr->Func[kPhoCand][kTrkBkg],1); handsomeTH1(corr->Func[kPhoCand][kTrkSig],2); corr->Func[kPhoCand][kTrkRaw]->Draw(); corr->Func[kPhoCand][kTrkBkg]->Draw("same hist"); corr->Func[kPhoCand][kTrkSig]->Draw("same"); gPad->SetLogy(); c1->cd(2); handsomeTH1(corr->Func[kPhoDecay][kTrkRaw],1); handsomeTH1(corr->Func[kPhoDecay][kTrkBkg],1); handsomeTH1(corr->Func[kPhoDecay][kTrkSig],4); corr->Func[kPhoDecay][kTrkRaw]->Draw(); corr->Func[kPhoDecay][kTrkBkg]->Draw("same hist"); corr->Func[kPhoDecay][kTrkSig]->Draw("same"); gPad->SetLogy(); c1->cd(3); corr->Func[kPhoCand][kTrkSig]->Draw(); corr->Func[kPhoDecay][kTrkSig]->Draw("same"); c1->cd(4); handsomeTH1(corr->Func[kPhoSig][kTrkSig],1); corr->Func[kPhoSig][kTrkSig]->Draw(); c1->SaveAs(Form("gifs/%s_%s.gif",outfName.Data(),c1->GetName()) ); TFile outf = TFile(Form("ffFiles/%s",outfName.Data()),"update"); corr->Func[kPhoCand][kTrkRaw]->Write(); corr->Func[kPhoCand][kTrkBkg]->Write(); corr->Func[kPhoCand][kTrkSig]->Write(); corr->Func[kPhoDecay][kTrkRaw]->Write(); corr->Func[kPhoDecay][kTrkBkg]->Write(); corr->Func[kPhoDecay][kTrkSig]->Write(); corr->Func[kPhoSig][kTrkRaw]->Write(); corr->Func[kPhoSig][kTrkBkg]->Write(); corr->Func[kPhoSig][kTrkSig]->Write(); outf.Close(); }
{ gROOT->Reset(); // Draw histos filled by Geant4 simulation // ////TFile f = TFile("elastic.root"); TFile f = TFile("nCaptureHP.root"); TCanvas* c1 = new TCanvas("c1", " "); c1->SetLogy(1); c1->cd(); c1->Update(); ///TH1D* hist1 = (TH1D*)f.Get("1"); ///hist1->Draw("HIST"); TH1D* hist2 = (TH1D*)f.Get("2"); hist2->Draw("HIST"); TH1D* hist3 = (TH1D*)f.Get("3"); hist3->Draw("HIST"); TH1D* hist11 = (TH1D*)f.Get("11"); hist11->Draw("HIST"); TH1D* hist12 = (TH1D*)f.Get("12"); hist12->Draw("HIST"); }
{ gROOT->Reset(); // Draw histos filled by Geant4 simulation // TFile f = TFile("testem7.root"); TCanvas* c1 = new TCanvas("c1", " "); TH1D* hist1 = (TH1D*)f.Get("h1"); hist1->Draw("HIST"); TH1D* hist2 = (TH1D*)f.Get("h2"); hist2->Draw("HIST"); TH1D* hist3 = (TH1D*)f.Get("h3"); hist3->Draw("HIST"); }
void energyCorrectionSet(TCut addCut, TString addName, bool drawRes) { const int nPtBin = 5; double ptBin[nPtBin+1] = {40, 60,80,100,140,200}; TH1D* hscale[10]; // const int nLt = 4; // double ltBin[nLt+1] = {0,10,20,30,40}; for ( int icent = 1 ; icent<=nCent_std ; icent++) { // for ( int icent = 1 ; icent<=nLt ; icent++) { for ( int icent = 1 ; icent<=nCent_std ; icent++) { int lowCent = centBin_std[icent-1]; int highCent = centBin_std[icent]-1; TCut centCut1 = Form("yEvt.hiBin >= %d && yEvt.hiBin<= %d",lowCent,highCent); //int lowCent = ltBin[icent-1]; //int highCent = ltBin[icent]-1; // TCut centCut1 = Form("locNtrk >= %d && locNtrk<= %d",lowCent,highCent); hscale[icent] = new TH1D(Form("hscale_%s_%d",addName.Data(),icent),";pT(GeV);scale",nPtBin,ptBin); if (drawRes) hscale[icent]->SetName(Form("hres_%s_%d",addName.Data(),icent)); for ( int ipt = 1 ; ipt<=nPtBin ; ipt++) { float lowPt = ptBin[ipt-1]; float highPt= ptBin[ipt]; scalePair theScale = energyCorrectionDiff( centCut1, lowPt, highPt,0,1.44,addCut); if (drawRes){ hscale[icent]->SetBinContent(ipt, theScale.res); hscale[icent]->SetBinError (ipt, theScale.resErr); } else { hscale[icent]->SetBinContent(ipt, theScale.val); hscale[icent]->SetBinError (ipt, theScale.err); } } } TH1D* htemp = (TH1D*)hscale[1]->Clone("htemp"); htemp->SetTitle(";Photon E_{T}^{Gen} (GeV) ; E_{T}^{Reco} / E_{T}^{Gen}"); handsomeTH1(htemp); htemp->SetAxisRange(0.9,1.2,"Y"); if ( drawRes ) htemp->SetAxisRange(0,0.1,"Y"); TF1 *func[10]; for ( int icent = 1 ; icent<=nCent_std ; icent++) { // for ( int icent = 1 ; icent<=nLt ; icent++) { handsomeTH1(hscale[icent],color[icent]); func[icent] = new TF1(Form("fit_%s",hscale[icent]->GetName()),resFun,10,1000,3); func[icent]->SetParameters(0.03, 0.2, 0.7 ); func[icent]->SetParNames("Constants","power"); hscale[icent]->Fit( func[icent]->GetName(),"LL M O Q"); func[icent]->SetLineColor(color[icent]); } htemp->Draw(); for ( int icent = 1 ; icent<=nCent_std ; icent++) { int lowCent = centBin_std[icent-1]; int highCent = centBin_std[icent]-1; hscale[icent]->Draw("same"); func[icent]->Draw("same"); } TLegend* leg1 = new TLegend(0.25,0.65,0.95,0.95,NULL,"brNDC"); easyLeg(leg1,""); leg1->AddEntry(hscale[1],"0 - 10%","lp"); leg1->AddEntry(hscale[2],"10 - 30%","lp"); leg1->AddEntry(hscale[3],"30 - 100%","lp"); leg1->Draw(); TFile outf = TFile("photonEnergyScaleTable.root","UPDATE"); for ( int icent = 1 ; icent<=nCent_std ; icent++) { hscale[icent]->Write(); func[icent]->Write(); } outf.Close(); }
//t->Print(); //led->GetDate(); //led->GetGain(2,-1,1); //TH1F*h = led->GetHist(1,1); //h->Draw(); #include <stdlib.h> #include <vector> typedef vector<TArrayD> vector_TArrayD; gSystem->Load("libAstro"); gSystem->Load("libMisc"); gSystem->Load("libEvent"); gSystem->Load("libDst"); gSystem->Load("libMd_Calib.so"); file = TFile("tmp/middle_drum/20081008/y2008m10d08p01.led355.root"); TTree*tree = file.Get("T"); TBranch*branch = tree->GetBranch("event"); THPKT1_DST_EVENT*event = 0; branch->SetAddress(&event); cout << branch->GetEntries() << endl; enum eConstants {MIN_CRATE = 0, MAX_CRATE = 14, NCRATE = 15, MIN_TUBE = 0, MAX_TUBE = 255, NTUBE = 256}; vector<TArrayD> fQdcb[NCRATE]; TArrayD flash(NTUBE) = {0}; Int_t br_entries = branch->GetEntries(); for(Int_t nentry = 0; nentry < br_entries; nentry++) { branch->GetEntry(nentry); if(event->ntubes > 240) {
{ gROOT->Reset(); // Draw histos filled by Geant4 simulation // TFile f = TFile("kulchi.root"); TCanvas* c1 = new TCanvas("c1", " "); TH1D* hist12 = (TH1D*)f.Get("12"); hist12->Draw("HIST"); TH1D* hist13 = (TH1D*)f.Get("13"); hist13->Draw("HIST"); }
void Merge(TString outfilename = "result.root") { // in an interactive ROOT session, edit the file names // Target and FileList, then // root > .L hadd.C // root > hadd() Target = TFile::Open(outfilename, "RECREATE"); TString filename; FileList = new TList(); for (Int_t iurqmd = 0; iurqmd < 200; iurqmd++){ //if (iurqmd < 100) { //with 0100 pi0 //if (iurqmd >= 100) { //with 0000 pi0 /* if ( iurqmd != 31 && iurqmd != 34 && iurqmd != 35 && iurqmd != 39 && iurqmd != 43 && iurqmd != 50 && iurqmd != 61 && iurqmd != 78 && iurqmd != 83 && iurqmd != 86 && iurqmd != 93 && iurqmd != 169 && iurqmd != 173 && iurqmd != 179 && iurqmd != 185 && iurqmd != 186 && iurqmd != 189 && iurqmd != 191 && iurqmd != 192 && iurqmd != 193 && iurqmd != 195 ){ //with 1000 pi0 */ /*if ( iurqmd == 31 || iurqmd == 34 || iurqmd == 39 || iurqmd == 43 || iurqmd == 50 || iurqmd == 61 || iurqmd == 78 || iurqmd == 83 || iurqmd == 86 || iurqmd == 93 || iurqmd == 185 || iurqmd == 186 || iurqmd == 191 || iurqmd == 192 || iurqmd == 193 ){ //without pi0 */ //if (iurqmd == 00) { //filename.Form("test.pa.trd_v12f.smearing.%04i.100events.root",iurqmd); filename.Form("reco/test.hd_qa.%04i.root",iurqmd); //cout << " " << filename; TFile test = TFile(filename,"READ"); if (test.IsOpen()){ cout << " file " << filename << ": added to TList" << endl; FileList->Add( TFile::Open(filename) ); test.Close(); } else { //cout << ": not found!" << endl; } } } MergeHistos( Target, FileList ); }
{ gROOT->Reset(); // Draw histos filled by Geant4 simulation // TFile f = TFile("allproc.root"); TCanvas* c1 = new TCanvas("c1", " "); TH1D* hist1 = (TH1D*)f.Get("1"); hist1->Draw("HIST"); TH1D* hist2 = (TH1D*)f.Get("2"); hist2->Draw("HIST"); TH1D* hist3 = (TH1D*)f.Get("3"); c1->SetLogy(0); c1->cd(); c1->Update(); hist3->Draw("HIST"); TH1D* hist11 = (TH1D*)f.Get("11"); hist11->Draw("HIST"); TH1D* hist12 = (TH1D*)f.Get("12"); hist12->Draw("HIST"); TH1D* hist13 = (TH1D*)f.Get("13"); hist13->Draw("HIST"); }
void gammaTrkHistProducer(sampleType collision = kPPDATA, float photonPtThr=20, float photonPtThrUp=9999, int icent =7){ TH1::SetDefaultSumw2(); TString stringSampleType = getSampleName(collision); ""; TDatime* date = new TDatime(); TString outName= Form("photonTrackCorr_%s_output_photonPtThr%d_to_%d_%d.root",stringSampleType.Data(),(int)photonPtThr, (int)photonPtThrUp, date->GetDate()); delete date; int lowerCent(0), upperCent(0); TCut centCut = ""; if ( (collision ==kHIDATA) || (collision ==kHIMC) ) { lowerCent = ((icent/100)%100) *2 ; upperCent = (icent%100)*2 -1 ; centCut = Form("cBin >= %d && cBin<= %d",lowerCent,upperCent); } else if ( (collision ==kPPDATA) || (collision==kPPMC) ){ // if it's pp centCut = "(1==1)"; // icent = 7; // for pp, centrality is set as the smearing } else { // pPb centCut = Form( "hf4Sum > %f && hf4Sum <= %f", (float)centBinPa[icent-1], (float)centBinPa[icent]); } cout <<" centrality : " << centCut.GetTitle() << endl; ///////// Photon cut ////////////////////////////////////////////////////////////////////////////// cout <<" photon pt >" << photonPtThr << " GeV" << endl; TCut ptPhoCut = Form("photonEt>%.1f && photonEt<%.1f", (float)photonPtThr, (float)photonPtThrUp ); TCut caloIso; if ( (collision==kPPMC) || (collision==kPPDATA) ) caloIso = "(ecalIso < 4.2 && hcalIso < 2.2 && trackIso < 2) && hovere<0.1"; else if ( (collision==kHIMC) || (collision==kHIDATA) ) caloIso = "(sumIso<5) && hovere<0.1"; else { caloIso = "ecalIso < 4.2 && hcalIso < 2.2 && trackIso < 2 && hovere<0.1"; } TCut sbIso = "(sumIso>5) && (sumIso<20) && hovere<0.1"; // if ( (collision==kPPMC) || (collision==kPPDATA) || (collision==kPAMC) || (collision==kPADATA) ) // sbIso = "ecalIso < 4.2 && hcalIso < 2.2 && trackIso > 2 && trackIso < 5 && hovere<0.1"; TCut basicPhoCut = centCut && ptPhoCut && caloIso ; TCut sbPhoCut = centCut && ptPhoCut && sbIso ; TCut evtSeltCut = basicPhoCut; TCut sbSeltCut = sbPhoCut; TCut phoCandCut = "sigmaIetaIeta<0.010"; TCut phoDecayCut = "(sigmaIetaIeta>0.011) && (sigmaIetaIeta<0.017)"; if ( ( collision == kHIMC ) || (collision == kPPMC) || (collision == kPAMC)) phoCandCut = phoCandCut && "genIso<5 && abs(genMomId)<=22"; TString fname = ""; if ( collision == kHIDATA) fname = fnameHIDATA; // else if ( collision == kPADATA) fname = fnamePADATA; else if ( collision == kPPDATA) { if ( icent == 7 ) fname = fnamePPDATA; else if ( icent == 10010 ) fname = fnamePPDATA0010; else if ( icent == 11030 ) fname = fnamePPDATA1030; else if ( icent == 13050 ) fname = fnamePPDATA3050; else if ( icent == 15099 ) fname = fnamePPDATA5099; else if ( icent == 10030 ) fname = fnamePPDATA0030; else if ( icent == 13099 ) fname = fnamePPDATA30100; } else fname = ""; multiTreeUtil* tgj = new multiTreeUtil(); tgj->addFile(fname, "tgj", evtSeltCut, 1); tgj->AddFriend("yTrk"); float purity(0); TString canvasName = Form("gifs/purity_%s_output_icent%d_photonPtThr%d-%d", stringSampleType.Data(), (int)icent, (int)photonPtThr, (int)photonPtThrUp); if ( collision == kPPDATA) { purity = 0.85; } else { fitResult fitr = getPurity(fname, collision, evtSeltCut, sbSeltCut, canvasName, photonPtThr, photonPtThrUp); purity = fitr.purity010; } GjSpectra* gSpec = new GjSpectra(); gSpec->init(Form("icent%d",(int)icent) ); tgj->Draw2(gSpec->hPtPhoCand, "photonEt", phoCandCut, ""); tgj->Draw2(gSpec->hPtPhoDecay, "photonEt", phoDecayCut, ""); // Obtain background subtracted spectra float candInt = gSpec->hPtPhoCand->Integral(); float decayInt = gSpec->hPtPhoDecay->Integral(); gSpec->hPtPhoSig->Reset(); gSpec->hPtPhoSig->Add(gSpec->hPtPhoCand); gSpec->hPtPhoSig->Add(gSpec->hPtPhoDecay, -(1. - purity) * candInt / decayInt); gSpec->hPtPhoSig->Scale(1./purity ) ; TFile outf = TFile(Form("ffFiles/%s",outName.Data()),"update"); gSpec->hPtPhoCand->Write(); gSpec->hPtPhoDecay->Write(); gSpec->hPtPhoSig->Write(); outf.Close(); // Objects multiTreeUtil* tObj[3]; tObj[kTrkRaw] = new multiTreeUtil(); tObj[kTrkBkg] = new multiTreeUtil(); tObj[kTrkRaw]->addFile(fname, "yTrk", evtSeltCut, 1); tObj[kTrkBkg]->addFile(fname, "mTrk", evtSeltCut, 1); tObj[kTrkRaw]->AddFriend("tgj"); tObj[kTrkBkg]->AddFriend("tgj"); TCut trkCut = Form("abs(eta)<%f && pt>%f", (float)cuttrkEta, (float)cuttrkPt ); TString varTrkDphi = Form("dphi"); corrFunctionTrk* cTrkDphi = new corrFunctionTrk(); TH1D* hTrkDphi = new TH1D(Form("dphi_icent%d",icent),";#Delta#phi_{Jet,#gamma} ;dN/d#Delta#phi",20,0,3.141592); gammaTrkSingle( gSpec, tObj, cTrkDphi, purity, collision, varTrkDphi, trkCut, "pt", phoCandCut, phoDecayCut, hTrkDphi, outName); TH1D* hTrkDphi1to2GeV = new TH1D(Form("dphi_icent%d_pt1to2GeV",icent),";#Delta#phi_{Jet,#gamma} ;dN/d#Delta#phi",20,0,3.141592); corrFunctionTrk* cTrkDphi1to2GeV = new corrFunctionTrk(); gammaTrkSingle( gSpec, tObj, cTrkDphi1to2GeV, purity, collision, varTrkDphi, trkCut && "pt > 1 && pt <=2", "pt", phoCandCut, phoDecayCut, hTrkDphi, outName); TH1D* hTrkDphi2to4GeV = new TH1D(Form("dphi_icent%d_pt2to4GeV",icent),";#Delta#phi_{Jet,#gamma} ;dN/d#Delta#phi",20,0,3.141592); corrFunctionTrk* cTrkDphi2to4GeV = new corrFunctionTrk(); gammaTrkSingle( gSpec, tObj, cTrkDphi2to4GeV, purity, collision, varTrkDphi, trkCut && "pt > 2 && pt <=4", "pt", phoCandCut, phoDecayCut, hTrkDphi, outName); TH1D* hTrkDphi4to8GeV = new TH1D(Form("dphi_icent%d_pt4to8GeV",icent),";#Delta#phi_{Jet,#gamma} ;dN/d#Delta#phi",20,0,3.141592); corrFunctionTrk* cTrkDphi4to8GeV = new corrFunctionTrk(); gammaTrkSingle( gSpec, tObj, cTrkDphi4to8GeV, purity, collision, varTrkDphi, trkCut && "pt > 4 && pt <=8", "pt", phoCandCut, phoDecayCut, hTrkDphi, outName); TH1D* hTrkDphi8andHighGeV = new TH1D(Form("dphi_icent%d_pt8andHighGeV",icent),";#Delta#phi_{Jet,#gamma} ;dN/d#Delta#phi",20,0,3.141592); corrFunctionTrk* cTrkDphi8andHighGeV = new corrFunctionTrk(); gammaTrkSingle( gSpec, tObj, cTrkDphi8andHighGeV, purity, collision, varTrkDphi, trkCut && "pt > 8", "pt", phoCandCut, phoDecayCut, hTrkDphi, outName); }
{ gROOT->Reset(); // Draw histos filled by Geant4 simulation // TFile f = TFile("testem12.root"); TCanvas* c1 = new TCanvas("c1", " "); TH1D* hist1 = (TH1D*)f.Get("1"); hist1->Draw("HIST"); TH1D* hist2 = (TH1D*)f.Get("2"); hist2->Draw("HIST"); TH1D* hist3 = (TH1D*)f.Get("3"); hist3->Draw("HIST"); TH1D* hist4 = (TH1D*)f.Get("4"); hist4->Draw("HIST"); TH1D* hist5 = (TH1D*)f.Get("5"); hist5->Draw("HIST"); TH1D* hist8 = (TH1D*)f.Get("8"); hist8->Draw("HIST"); }
const TFile& TFileCollection::AddFile(const Stroka& name, const Stroka& alias1, const Stroka& alias2) { return Merge(TFile(name).AddAlias(alias1).AddAlias(alias2)); }
{ gROOT->Reset(); // Draw histos filled by Geant4 simulation // TFile f = TFile("water_100um.root"); TCanvas* c1 = new TCanvas("c1", " "); c1->SetLogy(0); c1->cd(); c1->Update(); TH1D* hist1 = (TH1D*)f.Get("1"); hist1->Draw("HIST"); TH1D* hist3 = (TH1D*)f.Get("3"); hist3->Draw("HIST"); TH1D* hist4 = (TH1D*)f.Get("4"); hist4->Draw("HIST"); TH1D* hist5 = (TH1D*)f.Get("5"); hist5->Draw("HIST"); }
{ //study_string_high = "Razor #gamma#gamma + #geq 1 jet: Signal Injection Study"; //study_string_low = "Razor #gamma#gamma + #geq 1 jet: Signal Injection Study"; //study_string_low = "Razor #gamma#gamma + #geq 1 jet: Low R^{2} Fit ff Sample"; //study_string_high = "Razor #gamma#gamma + #geq 1 jet: High R^{2} ff Sample"; study_string_low = "Razor #gamma#gamma + #geq 1 jet: Low R^{2} Fit #gamma#gamma Sample"; study_string_high = "Razor #gamma#gamma + #geq 1 jet: High R^{2} #gamma#gamma Sample"; gStyle->SetOptStat(0); file = TFile("weight_hist.root","READ"); mr = hist_high_data; // mr->SetTitle("Data In High R^{2}"); mr_toy = hist_high_pred; mr_toy->SetTitle("Estimation In High R^{2}"); Float_t xmin = mr_toy->GetXaxis()->GetXmin(); Float_t xmax = mr_toy->GetXaxis()->GetXmax(); //build the canvas TCanvas *high_canvas = new TCanvas("c2","high canvas",1024,768); TPad *high_plot = new TPad("pad3","pad3",0,0.4,1,1); high_plot->SetTopMargin(.2); high_plot->SetBottomMargin(0); high_plot->Draw(); high_plot->cd(); high_plot->SetLogy();
void basicSpectraSingle(int lowCent, int highCent, double lowPt, double highPt ) { TCut hoeCut = "hadronicOverEm<0.1"; TCut ptCut = Form("pt>%.f && pt <%.f",lowPt,highPt); TString ptCutS = Form("E_{T} : %.0f - %.0f GeV",lowPt,highPt); if ( highPt > 200 ) ptCutS = Form("E_{T} > %.0f GeV",lowPt); // eta // phi // pT >30GeV // normalize it by 40GeV // energy/rawenergy TCanvas* c2 = new TCanvas("c2","",700,700); c2->Divide(2,2); c2->cd(1); TH1D* hpt = new TH1D("hpt",";E_{T} (GeV);Normalized by p_{T} > 40GeV",40,40,500); drawSingleVariable(hpt,lowCent,highCent,"pt","","","",0); // jumSun(40,1e-3,40,1); gPad->SetLogy(); c2->cd(2); TH1D* hhoe = new TH1D("hhoe",";H/E;Entries per photon candidate",50,0,1); drawSingleVariable(hhoe,lowCent,highCent,"hadronicOverEm",ptCut && etaCut,"","",0); drawText(ptCutS,0.5,0.66); // jumSun(0.2,0,0.2,0.24); // c2->cd(3); // TH1D* hcc4 = new TH1D("hcc4",";Ecal ISO (GeV);",40,-20,60); // drawSingleVariable(hcc4,lowCent,highCent,"cc4", hoeCut && ptCut,"","",0); // c2->cd(4); // TH1D* hcr4 = new TH1D("hcr4",";Hcal ISO (GeV);",40,-20,60); // drawSingleVariable(hcr4,lowCent,highCent,"cr4",ptCut &&hoeCut,"","",0); // c2->cd(5); // TH1D* hct4 = new TH1D("hct4",";track ISO (GeV);",40,-20,60); // drawSingleVariable(hct4,lowCent,highCent,"ct4PtCut20",ptCut&& hoeCut,"ct4PtCut","",0); c2->cd(3); TH1D* hIso = new TH1D("hIso",";Sum ISO (GeV);Entries per photon candidate",40,-30,100); drawSingleVariable(hIso,lowCent,highCent,"(ct4PtCut20+cc3+cr3)/0.9", ptCut && hoeCut,"(ct4PtCut+cc3+cr3)/0.9","",0); drawText(ptCutS,0.5,0.66); drawText("H/E < 0.2",0.5,0.6); // jumSun(5,0,5,0.24); //c2->cd(5); // TH1D* trackIso = new TH1D("trackIsoo",";track ISO (no BKG sub) (GeV);",40,0,100); // drawSingleVariable(trackIso,lowCent,highCent,"trkSumPtHollowConeDR04",ptCut&& hoeCut,"","",0); // c2->cd(5); // TH1D* hr9 = new TH1D("hr9",";r9 ;",50,0,1.1); // drawSingleVariable(hr9,lowCent,highCent,"r9", ptCut && hoeCut,"","",0); // "cc4*2.1394389581550754e-04 + cr4 * -1.1920380855810875e-02 + ct4PtCut20* 3.3720653764304644e-02 + cc3*-5.1750216598978376e-02 + cr3*-3.6800703345337124e-02 + ct3PtCut20*-9.10880235455440575e-02 > -0.5"; TCut sbCut = "(cc3+ cr3 + ct3PtCut20)>5 && (cc4j+ cr4j + ct3PtCut20)<10"; c2->cd(4); TH1D* hsieieData = new TH1D(Form("hsieieData_cent%dto%d_pt%dto%d",lowCent,highCent,(int)lowPt,(int)highPt),";shower shape (#sigma_{#eta#eta});Entries per photon candidate;",25,0,0.025); TH1D* hsieieSig = (TH1D*)hsieieData->Clone(Form("hsieieSig_cent%dto%d_pt%dto%d",lowCent,highCent,(int)lowPt,(int)highPt)); drawSingleVariable(hsieieData,lowCent,highCent,"sigmaIetaIeta",ptCut && hoeCut && FisherCut,"",ptCut && hoeCut && "cc4j<1 && cr4j<1 && ct4PtCut<1",-1,false,hsieieSig); drawText(ptCutS,0.5,0.66); drawText("H/E < 0.2",0.5,0.6); drawText("Sum ISO < 5GeV",0.5,0.54); TH1D* hsieieSB = new TH1D(Form("hsieieSB_cent%dto%d_pt%dto%d",lowCent,highCent,(int)lowPt,(int)highPt),";shower shape (#sigma_{#eta#eta});Entries per photon;",25,0,0.025); drawSingleVariable(hsieieSB,lowCent,highCent,"sigmaIetaIeta",ptCut && hoeCut && sbCut,"",ptCut && hoeCut && "cc3<1 && cr3<1 && ct4PtCut>2 && ct4PtCut<6",0); TFile outf = TFile("templates2011.root","update"); hsieieData->Write(); hsieieSB->Write(); hsieieSig->Write(); outf.Close(); }
{ gROOT->Reset(); // Draw histos filled by Geant4 simulation // double minE = 40; double maxE = 10000; double minY = 1e-2; //c1 double maxY = 1e+2; //c1 double minY1 = 1e-8; //c2 double maxY1 = 1; //c2 //file open // TFile f = TFile("testem6_0.root"); //CrossSectionPerAtom // TH1D* h7 = (TH1D*)f.Get("7"); //ee to MuMu TH1D* h8 = (TH1D*)f.Get("8"); //ee to gammagamma TH1D* h9 = (TH1D*)f.Get("9"); //ee to Hadrons TH1D* h10 = (TH1D*)f.Get("10"); //ee to gammagamma(theory) TH1D* h11 = (TH1D*)f.Get("11"); //ee to MuMu(theory) //CrossSectionPerVolume // TH1D* h12 = (TH1D*)f.Get("12"); //eBrem TH1D* h13 = (TH1D*)f.Get("13"); //eIoni TH1D* h14 = (TH1D*)f.Get("14"); //ee to MuMu TH1D* h15 = (TH1D*)f.Get("15"); //ee to gammagamma TH1D* h16 = (TH1D*)f.Get("16"); //ee to Hadrons
{ gROOT->Reset(); // Draw histos filled by Geant4 simulation // TFile f = TFile("testem3.root"); TCanvas* c1 = new TCanvas("c1", " "); TH1D* hist1 = (TH1D*)f.Get("1"); hist1->Draw("HIST"); TH1D* hist2 = (TH1D*)f.Get("2"); hist2->Draw("HIST"); TH1D* hist3 = (TH1D*)f.Get("21"); c1->SetLogy(1); c1->cd(); c1->Update(); hist3->Draw("HIST"); }
void gammaJetHistProducer_jetEnergyScaledMinus2percent(sampleType collision = kPADATA, float photonPtThr=60, float photonPtThrUp=9999, float jetPtThr=30, int icent =1) { TH1::SetDefaultSumw2(); TString stringSampleType = getSampleName(collision); ""; TDatime* date = new TDatime(); TString outName= Form("photonTrackCorr_%s_output_photonPtThr%d_to_%d_jetPtThr%d_%d.root",stringSampleType.Data(),(int)photonPtThr, (int)photonPtThrUp, (int)jetPtThr, date->GetDate()); delete date; int lowerCent(0), upperCent(0); TCut centCut = ""; if ( (collision ==kHIDATA) || (collision==kHIMC) ) { lowerCent = centBin1[icent-1]; upperCent = centBin1[icent]-1; if ( icent > 9999) { lowerCent = ((icent/100)%100)/2.5; upperCent = (icent%100)/2.5 -1; } centCut = Form("cBin >= %d && cBin<= %d",lowerCent,upperCent); } else if ( (collision ==kPPDATA) || (collision==kPPMC) ){ // if it's pp centCut = "(1==1)"; // icent = 7; // for pp, centrality is set as the smearing } else { // pPb centCut = Form( "hf4Sum > %f && hf4Sum <= %f", (float)centBinPa[icent-1], (float)centBinPa[icent]); } cout <<" centrality : " << centCut.GetTitle() << endl; ///////// Photon cut ////////////////////////////////////////////////////////////////////////////// cout <<" photon pt >" << photonPtThr << " GeV" << endl; TCut ptPhoCut = Form("photonEt>%.1f && photonEt<%.1f", (float)photonPtThr, (float)photonPtThrUp ); TCut caloIso; if ( (collision==kPPMC) || (collision==kPPDATA) ) caloIso = "(ecalIso < 4.2 && hcalIso < 2.2 && trackIso < 2) && hovere<0.1"; else if ( (collision==kHIMC) || (collision==kHIDATA) ) caloIso = "(sumIso<1) && hovere<0.1"; else { caloIso = "ecalIso < 4.2 && hcalIso < 2.2 && trackIso < 2 && hovere<0.1"; } TCut sbIso = "(sumIso>10) && (sumIso<20) && hovere<0.1"; // if ( (collision==kPPMC) || (collision==kPPDATA) || (collision==kPAMC) || (collision==kPADATA) ) // sbIso = "ecalIso < 4.2 && hcalIso < 2.2 && trackIso > 2 && trackIso < 5 && hovere<0.1"; TCut basicPhoCut = centCut && ptPhoCut && caloIso ; TCut sbPhoCut = centCut && ptPhoCut && sbIso ; TCut evtSeltCut = basicPhoCut; TCut sbSeltCut = sbPhoCut; TCut phoCandCut = "sigmaIetaIeta<0.010"; TCut phoDecayCut = "(sigmaIetaIeta>0.011) && (sigmaIetaIeta<0.017)"; if ( ( collision == kHIMC ) || (collision == kPPMC) || (collision == kPAMC)) phoCandCut = phoCandCut && "genIso<5 && abs(genMomId)<=22"; TString fname = ""; if ( collision == kHIDATA) fname = fnameHIDATA_Minus2percentScaled; else if ( collision == kPADATA) fname = fnamePADATA_Minus2percentScaled; else if ( collision == kPPDATA) { if ( icent == 7 ) fname = fnamePPDATA_Minus2percentScaled; } else fname = ""; multiTreeUtil* tgj = new multiTreeUtil(); multiTreeUtil* tgjMC = new multiTreeUtil(); if ( ( collision == kHIDATA) || ( collision==kPADATA) || ( collision == kPPDATA) ) { tgj->addFile(fname, "tgj", evtSeltCut, 1); } else if ( collision == kPPMC ) { tgj->addFile(fnamePPMC_AllQcdPho30to50, "tgj", evtSeltCut, wPPMC_AllQcdPho30to50 ); tgj->addFile(fnamePPMC_AllQcdPho50to80, "tgj", evtSeltCut, wPPMC_AllQcdPho50to80 ); tgj->addFile(fnamePPMC_AllQcdPho80to120, "tgj", evtSeltCut, wPPMC_AllQcdPho80to120 ); tgj->addFile(fnamePPMC_AllQcdPho120to9999, "tgj", evtSeltCut, wPPMC_AllQcdPho120to9999 ); } else if ( collision == kPAMC ) { tgj->addFile(fnamePAMC_AllQcdPho30to50, "tgj", evtSeltCut, wPAMC_AllQcdPho30to50 ); tgj->addFile(fnamePAMC_AllQcdPho50to80, "tgj", evtSeltCut, wPAMC_AllQcdPho50to80 ); tgj->addFile(fnamePAMC_AllQcdPho80to120, "tgj", evtSeltCut, wPAMC_AllQcdPho80to120 ); tgj->addFile(fnamePAMC_AllQcdPho120to9999, "tgj", evtSeltCut, wPAMC_AllQcdPho120to9999 ); } else { // kHIMC tgj->addFile(fnameHIMC_AllQcdPho30to50, "tgj", evtSeltCut, wHIMC_AllQcdPho30to50 ); tgj->addFile(fnameHIMC_AllQcdPho50to80, "tgj", evtSeltCut, wHIMC_AllQcdPho50to80 ); tgj->addFile(fnameHIMC_AllQcdPho80to9999, "tgj", evtSeltCut, wHIMC_AllQcdPho80to9999 ); } tgj->AddFriend("yJet"); // get purity with the current jet cut ! float purity(0); TString canvasName = Form("gifs/purity_%s_output_icent%d_photonPtThr%d-%d_jetPtThr%d", stringSampleType.Data(), (int)icent, (int)photonPtThr, (int)photonPtThrUp, (int)jetPtThr); // if ( (collision==kPPDATA) && (photonPtThr < 50 ) ) { // purity = 0.86 ; // cout << " !!!!!!!" << endl << endl << " purity is set as 0.86 for this bin because we don't have pp MC low pt sample " << endl; // cout << endl << endl << endl << " !!!!!!" << endl; // } if ( (collision==kHIDATA)||(collision==kPPDATA)||(collision==kPADATA) ) { fitResult fitr = getPurity(fname, collision, evtSeltCut, sbSeltCut, canvasName, photonPtThr, photonPtThrUp); purity = fitr.purity010; /* float originalP = purity; if (collision==kPPDATA) purity = purity - 0.05; else if (collision==kHIDATA) { if ( icent == 10030) purity = purity - 0.08; else if ( icent == 13099) purity = purity - 0.07; } cout << "====================================================================================" << endl << endl << endl; cout << "====================================================================================" << endl << endl << endl; cout << "================================ Purity modified!!! ================================" << endl << endl << endl; cout << "=============== "<<originalP<< " --> "<<purity<< "====================================" << endl << endl << endl; cout << "====================================================================================" << endl << endl << endl; */ } else { purity = 1; cout << " MC purity = 1" << endl; } GjSpectra* gSpec = new GjSpectra(); gSpec->init(Form("icent%d",(int)icent) ); tgj->Draw2(gSpec->hPtPhoCand, "photonEt", phoCandCut, "") ; tgj->Draw2(gSpec->hPtPhoDecay, "photonEt", phoDecayCut, "") ; // Obtain background subtracted spectra float candInt = gSpec->hPtPhoCand->Integral(); float candDecay = gSpec->hPtPhoDecay->Integral(); gSpec->hPtPhoSig->Reset(); gSpec->hPtPhoSig->Add(gSpec->hPtPhoCand); gSpec->hPtPhoSig->Add(gSpec->hPtPhoDecay, -(1. - purity) * candInt / candDecay); gSpec->hPtPhoSig->Scale(1./purity ) ; TFile outf = TFile(Form("ffFiles/%s",outName.Data()),"update"); gSpec->hPtPhoCand->Write(); gSpec->hPtPhoDecay->Write(); gSpec->hPtPhoSig->Write(); outf.Close(); // Objects multiTreeUtil* tObj[3]; tObj[kTrkRaw] = new multiTreeUtil(); tObj[kTrkBkg] = new multiTreeUtil(); if ( ( collision == kHIDATA) || ( collision==kPADATA) || ( collision == kPPDATA) ) { tObj[kTrkRaw]->addFile(fname, "yJet", evtSeltCut, 1); tObj[kTrkBkg]->addFile(fname, "mJet", evtSeltCut, 1); } else if ( collision == kHIMC ) { tObj[kTrkRaw]->addFile(fnameHIMC_AllQcdPho30to50, "yJet", evtSeltCut, wHIMC_AllQcdPho30to50 ) ; tObj[kTrkRaw]->addFile(fnameHIMC_AllQcdPho50to80, "yJet", evtSeltCut, wHIMC_AllQcdPho50to80 ) ; tObj[kTrkRaw]->addFile(fnameHIMC_AllQcdPho80to9999, "yJet", evtSeltCut, wHIMC_AllQcdPho80to9999 ) ; tObj[kTrkBkg]->addFile(fnameHIMC_AllQcdPho30to50, "mJet", evtSeltCut, wHIMC_AllQcdPho30to50 ) ; tObj[kTrkBkg]->addFile(fnameHIMC_AllQcdPho50to80, "mJet", evtSeltCut, wHIMC_AllQcdPho50to80 ) ; tObj[kTrkBkg]->addFile(fnameHIMC_AllQcdPho80to9999, "mJet", evtSeltCut, wHIMC_AllQcdPho80to9999 ) ; } else if ( collision == kPAMC ) { tObj[kTrkRaw]->addFile(fnamePAMC_AllQcdPho30to50, "yJet", evtSeltCut, wPAMC_AllQcdPho30to50 ) ; tObj[kTrkRaw]->addFile(fnamePAMC_AllQcdPho50to80, "yJet", evtSeltCut, wPAMC_AllQcdPho50to80 ) ; tObj[kTrkRaw]->addFile(fnamePAMC_AllQcdPho80to120, "yJet", evtSeltCut, wPAMC_AllQcdPho80to120 ) ; tObj[kTrkRaw]->addFile(fnamePAMC_AllQcdPho120to9999,"yJet", evtSeltCut, wPAMC_AllQcdPho120to9999 ) ; tObj[kTrkBkg]->addFile(fnamePAMC_AllQcdPho30to50, "mJet", evtSeltCut, wPAMC_AllQcdPho30to50 ) ; tObj[kTrkBkg]->addFile(fnamePAMC_AllQcdPho50to80, "mJet", evtSeltCut, wPAMC_AllQcdPho50to80 ) ; tObj[kTrkBkg]->addFile(fnamePAMC_AllQcdPho80to120, "mJet", evtSeltCut, wPAMC_AllQcdPho80to120 ) ; tObj[kTrkBkg]->addFile(fnamePAMC_AllQcdPho120to9999,"mJet", evtSeltCut, wPAMC_AllQcdPho120to9999 ) ; } else if ( collision == kPPMC ) { tObj[kTrkRaw]->addFile(fnamePPMC_AllQcdPho30to50, "yJet", evtSeltCut, wPPMC_AllQcdPho30to50 ); tObj[kTrkRaw]->addFile(fnamePPMC_AllQcdPho50to80, "yJet", evtSeltCut, wPPMC_AllQcdPho50to80 ); tObj[kTrkRaw]->addFile(fnamePPMC_AllQcdPho80to120, "yJet", evtSeltCut, wPPMC_AllQcdPho80to120 ); tObj[kTrkRaw]->addFile(fnamePPMC_AllQcdPho120to9999,"yJet", evtSeltCut, wPPMC_AllQcdPho120to9999 ); tObj[kTrkBkg]->addFile(fnamePPMC_AllQcdPho30to50, "mJet", evtSeltCut, wPPMC_AllQcdPho30to50 ); tObj[kTrkBkg]->addFile(fnamePPMC_AllQcdPho50to80, "mJet", evtSeltCut, wPPMC_AllQcdPho50to80 ); tObj[kTrkBkg]->addFile(fnamePPMC_AllQcdPho80to120, "mJet", evtSeltCut, wPPMC_AllQcdPho80to120 ); tObj[kTrkBkg]->addFile(fnamePPMC_AllQcdPho120to9999,"mJet", evtSeltCut, wPPMC_AllQcdPho120to9999 ); } tObj[kTrkRaw]->AddFriend("tgj"); tObj[kTrkBkg]->AddFriend("tgj"); TCut jetCut = Form("abs(eta)<%f && pt>%f", (float)cutjetEta, (float)jetPtThr ); TCut jetCutDphi = jetCut && (TCut)(Form("abs(dphi)>%f",(float)awayRange)); TCut genJetCut = Form("abs(jtEta)<%f && jtPt>%f", (float)cutjetEta, (float)jetPtThr ); TCut genJetCutDphi = jetCut && (TCut)(Form("abs(refDphi)>%f",(float)awayRange)); TCut jetCut2 = Form("abs(dphi)>%f && pt>%f", (float)awayRange, (float)jetPtThr ) ; TString jetWeight = ""; TH1D* hJetDphi = new TH1D(Form("jetDphi_icent%d",icent),";#Delta#phi_{Jet,#gamma} ;dN/d#Delta#phi",20,0,3.141592); corrFunctionTrk* cJetDphi = new corrFunctionTrk(); TString varJetDphi = Form("dphi"); gammaTrkSingle( gSpec, tObj, cJetDphi, purity, collision, varJetDphi, jetCut, jetWeight, phoCandCut, phoDecayCut, hJetDphi, outName); TH1D* hJetPt = new TH1D(Form("jetPt_icent%d",icent),";Jet p_{T} (GeV) ;dN/dp_{T} (GeV^{-1})",280, 20,300); corrFunctionTrk* cJetPt = new corrFunctionTrk(); TString varJetPt = Form("pt"); gammaTrkSingle( gSpec, tObj, cJetPt, purity, collision, varJetPt, jetCutDphi, jetWeight, phoCandCut, phoDecayCut, hJetPt, outName); const int nJetIaaBin = 7; double jetIaaBin[nJetIaaBin+1] = {30,40,50,60,80,100,120,200}; TH1D* hJetPtForIaa = new TH1D(Form("jetPtForIaa_icent%d",icent),";Jet p_{T} (GeV) ;dN/dp_{T} (GeV^{-1})",nJetIaaBin, jetIaaBin); corrFunctionTrk* cJetIaaPt = new corrFunctionTrk(); gammaTrkSingle( gSpec, tObj, cJetIaaPt, purity, collision, varJetPt, jetCutDphi, jetWeight, phoCandCut, phoDecayCut, hJetPtForIaa, outName); // TH1D* hDjetPt = new TH1D(Form("dpt_icent%d",icent),";p_{T}^{#gamma} - p_{T}^{Jet} (GeV) ;dN/dp_{T} (GeV^{-1})",30,-150,150); // corrFunctionTrk* cDjetPt = new corrFunctionTrk(); // TString varJetDpt = Form("pt - photonEt"); // gammaTrkSingle( gSpec, tObj, cDjetPt, purity, // collision, varJetDpt, jetCutDphi, jetWeight, // phoCandCut, phoDecayCut, hDjetPt, outName); TH1D* hJetXjg = new TH1D(Form("xjg_icent%d",icent),";p_{T}^{Jet}/p_{T}^{#gamma} ; ",400,0,5); corrFunctionTrk* cJetXjg = new corrFunctionTrk(); TString varJetXjg = Form("pt/photonEt"); gammaTrkSingle( gSpec, tObj, cJetXjg, purity, collision, varJetXjg, jetCutDphi, jetWeight, phoCandCut, phoDecayCut, hJetXjg, outName); if ( (collision == kPAMC) || (collision == kPPMC) ||(collision == kHIMC) ) { TH1D* hGenJetPt = (TH1D*)hJetPt->Clone(Form("genJetPt_icent%d",icent)); corrFunctionTrk* cGenJetPt = new corrFunctionTrk(); TString varGenJetPt = Form("refPt"); gammaTrkSingle( gSpec, tObj, cJetPt, purity, collision, varGenJetPt, genJetCutDphi, jetWeight, phoCandCut, phoDecayCut, hGenJetPt, outName); TH1D* hGenJetXjg = (TH1D*)hJetXjg->Clone(Form("xjg_genJet_icent%d",icent)); corrFunctionTrk* cGenJetXjg = new corrFunctionTrk(); TString varGenJetXjg = Form("refPt/photonEt"); gammaTrkSingle( gSpec, tObj, cGenJetXjg, purity, collision, varGenJetXjg, genJetCutDphi , jetWeight, phoCandCut, phoDecayCut, hGenJetXjg, outName); TH1D* hGenPhotonXjg = (TH1D*)hJetXjg->Clone(Form("xjg_genPho_icent%d",icent)); corrFunctionTrk* cGenPhotonXjg = new corrFunctionTrk(); TString varGenPhotonXjg = Form("pt/genPhotonEt"); gammaTrkSingle( gSpec, tObj, cGenPhotonXjg, purity, collision, varGenPhotonXjg, jetCutDphi, jetWeight, phoCandCut, phoDecayCut, hGenPhotonXjg, outName); TH1D* hGenPhoGenJetXjg = (TH1D*)hJetXjg->Clone(Form("xjg_genPho_genJet_icent%d",icent)); corrFunctionTrk* cGenPhoGenJetXjg = new corrFunctionTrk(); TString varGenPhoGenJetXjg = Form("refPt/genPhotonEt"); gammaTrkSingle( gSpec, tObj, cGenPhoGenJetXjg, purity, collision, varGenPhoGenJetXjg, genJetCutDphi, jetWeight, phoCandCut, phoDecayCut, hGenPhoGenJetXjg, outName); } bool doRapidity= false; if ( doRapidity) { // Eta distribution TH1D* hEtaJg = new TH1D(Form("etaJg_icent%d",icent),";#eta_{J,#gamma} ; ",160,-3,3); corrFunctionTrk* cEtaJg = new corrFunctionTrk(); TString varEtaJg = Form("(photonEta+eta)/2."); gammaTrkSingle( gSpec, tObj, cEtaJg, purity, collision, varEtaJg, jetCut2, jetWeight, phoCandCut, phoDecayCut, hEtaJg, outName); TH1D* hEtaJet = new TH1D(Form("etaJet_icent%d",icent),";#eta_{Jet} ; ",160,-3,3); corrFunctionTrk* cEtaJet = new corrFunctionTrk(); TString varEtaJet = Form("eta"); gammaTrkSingle( gSpec, tObj, cEtaJet, purity, collision, varEtaJet, jetCut2, jetWeight, phoCandCut, phoDecayCut, hEtaJet, outName); TH1D* hEtaPhoton = new TH1D(Form("etaPhoton_icent%d",icent),";#eta_{#gamma} ; ",160,-3,3); corrFunctionTrk* cEtaPhoton = new corrFunctionTrk(); TString varEtaPhoton = Form("photonEta"); gammaTrkSingle( gSpec, tObj, cEtaPhoton, purity, collision, varEtaPhoton, jetCut2, jetWeight, phoCandCut, phoDecayCut, hEtaPhoton, outName); } }
{ gROOT->Reset(); // Draw histos filled by Geant4 simulation // TFile f = TFile("run01.root"); TCanvas* c1 = new TCanvas("c1", " "); TH1D* hist1 = (TH1D*)f.Get("1"); hist1->Draw("HIST"); TH1D* hist3 = (TH1D*)f.Get("3"); hist3->Draw("HIST"); TH1D* hist2 = (TH1D*)f.Get("2"); c1->SetLogy(1); c1->cd(); c1->Update(); hist2->Draw("HIST"); TH1D* hist4 = (TH1D*)f.Get("4"); hist4->Draw("HIST"); TH1D* hist5 = (TH1D*)f.Get("5"); hist5->Draw("HIST"); }
void Plotter_sbatb2(){ Int_t mA=248; TString strmA = "248"; Int_t mH=500; TString strmH = "500"; gStyle->SetOptStat(0); gStyle->SetOptTitle(0); gStyle->SetPadLeftMargin(0.1191275); gStyle->SetPadRightMargin(0.05944056); gStyle->SetPadTopMargin(0.05944056); gStyle->SetPadBottomMargin(0.1206294); gStyle->SetTitleSize(0.04, "XYZ"); gStyle->SetTitleXOffset(1.1); gStyle->SetTitleYOffset(1.45); gStyle->SetPalette(1); gStyle->SetNdivisions(505); gStyle->SetLabelSize(0.04,"XYZ"); // Getting the limits from combine root files TString file_path_sig1 = "/home/fynu/amertens/storage/CMSSW/CMSSW_6_1_1/src/HiggsAnalysis/CombinedLimit/python/v1_MH_"+strmH+"_Asymptotic_Unblind_Combined_/higgsCombineTest.Asymptotic.mA"+strmA+".root"; Double_t limit; TGraph2D* myTGraph_ratio = new TGraph2D(10); myTGraph_ratio->SetName("Ratio CMSSW/Delphes"); myTGraph_ratio->SetTitle("Ratio CMSSW/Delphes"); myTGraph_ratio->SetPoint(0,35,142,0.411); myTGraph_ratio->SetPoint(1,10,200,0.838); myTGraph_ratio->SetPoint(2,110,200,0.796); myTGraph_ratio->SetPoint(3,30,329,0.826); myTGraph_ratio->SetPoint(4,70,329,0.897); myTGraph_ratio->SetPoint(5,70,575,0.955); myTGraph_ratio->SetPoint(6,70,875,0.907); myTGraph_ratio->SetPoint(7,142,329,0.925); myTGraph_ratio->SetPoint(8,142,875,0.927); myTGraph_ratio->SetPoint(9,378,575,0.891); myTGraph_ratio->SetPoint(10,378,875,0.911); myTGraph_ratio->SetPoint(11,575,875,0.890); myTGraph_ratio->SetPoint(12,761,875,0.849); myTGraph_ratio->SetPoint(13,50,1200,0.9); myTGraph_ratio->SetPoint(14,1200,1200,0.85); Double_t ratio = myTGraph_ratio->Interpolate(mA,mH); pathDelphesEff = "/home/fynu/amertens/storage/THDM/eff_v1/"+strmH+"_"+strmA+".root"; DelphesFile = TFile(pathDelphesEff); TGraph2D* myG2D = DelphesFile.Get("Graph2D"); Double_t eff = myG2D->Interpolate(int(mA),int(mH)); Double_t lumi = 19.7; cout << "efficiency : " << eff << " ratio : " << ratio << endl; Double_t LumiEff = eff*ratio*lumi; TFile* f_Sig1 = new TFile(file_path_sig1); TTree* tree_Sig1 = (TTree*) f_Sig1->Get("limit"); TBranch *branch = tree_Sig1->GetBranch("limit"); branch->SetAddress(&limit); branch->GetEntry(5); Double_t limit_obs = limit /(0.067*LumiEff); branch->GetEntry(0); Double_t limit_m2 = limit /(0.067*LumiEff); branch->GetEntry(1); Double_t limit_m1 = limit /(0.067*LumiEff); branch->GetEntry(2); Double_t limit_exp = limit /(0.067*LumiEff); branch->GetEntry(3); Double_t limit_p1 = limit /(0.067*LumiEff); branch->GetEntry(4); Double_t limit_p2 = limit /(0.067*LumiEff); // Limit vs TanBeta cosba TString Xsec_path = "/home/fynu/amertens/Delphes/delphes/condor/xsec_H_ZA_ll_bb_tautau_tanb_cosba_"+strmH+"_"+strmA+".root"; TFile *f4 = new TFile(Xsec_path); TCanvas* C_tbcba = new TCanvas("C_tbcba","C_tbcba",600,600); gPad->SetGrid(); C_tbcba->SetLogy(true); //C_tbcba->SetRightMargin(0.17); TH2D* h_tbcba = f4->Get("h_HZbbXsec"); TGraph* g_obs = getContourFilledX(h_tbcba, C_tbcba, 3, 1,3645, limit_obs); TGraph* g_exp = getContourFilledX(h_tbcba, C_tbcba, 3, 7,0, limit_exp); Double_t contours[6]; contours[0] = limit_m2; contours[1] = limit_m1; contours[2] = limit_exp; contours[3] = limit_p1; contours[4] = limit_p2; h_tbcba->SetContour(5, contours); TH2D* finalPlot_tbcba = h_tbcba; Int_t colors[] = {kYellow, kGreen, kGreen, kYellow, kWhite}; // #colors >= #levels - 1 gStyle->SetPalette((sizeof(colors)/sizeof(Int_t)), colors); DrawThis(); finalPlot_tbcba->Draw("cont list same"); cout << "limits : " << limit_m2 << endl; cout << "limits : " << limit_m1 << endl; cout << "limits : " << limit_exp << endl; cout << "limits : " << limit_p1 << endl; cout << "limits : " << limit_p2 << endl; cout << "limits obs : " << limit_obs << endl; // TGraph* g_obs = getContourFilledX(finalPlot_tbcba, C_tbcba, 3, 1,3004, limit_obs); // TGraph* g_exp = getContourFilledX(finalPlot_tbcba, C_tbcba, 3, 7,4000, limit_exp); g_obs->Draw("CL F same"); g_exp->Draw("CL F same"); DrawMasses("M_{H} = 330 GeV", "M_{A} = 100 GeV"); TGraph* g_yellow = new TGraph(); g_yellow->SetFillColor(kYellow); TGraph* g_green = new TGraph(); g_green->SetFillColor(kGreen); TLegend* leg = new TLegend(0.7,0.5,0.9,0.7); //leg->SetHeader("#splitline{THDM type II}{#splitline{M_{H} = 378}{M_{A} = 216}}"); leg->SetLineColor(0); leg->SetFillColor(0); leg->AddEntry(g_obs,"Obs. Excl.","F"); leg->AddEntry(g_exp,"Exp. Excl.","l"); leg->AddEntry(g_green,"1-sigma","F"); leg->AddEntry(g_yellow,"2-sigma","F"); leg->Draw(); gPad->RedrawAxis("g"); // for "grid lines" }
void kanaelec::Loop(int wda, int wsp, const char *outfilename) { if (fChain == 0) return; Long64_t nentries = fChain->GetEntries(); // Out Put File Here TFile fresults = TFile(outfilename,"RECREATE"); TTree *newtree = fChain->CloneTree(); Float_t fit_mu_px=0, fit_mu_py =0, fit_mu_pz=0, fit_mu_e=0; Float_t fit_nv_px=0, fit_nv_py =0, fit_nv_pz=0, fit_nv_e=0; Float_t fit_aj_px=0, fit_aj_py =0, fit_aj_pz=0, fit_aj_e=0; Float_t fit_bj_px=0, fit_bj_py =0, fit_bj_pz=0, fit_bj_e=0; Float_t fit_mlvjj=0, fit_chi2 =999; Int_t fit_NDF =999, fit_status=999, gdevtt =0; TBranch *branch_mu_px = newtree->Branch("fit_el_px", &fit_mu_px, "fit_el_px/F"); TBranch *branch_mu_py = newtree->Branch("fit_el_py", &fit_mu_py, "fit_el_py/F"); TBranch *branch_mu_pz = newtree->Branch("fit_el_pz", &fit_mu_pz, "fit_el_pz/F"); TBranch *branch_mu_e = newtree->Branch("fit_el_e", &fit_mu_e, "fit_el_e/F"); TBranch *branch_nv_px = newtree->Branch("fit_nv_px", &fit_nv_px, "fit_nv_px/F"); TBranch *branch_nv_py = newtree->Branch("fit_nv_py", &fit_nv_py, "fit_nv_py/F"); TBranch *branch_nv_pz = newtree->Branch("fit_nv_pz", &fit_nv_pz, "fit_nv_pz/F"); TBranch *branch_nv_e = newtree->Branch("fit_nv_e", &fit_nv_e, "fit_nv_e/F"); TBranch *branch_aj_px = newtree->Branch("fit_aj_px", &fit_aj_px, "fit_aj_px/F"); TBranch *branch_aj_py = newtree->Branch("fit_aj_py", &fit_aj_py, "fit_aj_py/F"); TBranch *branch_aj_pz = newtree->Branch("fit_aj_pz", &fit_aj_pz, "fit_aj_pz/F"); TBranch *branch_aj_e = newtree->Branch("fit_aj_e", &fit_aj_e, "fit_aj_e/F"); TBranch *branch_bj_px = newtree->Branch("fit_bj_px", &fit_bj_px, "fit_bj_px/F"); TBranch *branch_bj_py = newtree->Branch("fit_bj_py", &fit_bj_py, "fit_bj_py/F"); TBranch *branch_bj_pz = newtree->Branch("fit_bj_pz", &fit_bj_pz, "fit_bj_pz/F"); TBranch *branch_bj_e = newtree->Branch("fit_bj_e", &fit_bj_e, "fit_bj_e/F"); TBranch *branch_mlvjj = newtree->Branch("fit_mlvjj", &fit_mlvjj, "fit_mlvjj/F"); TBranch *branch_chi2 = newtree->Branch("fit_chi2", &fit_chi2, "fit_chi2/F"); TBranch *branch_NDF = newtree->Branch("fit_NDF", &fit_NDF, "fit_NDF/I"); TBranch *branch_status= newtree->Branch("fit_status",&fit_status, "fit_status/I"); TBranch *branch_gdevtt= newtree->Branch("gdevtt", &gdevtt, "gdevtt/I"); Float_t fi2_mu_px=0, fi2_mu_py =0, fi2_mu_pz=0, fi2_mu_e=0; Float_t fi2_nv_px=0, fi2_nv_py =0, fi2_nv_pz=0, fi2_nv_e=0; Float_t fi2_aj_px=0, fi2_aj_py =0, fi2_aj_pz=0, fi2_aj_e=0; Float_t fi2_bj_px=0, fi2_bj_py =0, fi2_bj_pz=0, fi2_bj_e=0; Float_t fi2_mlvjj=0, fi2_chi2 =999; Int_t fi2_NDF =999, fi2_status=999; TBranch *branc2_mu_px = newtree->Branch("fi2_el_px", &fi2_mu_px, "fi2_el_px/F"); TBranch *branc2_mu_py = newtree->Branch("fi2_el_py", &fi2_mu_py, "fi2_el_py/F"); TBranch *branc2_mu_pz = newtree->Branch("fi2_el_pz", &fi2_mu_pz, "fi2_el_pz/F"); TBranch *branc2_mu_e = newtree->Branch("fi2_el_e", &fi2_mu_e, "fi2_el_e/F"); TBranch *branc2_nv_px = newtree->Branch("fi2_nv_px", &fi2_nv_px, "fi2_nv_px/F"); TBranch *branc2_nv_py = newtree->Branch("fi2_nv_py", &fi2_nv_py, "fi2_nv_py/F"); TBranch *branc2_nv_pz = newtree->Branch("fi2_nv_pz", &fi2_nv_pz, "fi2_nv_pz/F"); TBranch *branc2_nv_e = newtree->Branch("fi2_nv_e", &fi2_nv_e, "fi2_nv_e/F"); TBranch *branc2_aj_px = newtree->Branch("fi2_aj_px", &fi2_aj_px, "fi2_aj_px/F"); TBranch *branc2_aj_py = newtree->Branch("fi2_aj_py", &fi2_aj_py, "fi2_aj_py/F"); TBranch *branc2_aj_pz = newtree->Branch("fi2_aj_pz", &fi2_aj_pz, "fi2_aj_pz/F"); TBranch *branc2_aj_e = newtree->Branch("fi2_aj_e", &fi2_aj_e, "fi2_aj_e/F"); TBranch *branc2_bj_px = newtree->Branch("fi2_bj_px", &fi2_bj_px, "fi2_bj_px/F"); TBranch *branc2_bj_py = newtree->Branch("fi2_bj_py", &fi2_bj_py, "fi2_bj_py/F"); TBranch *branc2_bj_pz = newtree->Branch("fi2_bj_pz", &fi2_bj_pz, "fi2_bj_pz/F"); TBranch *branc2_bj_e = newtree->Branch("fi2_bj_e", &fi2_bj_e, "fi2_bj_e/F"); TBranch *branc2_mlvjj = newtree->Branch("fi2_mlvjj", &fi2_mlvjj, "fi2_mlvjj/F"); TBranch *branc2_chi2 = newtree->Branch("fi2_chi2", &fi2_chi2, "fi2_chi2/F"); TBranch *branc2_NDF = newtree->Branch("fi2_NDF", &fi2_NDF, "fi2_NDF/I"); TBranch *branc2_status= newtree->Branch("fi2_status",&fi2_status, "fi2_status/I"); // Loop over all events Long64_t nbytes = 0, nb = 0; for (Long64_t jentry=0; jentry<nentries;jentry++) { //Long64_t ientry = LoadTree(jentry); //if (ientry < 0) break; nb = newtree->GetEntry(jentry); nbytes += nb; // Cut variable definitions double jess = 1.00; // control the jet energy scale //double muoniso = (W_muon_trackiso+W_muon_hcaliso+W_muon_ecaliso-event_RhoForLeptonIsolation*3.141592653589*0.09)/W_muon_pt; double dijetpt = sqrt(JetPFCor_Pt[0]*JetPFCor_Pt[0]+ JetPFCor_Pt[1]*JetPFCor_Pt[1]+ 2*JetPFCor_Pt[0]*JetPFCor_Pt[1]*cos(JetPFCor_Phi[0]-JetPFCor_Phi[1])); // Save variable initialization fit_mu_px = 0; fit_mu_py = 0; fit_mu_pz = 0; fit_mu_e = 0; fit_nv_px = 0; fit_nv_py = 0; fit_nv_pz = 0; fit_nv_e = 0; fit_aj_px = 0; fit_aj_py = 0; fit_aj_pz = 0; fit_aj_e = 0; fit_bj_px = 0; fit_bj_py = 0; fit_bj_pz = 0; fit_bj_e = 0; fit_mlvjj = 0; fit_chi2 =999;fit_NDF =999; fit_status=999; gdevtt = 0; fi2_mu_px = 0; fi2_mu_py = 0; fi2_mu_pz = 0; fi2_mu_e = 0; fi2_nv_px = 0; fi2_nv_py = 0; fi2_nv_pz = 0; fi2_nv_e = 0; fi2_aj_px = 0; fi2_aj_py = 0; fi2_aj_pz = 0; fi2_aj_e = 0; fi2_bj_px = 0; fi2_bj_py = 0; fi2_bj_pz = 0; fi2_bj_e = 0; fi2_mlvjj = 0; fi2_chi2 =999;fi2_NDF =999; fi2_status=999; // Good Event Selection Requirement if (JetPFCor_Pt[0]>30. && JetPFCor_Pt[1]>30. && JetPFCor_Pt[2]<0.5 && abs(JetPFCor_Eta[0]-JetPFCor_Eta[1])<1.5 && W_electron_et>30. && W_electron_isWP80==1 && (W_electron_trackiso+W_electron_hcaliso+W_electron_ecaliso-event_RhoForLeptonIsolation*3.141592653589*0.09)/W_electron_pt<0.05 && ((abs(W_electron_eta)<1.5 && abs(W_electron_deltaphi_in)<0.03 && abs(W_electron_deltaeta_in)<0.004) || (abs(W_electron_eta)>1.5 && abs(W_electron_deltaphi_in)<0.02 && abs(W_electron_deltaeta_in)<0.005)) && sqrt((W_electron_vx-event_BeamSpot_x)*(W_electron_vx-event_BeamSpot_x)+(W_electron_vy-event_BeamSpot_y)*(W_electron_vy-event_BeamSpot_y))<0.02 && JetPFCor_bDiscriminator[0]<1.19 && JetPFCor_bDiscriminator[1]<1.19 && cosJacksonAngle2j_PFCor<0.8 && cosJacksonAngle2j_PFCor>-0.6 && event_met_pfmet>30. && W_mt>40. && dijetpt > 40. ) { gdevtt = 1; // Do the kinematic fit for all event!!! int Aj = 0, Bj = 1; TLorentzVector mup, nvp, ajp, bjp; mup.SetPtEtaPhiE(W_electron_pt, W_electron_eta, W_electron_phi, W_electron_e ); nvp.SetPxPyPzE(event_met_pfmet * cos(event_met_pfmetPhi), event_met_pfmet * sin(event_met_pfmetPhi), W_pzNu1, sqrt(event_met_pfmet*event_met_pfmet + W_pzNu1*W_pzNu1) ); ajp.SetPtEtaPhiE(jess * JetPFCor_Pt[Aj], JetPFCor_Eta[Aj], JetPFCor_Phi[Aj], jess * JetPFCor_E[Aj] ); bjp.SetPtEtaPhiE(jess * JetPFCor_Pt[Bj], JetPFCor_Eta[Bj], JetPFCor_Phi[Bj], jess * JetPFCor_E[Bj] ); TLorentzVector fit_mup(0,0,0,0), fit_nvp(0,0,0,0), fit_ajp(0,0,0,0), fit_bjp(0,0,0,0) ; doKinematicFit( 1, mup, nvp, ajp, bjp, fit_mup, fit_nvp, fit_ajp, fit_bjp, fit_chi2, fit_NDF, fit_status); fit_mu_px = fit_mup.Px(); fit_mu_py = fit_mup.Py(); fit_mu_pz = fit_mup.Pz(); fit_mu_e = fit_mup.E(); fit_nv_px = fit_nvp.Px(); fit_nv_py = fit_nvp.Py(); fit_nv_pz = fit_nvp.Pz(); fit_nv_e = fit_nvp.E(); fit_aj_px = fit_ajp.Px(); fit_aj_py = fit_ajp.Py(); fit_aj_pz = fit_ajp.Pz(); fit_aj_e = fit_ajp.E(); fit_bj_px = fit_bjp.Px(); fit_bj_py = fit_bjp.Py(); fit_bj_pz = fit_bjp.Pz(); fit_bj_e = fit_bjp.E(); fit_mlvjj = (fit_mup+fit_nvp+fit_ajp+fit_bjp).M(); TLorentzVector fi2_mup(0,0,0,0), fi2_nvp(0,0,0,0), fi2_ajp(0,0,0,0), fi2_bjp(0,0,0,0) ; doKinematicFit( 2, mup, nvp, ajp, bjp, fi2_mup, fi2_nvp, fi2_ajp, fi2_bjp, fi2_chi2, fi2_NDF, fi2_status); fi2_mu_px = fi2_mup.Px(); fi2_mu_py = fi2_mup.Py(); fi2_mu_pz = fi2_mup.Pz(); fi2_mu_e = fi2_mup.E(); fi2_nv_px = fi2_nvp.Px(); fi2_nv_py = fi2_nvp.Py(); fi2_nv_pz = fi2_nvp.Pz(); fi2_nv_e = fi2_nvp.E(); fi2_aj_px = fi2_ajp.Px(); fi2_aj_py = fi2_ajp.Py(); fi2_aj_pz = fi2_ajp.Pz(); fi2_aj_e = fi2_ajp.E(); fi2_bj_px = fi2_bjp.Px(); fi2_bj_py = fi2_bjp.Py(); fi2_bj_pz = fi2_bjp.Pz(); fi2_bj_e = fi2_bjp.E(); fi2_mlvjj = (fi2_mup+fi2_nvp+fi2_ajp+fi2_bjp).M(); } // Only Good event will be performed kinematic fit branch_mu_px->Fill(); branch_mu_py->Fill(); branch_mu_pz->Fill(); branch_mu_e ->Fill(); branch_nv_px->Fill(); branch_nv_py->Fill(); branch_nv_pz->Fill(); branch_nv_e ->Fill(); branch_aj_px->Fill(); branch_aj_py->Fill(); branch_aj_pz->Fill(); branch_aj_e ->Fill(); branch_bj_px->Fill(); branch_bj_py->Fill(); branch_bj_pz->Fill(); branch_bj_e ->Fill(); branch_mlvjj->Fill(); branch_chi2 ->Fill(); branch_NDF ->Fill(); branch_status->Fill(); branch_gdevtt->Fill(); branc2_mu_px->Fill(); branc2_mu_py->Fill(); branc2_mu_pz->Fill(); branc2_mu_e ->Fill(); branc2_nv_px->Fill(); branc2_nv_py->Fill(); branc2_nv_pz->Fill(); branc2_nv_e ->Fill(); branc2_aj_px->Fill(); branc2_aj_py->Fill(); branc2_aj_pz->Fill(); branc2_aj_e ->Fill(); branc2_bj_px->Fill(); branc2_bj_py->Fill(); branc2_bj_pz->Fill(); branc2_bj_e ->Fill(); branc2_mlvjj->Fill(); branc2_chi2 ->Fill(); branc2_NDF ->Fill(); branc2_status->Fill(); } // end event loop fresults.cd(); newtree->Write("WJet"); fresults.Close(); std::cout << wda << "-" << wsp << " :: " << outfilename << " "<< nentries << std::endl; }
{ gROOT->Reset(); // Draw histos filled by Geant4 simulation // TFile f = TFile("gun2.root"); TCanvas* c1 = new TCanvas("c1", " "); TH1D* hist1 = (TH1D*)f.Get("1"); hist1->Draw("HIST"); TH1D* hist2 = (TH1D*)f.Get("2"); hist2->Draw("HIST"); TH1D* hist3 = (TH1D*)f.Get("3"); hist3->Draw("HIST"); TH1D* hist4 = (TH1D*)f.Get("4"); hist4->Draw("HIST"); TH1D* hist5 = (TH1D*)f.Get("5"); hist5->Draw("HIST"); TH1D* hist6 = (TH1D*)f.Get("6"); hist6->Draw("HIST"); TH1D* hist7 = (TH1D*)f.Get("7"); hist7->Draw("HIST"); }
{ server = new THttpServer("http:80"); // server->AddLocation("myfiles", "/root"); f = TFile("graph.root"); server->Register("1/graph", f->FindAnyObject("exclusion")); server->Register("1/graph", f->FindAnyObject("Graph")); // while (true) { // if (gSystem->ProcessEvents()) break; // } }