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