rivet is hosted by Hepforge, IPPP Durham
CMS_2011_S9086218.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/RivetYODA.hh"
00004 #include "Rivet/Projections/FinalState.hh"
00005 #include "Rivet/Projections/FastJets.hh"
00006 #include "Rivet/Tools/BinnedHistogram.hh"
00007 
00008 namespace Rivet {
00009 
00010   // Inclusive jet pT
00011   class CMS_2011_S9086218 : public Analysis {
00012   public:
00013 
00014     // Constructor
00015     CMS_2011_S9086218() : Analysis("CMS_2011_S9086218") {}
00016 
00017 
00018     // Book histograms and initialize projections:
00019     void init() {
00020       const FinalState fs;
00021 
00022       // Initialize the projectors:
00023       addProjection(FastJets(fs, FastJets::ANTIKT, 0.5),"Jets");
00024 
00025       // Book histograms:
00026       _hist_sigma.addHistogram(0.0, 0.5, bookHisto1D(1, 1, 1));
00027       _hist_sigma.addHistogram(0.5, 1.0, bookHisto1D(2, 1, 1));
00028       _hist_sigma.addHistogram(1.0, 1.5, bookHisto1D(3, 1, 1));
00029       _hist_sigma.addHistogram(1.5, 2.0, bookHisto1D(4, 1, 1));
00030       _hist_sigma.addHistogram(2.0, 2.5, bookHisto1D(5, 1, 1));
00031       _hist_sigma.addHistogram(2.5, 3.0, bookHisto1D(6, 1, 1));
00032     }
00033 
00034     // Analysis
00035     void analyze(const Event &event) {
00036       const double weight = event.weight();
00037       const FastJets &fj = applyProjection<FastJets>(event,"Jets");
00038       const Jets& jets = fj.jets(18.0*GeV, 1100.0*GeV, -4.7, 4.7, RAPIDITY);
00039 
00040       // Fill the relevant histograms:
00041       foreach(const Jet &j, jets) {
00042         _hist_sigma.fill(fabs(j.momentum().rapidity()), j.momentum().pT(), weight);
00043       }
00044     }
00045 
00046     // Finalize
00047     void finalize() {
00048       _hist_sigma.scale(crossSection()/sumOfWeights()/2.0, this);
00049     }
00050 
00051   private:
00052     BinnedHistogram<double> _hist_sigma;
00053   };
00054 
00055   // This global object acts as a hook for the plugin system.
00056   DECLARE_RIVET_PLUGIN(CMS_2011_S9086218);
00057 
00058 }