#include "TROOT.h" #include "TFile.h" #include "TTree.h" #include "TCanvas.h" #include "TProfile.h" #include "TF1.h" #include "TGraph.h" #include "interface/FuncDef.h" void JetResol() { setTDRStyle(); gROOT->Reset(); TFile *f1 = new TFile("JET.root","read"); TTree *Analyze = (TTree*)f1->Get("Analysis"); const Int_t numBin=7; double bins[numBin]={0,20,40,60,80,100,220}; TProfile *ETSoverET = new TProfile("ETSoverET","Jet resolution: E_{T}^{rec}/E_{T}^{mc}",(numBin-1),bins,-10,10); double rms[numBin]; double mean[numBin]; TCanvas *c1 = new TCanvas("c1","JET resol",0,0,1000,650); c1->cd(); int frame=0; c1->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 = 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]; if(i==0)binMin=5; sprintf(tempMin,"JetPTResol.NonSmearePT > %d",binMin); string mystringMin(tempMin); char tempMax[500]; sprintf(tempMax,"JetPTResol.NonSmearePT < %d",binMax); string mystringMax(tempMax); char tempName[500]; sprintf(tempName,"(JetPTResol.SmearePT)>>hETSoverET%d",i); string mystringName(tempName); c1->cd(++frame); GaussValues(Analyze,tempName,rms[i],mean[i],mystringMin,mystringMax); x[i]=binCenter; finval=rms[i]/mean[i]; y[i]=(finval*100); ex[i]=0; ey[i]=0; } TCanvas *c2 = new TCanvas("c2","JET resol",100,100,600,450); c2->cd(); TF1 *fitfun = new TF1("user","sqrt(pow([0],2)+pow([1]/sqrt(x),2)+pow([2]/x,2))",1,170); TGraphErrors *gr11 = new TGraphErrors((numBin-1),x,y,ex,ey); gr11->Draw("AP"); gr11->SetTitle(""); gr11->GetXaxis()->SetTitle("E_{T}^{MC} [GeV]"); gr11->GetYaxis()->SetRangeUser(0,50); gr11->GetYaxis()->SetTitle("#sigma(E_{T}^{rec}/E_{T}^{MC})_{fit}/_{fit}"); Double_t* params = fitfun->GetParameters(); gr11->Fit("user","QR"); gr11->Fit("user","QRI"); gr11->Fit("user","QRI"); gr11->Fit("user","QRI"); char tempResol[500]; if(params[2]==0.000000)sprintf(tempResol,"#frac{#sigma(E_{T}^{rec}/E_{T}^{MC})}{} = #frac{%f}{#sqrt{E_{T}^{MC}}} #oplus %f",params[1]/100,params[0]/100); else sprintf(tempResol,"#frac{#sigma(E_{T}^{rec}/E_{T}^{MC})}{} = #frac{%f}{#sqrt{E_{T}^{MC}}} #oplus #frac{%f}{E_{T}^{MC}} #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 *events = MakeTPave(0.2,0.75,0.35,0.8,"Events: pp #rightarrow gg "); events->Draw(); TPaveText *Delphes = MakeTPave(0.2,0.15,0.35,0.2,"MG/ME + Delphes"); Delphes->Draw(); delete fitfun; } void ElecResol() { setTDRStyle(); gROOT->Reset(); TFile *f1 = new TFile("Etmis.root","read"); TTree *Analyze = (TTree*)f1->Get("Analysis"); const Int_t numBin=6; double bins[numBin]={0,20,40,60,80,140}; 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); 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("Etmis.root","read"); 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 W#tau#tauq'#rightarrowjjl#tauq', 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 W#tau#tauq'#rightarrowjjl#tauq', m_{H}=150 GeV "); events->Draw(); } void ETmisResol() { setTDRStyle(); gROOT->Reset(); TFile *f1 = new TFile("Etmis.root","read"); TTree *Analyze = (TTree*)f1->Get("Analysis"); TF1 *fitfun = new TF1("user","[0]*sqrt(x)",0,600); const Int_t numBin=7; double bins[numBin]={200,250,300,350,400,450,500}; TProfile *ETSoverET = new TProfile("ETSoverET","ETmis resol",(numBin-1),bins,-1000,1000); double rms[numBin-1]; TCanvas *c5 = new TCanvas("c5","PTmis resol",0,0,1000,650); c5->cd(); int frame=0; c5->Divide(6,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); 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->Draw("AP"); gr11->GetXaxis()->SetTitle("Offline sum of 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,30); gr11->GetXaxis()->SetRangeUser(1,600); Double_t* params = fitfun->GetParameters(); char tempResol[500]; sprintf(tempResol,"%f * #sqrt{E_{T}}",params[0]); TPaveText *leg1 = MakeTPave(0.4,0.6,0.8,0.65,tempResol); leg1->Draw(); TPaveText *leg2 = MakeTPave(0.2,0.8,0.8,0.85,"WHq'#rightarrow W#tau#tauq'#rightarrowjjl#tauq', m_{H}=150 GeV "); leg2->Draw(); TPaveText *Delphes = MakeTPave(0.2,0.15,0.35,0.2,"MG/ME + Delphes"); Delphes->Draw(); delete fitfun; } void General() { // JetResol(); ElecResol(); ETmisResol(); TauJetInfo(); }