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