Index: trunk/routines/resolutions.C
===================================================================
--- trunk/routines/resolutions.C	(revision 91)
+++ trunk/routines/resolutions.C	(revision 153)
@@ -6,4 +6,5 @@
 #include "TF1.h"
 #include "TGraph.h"
+#include "TLegend.h"
 
 #include "interface/FuncDef.h"
@@ -17,6 +18,6 @@
   TTree *Analyze = (TTree*)f1->Get("Analysis");
   
-  const Int_t numBin=7;
-  double bins[numBin]={0,20,40,60,80,100,220};
+  const Int_t numBin=16;
+  double bins[numBin]={0,10,20,30,40,50,60,70,80,100,120,140,180,220,300,1200};
   TProfile *ETSoverET = new TProfile("ETSoverET","Jet resolution: E_{T}^{rec}/E_{T}^{mc}",(numBin-1),bins,-10,10);
   
@@ -64,7 +65,9 @@
   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);
+  TF1 *fitfun = new TF1("user","sqrt(pow([0]/x,2)+pow([1]/sqrt(x),2)+pow([2],2))",10,800);
+  TF1 *fitfunCMS = new TF1("userCMS","sqrt(pow(1.05*100/sqrt(x),2)+pow(0.06*100,2)+pow(0*100/x,2))",10,800);
+  //TF1 *fitfunCMS = new TF1("userCMS","sqrt(pow(1.17*100/sqrt(x),2)+pow(0.039*100,2))",10,800);
+  
+  TGraph *gr11 = new TGraph((numBin-1),x,y);
   gr11->Draw("AP");
   gr11->SetTitle("");
@@ -74,24 +77,37 @@
   
   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})}{<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})}{<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();
+
+  fitfun->SetLineColor(6);
+  gr11->Fit("user","QR");
+  gr11->Fit("user","QR");
+  gr11->Fit("user","QR");
+  gr11->Fit("user","QR");
+  char tempResol[100];
+  sprintf(tempResol,"Delphes resolution: #frac{#sigma(E_{T}^{rec}/E_{T}^{MC})}{<E_{T}^{rec}/E_{T}^{MC}>} = #frac{%f}{#sqrt{E_{T}^{MC}}} #oplus %f",params[1],params[2]);
+ char tempResol2[100];
+  sprintf(tempResol2,"sqrt(pow(%f/sqrt(x),2)+pow(%f,2))",params[1],params[2]);
+
+
+  TF1 *fitfunDelphes = new TF1("userDelphes",tempResol2,7,1000);
+  fitfunDelphes->SetLineColor(6);
+  fitfunDelphes->Draw("same");
+
+  //CMS values
+  fitfunCMS->SetLineColor(9);
+  fitfunCMS->Draw("same");
 
   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();
- 
- 
+
+  TLegend *legend = new TLegend(0.2,0.6,0.9,0.85,NULL,"NDC");
+  legend->AddEntry(fitfunCMS,"CMS resolution","l");
+  legend->AddEntry(fitfunDelphes,tempResol,"l");
+  legend->SetFillColor(10);
+  legend->SetBorderSize(0);
+  legend->Draw();
+
   delete fitfun;
 }
@@ -103,9 +119,9 @@
   gROOT->Reset();
   
-  TFile *f1 = new TFile("lept.root","read");
+  TFile *f1 = new TFile("ETMIS2.root","read");
   TTree *Analyze = (TTree*)f1->Get("Analysis");
   
-  const Int_t numBin=6;
-  double bins[numBin]={0,20,40,60,80,140};
+  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);
   
@@ -142,5 +158,6 @@
       
       c3->cd(++frame);
-      GaussValues(Analyze,tempName,rms[i],mean[i],mystringMin,mystringMax);
+      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;
@@ -189,5 +206,5 @@
   gROOT->Reset();
   
-  TFile *f1 = new TFile("Etmis.root","read");
+  TFile *f1 = new TFile("ETMIS2.root","read");
   TTree *Analyze = (TTree*)f1->Get("Analysis");
   
@@ -206,5 +223,5 @@
   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 ");
+  TPaveText *events1 = MakeTPave(0.3,0.65,0.45,0.7,"Events: WHq'#rightarrow WWWq'#rightarrow lllq', m_{H}=150 GeV ");
   events1->Draw();
   
@@ -222,5 +239,5 @@
   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 ");
+  TPaveText *events = MakeTPave(0.6,0.65,0.85,0.7,"Events: WHq'#rightarrow WWWq'#rightarrow lllq', m_{H}=150 GeV ");
   events->Draw();
    
@@ -233,10 +250,10 @@
   gROOT->Reset();
   
-  TFile *f1 = new TFile("Etmis.root","read");
+  TFile *f1 = new TFile("JET.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};
+  const Int_t numBin=6;
+  double bins[numBin]={180,260,340,420,500,580};
   TProfile *ETSoverET = new TProfile("ETSoverET","ETmis resol",(numBin-1),bins,-1000,1000);
  
@@ -288,5 +305,5 @@
   gr11->Fit("user","RQ");
   gr11->Fit("user","RQ");
-  gr11->GetYaxis()->SetRangeUser(0,30);
+  gr11->GetYaxis()->SetRangeUser(0,60);
   gr11->GetXaxis()->SetRangeUser(1,600);
 
@@ -299,5 +316,5 @@
   leg1->Draw();
 
-  TPaveText *leg2 = MakeTPave(0.2,0.8,0.8,0.85,"WHq'#rightarrow W#tau#tauq'#rightarrowjjl#tauq', m_{H}=150 GeV ");
+  TPaveText *leg2 = MakeTPave(0.2,0.8,0.8,0.85,"WHq'#rightarrow WWWq'#rightarrow lllq', m_{H}=150 GeV ");
   leg2->Draw();
 
@@ -312,9 +329,9 @@
 {
   JetResol();
-  ElecResol();
-  ETmisResol();
-  TauJetInfo();
-  
-}
-
-
+//  ElecResol();
+//  ETmisResol();
+//  TauJetInfo();
+  
+}
+
+
