MC_WJETS.cc

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