MC_ZJETS.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analyses/MC_JetAnalysis.hh"
00003 #include "Rivet/Projections/ZFinder.hh"
00004 #include "Rivet/Projections/FastJets.hh"
00005 #include "Rivet/Tools/Logging.hh"
00006 #include "Rivet/RivetAIDA.hh"
00007 
00008 namespace Rivet {
00009 
00010 
00011   /// @brief MC validation analysis for Z + jets events
00012   class MC_ZJETS : public MC_JetAnalysis {
00013   public:
00014 
00015     /// Default constructor
00016     MC_ZJETS()
00017       : MC_JetAnalysis("MC_ZJETS", 4, "Jets")
00018     {
00019       setNeedsCrossSection(true);
00020     }
00021 
00022 
00023     /// @name Analysis methods
00024     //@{
00025 
00026     /// Book histograms
00027     void init() {
00028       ZFinder zfinder(-3.5, 3.5, 25.0*GeV, ELECTRON, 65.0*GeV, 115.0*GeV, 0.2);
00029       addProjection(zfinder, "ZFinder");
00030       FastJets jetpro(zfinder.remainingFinalState(), FastJets::KT, 0.7);
00031       addProjection(jetpro, "Jets");
00032 
00033       _h_Z_mass = bookHistogram1D("Z_mass", 50, 66.0, 116.0);
00034       _h_Z_pT = bookHistogram1D("Z_pT", logBinEdges(100, 1.0, 0.5*sqrtS()));
00035       _h_Z_pT_peak = bookHistogram1D("Z_pT_peak", 25, 0.0, 25.0);
00036       _h_Z_y = bookHistogram1D("Z_y", 40, -4.0, 4.0);
00037       _h_Z_phi = bookHistogram1D("Z_phi", 25, 0.0, TWOPI);
00038       _h_Z_jet1_deta = bookHistogram1D("Z_jet1_deta", 50, -5.0, 5.0);
00039       _h_Z_jet1_dR = bookHistogram1D("Z_jet1_dR", 25, 0.5, 7.0);
00040       _h_lepton_pT = bookHistogram1D("lepton_pT", logBinEdges(100, 10.0, 0.25*sqrtS()));
00041       _h_lepton_eta = bookHistogram1D("lepton_eta", 40, -4.0, 4.0);
00042 
00043       MC_JetAnalysis::init();
00044     }
00045 
00046 
00047 
00048     /// Do the analysis
00049     void analyze(const Event & e) {
00050       const ZFinder& zfinder = applyProjection<ZFinder>(e, "ZFinder");
00051       if (zfinder.particles().size()!=1) {
00052         vetoEvent;
00053       }
00054       const double weight = e.weight();
00055 
00056       FourMomentum zmom(zfinder.particles()[0].momentum());
00057       _h_Z_mass->fill(zmom.mass(),weight);
00058       _h_Z_pT->fill(zmom.pT(),weight);
00059       _h_Z_pT_peak->fill(zmom.pT(),weight);
00060       _h_Z_y->fill(zmom.rapidity(),weight);
00061       _h_Z_phi->fill(zmom.azimuthalAngle(),weight);
00062       foreach (const Particle& l, zfinder.constituentsFinalState().particles()) {
00063         _h_lepton_pT->fill(l.momentum().pT(), weight);
00064         _h_lepton_eta->fill(l.momentum().eta(), weight);
00065       }
00066 
00067       const FastJets& jetpro = applyProjection<FastJets>(e, "Jets");
00068       const Jets& jets = jetpro.jetsByPt(20.0*GeV);
00069       if (jets.size() > 0) {
00070         _h_Z_jet1_deta->fill(zmom.eta()-jets[0].momentum().eta(), weight);
00071         _h_Z_jet1_dR->fill(deltaR(zmom, jets[0].momentum()), weight);
00072       }
00073 
00074       MC_JetAnalysis::analyze(e);
00075     }
00076 
00077 
00078     /// Finalize
00079     void finalize() {
00080       scale(_h_Z_mass, crossSection()/sumOfWeights());
00081       scale(_h_Z_pT, crossSection()/sumOfWeights());
00082       scale(_h_Z_pT_peak, crossSection()/sumOfWeights());
00083       scale(_h_Z_y, crossSection()/sumOfWeights());
00084       scale(_h_Z_phi, crossSection()/sumOfWeights());
00085       scale(_h_Z_jet1_deta, crossSection()/sumOfWeights());
00086       scale(_h_Z_jet1_dR, crossSection()/sumOfWeights());
00087       scale(_h_lepton_pT, crossSection()/sumOfWeights());
00088       scale(_h_lepton_eta, crossSection()/sumOfWeights());
00089 
00090       MC_JetAnalysis::finalize();
00091     }
00092 
00093     //@}
00094 
00095 
00096   private:
00097 
00098     /// @name Histograms
00099     //@{
00100     AIDA::IHistogram1D * _h_Z_mass;
00101     AIDA::IHistogram1D * _h_Z_pT;
00102     AIDA::IHistogram1D * _h_Z_pT_peak;
00103     AIDA::IHistogram1D * _h_Z_y;
00104     AIDA::IHistogram1D * _h_Z_phi;
00105     AIDA::IHistogram1D * _h_Z_jet1_deta;
00106     AIDA::IHistogram1D * _h_Z_jet1_dR;
00107     AIDA::IHistogram1D * _h_lepton_pT;
00108     AIDA::IHistogram1D * _h_lepton_eta;
00109     //@}
00110 
00111   };
00112 
00113 
00114 
00115   // This global object acts as a hook for the plugin system
00116   AnalysisBuilder<MC_ZJETS> plugin_MC_ZJETS;
00117 
00118 }