rivet is hosted by Hepforge, IPPP Durham
D0_2008_S7863608.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/Tools/Logging.hh"
00004 #include "Rivet/Projections/ZFinder.hh"
00005 #include "Rivet/Projections/FastJets.hh"
00006 #include "Rivet/RivetYODA.hh"
00007 
00008 namespace Rivet {
00009 
00010 
00011   /// @brief D0 differential Z/\f$ \gamma^* \f$ + jet + \f$ X \f$ cross sections
00012   /// @author Gavin Hesketh, Andy Buckley, Frank Siegert
00013   class D0_2008_S7863608 : public Analysis {
00014   public:
00015 
00016     /// @name Construction
00017     //@{
00018     /// Constructor
00019     D0_2008_S7863608()
00020       : Analysis("D0_2008_S7863608")
00021     {    }
00022 
00023     //@}
00024 
00025 
00026     /// @name Analysis methods
00027     //@{
00028 
00029     /// Book histograms
00030     void init() {
00031       FinalState fs;
00032       ZFinder zfinder(fs, -1.7, 1.7, 15.0*GeV, MUON, 65.0*GeV, 115.0*GeV, 0.2, false, true);
00033       addProjection(zfinder, "ZFinder");
00034 
00035       FastJets conefinder(zfinder.remainingFinalState(), FastJets::D0ILCONE, 0.5);
00036       addProjection(conefinder, "ConeFinder");
00037 
00038       _sum_of_weights_inclusive=0.0;
00039 
00040       _h_jet_pT_cross_section = bookHisto1D(1, 1, 1);
00041       _h_jet_pT_normalised = bookHisto1D(1, 1, 2);
00042       _h_jet_y_cross_section = bookHisto1D(2, 1, 1);
00043       _h_jet_y_normalised = bookHisto1D(2, 1, 2);
00044       _h_Z_pT_cross_section = bookHisto1D(3, 1, 1);
00045       _h_Z_pT_normalised = bookHisto1D(3, 1, 2);
00046       _h_Z_y_cross_section = bookHisto1D(4, 1, 1);
00047       _h_Z_y_normalised = bookHisto1D(4, 1, 2);
00048       _h_total_cross_section = bookHisto1D(5, 1, 1);
00049     }
00050 
00051 
00052 
00053     // Do the analysis
00054     void analyze(const Event& e) {
00055       const double weight = e.weight();
00056 
00057       const ZFinder& zfinder = applyProjection<ZFinder>(e, "ZFinder");
00058       if (zfinder.bosons().size()==1) {
00059         _sum_of_weights_inclusive += weight;
00060         const JetAlg& jetpro = applyProjection<JetAlg>(e, "ConeFinder");
00061         const Jets& jets = jetpro.jetsByPt(20.0*GeV);
00062         Jets jets_cut;
00063         foreach (const Jet& j, jets) {
00064           if (fabs(j.momentum().pseudorapidity()) < 2.8) {
00065             jets_cut.push_back(j);
00066           }
00067         }
00068 
00069         // Return if there are no jets:
00070         if(jets_cut.size()<1) {
00071           MSG_DEBUG("Skipping event " << e.genEvent().event_number()
00072                     << " because no jets pass cuts ");
00073           vetoEvent;
00074         }
00075 
00076         const FourMomentum Zmom = zfinder.bosons()[0].momentum();
00077 
00078         // In jet pT
00079         _h_jet_pT_cross_section->fill( jets_cut[0].momentum().pT(), weight);
00080         _h_jet_pT_normalised->fill( jets_cut[0].momentum().pT(), weight);
00081         _h_jet_y_cross_section->fill( fabs(jets_cut[0].momentum().rapidity()), weight);
00082         _h_jet_y_normalised->fill( fabs(jets_cut[0].momentum().rapidity()), weight);
00083 
00084         // In Z pT
00085         _h_Z_pT_cross_section->fill(Zmom.pT(), weight);
00086         _h_Z_pT_normalised->fill(Zmom.pT(), weight);
00087         _h_Z_y_cross_section->fill(fabs(Zmom.rapidity()), weight);
00088         _h_Z_y_normalised->fill(fabs(Zmom.rapidity()), weight);
00089 
00090         _h_total_cross_section->fill(1960.0, weight);
00091       }
00092     }
00093 
00094 
00095 
00096     /// Finalize
00097     void finalize() {
00098       const double invlumi = crossSection()/sumOfWeights();
00099       scale(_h_total_cross_section, invlumi);
00100       scale(_h_jet_pT_cross_section, invlumi);
00101       scale(_h_jet_y_cross_section, invlumi);
00102       scale(_h_Z_pT_cross_section, invlumi);
00103       scale(_h_Z_y_cross_section, invlumi);
00104 
00105       double factor=1.0/_sum_of_weights_inclusive;
00106       if (_sum_of_weights_inclusive==0.0) factor=0.0;
00107       scale(_h_jet_pT_normalised, factor);
00108       scale(_h_jet_y_normalised, factor);
00109       scale(_h_Z_pT_normalised, factor);
00110       scale(_h_Z_y_normalised, factor);
00111     }
00112 
00113     //@}
00114 
00115 
00116   private:
00117 
00118     /// @name Histograms
00119     //@{
00120     Histo1DPtr _h_jet_pT_cross_section;
00121     Histo1DPtr _h_jet_y_cross_section;
00122     Histo1DPtr _h_Z_pT_cross_section;
00123     Histo1DPtr _h_Z_y_cross_section;
00124     Histo1DPtr _h_total_cross_section;
00125     Histo1DPtr _h_jet_pT_normalised;
00126     Histo1DPtr _h_jet_y_normalised;
00127     Histo1DPtr _h_Z_pT_normalised;
00128     Histo1DPtr _h_Z_y_normalised;
00129     //@}
00130 
00131     double _sum_of_weights_inclusive;
00132 
00133   };
00134 
00135 
00136 
00137   // The hook for the plugin system
00138   DECLARE_RIVET_PLUGIN(D0_2008_S7863608);
00139 
00140 }