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 
00020 
00021     /// @name Analysis methods
00022     //@{
00023 
00024     /// Book histograms
00025     void init() {
00026       ZFinder zfinder(-3.5, 3.5, 25.0*GeV, ELECTRON, 65.0*GeV, 115.0*GeV, 0.2, true, true);
00027       addProjection(zfinder, "ZFinder");
00028       FastJets jetpro(zfinder.remainingFinalState(), FastJets::KT, 0.7);
00029       addProjection(jetpro, "Jets");
00030 
00031       _h_Z_mass = bookHistogram1D("Z_mass", 50, 66.0, 116.0);
00032       _h_Z_pT = bookHistogram1D("Z_pT", logBinEdges(100, 1.0, 0.5*sqrtS()));
00033       _h_Z_pT_peak = bookHistogram1D("Z_pT_peak", 25, 0.0, 25.0);
00034       _h_Z_y = bookHistogram1D("Z_y", 40, -4.0, 4.0);
00035       _h_Z_phi = bookHistogram1D("Z_phi", 25, 0.0, TWOPI);
00036       _h_Z_jet1_deta = bookHistogram1D("Z_jet1_deta", 50, -5.0, 5.0);
00037       _h_Z_jet1_dR = bookHistogram1D("Z_jet1_dR", 25, 0.5, 7.0);
00038       _h_lepton_pT = bookHistogram1D("lepton_pT", logBinEdges(100, 10.0, 0.25*sqrtS()));
00039       _h_lepton_eta = bookHistogram1D("lepton_eta", 40, -4.0, 4.0);
00040 
00041       MC_JetAnalysis::init();
00042     }
00043 
00044 
00045 
00046     /// Do the analysis
00047     void analyze(const Event & e) {
00048       const ZFinder& zfinder = applyProjection<ZFinder>(e, "ZFinder");
00049       if (zfinder.bosons().size()!=1) {
00050         vetoEvent;
00051       }
00052       const double weight = e.weight();
00053 
00054       FourMomentum zmom(zfinder.bosons()[0].momentum());
00055       _h_Z_mass->fill(zmom.mass(),weight);
00056       _h_Z_pT->fill(zmom.pT(),weight);
00057       _h_Z_pT_peak->fill(zmom.pT(),weight);
00058       _h_Z_y->fill(zmom.rapidity(),weight);
00059       _h_Z_phi->fill(zmom.azimuthalAngle(),weight);
00060       foreach (const Particle& l, zfinder.constituents()) {
00061         _h_lepton_pT->fill(l.momentum().pT(), weight);
00062         _h_lepton_eta->fill(l.momentum().eta(), weight);
00063       }
00064 
00065       const FastJets& jetpro = applyProjection<FastJets>(e, "Jets");
00066       const Jets& jets = jetpro.jetsByPt(20.0*GeV);
00067       if (jets.size() > 0) {
00068         _h_Z_jet1_deta->fill(zmom.eta()-jets[0].momentum().eta(), weight);
00069         _h_Z_jet1_dR->fill(deltaR(zmom, jets[0].momentum()), weight);
00070       }
00071 
00072       MC_JetAnalysis::analyze(e);
00073     }
00074 
00075 
00076     /// Finalize
00077     void finalize() {
00078       scale(_h_Z_mass, crossSection()/sumOfWeights());
00079       scale(_h_Z_pT, crossSection()/sumOfWeights());
00080       scale(_h_Z_pT_peak, crossSection()/sumOfWeights());
00081       scale(_h_Z_y, crossSection()/sumOfWeights());
00082       scale(_h_Z_phi, crossSection()/sumOfWeights());
00083       scale(_h_Z_jet1_deta, crossSection()/sumOfWeights());
00084       scale(_h_Z_jet1_dR, crossSection()/sumOfWeights());
00085       scale(_h_lepton_pT, crossSection()/sumOfWeights());
00086       scale(_h_lepton_eta, crossSection()/sumOfWeights());
00087 
00088       MC_JetAnalysis::finalize();
00089     }
00090 
00091     //@}
00092 
00093 
00094   private:
00095 
00096     /// @name Histograms
00097     //@{
00098     AIDA::IHistogram1D * _h_Z_mass;
00099     AIDA::IHistogram1D * _h_Z_pT;
00100     AIDA::IHistogram1D * _h_Z_pT_peak;
00101     AIDA::IHistogram1D * _h_Z_y;
00102     AIDA::IHistogram1D * _h_Z_phi;
00103     AIDA::IHistogram1D * _h_Z_jet1_deta;
00104     AIDA::IHistogram1D * _h_Z_jet1_dR;
00105     AIDA::IHistogram1D * _h_lepton_pT;
00106     AIDA::IHistogram1D * _h_lepton_eta;
00107     //@}
00108 
00109   };
00110 
00111 
00112 
00113   // The hook for the plugin system
00114   DECLARE_RIVET_PLUGIN(MC_ZJETS);
00115 
00116 }