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(string name="MC_WJETS")
00016       : MC_JetAnalysis(name, 4, "Jets")
00017     {
00018          _dR=0.2;
00019          _lepton=PID::ELECTRON;
00020    }
00021 
00022 
00023     /// @name Analysis methods
00024     //@{
00025 
00026     /// Book histograms
00027     void init() {
00028       FinalState fs;
00029       WFinder wfinder(fs, Cuts::abseta < 3.5 && Cuts::pT > 25*GeV, _lepton, 60.0*GeV, 100.0*GeV, 25.0*GeV, _dR);
00030       addProjection(wfinder, "WFinder");
00031       FastJets jetpro(wfinder.remainingFinalState(), FastJets::ANTIKT, 0.4);
00032       addProjection(jetpro, "Jets");
00033 
00034       _h_W_jet1_deta = bookHisto1D("W_jet1_deta", 50, -5.0, 5.0);
00035       _h_W_jet1_dR = bookHisto1D("W_jet1_dR", 25, 0.5, 7.0);
00036 
00037       MC_JetAnalysis::init();
00038     }
00039 
00040 
00041 
00042     /// Do the analysis
00043     void analyze(const Event & e) {
00044       const double weight = e.weight();
00045 
00046       const WFinder& wfinder = applyProjection<WFinder>(e, "WFinder");
00047       if (wfinder.bosons().size() != 1) {
00048         vetoEvent;
00049       }
00050       FourMomentum wmom(wfinder.bosons().front().momentum());
00051 
00052       const Jets& jets = applyProjection<FastJets>(e, "Jets").jetsByPt(_jetptcut);
00053       if (jets.size() > 0) {
00054         _h_W_jet1_deta->fill(wmom.eta()-jets[0].eta(), weight);
00055         _h_W_jet1_dR->fill(deltaR(wmom, jets[0].momentum()), weight);
00056       }
00057 
00058       MC_JetAnalysis::analyze(e);
00059     }
00060 
00061 
00062     /// Finalize
00063     void finalize() {
00064       scale(_h_W_jet1_deta, crossSection()/picobarn/sumOfWeights());
00065       scale(_h_W_jet1_dR, crossSection()/picobarn/sumOfWeights());
00066       MC_JetAnalysis::finalize();
00067     }
00068 
00069     //@}
00070 
00071 
00072   protected:
00073 
00074     /// @name Parameters for specialised e/mu and dressed/bare subclassing
00075     //@{
00076     double _dR;
00077     PdgId _lepton;
00078     //@}
00079 
00080 
00081   private:
00082 
00083     /// @name Histograms
00084     //@{
00085     Histo1DPtr _h_W_jet1_deta;
00086     Histo1DPtr _h_W_jet1_dR;
00087     //@}
00088 
00089   };
00090 
00091 
00092 
00093   struct MC_WJETS_EL : public MC_WJETS {
00094     MC_WJETS_EL() : MC_WJETS("MC_WJETS_EL") {
00095       _dR = 0.2;
00096       _lepton = PID::ELECTRON;
00097     }
00098   };
00099 
00100   struct MC_WJETS_EL_BARE : public MC_WJETS {
00101     MC_WJETS_EL_BARE() : MC_WJETS("MC_WJETS_EL_BARE") {
00102       _dR = 0;
00103       _lepton = PID::ELECTRON;
00104     }
00105   };
00106 
00107   struct MC_WJETS_MU : public MC_WJETS {
00108     MC_WJETS_MU() : MC_WJETS("MC_WJETS_MU") {
00109       _dR = 0.2;
00110       _lepton = PID::MUON;
00111     }
00112   };
00113 
00114   struct MC_WJETS_MU_BARE : public MC_WJETS {
00115     MC_WJETS_MU_BARE() : MC_WJETS("MC_WJETS_MU_BARE") {
00116       _dR = 0;
00117       _lepton = PID::MUON;
00118     }
00119   };
00120 
00121 
00122 
00123   // The hooks for the plugin system
00124   DECLARE_RIVET_PLUGIN(MC_WJETS);
00125   DECLARE_RIVET_PLUGIN(MC_WJETS_EL);
00126   DECLARE_RIVET_PLUGIN(MC_WJETS_EL_BARE);
00127   DECLARE_RIVET_PLUGIN(MC_WJETS_MU);
00128   DECLARE_RIVET_PLUGIN(MC_WJETS_MU_BARE);
00129 
00130 }