Index: trunk/Resolutions.cpp
===================================================================
--- trunk/Resolutions.cpp	(revision 38)
+++ trunk/Resolutions.cpp	(revision 39)
@@ -52,7 +52,44 @@
 //------------------------------------------------------------------------------
 
-
-
-void PairingJet(TLorentzVector &JETSm, TLorentzVector JET,  vector<fastjet::PseudoJet> sorted_jetsS)
+// //********************************** PYTHIA INFORMATION*********************************
+
+TSimpleArray<TRootGenParticle> TauHadr(const TClonesArray *GEN)
+ {
+   TIter it((TCollection*)GEN);
+   it.Reset();
+   TRootGenParticle *gen1;
+   TSimpleArray<TRootGenParticle> array,array2;
+
+   while((gen1 = (TRootGenParticle*) it.Next()))
+      {
+        array.Add(gen1);
+      }
+   it.Reset();
+   bool tauhad;
+   while((gen1 = (TRootGenParticle*) it.Next()))
+    {
+       tauhad=false;
+       if(abs(gen1->PID)==15)
+         {
+            int d1=gen1->D1;
+            int d2=gen1->D2;
+
+            if((d1 < array.GetEntries()) && (d1 > 0) && (d2 < array.GetEntries()) && (d2 > 0))
+               {
+                 tauhad=true;
+                 for(int d=d1; d < d2+1; d++)
+                    {
+                      if(abs(array[d]->PID)== pE || abs(array[d]->PID)== pMU)tauhad=false;
+                    }
+               }
+         }
+        if(tauhad)array2.Add(gen1);
+     }
+   return array2;
+ }
+
+
+
+void PairingJet(TLorentzVector &JETSm, const TLorentzVector &JET,  vector<fastjet::PseudoJet> sorted_jetsS)
 {
   JETSm.SetPxPyPzE(0,0,0,0);
@@ -146,7 +183,6 @@
   
   TRootGenParticle *particle;
-  TRootETmis *etmisc;
-  
-  RESOLELEC *elementElec;
+  
+  RESOLELEC * elementElec;
   RESOLMUON *elementMuon;
   RESOLJET *elementJet;
@@ -172,10 +208,17 @@
   vector<fastjet::PseudoJet> inclusive_jetsS;
   vector<fastjet::PseudoJet> sorted_jetsS;
+
+  vector<fastjet::PseudoJet> input_particlesT;//for FastJet algorithm
+  vector<fastjet::PseudoJet> inclusive_jetsT;
+  vector<fastjet::PseudoJet> sorted_jetsT;
+
   vector<PhysicsTower> towers;
   
   fastjet::JetDefinition jet_def;
   fastjet::JetDefinition jet_defS;
+  fastjet::JetDefinition jet_defT;
   fastjet::JetDefinition::Plugin * plugins;
   fastjet::JetDefinition::Plugin * pluginsS;
+  fastjet::JetDefinition::Plugin * pluginsT;
   
   // set up a CDF midpoint jet definition
@@ -195,4 +238,12 @@
 #endif
   
+ // set up a CDF midpoint jet definition
+ #ifdef ENABLE_PLUGIN_CDFCONES
+ pluginsT = new fastjet::CDFJetCluPlugin(0,DET->CONERADIUS,DET->C_ADJACENCYCUT,DET->C_MAXITERATIONS,DET->C_IRATCH,DET->C_OVERLAPTHRESHOLD);
+ jet_defT = fastjet::JetDefinition(pluginsT);
+ #else
+ pluginsT = NULL;
+ #endif
+ 
   
   // Loop over all events
@@ -212,10 +263,16 @@
       TrackCentral.clear();
       TSimpleArray<TRootGenParticle> NFCentralQ;
+   
+      sorted_jetsS.clear();
+      input_particlesS.clear();
+      inclusive_jetsS.clear();
+
+      sorted_jetsT.clear();
+      input_particlesT.clear();
+      inclusive_jetsT.clear();
+
+      sorted_jets.clear();
       input_particles.clear();
       inclusive_jets.clear();
-      sorted_jets.clear();
-      input_particlesS.clear();
-      inclusive_jetsS.clear();
-      sorted_jetsS.clear();
       towers.clear();
       
@@ -228,9 +285,10 @@
 	  float eta = fabs(particle->Eta);
 	  
-          if(particle->Status == 1)
+          if(particle->Status == 1 && eta < DET->MAX_CALO_FWD)
 	    {
 	      input_particles.push_back(fastjet::PseudoJet(genMomentum.Px(),genMomentum.Py(),genMomentum.Pz(), genMomentum.E()));
 	    }
 	  
+          if((pid == pNU1) || (pid == pNU2) || (pid == pNU3))PTmis = PTmis + genMomentum;
 	  // keeps only final particles, visible by the central detector, including the fiducial volume
 	  // the ordering of conditions have been optimised for speed : put first the STATUS condition
@@ -241,9 +299,15 @@
 	      ) 
 	    {
-	      PTmis = PTmis + genMomentum;//ptmis
+              //if((pid != pNU1) && (pid != pNU2) && (pid != pNU3))PTmis = PTmis + genMomentum;//ptmis
+
+              Float_t nonS=0;
 	      switch(pid) {
-
 	      case pE: // all electrons with eta < DET->MAX_CALO_FWD
-		DET->SmearElectron(genMomentum);
+                nonS = genMomentum.E();
+                DET->SmearElectron(genMomentum);
+                if(eta < DET->MAX_TRACKER){
+                elementElec=(RESOLELEC*) branchelec->NewEntry();
+                elementElec->NonSmeareE = nonS;
+                elementElec->SmeareE = genMomentum.E();}
 		break; // case pE
 	      case pGAMMA: // all photons with eta < DET->MAX_CALO_FWD
@@ -251,5 +315,8 @@
 		break; // case pGAMMA
 	      case pMU: // all muons with eta < DET->MAX_MU
+                elementMuon = (RESOLMUON*) branchmuon->NewEntry();
+                elementMuon->OneoverNonSmearePT = (1/genMomentum.Pt());
 		DET->SmearMu(genMomentum);
+                elementMuon->OneoverSmearePT = (1/genMomentum.Pt());
 		break; // case pMU
 	      case pLAMBDA: // all lambdas with eta < DET->MAX_CALO_FWD
@@ -264,7 +331,6 @@
 	      if(pid != pMU)
 		{
-//		  PTmisS = PTmisS + genMomentum;
 		  towers.push_back(PhysicsTower(LorentzVector(genMomentum.Px(),genMomentum.Py(),genMomentum.Pz(), genMomentum.E())));
-		  if(genMomentum.Et()>0.5)input_particlesS.push_back(fastjet::PseudoJet(genMomentum.Px(),genMomentum.Py(),genMomentum.Pz(), genMomentum.E()));
+		  input_particlesS.push_back(fastjet::PseudoJet(genMomentum.Px(),genMomentum.Py(),genMomentum.Pz(), genMomentum.E()));
 		}
 	      
@@ -286,16 +352,24 @@
 	    } // switch
 	} // while
