rivet is hosted by Hepforge, IPPP Durham
MC_WJETS.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analyses/MC_JetAnalysis.hh"
00003 #include "Rivet/Projections/WFinder.hh"
00004 #include "Rivet/Projections/FastJets.hh"
00005 #include "Rivet/Analysis.hh"
00006 
00007 namespace Rivet {
00008 
00009 
00010   /// @brief MC validation analysis for W + jets events
00011   class MC_WJETS : public MC_JetAnalysis {
00012   public:
00013 
00014     /// Default constructor
00015     MC_WJETS()
00016       : MC_JetAnalysis("MC_WJETS", 4, "Jets")
00017     {    }
00018 
00019 
00020     /// @name Analysis methods
00021     //@{
00022 
00023     /// Book histograms
00024     void init() {
00025       FinalState fs;
00026       WFinder wfinder(fs, EtaIn(-3.5, 3.5) & (Cuts::pT >= 25.0*GeV), PID::ELECTRON, 60.0*GeV, 100.0*GeV, 25.0*GeV, 0.2);
00027       addProjection(wfinder, "WFinder");
00028       FastJets jetpro(wfinder.remainingFinalState(), FastJets::ANTIKT, 0.4);
00029       addProjection(jetpro, "Jets");
00030 
00031       _h_W_jet1_deta = bookHisto1D("W_jet1_deta", 50, -5.0, 5.0);
00032       _h_W_jet1_dR = bookHisto1D("W_jet1_dR", 25, 0.5, 7.0);
00033 
00034       MC_JetAnalysis::init();
00035     }
00036 
00037 
00038 
00039     /// Do the analysis
00040     void analyze(const Event & e) {
00041       const double weight = e.weight();
00042 
00043       const WFinder& wfinder = applyProjection<WFinder>(e, "WFinder");
00044       if (wfinder.bosons().size() != 1) {
00045         vetoEvent;
00046       }
00047       FourMomentum wmom(wfinder.bosons().front().momentum());
00048 
00049       const Jets& jets = applyProjection<FastJets>(e, "Jets").jetsByPt(m_jetptcut);
00050       if (jets.size() > 0) {
00051         _h_W_jet1_deta->fill(wmom.eta()-jets[0].eta(), weight);
00052         _h_W_jet1_dR->fill(deltaR(wmom, jets[0].momentum()), weight);
00053       }
00054 
00055       MC_JetAnalysis::analyze(e);
00056     }
00057 
00058 
00059     /// Finalize
00060     void finalize() {
00061       scale(_h_W_jet1_deta, crossSection()/sumOfWeights());
00062       scale(_h_W_jet1_dR, crossSection()/sumOfWeights());
00063 
00064       MC_JetAnalysis::finalize();
00065     }
00066 
00067     //@}
00068 
00069 
00070   private:
00071 
00072     /// @name Histograms
00073     //@{
00074     Histo1DPtr _h_W_jet1_deta;
00075     Histo1DPtr _h_W_jet1_dR;
00076     //@}
00077 
00078   };
00079 
00080 
00081 
00082   // The hook for the plugin system
00083   DECLARE_RIVET_PLUGIN(MC_WJETS);
00084 
00085 }