Index: examples/Validation.C
===================================================================
--- examples/Validation.C	(revision 6563d4dbd180358a3b9ab309c0e40f2b906aecf8)
+++ examples/Validation.C	(revision 7b480856d0d43b9d6f806b1eee83e4ef50423496)
@@ -144,12 +144,14 @@
   Int_t i, j;
 
-  TH1D *histGenPt = new TH1D(name+" gen spectra Pt",name+" gen spectra Pt", Nbins, TMath::Log10(ptrangemin), TMath::Log10(ptrangemax));
-  TH1D *histRecoPt = new TH1D(name+" reco spectra Pt",name+" reco spectra Pt", Nbins, TMath::Log10(ptrangemin), TMath::Log10(ptrangemax));
-  TH1D *histGenEta  = new TH1D(name+" gen spectra Eta",name+" gen spectra Eta", 12, -3, 3);
-  TH1D *histRecoEta = new TH1D(name+" reco spectra Eta",name+" reco spectra Eta", 12, -3, 3);
-
-
-  BinLogX(histGenPt);
-  BinLogX(histRecoPt);
+  TH1D *histGenPtcen = new TH1D(name+" gen spectra Pt",name+" gen spectra cen", Nbins, TMath::Log10(ptrangemin), TMath::Log10(ptrangemax));
+  TH1D *histRecoPtcen = new TH1D(name+" reco spectra Pt",name+" reco spectra cen", Nbins, TMath::Log10(ptrangemin), TMath::Log10(ptrangemax));
+  TH1D *histGenPtfwd  = new TH1D(name+" gen spectra Eta",name+" gen spectra fwd", Nbins, TMath::Log10(ptrangemin), TMath::Log10(ptrangemax));
+  TH1D *histRecoPtfwd = new TH1D(name+" reco spectra Eta",name+" reco spectra fwd", Nbins, TMath::Log10(ptrangemin), TMath::Log10(ptrangemax));
+
+
+  BinLogX(histGenPtcen);
+  BinLogX(histRecoPtcen);
+  BinLogX(histGenPtfwd);
+  BinLogX(histRecoPtfwd);
 
   // Loop over all events
@@ -201,11 +203,14 @@
         eta = genMomentum.Eta();
 
-        histGenPt->Fill(pt);
-        histGenEta->Fill(eta);
-
-        if(deltaR < 0.3)
+        if (TMath::Abs(eta) < 1.5) 
         {
-          histRecoPt->Fill(pt);
-          histRecoEta->Fill(eta); 
+          histGenPtcen->Fill(pt);
+          if(deltaR < 0.3) { histRecoPtcen->Fill(pt); }
+        }
+        else if (TMath::Abs(eta) < 2.5)
+        {
+          histGenPtfwd->Fill(pt);
+          if(deltaR < 0.3) { histRecoPtfwd->Fill(pt); } 
+          
         }
       }
@@ -216,9 +221,9 @@
   std::pair<TH1D*,TH1D*> histos; 
 
-  histRecoPt->Divide(histGenPt);
-  histRecoEta->Divide(histGenEta);
-
-  histos.first = histRecoPt;
-  histos.second = histRecoEta;
+  histRecoPtcen->Divide(histGenPtcen);
+  histRecoPtfwd->Divide(histGenPtfwd);
+
+  histos.first = histRecoPtcen;
+  histos.second = histRecoPtfwd;
 
   return histos;
@@ -355,8 +360,13 @@
         for (bin = 0; bin < Nbins; bin++)
         {
-            if(pt > histos->at(bin).ptmin && pt < histos->at(bin).ptmax && eta > 0.0 && eta < 1.5) 
+            if(pt > histos->at(bin).ptmin && pt < histos->at(bin).ptmax && eta < 1.5) 
             {
                 histos->at(bin).cenResolHist->Fill(jetMomentum.Pt()/bestGenJetMomentum.Pt());
             }
+            else if(pt > histos->at(bin).ptmin && pt < histos->at(bin).ptmax && eta < 2.5)
+            {
+                histos->at(bin).fwdResolHist->Fill(jetMomentum.Pt()/bestGenJetMomentum.Pt());
+            }
+
         }
       }