-     
-     TLorentzVector TowerTLV(0.,0.,0.,0.);
+    
+     TLorentzVector Att(0.,0.,0.,0.);
+     float ScalarEt=0;
      for(unsigned int i=0; i < towers.size(); i++) 
        {
-         TowerTLV.SetPxPyPzE(towers[i].fourVector.px,towers[i].fourVector.py,towers[i].fourVector.pz,towers[i].fourVector.E);
-         if(TowerTLV.Et()>0.5)PTmisS = PTmisS + TowerTLV;
-      }
-
- 
+         Att.SetPxPyPzE(towers[i].fourVector.px,towers[i].fourVector.py,towers[i].fourVector.pz,towers[i].fourVector.E);
+         ScalarEt = ScalarEt + Att.Et();
+         PTmisS = PTmisS + Att;
+       }
+//cout<<"non smeare "<<PTmis.Pt()<<" "<<PTmisS.Pt()<<endl;
+//cout<<"smeare "<<PTmis.Px()<<" "<<PTmisS.Px()<<endl;
+//cout<<"**********"<<endl;
+
       elementEtmis= (ETMIS*) branchetmis->NewEntry();
-      elementEtmis->Et = (PTmis).Et();
-      elementEtmis->EtSmeare = (PTmisS).Et()-(PTmis).Et();
+      elementEtmis->Et = (PTmis).Pt();
+      elementEtmis->Ex = (-PTmis).Px();
+      elementEtmis->SEt = ScalarEt;
+
+      elementEtmis->EtSmeare = (PTmisS).Pt()-(PTmis).Pt();
+      elementEtmis->ExSmeare = (-PTmisS).Px()-(PTmis).Px();
       
       //*****************************
