Index: examples/Validation.C
===================================================================
--- examples/Validation.C	(revision 734b267d8006ca56a0b57cba493861d3359dcacf)
+++ examples/Validation.C	(revision fe3908f1c7e95d37ed85c8f827528c0e41bb018f)
@@ -57,5 +57,5 @@
 double ptrangemin = 10;
 double ptrangemax = 10000;
-static const int Nbins = 10;
+static const int Nbins = 20;
 
 int objStyle = 1;
@@ -101,5 +101,5 @@
     obj = object;
 
-    cenResolHist = new TH1D(obj+"_delta_pt_"+Form("%4.2f",ptmin)+"_"+Form("%4.2f",ptmax)+"_cen", obj+"_delta_pt_"+Form("%4.2f",ptmin)+"_"+Form("%4.2f",ptmax)+"_cen", 500, -0.4, 0.4);
+    cenResolHist = new TH1D(obj+"_delta_pt_"+Form("%4.2f",ptmin)+"_"+Form("%4.2f",ptmax)+"_cen", obj+"_delta_pt_"+Form("%4.2f",ptmin)+"_"+Form("%4.2f",ptmax)+"_cen", 500, -1, 1);
     fwdResolHist = new TH1D(obj+"_delta_pt_"+Form("%4.2f",ptmin)+"_"+Form("%4.2f",ptmax)+"_fwd", obj+"_delta_pt_"+Form("%4.2f",ptmin)+"_"+Form("%4.2f",ptmax)+"_fwd", 500, 0.4, 0.4);
 
@@ -317,5 +317,5 @@
   Long64_t allEntries = treeReader->GetEntries();
 
-cout << "** Computing resolution of " << branchJet->GetName() << " induced by " << branchGenJet->GetName() << endl;
+  cout << "** Computing resolution of " << branchJet->GetName() << " induced by " << branchGenJet->GetName() << endl;
 
   Jet *jet, *genjet;
@@ -338,5 +338,5 @@
 
     // Loop over all reconstructed jets in event
-    for(i = 0; i < branchJet->GetEntriesFast(); ++i)
+    for(i = 0; i < TMath::Min(2,branchJet->GetEntriesFast()); ++i) //branchJet->GetEntriesFast(); ++i)
     {
 
@@ -347,5 +347,5 @@
 
      // Loop over all hard partons in event
-     for(j = 0; j < branchGenJet->GetEntriesFast(); ++j)
+     for(j = 0; j < TMath::Min(2,branchGenJet->GetEntriesFast()); ++j)
      {
         genjet = (Jet*) branchGenJet->At(j);
@@ -365,5 +365,5 @@
       }
 
-      if(deltaR < 0.1)
+      if(deltaR < 0.3)
       {
         pt  = genJetMomentum.Pt();
@@ -372,5 +372,5 @@
         for (bin = 0; bin < Nbins; bin++)
         {
-            if(pt > histos->at(bin).ptmin && pt < histos->at(bin).ptmax && eta > 0.0 && eta < 0.5) 
+            if(pt > histos->at(bin).ptmin && pt < histos->at(bin).ptmax && eta > 0.0 && eta < 2.5) 
             {
                 histos->at(bin).cenResolHist->Fill((bestGenJetMomentum.E()-jetMomentum.E())/bestGenJetMomentum.E());
@@ -389,4 +389,5 @@
     delete f1;
     return make_pair (sig, sigErr);
+    //return make_pair (hist->GetRMS(), hist->GetRMSError());
 }
 
@@ -395,5 +396,6 @@
 {
     Int_t bin;
-    TGraphErrors gr = TGraphErrors(Nbins);
+    Int_t count = 0;
+    TGraphErrors gr = TGraphErrors(Nbins/2);
     Double_t sig = 0;
     Double_t sigErr = 0;
@@ -406,6 +408,7 @@
             std::cout << " entries : " << histos->at(bin).cenResolHist->GetEntries() << std::endl;
             std::pair<Double_t, Double_t> sigvalues = GausFit(histos->at(bin).cenResolHist);
-            gr.SetPoint(bin,(histos->at(bin).ptmin+histos->at(bin).ptmax)/2.0, sigvalues.first);
-            gr.SetPointError(bin,0, sigvalues.second);
+            gr.SetPoint(count,(histos->at(bin).ptmin+histos->at(bin).ptmax)/2.0, sigvalues.first);
+            gr.SetPointError(count,0, sigvalues.second);
+            count++;
         }
         /*
@@ -516,4 +519,6 @@
   gPad->SetBottomMargin(0.2);
   gPad->SetLeftMargin(0.2);
+  gPad->Modified();
+  gPad->Update();
   
 }
@@ -653,4 +658,5 @@
   C_el2->SaveAs(elRes+".eps");
 
+  gDirectory->cd(0);
 
 /*
@@ -802,4 +808,28 @@
   TGraphErrors gr_pfjets = EresGraph(&plots_pfjets, true);
   gr_pfjets.SetName("pfJet");
+
+
+  // PFJets Energy Resolution
+  std::vector<resolPlot> plots_calojets;
+  HistogramsCollection(&plots_calojets, TMath::Log10(ptrangemin), TMath::Log10(ptrangemax), "CaloJet");
+  GetJetsEres( &plots_calojets, branchCaloJet, branchGenJet, treeReader);
+  TGraphErrors gr_calojets = EresGraph(&plots_calojets, true);
+  gr_calojets.SetName("caloJet");
+
+
+  TString jetRes = "jetERes";
+  TCanvas *C_jet = new TCanvas(jetRes,jetRes, 1000, 500);
+  TMultiGraph *mg_jet = new TMultiGraph(jetRes,jetRes);
+  TLegend *leg_jet = new TLegend(0.52,0.7,0.9,0.9);
+
+  addGraph(mg_jet, &gr_calojets, leg_jet, 3);
+  addGraph(mg_jet, &gr_pfjets, leg_jet, 1);
+
+  mg_jet->Draw("ACX");
+  leg_jet->Draw();
+
+  DrawAxis(mg_jet, leg_jet, 0.25);
+
+  C_jet->SaveAs(jetRes+".eps");
 
   
@@ -820,4 +850,5 @@
   {  
       plots_pfjets.at(bin).cenResolHist->Write();
+      plots_calojets.at(bin).cenResolHist->Write();
       plots_el.at(bin).cenResolHist->Write();
       plots_eltrack.at(bin).cenResolHist->Write();
@@ -848,4 +879,5 @@
   C_el1->Write();
   C_el2->Write();
+  C_jet->Write();
 /*
   C_mu->Write();
@@ -853,5 +885,5 @@
 */
   gr_pfjets.Write();
-  //gr_calojets.Write();
+  gr_calojets.Write();
 
   fout->Write();