@@ -430,7 +440,4 @@
         if (central == true && histos->at(bin).cenResolHist->GetEntries() > 100) 
         {
-            std::cout << " pt : " << (histos->at(bin).ptmin+histos->at(bin).ptmax)/2.0;
-            std::cout << " mean : " << histos->at(bin).cenResolHist->GetMean() << " RMS : " << histos->at(bin).cenResolHist->GetRMS(); 
-            std::cout << " entries : " << histos->at(bin).cenResolHist->GetEntries() << std::endl;
             std::pair<Double_t, Double_t> sigvalues = GausFit(histos->at(bin).cenResolHist);
             if (rms == true) 
@@ -446,15 +453,21 @@
             count++;
         }
-        /*
-        else if (histos->at(bin).cenResolHist->GetEntries() > 10) 
+        
+        else if (central == false && histos->at(bin).fwdResolHist->GetEntries() > 10) 
         {
-            histos->at(bin).fwdResolHist->Fit("gaus","","", -2*histos->at(bin).fwdResolHist->GetRMS(), 2*histos->at(bin).fwdResolHist->GetRMS());
-            TF1 *f = histos->at(bin).fwdResolHist->GetFunction("gaus");
-            Double_t sig = f->GetParameter(2);
-            Double_t sigErr = f->GetParError(2);
-            gr.SetPoint(bin,(histos->at(bin).ptmin+histos->at(bin).ptmax)/2.0, sig);
-            gr.SetPointError(bin,0, sigErr);
+            std::pair<Double_t, Double_t> sigvalues = GausFit(histos->at(bin).fwdResolHist);
+            if (rms == true)
+            {
+              gr.SetPoint(count,(histos->at(bin).ptmin+histos->at(bin).ptmax)/2.0, sigvalues.second);
+              gr.SetPointError(count,0, sigvalues.second); // to correct
+            }
+            else
+            {
+              gr.SetPoint(count,(histos->at(bin).ptmin+histos->at(bin).ptmax)/2.0, sigvalues.first);
+              gr.SetPointError(count,0, sigvalues.second);
+            }
+            count++;
         }
-        */
+        
     }
     return gr;
@@ -629,5 +642,7 @@
   GetEres<Electron>( &plots_el, branchElectron, branchParticle, elID, treeReader);
   TGraphErrors gr_el = EresGraph(&plots_el, true);
+  TGraphErrors gr_elFwd = EresGraph(&plots_el, false);
   gr_el.SetName("Electron");
+  gr_elFwd.SetName("ElectronFwd");
 
   // Electron Track Energy Resolution
@@ -636,5 +651,7 @@
   GetEres<Track>( &plots_eltrack, branchTrack, branchParticle, elID, treeReader);
   TGraphErrors gr_eltrack = EresGraph(&plots_eltrack, true);
+  TGraphErrors gr_eltrackFwd = EresGraph(&plots_eltrack, false);
   gr_eltrack.SetName("ElectronTracks");
+  gr_eltrackFwd.SetName("ElectronTracksFwd");
 
   // Electron Tower Energy Resolution
@@ -643,5 +660,7 @@
   GetEres<Tower>( &plots_eltower, branchTower, branchParticle, elID, treeReader);
   TGraphErrors gr_eltower = EresGraph(&plots_eltower, true);
+  TGraphErrors gr_eltowerFwd = EresGraph(&plots_eltower, false);
   gr_eltower.SetName("ElectronTower");
+  gr_eltrackFwd.SetName("ElectronTracksFwd");
 
   // Canvases
@@ -666,4 +685,5 @@
   TLegend *leg_el2 = new TLegend(effLegXmin,effLegYmin,effLegXmax,effLegYmax);
 
+  gPad->SetLogx();
   histos_eltrack.second->Draw();
   addHist(histos_eltrack.second, leg_el2, 2);
@@ -673,10 +693,13 @@
   addHist(histos_el.second, leg_el2, 1);
 
-  DrawAxis(histos_eltrack.second, leg_el2, 1);
+  DrawAxis(histos_eltrack.second, leg_el2, 0);
   delete(leg_el2);
   C_el1->cd(0);
  
   TString elRes = "electronERes";
+  TString elResFwd = "electronEResForward";
   TCanvas *C_el2 = new TCanvas(elRes,elRes, 1000, 500);
+  C_el2->Divide(2);
+  C_el2->cd(1);
   TMultiGraph *mg_el = new TMultiGraph(elRes,elRes);
   TLegend *leg_el = new TLegend(0.52,0.7,0.9,0.9);