@@ -316,4 +390,6 @@
         }
       
+      TSimpleArray<TRootGenParticle> TausHadr = TauHadr(branchGen);
+
       TLorentzVector JETSm(0,0,0,0);
       for (unsigned int i = 0; i < sorted_jets.size(); i++) {
@@ -326,6 +402,22 @@
             elementJet->NonSmearePT = JET.Et();
             elementJet->SmearePT = JETSm.Et()/JET.Et();
-	    
           }
+      }
+      for (unsigned int i = 0; i < sorted_jetsS.size(); i++) {
+        TLorentzVector JETT(0,0,0,0);
+        JETT.SetPxPyPzE(sorted_jetsS[i].px(),sorted_jetsS[i].py(),sorted_jetsS[i].pz(),sorted_jetsS[i].E());
+        if(fabs(JETT.Eta()) < (DET->MAX_TRACKER - DET->TAU_CONE_TRACKS)) 
+           {
+            for(Int_t i=0; i<TausHadr.GetEntries();i++)
+              {
+                if(DeltaR(TausHadr[i]->Phi,TausHadr[i]->Eta,JETT.Phi(),JETT.Eta())<0.1)
+                  {
+                    elementTaujet= (TAUHAD*) branchtaujet->NewEntry();
+                    elementTaujet->EnergieCen = (DET->EnergySmallCone(towers,JETT.Eta(),JETT.Phi())/JETT.E());
+                    elementTaujet->NumTrack = DET->NumTracks(TrackCentral,DET->PT_TRACK_TAU,JETT.Eta(),JETT.Phi());
+                 }
+              }
+           }
+         
 	
       } // for itJet : loop on all jets
Index: trunk/interface/FuncDef.h
===================================================================
--- trunk/interface/FuncDef.h	(revision 38)
+++ trunk/interface/FuncDef.h	(revision 39)
@@ -79,18 +79,15 @@
 
   string nom = histo.erase(0,histo.find(">>")+2);
-  TH1F *h = new TH1F(nom.c_str(),"",200,0,3);
+  TH1F *h = new TH1F(nom.c_str(),"",50,-3,3);
 
   string all = min + " && " + max;
   Analyze->Draw(temp.c_str(),all.c_str());
   h->SetMarkerSize(0.6);
-//  double MeanFix = ;
   double MeanFix = h->GetMean();
-  double RangMin = h->GetMean()-h->GetRMS();
-  double RangMax = h->GetMean()+h->GetRMS();
-  TF1 *Gauss = new TF1("Gauss","gaus",RangMin,RangMax);
+  TF1 *Gauss = new TF1("Gauss","gaus",-3,3);
   Gauss->FixParameter(1,MeanFix);
-  h->Fit("Gauss","R");
-  h->Fit("Gauss","RI");
-  h->Fit("Gauss","RI");
+  h->Fit("Gauss","QR");
+  h->Fit("Gauss","QRI");
+  h->Fit("Gauss","QRI");
   Double_t* params = Gauss->GetParameters();
   rms=params[2];
