/*********************************************************************** ** ** ** /----------------------------------------------\ ** ** | Delphes, a framework for the fast simulation | ** ** | of a generic collider experiment | ** ** \------------- arXiv:0903.2225v1 ------------/ ** ** ** ** ** ** This package uses: ** ** ------------------ ** ** ROOT: Nucl. Inst. & Meth. in Phys. Res. A389 (1997) 81-86 ** ** FastJet algorithm: Phys. Lett. B641 (2006) [hep-ph/0512210] ** ** Hector: JINST 2:P09005 (2007) [physics.acc-ph:0707.1198v2] ** ** FROG: [hep-ex/0901.2718v1] ** ** HepMC: Comput. Phys. Commun.134 (2001) 41 ** ** ** ** ------------------------------------------------------------------ ** ** ** ** Main authors: ** ** ------------- ** ** ** ** Severine Ovyn Xavier Rouby ** ** severine.ovyn@uclouvain.be xavier.rouby@cern ** ** ** ** Center for Particle Physics and Phenomenology (CP3) ** ** Universite catholique de Louvain (UCL) ** ** Louvain-la-Neuve, Belgium ** ** ** ** Copyright (C) 2008-2009, ** ** All rights reserved. ** ** ** ***********************************************************************/ #include "TROOT.h" #include "TFile.h" #include "TTree.h" #include "TCanvas.h" #include "TProfile.h" #include "TF1.h" #include "TGraph.h" #include "TLegend.h" #include "interface/FuncDef.h" void JetResol() { setTDRStyle(); gROOT->Reset(); //TFile *f1 = new TFile("JET2_atlas_jetclu.root","read"); //TFile *f1 = new TFile("JET2_atlas_jetclu_new.root","read"); // 40k //TFile *f1 = new TFile("JET2_atlas_siscone.root","read"); //TFile *f1 = new TFile("JET2_atlas_antikt.root","read"); //TFile *f1 = new TFile("JET2_atlas_midpoint.root","read"); //TFile *f1 = new TFile("JET2_atlas_midpoint_eflow.root","read"); //TFile *f1 = new TFile("JET2_atlas_midpoint_newCaloRes.root","read"); //TFile *f1 = new TFile("JET2_atlas_kt_40k.root","read"); // 40k events //TFile *f1 = new TFile("JET2_atlas_kt_60k.root","read"); // 60k events //TFile *f1 = new TFile("JET2_atlas_jetclu_60k.root","read"); // 60k events //TFile *f1 = new TFile("JET2_atlas.kt_80k.root","read"); // 80k events -- samples jx -- default Delphes //TFile *f1 = new TFile("JET2_atlas.cone_80k.root","read"); // 80k events -- samples jx -- default Delphes + endcaps TFile *f1 = new TFile("JET2_atlas_kt_80k_endcap.root","read"); // 80k events -- samples jx -- default Delphes + endcaps if(!f1->IsOpen()) { cout << "could not open "<< f1->GetName() << ". Exiting..." << endl; return;} if(!f1->FindKey("Analysis")) { cout << "Bad input file, could not find the \"Analysis\" tree. Exiting..." << endl; return;} TTree *Analyze = (TTree*)f1->Get("Analysis"); /* const int numBin=16; double bins[numBin]={0,10,20,30,40,50,60,70,80,100,120,140,180,220,300,1200}; // cms-samples bins string cut = "1==1"; TF1 *fitfunATLAS = new TF1("userATLAS","sqrt(pow(0.69*100/sqrt(x),2)+pow(0.03*100,2)+pow(6.3*100/x,2))",10,800); TPaveText *etacut = MakeTPave(0.58,0.51,0.65,0.55,"|#eta|<0.5 "); */ /* const int numBin=25; double bins[numBin]={21,26,32,39,48, 59,72,88,107,130, 158,191,230,278,336, 405,485,581,696,834, 1000,1198,1435,1719,2060}; string cut = "1==1"; TF1 *fitfunATLAS = new TF1("userATLAS","sqrt(pow(0.69*100/sqrt(x),2)+pow(0.03*100,2)+pow(6.3*100/x,2))",10,800); TPaveText *etacut = MakeTPave(0.58,0.51,0.65,0.55,"|#eta|<0.5 "); */ /* const int numBin=20; double bins[numBin]={21,26,32,39,48, 59,72,88,107,130, 158,191,230,278,336, 405,485,581,696,834 }; string cut = "1==1"; TF1 *fitfunATLAS = new TF1("userATLAS","sqrt(pow(0.69*100/sqrt(x),2)+pow(0.03*100,2)+pow(6.3*100/x,2))",10,800); TPaveText *etacut = MakeTPave(0.58,0.51,0.65,0.55,"|#eta|<0.5 "); */ // for eta < 0.5, use this const int numBin=14; double bins[numBin]={21,26,32,39,48, 59,72,88,130, 191,278, 405,581,834 }; string cut = "abs(JetPTResol.Eta)<0.5"; TF1 *fitfunATLAS = new TF1("userATLAS","sqrt(pow(0.69*100/sqrt(x),2)+pow(0.03*100,2)+pow(6.3*100/x,2))",10,800); TPaveText *etacut = MakeTPave(0.58,0.51,0.65,0.55,"|#eta|<0.5 "); /* // for forward 1.5 < eta < 2.0, use this const int numBin=10; double bins[numBin]={48, 59,72,88,130, 191,278, 405,581,834 }; string cut = "abs(JetPTResol.Eta)<2.0 && abs(JetPTResol.Eta)>1.5"; TF1 *fitfunATLAS= new TF1("userATLAS","sqrt(pow(1.19*100/sqrt(x),2)+pow(0.01*100,2)+pow(10*100/x,2))",10,800); TPaveText *etacut = MakeTPave(0.58,0.51,0.65,0.55,"1.5<|#eta|<2.0 "); */ TProfile *ESoverE = new TProfile("ESoverE","Jet resolution for ATLAS ",numBin-1,bins,-10,10); double mean[numBin], mean2[numBin]; TCanvas *c1 = new TCanvas("c1","JET resol: (E_reco - E_gen)/E_gen",0,0,1000,650); c1->cd(); int frame=0; int nc = numBin/2 + numBin%2; c1->Divide(nc,2); TCanvas *c1b = new TCanvas("c1b","JET resol: [(E_reco - E_gen)/E_gen]^2 ",0,0,1000,650); c1b->cd(); int frame2=0; c1b->Divide(nc,2); float x[numBin-1]; float y[numBin-1]; float ex[numBin-1]; float ey[numBin-1]; float erec_over_etruth[numBin-1]; float finval=0;//valeur a remplir puis a fitter // available variables: // - E : true Energy // - PT : true transverse energy // - SmearedPT : ratio ET_rec / ET_gen // - dE : ratio (E_rec - E_truth)/E_truth // - dE2 : ( (E_rec - E_truth)/E_truth )^2 for ( int i=0; iGetXaxis(); float binCenter = xaxis->GetBinCenter(i+1); int binMin = (int)xaxis->GetBinLowEdge(i+1); int binMax = (int)xaxis->GetBinUpEdge(i+1); char tempMin[500]; if(i==0)binMin=5; sprintf(tempMin,"JetPTResol.E > %d",binMin); string mystringMin(tempMin); char tempMax[500]; sprintf(tempMax,"JetPTResol.E < %d",binMax); string mystringMax(tempMax); char tempName[500]; //sprintf(tempName,"JetPTResol.dE/JetPTResol.SmearedPT>>hdE%d",i); //sprintf(tempName,"JetPTResol.dE>>hdE%d",i); sprintf(tempName,"JetPTResol.dE_reco>>hdE%d",i); string mystringName(tempName); c1->cd(++frame); GaussValuesAsymmetry(Analyze,tempName,mean[i],mystringMin,mystringMax,cut); //sprintf(tempName,"JetPTResol.dE2/JetPTResol.SmearedPT>>hdE2%d",i); //sprintf(tempName,"JetPTResol.dE2/JetPTResol.SmearedPT>>hdE2%d",i); sprintf(tempName,"JetPTResol.dE2_reco>>hdE2%d",i); string mystringName2(tempName); c1b->cd(++frame2); GaussValuesAsymmetry2(Analyze,tempName,mean2[i],mystringMin,mystringMax,cut); x[i]=binCenter; finval=sqrt(mean2[i] - mean[i]*mean[i]); y[i]=finval*100; ex[i]=0; ey[i]=0; erec_over_etruth[i]=mean[i]+1; } TCanvas *c3 = new TCanvas("c3","JET linearity",100,100,600,450); c3->cd(); //for(int i=0; iDraw("AP"); linearity->SetTitle(""); linearity->GetXaxis()->SetTitle("E^{Truth} [GeV]"); linearity->GetYaxis()->SetTitle(""); linearity->GetXaxis()->SetRangeUser(30,1000); linearity->SetMinimum(0.85); linearity->SetMaximum(1.20); gPad->SetLogx(); TCanvas *c2 = new TCanvas("c2","JET resol",100,100,600,450); c2->cd(); TGraph *gr11 = new TGraph(numBin-1,x,y); gr11->Draw("AP"); gr11->SetTitle(""); gr11->GetXaxis()->SetTitle("E^{MC} [GeV]"); gr11->GetYaxis()->SetRangeUser(0,50); gr11->GetYaxis()->SetTitle("#sigma(E)/E"); TF1 *fitfun = new TF1("user","sqrt(pow([0]/x,2)+pow([2]/sqrt(x),2)+pow([1],2))",10,800); Double_t* params = fitfun->GetParameters(); fitfun->SetLineColor(kBlue); gr11->Fit("user","QRN"); gr11->Fit("user","QRN"); gr11->Fit("user","QRN"); gr11->Fit("user","QRN"); gr11->GetXaxis()->SetRangeUser(30,1200); //gPad->SetLogx(); char tempResol[100]; //sprintf(tempResol,"Delphes resolution: #frac{#sigma(E)}{E} = #sqrt{ <( #frac{E_{reco} - E_{gen}}{E_{gen}} )^{2} > - < #frac{E_{reco}-E_{gen}}{E_{gen}}>^{2} } =\n #frac{%f}{#sqrt{E_{T}^{MC}}} #oplus %f #oplus #frac{%f}{E}",params[1],params[2],params[3]); sprintf(tempResol,"Delphes resolution: #frac{#sigma(E)}{E} = #frac{%.1f}{#sqrt{E^{MC}}} #oplus %.1f #oplus #frac{%.1f}{E^{MC}}",params[2],params[1],params[0]); char tempResol2[100]; sprintf(tempResol2,"sqrt(pow(%f/x,2)+pow(%f/sqrt(x),2)+pow(%f,2) )",params[0],params[2],params[1]); TF1 *fitfunDelphes = new TF1("userDelphes",tempResol2,7,1000); fitfunDelphes->SetLineColor(kBlack); fitfunDelphes->SetLineStyle(7); fitfunDelphes->Draw("same"); fitfunATLAS->SetLineColor(kBlue); fitfunATLAS->Draw("same"); etacut->Draw(); TPaveText *events = MakeTPave(0.62,0.43,0.75,0.47,"Events: pp #rightarrow ggX "); events->Draw(); TPaveText *algo = MakeTPave(0.64,0.36,0.76,0.40,"k_{T} algorithm #Delta R = 0.6"); //TPaveText *algo = MakeTPave(0.64,0.36,0.76,0.40,"Cone algorithm #Delta R = 0.7"); algo->Draw(); TPaveText *Delphes = MakeTPave(0.62,0.29,0.85,0.33,"MG/ME + Pythia + Delphes"); Delphes->Draw(); TLegend *legend = new TLegend(0.18,0.72,0.87,0.87,NULL,"NDC"); legend->AddEntry(fitfunATLAS,"ATLAS resolution","l"); legend->AddEntry(fitfunDelphes,tempResol,"l"); legend->SetFillColor(10); legend->SetBorderSize(0); legend->Draw(); delete fitfun; } void ElecResol() { setTDRStyle(); gROOT->Reset(); TFile *f1 = new TFile("ETMIS2_ATLAS.root","read"); if(!f1->IsOpen()) { cout << "could not open "<< f1->GetName() << ". Exiting..." << endl; return;} if(!f1->FindKey("Analysis")) { cout << "Bad input file, could not find the \"Analysis\" tree. Exiting..." << endl; return;} TTree *Analyze = (TTree*)f1->Get("Analysis"); const Int_t numBin=11; double bins[numBin]={0,10,20,30,40,50,60,70,80,100,120}; TProfile *ETSminusET = new TProfile("ETSminusET","Electron resolution: E_{T}^{rec}/E_{T}^{mc}",(numBin-1),bins,-10,10); double rms[numBin]; double mean[numBin]; TCanvas *c3 = new TCanvas("c3","ELEC resol",0,0,1000,650); c3->cd(); int frame=0; c3->Divide(6,2); float x[numBin-1]; float y[numBin-1]; float ex[numBin-1]; float ey[numBin-1]; float finval=0;//valeur a remplir puis a fitter for ( int i=0; i<(numBin-1); i++) // première bin : i ==1 et pas i == 0 { TAxis *xaxis = ETSminusET->GetXaxis(); float binCenter = xaxis->GetBinCenter(i+1); int binMin = (int)xaxis->GetBinLowEdge(i+1); int binMax = (int)xaxis->GetBinUpEdge(i+1); char tempMin[500]; if(i==0)binMin=5; sprintf(tempMin,"ElecEResol.E > %d",binMin); string mystringMin(tempMin); char tempMax[500]; sprintf(tempMax,"ElecEResol.E < %d",binMax); string mystringMax(tempMax); char tempName[500]; sprintf(tempName,"(ElecEResol.E-ElecEResol.SmearedE)>>hETSoverET%d",i); string mystringName(tempName); c3->cd(++frame); GaussValuesElec(Analyze,tempName,rms[i],mean[i],mystringMin,mystringMax); //GaussValues(Analyze,tempName,rms[i],mean[i],mystringMin,mystringMax); x[i]=binCenter; finval=rms[i]/binCenter; y[i]=(finval*100); ex[i]=0; ey[i]=0; } TCanvas *c4 = new TCanvas("c4","ELEC resol",100,100,600,450); c4->cd(); TF1 *fitfun = new TF1("user","sqrt(pow([0],2)+pow([1]/sqrt(x),2)+pow([2]/x,2))",1,400); TGraphErrors *gr11 = new TGraphErrors((numBin-1),x,y,ex,ey); gr11->Draw("AP"); gr11->SetTitle(""); gr11->GetXaxis()->SetTitle("E [GeV]"); gr11->GetYaxis()->SetRangeUser(0,5); gr11->GetYaxis()->SetTitle("#sigma/E"); Double_t* params = fitfun->GetParameters(); gr11->Fit("user","QR"); gr11->Fit("user","QRI"); gr11->Fit("user","QRI"); gr11->Fit("user","QRI"); char tempResol[500]; sprintf(tempResol,"#frac{#sigma}{E} = #frac{%f}{#sqrt{E}} #oplus #frac{%f}{E} #oplus %f",params[1]/100,params[2]/100,params[0]/100); TPaveText *leg1 = MakeTPave(0.4,0.6,0.8,0.65,tempResol); leg1->Draw(); TPaveText *Delphes = MakeTPave(0.2,0.15,0.35,0.2,"MG/ME + Delphes"); Delphes->Draw(); TPaveText *events = MakeTPave(0.2,0.75,0.35,0.8,"Events: WHq'#rightarrow W#tau#tauq'#rightarrowjjl#tauq', m_{H}=150 GeV "); events->Draw(); delete fitfun; } void TauJetInfo() { setTDRStyle(); gROOT->Reset(); TFile *f1 = new TFile("TAUJET2_ATLAS.root","read"); if(!f1->IsOpen()) { cout << "could not open "<< f1->GetName() << ". Exiting..." << endl; return;} if(!f1->FindKey("Analysis")) { cout << "Bad input file, could not find the \"Analysis\" tree. Exiting..." << endl; return;} TTree *Analyze = (TTree*)f1->Get("Analysis"); TCanvas *ct1 = new TCanvas("ct1","Tau information",100,100,600,450); ct1->cd(); TH1F *tauEnergy =MakeNormTH1F(20,0.8,1,Analyze,"TauJetPTResol.EnergieCen>>tauEnergy",1, 0, 1,2,false); tauEnergy->Draw(); tauEnergy->SetTitle(""); tauEnergy->GetYaxis()->SetTitle("Fraction of events"); tauEnergy->GetXaxis()->SetTitle("C_{#tau}"); TPaveText *Delphes1 = MakeTPave(0.3,0.85,0.45,0.9,"MG/ME + Delphes"); Delphes1->Draw(); TPaveText *ctau = MakeTPave(0.3,0.75,0.45,0.8,"C_{#tau} = #frac{#sum E^{towers} (#DeltaR = 0.15)}{E^{jet}}"); ctau->Draw(); TPaveText *events1 = MakeTPave(0.3,0.65,0.45,0.7,"Events: WHq'#rightarrow WWWq'#rightarrow lllq', m_{H}=150 GeV "); events1->Draw(); TCanvas *ct2 = new TCanvas("ct2","Tau information",100,100,600,450); ct2->cd(); TH1F *NumTrack =MakeNormTH1F(6,0,6,Analyze,"TauJetPTResol.NumTrack>>NumTrack",1, 0, 1,2,false); NumTrack->Draw(); NumTrack->SetTitle(""); NumTrack->GetYaxis()->SetTitle("Fraction of events"); NumTrack->GetXaxis()->SetTitle("N^{tracks}"); TPaveText *Delphes = MakeTPave(0.6,0.85,0.85,0.9,"MG/ME + Delphes"); Delphes->Draw(); TPaveText *numtracks = MakeTPave(0.6,0.75,0.85,0.8,"#DeltaR < 0.4, p_{T}^{track} > 2 GeV"); numtracks->Draw(); TPaveText *events = MakeTPave(0.6,0.65,0.85,0.7,"Events: WHq'#rightarrow WWWq'#rightarrow lllq', m_{H}=150 GeV "); events->Draw(); } void ETmisResol() { setTDRStyle(); gROOT->Reset(); //TFile *f1 = new TFile("JET2_ATLAS.root","read"); //TFile *f1 = new TFile("JET2_atlas_midpoint.root","read"); //TFile *f1 = new TFile("JET2_atlas_kt_60k.root","read"); // 60k events //TFile *f1 = new TFile("JET2_atlas_kt_80k_endcap.root","read"); // 80k events + endcap TFile *f1 = new TFile("JET2_atlas.cone_80k.root","read"); // 80k events + endcap if(!f1->IsOpen()) { cout << "could not open "<< f1->GetName() << ". Exiting..." << endl; return;} if(!f1->FindKey("Analysis")) { cout << "Bad input file, could not find the \"Analysis\" tree. Exiting..." << endl; return;} TTree *Analyze = (TTree*)f1->Get("Analysis"); //const Int_t numBin=6; double bins[numBin]={180,260,340,420,500,580}; double max = 900; const Int_t numBin=6; double bins[numBin]={100,250,400,550,700,max}; //const Int_t numBin=6; double bins[numBin]={180,260,340,420,500,max}; TProfile *ETSoverET = new TProfile("ETSoverET","ETmis resol",numBin-1,bins,-1000,1000); TF1 *fitfun = new TF1("user","[0]*sqrt(x)",0,max); fitfun->SetLineColor(kBlue); double rms[numBin-1]; TCanvas *c5 = new TCanvas("c5","PTmis resol",0,0,1000,650); c5->cd(); int frame=0; int nb = numBin/2 + numBin%2; c5->Divide(nb,2); double x[numBin]; double y[numBin]; for ( int i=0; i<(numBin-1); i++) // première bin : i ==1 et pas i == 0 { TAxis *xaxis = ETSoverET->GetXaxis(); float binCenter = xaxis->GetBinCenter(i+1); int binMin = (int)xaxis->GetBinLowEdge(i+1); int binMax = (int)xaxis->GetBinUpEdge(i+1); char tempMin[500]; sprintf(tempMin,"ETmisResol.SEt>%d",binMin); string mystringMin(tempMin); char tempMax[500]; sprintf(tempMax,"ETmisResol.SEt<%d",binMax); string mystringMax(tempMax); char tempName[500]; sprintf(tempName,"ETmisResol.ExSmeare>>hETSoverET%d",i); //sprintf(tempName,"ETmisResol.EtSmeare>>hETSoverET%d",i); // non-gaussian, so it does not work properly string mystringName(tempName); c5->cd(++frame); GaussValuesETmis(Analyze,tempName,rms[i],mystringMin,mystringMax); x[i]=binCenter; y[i]=rms[i]; } TCanvas *c6 = new TCanvas("c6","ETmis resolution",100,100,600,450); c6->cd(); x[numBin]=0; y[numBin]=0; TGraph *gr11 = new TGraph(numBin,x,rms); gr11->SetTitle(""); gr11->SetMarkerStyle(3); gr11->Draw("AP"); gr11->GetXaxis()->SetTitle("#Sigma E_{T} [GeV]"); gr11->GetYaxis()->SetTitle("Resolution of x-component of MET [GeV]"); gr11->Fit("user","RQ"); gr11->Fit("user","RQ"); gr11->Fit("user","RQ"); gr11->Fit("user","RQ"); gr11->GetYaxis()->SetRangeUser(0,60); gr11->GetXaxis()->SetRangeUser(1,max); gr11->SetMaximum(16); Double_t* params = fitfun->GetParameters(); char tempResol[500]; sprintf(tempResol,"E_{x}^{mis} resolution: %.2f #times #sqrt{E_{T}}",params[0]); TPaveText *leg1 = MakeTPave(0.26,0.84,0.43,0.89,tempResol); leg1->Draw(); TPaveText *leg2 = MakeTPave(0.15,0.75,0.45,0.8,"Events: pp #rightarrow ggX"); leg2->Draw(); TPaveText *Delphes = MakeTPave(0.65,0.19,0.8,0.24,"MG/ME + Pythia + Delphes"); Delphes->Draw(); TPaveText *atlas = MakeTPave(0.65,0.25,0.8,0.30,"ATLAS-like detector"); atlas->Draw(); delete fitfun; } void General() { JetResol(); ElecResol(); ETmisResol(); //TauJetInfo(); }