@@ -690,4 +713,17 @@
 
   DrawAxis(mg_el, leg_el, 0.1);
+
+  C_el2->cd(2);
+  TMultiGraph *mg_elFwd = new TMultiGraph(elResFwd,elResFwd);
+  TLegend *leg_elFwd = new TLegend(0.52,0.7,0.9,0.9);
+
+  addGraph(mg_elFwd, &gr_eltowerFwd, leg_elFwd, 3);
+  addGraph(mg_elFwd, &gr_eltrackFwd, leg_elFwd, 2);
+  addGraph(mg_elFwd, &gr_elFwd, leg_elFwd, 1);
+
+  mg_elFwd->Draw("ACX");
+
+  DrawAxis(mg_elFwd, leg_elFwd, 0.1);
+
   
   C_el1->SaveAs(elEff+".eps");
@@ -716,5 +752,7 @@
   GetEres<Muon>( &plots_mu, branchMuon, branchParticle, muID, treeReader);
   TGraphErrors gr_mu = EresGraph(&plots_mu, true);
+  TGraphErrors gr_muFwd = EresGraph(&plots_mu, false);
   gr_mu.SetName("Muon");
+  gr_muFwd.SetName("MuonFwd");
 
   // Muon Track Energy Resolution
@@ -723,5 +761,6 @@
   GetEres<Track>( &plots_mutrack, branchTrack, branchParticle, muID, treeReader);
   TGraphErrors gr_mutrack = EresGraph(&plots_mutrack, true);
-  gr_mutrack.SetName("MuonTracks");
+  TGraphErrors gr_mutrackFwd = EresGraph(&plots_mutrack, false);
+  gr_mutrackFwd.SetName("MuonTracksFwd");
 
   // Canvas
@@ -745,4 +784,5 @@
   TLegend *leg_mu2 = new TLegend(effLegXmin,effLegYmin,effLegXmax,effLegYmax);
 
+  gPad->SetLogx();
   histos_mutrack.second->Draw();
   addHist(histos_mutrack.second, leg_mu2, 2);
@@ -753,5 +793,9 @@
 
   TString muRes = "muonERes";
+  TString muResFwd = "muonEResFwd";
+
   TCanvas *C_mu = new TCanvas(muRes,muRes, 1000, 500);
+  C_mu->Divide(2);
+  C_mu->cd(1);
   TMultiGraph *mg_mu = new TMultiGraph(muRes,muRes);
   TLegend *leg_mu = new TLegend(0.52,0.7,0.9,0.9);
@@ -764,4 +808,15 @@
 
   DrawAxis(mg_mu, leg_mu, 0.3);
+
+  C_mu->cd(2);
+  TMultiGraph *mg_muFwd = new TMultiGraph(muResFwd,muResFwd);
+  TLegend *leg_muFwd = new TLegend(0.52,0.7,0.9,0.9);
+
+  addGraph(mg_muFwd, &gr_mutrackFwd, leg_muFwd, 2);
+  addGraph(mg_muFwd, &gr_muFwd, leg_muFwd, 1);
+
+  mg_muFwd->Draw("ACX");
+
+  DrawAxis(mg_muFwd, leg_muFwd, 0.3);
 
   C_mu1->SaveAs(muEff+".eps");
@@ -788,5 +843,8 @@
   GetEres<Photon>( &plots_ph, branchPhoton, branchParticle, phID, treeReader);
   TGraphErrors gr_ph = EresGraph(&plots_ph, true);
+  TGraphErrors gr_phFwd = EresGraph(&plots_ph, false);
   gr_ph.SetName("Photon");
+  gr_phFwd.SetName("PhotonFwd");
+
 
   // Photon Tower Energy Resolution
@@ -795,5 +853,7 @@
   GetEres<Tower>( &plots_phtower, branchTower, branchParticle, phID, treeReader);
   TGraphErrors gr_phtower = EresGraph(&plots_phtower, true);
+  TGraphErrors gr_phtowerFwd = EresGraph(&plots_phtower, false);
   gr_phtower.SetName("PhotonTower");
+  gr_phtowerFwd.SetName("PhotonTowerFwd");
 
   // Canvas
@@ -817,4 +877,5 @@
   TLegend *leg_ph2 = new TLegend(effLegXmin,effLegYmin,effLegXmax,effLegYmax);
 
+  gPad->SetLogx();
   histos_phtower.second->Draw("same");
   addHist(histos_phtower.second, leg_ph2, 3);