@@ -102,5 +99,5 @@
 }
 
-void GaussValuesETmis(TTree * Analyze,string histo,double &rms, double &mean, string min,string max)
+void GaussValuesETmis(TTree * Analyze,string histo,double &rms, string min,string max)
 {
   string temp = histo;
@@ -109,5 +106,5 @@
 
   string nom = histo.erase(0,histo.find(">>")+2);
-  TH1F *h = new TH1F(nom.c_str(),"",50,-300,300);
+  TH1F *h = new TH1F(nom.c_str(),"",20,-100,100);
 
   string all = min + " && " + max;
@@ -117,10 +114,12 @@
   double RangMax = h->GetMean()+h->GetRMS();
   TF1 *Gauss = new TF1("Gauss","gaus",RangMin,RangMax);
-  h->Fit("Gauss","R");
-  h->Fit("Gauss","RI");
-  h->Fit("Gauss","RI");
+  //TF1 *Gauss = new TF1("Gauss","gaus");
+  h->Fit("Gauss","QR");
+  h->Fit("Gauss","QRI");
+  h->Fit("Gauss","QRI");
   Double_t* params = Gauss->GetParameters();
   rms=params[2];
-  mean=params[1];
+  //rms=h->GetRMS();
+  //mean=params[1];
   h->Draw("P");
   h->GetXaxis()->SetTitle("E_{T}^{rec}-E_{T}^{MC} [GeV]");
Index: trunk/routines/resolutions.C
===================================================================
--- trunk/routines/resolutions.C	(revision 38)
+++ trunk/routines/resolutions.C	(revision 39)
@@ -11,165 +11,312 @@
 void JetResol()
 {
-
-   setTDRStyle();
-   gROOT->Reset();
-
-   TFile *f1 = new TFile("JETResol.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);
-        cout<<"binMin "<<binMin<<" binMax "<<binMax<<" bin center "<<binCenter<<endl;
-        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;
-        cout<<"finval "<<finval<<" mean val "<<mean[i]<<" rms value "<<rms[i]<<endl;
-      }
-
-   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}/<E_{T}^{rec}/E_{T}^{MC}>_{fit}");
-
-   Double_t* params = fitfun->GetParameters();
-
-   gr11->Fit("user","R");
-   gr11->Fit("user","RI");
-   gr11->Fit("user","RI");
-   gr11->Fit("user","RI");
-   char tempResol[500];
-   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();
-
-   delete fitfun;
-}
-
+  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}/<E_{T}^{rec}/E_{T}^{MC}>_{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})}{<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();
+
+  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("PTMIS.root","read");
+  TTree *Analyze = (TTree*)f1->Get("Analysis");
+  
+  const Int_t numBin=9;
+  double bins[numBin]={0,20,40,60,80,100,150,220,400};
+  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.NonSmeareE > %d",binMin);
+      string mystringMin(tempMin);
+      char tempMax[500];
+      sprintf(tempMax,"ElecEResol.NonSmeareE < %d",binMax);
+      string mystringMax(tempMax);
+      char tempName[500];
+      sprintf(tempName,"(ElecEResol.NonSmeareE-ElecEResol.SmeareE)>>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,"t#bar{t} #rightarrow l^{+}l^{-}#nu#bar{#nu}b#bar{b}");
+  events->Draw();
+  
+  delete fitfun;
+}
+
+void TauJetInfo()
+{
+  
+  setTDRStyle();
+  gROOT->Reset();
+  
+  TFile *f1 = new TFile("PTMIS.root","read");
+  TTree *Analyze = (TTree*)f1->Get("Analysis");
+  
+  TCanvas *ct = new TCanvas("ct","Tau information",0,0,1000,425);
+  ct->cd(); int frame=0;
+  ct->Divide(2,1);
+  
+  ct->cd(++frame);
+  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: t#bar{t} #rightarrow l^{+}#nul^{-}#bar{#nu}b#bar{b}");
+  events1->Draw();
+  
+  
+  ct->cd(++frame);
+  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: t#bar{t} #rightarrow l^{+}#nul^{-}#bar{#nu}b#bar{b}");
+  events->Draw();
+   
+}
 
 void ETmisResol()
 {
-
-   setTDRStyle();
-   gROOT->Reset();
-
-   TFile *f1 = new TFile("PTMIS.root","read");
-   TTree *Analyze = (TTree*)f1->Get("Analysis");
-
-   const Int_t numBin=6;
-   double bins[numBin]={10,20,30,50,80,100};
-   TProfile *ETSoverET = new TProfile("ETSoverET","ETmis resol",(numBin-1),bins,-1000,1000);
-
-   double rms[numBin-1];
-   double mean[numBin-1];
-
-   TCanvas *c5 = new TCanvas("c5","gerrors2",0,0,1000,650);
-   c5->cd(); int frame=0;
-   c5->Divide(6,2);
-
-   double x[numBin-1];
-   double y[numBin-1];
-
-   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);
-        cout<<"binMin "<<binMin<<" binMax "<<binMax<<" bin center "<<binCenter<<endl;
-        char tempMin[500];
-        sprintf(tempMin,"ETmisResol.Et>%d",binMin);
-        string mystringMin(tempMin);
-        char tempMax[500];
-        sprintf(tempMax,"ETmisResol.Et<%d",binMax);
-        string mystringMax(tempMax);
-
-        char tempName[500];
-        sprintf(tempName,"ETmisResol.EtSmeare>>hETSoverET%d",i);
-        string mystringName(tempName);
-
-        c5->cd(++frame);
-        GaussValuesETmis(Analyze,tempName,rms[i],mean[i],mystringMin,mystringMax);
-        x[i]=binCenter;
-        y[i]=rms[i];
-        cout<<" mean val "<<mean[i]<<" rms value "<<rms[i]<<endl;
-
-      }
-
-   TCanvas *c6 = new TCanvas("c6","ETmis resolution",100,100,600,450);
-   c6->cd();
-
-   TF1 *fitfun = new TF1("user","sqrt(pow([0],2)+pow([1]/sqrt(x),2)+pow([2]/x,2))",0,200);
-
-   TGraph *gr11 = new TGraph((numBin-1),x,rms);
-   gr11->Draw("AP");
-   gr11->GetXaxis()->SetTitle("MC^{MET} [GeV]");
-   gr11->GetYaxis()->SetTitle("#sigma(REC^{MET}-MC^{MET})");
-   gr11->Fit("user","RQ");
-   gr11->Fit("user","RQ");
-   gr11->Fit("user","RQ");
-   gr11->Fit("user","R");
-
-   TCanvas *c7 = new TCanvas("c7","ETmis resolution",100,100,600,450);
-   c7->cd();
-
-   TGraph *gr12 = new TGraph((numBin-1),x,mean);
-   gr12->Draw("AP");
-   gr12->GetXaxis()->SetTitle("MC^{MET} [GeV]");
-   gr12->GetYaxis()->SetTitle("<(REC^{MET}-MC^{MET})>");
-
-
- delete fitfun;
+  
+  setTDRStyle();
+  gROOT->Reset();
+  
+  TFile *f1 = new TFile("test2.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]={10,100,150,200,250,300,350,400,450,500};
+  double bins[numBin]={200,250,300,350,400,450,500};
+//  double bins[numBin]={0,10,20,30,40,50,60,70};
+  TProfile *ETSoverET = new TProfile("ETSoverET","ETmis resol",(numBin-1),bins,-1000,1000);
+  Analyze->Draw("ETmisResol.ExSmeare:ETmisResol.SEt>>ETSoverET");
+  Analyze->Fit("user","RQ");
+  Analyze->Fit("user","RQ");
+ 
+ 
+  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();
+  //JetResol();
+  //ElecResol();
   ETmisResol();
-}
-
-
+  //TauJetInfo();
+  
+}
+
+
