D0_2008_S7662670.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/RivetAIDA.hh"
00004 #include "Rivet/Tools/Logging.hh"
00005 #include "Rivet/Projections/FinalState.hh"
00006 #include "Rivet/Projections/LeadingParticlesFinalState.hh"
00007 #include "Rivet/Projections/VetoedFinalState.hh"
00008 #include "Rivet/Projections/FastJets.hh"
00009 
00010 namespace Rivet {
00011 
00012 
00013   /// @brief Measurement of D0 differential jet cross sections
00014   /// @author Andy Buckley
00015   /// @author Gavin Hesketh
00016   class D0_2008_S7662670 : public Analysis {
00017 
00018   public:
00019 
00020     /// @name Constructors etc.
00021     //@{
00022 
00023     /// Constructor
00024     D0_2008_S7662670()
00025       : Analysis("D0_2008_S7662670")
00026     {
00027       setBeams(PROTON, ANTIPROTON);
00028       setNeedsCrossSection(true);
00029     }
00030  
00031     //@}
00032 
00033 
00034     /// @name Analysis methods
00035     //@{
00036 
00037     void init()
00038     {
00039    
00040       // Full final state
00041       FinalState fs;
00042       addProjection(fs, "FS");
00043 
00044       // Jets
00045       FastJets jetpro(fs, FastJets::D0ILCONE, 0.7);
00046       addProjection(jetpro, "Jets");
00047 
00048       // Book histograms
00049       _h_dsigdptdy_y00_04 = bookHistogram1D(1, 1, 1);
00050       _h_dsigdptdy_y04_08 = bookHistogram1D(2, 1, 1);
00051       _h_dsigdptdy_y08_12 = bookHistogram1D(3, 1, 1);
00052       _h_dsigdptdy_y12_16 = bookHistogram1D(4, 1, 1);
00053       _h_dsigdptdy_y16_20 = bookHistogram1D(5, 1, 1);
00054       _h_dsigdptdy_y20_24 = bookHistogram1D(6, 1, 1);
00055     }
00056  
00057  
00058  
00059     /// Do the analysis
00060     void analyze(const Event& event) {
00061       const double weight = event.weight();
00062    
00063       // Skip if the event is empty
00064       const FinalState& fs = applyProjection<FinalState>(event, "FS");
00065       if (fs.empty()) {
00066         getLog() << Log::DEBUG << "Empty event!" << endl;
00067         vetoEvent;
00068       }
00069    
00070       // Find the jets
00071       const JetAlg& jetpro = applyProjection<JetAlg>(event, "Jets");
00072       // Fill histo for each jet
00073       foreach (const Jet& j, jetpro.jets(50.0*GeV)) {
00074         const double pt = j.momentum().pT();
00075         const double y = fabs(j.momentum().rapidity());
00076         getLog() << Log::TRACE << "Filling histos: pT = " << pt/GeV
00077             << ", |y| = " << y << endl;
00078         if (y < 0.4) {
00079           _h_dsigdptdy_y00_04->fill(pt/GeV, weight);
00080         } else if (y < 0.8) {
00081           _h_dsigdptdy_y04_08->fill(pt/GeV, weight);
00082         } else if (y < 1.2) {
00083           _h_dsigdptdy_y08_12->fill(pt/GeV, weight);
00084         } else if (y < 1.6) {
00085           _h_dsigdptdy_y12_16->fill(pt/GeV, weight);
00086         } else if (y < 2.0) {
00087           _h_dsigdptdy_y16_20->fill(pt/GeV, weight);
00088         } else if (y < 2.4) {
00089           _h_dsigdptdy_y20_24->fill(pt/GeV, weight);
00090         }
00091       }
00092    
00093     }
00094  
00095 
00096     /// Finalize
00097     void finalize() {
00098       /// Scale by L_eff = sig_MC * L_exp / num_MC
00099       const double lumi_mc = sumOfWeights() / crossSection();
00100       const double scalefactor =  1 / lumi_mc;
00101       scale(_h_dsigdptdy_y00_04, scalefactor);
00102       scale(_h_dsigdptdy_y04_08, scalefactor);
00103       scale(_h_dsigdptdy_y08_12, scalefactor);
00104       scale(_h_dsigdptdy_y12_16, scalefactor);
00105       scale(_h_dsigdptdy_y16_20, scalefactor);
00106       scale(_h_dsigdptdy_y20_24, scalefactor);
00107     }
00108 
00109     //@}
00110 
00111   private:
00112 
00113     /// @name Histograms
00114     //@{
00115     AIDA::IHistogram1D* _h_dsigdptdy_y00_04;
00116     AIDA::IHistogram1D* _h_dsigdptdy_y04_08;
00117     AIDA::IHistogram1D* _h_dsigdptdy_y08_12;
00118     AIDA::IHistogram1D* _h_dsigdptdy_y12_16;
00119     AIDA::IHistogram1D* _h_dsigdptdy_y16_20;
00120     AIDA::IHistogram1D* _h_dsigdptdy_y20_24;
00121     //@}
00122 
00123   };
00124  
00125  
00126  
00127   // This global object acts as a hook for the plugin system
00128   AnalysisBuilder<D0_2008_S7662670> plugin_D0_2008_S7662670;
00129 
00130 }