@@ -827,5 +888,9 @@
 
   TString phRes = "phERes";
+  TString phResFwd = "phEResFwd";
+
   TCanvas *C_ph = new TCanvas(phRes,phRes, 1000, 500);
+  C_ph->Divide(2);
+  C_ph->cd(1);
   TMultiGraph *mg_ph = new TMultiGraph(phRes,phRes);
   TLegend *leg_ph = new TLegend(0.52,0.7,0.9,0.9);
@@ -838,4 +903,15 @@
 
   DrawAxis(mg_ph, leg_ph, 0.3);
+
+  C_ph->cd(2);
+  TMultiGraph *mg_phFwd = new TMultiGraph(phResFwd,phResFwd);
+  TLegend *leg_phFwd = new TLegend(0.52,0.7,0.9,0.9);
+
+  addGraph(mg_phFwd, &gr_phtowerFwd, leg_phFwd, 3);
+  addGraph(mg_phFwd, &gr_phFwd, leg_phFwd, 1);
+
+  mg_phFwd->Draw("ACX");
+
+  DrawAxis(mg_phFwd, leg_phFwd, 0.3);
 
   C_ph->SaveAs(phRes+".eps");
@@ -864,5 +940,7 @@
   GetJetsEres( &plots_pfjets, branchPFJet, branchGenJet, treeReader);
   TGraphErrors gr_pfjets = EresGraph(&plots_pfjets, true);
+  TGraphErrors gr_pfjetsFwd = EresGraph(&plots_pfjets, false);
   gr_pfjets.SetName("pfJet");
+  gr_pfjetsFwd.SetName("pfJetFwd");
 
   // CaloJets Energy Resolution
@@ -871,5 +949,7 @@
   GetJetsEres( &plots_calojets, branchCaloJet, branchGenJet, treeReader);
   TGraphErrors gr_calojets = EresGraph(&plots_calojets, true);
+  TGraphErrors gr_calojetsFwd = EresGraph(&plots_calojets, false);
   gr_calojets.SetName("caloJet");
+  gr_calojetsFwd.SetName("caloJetFwd");
 
   // MET Resolution vs HT
@@ -881,5 +961,4 @@
 
   // Canvas
-
   TString btagEff = "btagEff";
   TCanvas *C_btag1 = new TCanvas(btagEff,btagEff, 1000, 500);
@@ -929,5 +1008,9 @@
 
   TString jetRes = "jetERes";
+  TString jetResFwd = "jetEResFwd";
   TCanvas *C_jet = new TCanvas(jetRes,jetRes, 1000, 500);
+  C_jet->Divide(2);
+
+  C_jet->cd(1);
   TMultiGraph *mg_jet = new TMultiGraph(jetRes,jetRes);
   TLegend *leg_jet = new TLegend(0.52,0.7,0.9,0.9);
@@ -940,4 +1023,15 @@
 
   DrawAxis(mg_jet, leg_jet, 0.25);
+
+  C_jet->cd(2);
+  TMultiGraph *mg_jetFwd = new TMultiGraph(jetResFwd,jetResFwd);
+  TLegend *leg_jetFwd = new TLegend(0.52,0.7,0.9,0.9);
+
+  addGraph(mg_jetFwd, &gr_calojetsFwd, leg_jetFwd, 3);
+  addGraph(mg_jetFwd, &gr_pfjetsFwd, leg_jetFwd, 1);
+
+  mg_jetFwd->Draw("ACX");
+
+  DrawAxis(mg_jetFwd, leg_jetFwd, 0.25);
 
   C_btag1->SaveAs(btagEff+".eps");
@@ -979,4 +1073,7 @@
       plots_eltrack.at(bin).cenResolHist->Write();
       plots_eltower.at(bin).cenResolHist->Write();
+      plots_el.at(bin).fwdResolHist->Write();
+      plots_eltrack.at(bin).fwdResolHist->Write();
+      plots_eltower.at(bin).fwdResolHist->Write();
   }
   //  gr.Write();
@@ -1010,5 +1107,7 @@
   {
       plots_pfjets.at(bin).cenResolHist->Write();
+      plots_pfjets.at(bin).fwdResolHist->Write();
       plots_calojets.at(bin).cenResolHist->Write();
+      plots_calojets.at(bin).fwdResolHist->Write();
       plots_met.at(bin).cenResolHist->Write();
   }
