rivet is hosted by Hepforge, IPPP Durham
CMS_2013_I1208923.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   // This analysis is a derived from the class Analysis:
00010   class CMS_2013_I1208923 : public Analysis {
00011 
00012   public:
00013     // Constructor
00014     CMS_2013_I1208923()
00015       : Analysis("CMS_2013_I1208923") {
00016       //setNeedsCrossSection(true);
00017     }
00018 
00019     // Book histograms and initialize projections:
00020     void init() {
00021       const FinalState fs;
00022       addProjection(fs, "FS");
00023 
00024       // Initialize the projections
00025       addProjection(FastJets(fs, FastJets::ANTIKT, 0.7), "Jets");
00026 
00027       // Book histograms
00028       _h_sigma.addHistogram(0.0, 0.5, bookHisto1D(1, 1, 1));
00029       _h_sigma.addHistogram(0.5, 1.0, bookHisto1D(1, 1, 2));
00030       _h_sigma.addHistogram(1.0, 1.5, bookHisto1D(1, 1, 3));
00031       _h_sigma.addHistogram(1.5, 2.0, bookHisto1D(1, 1, 4));
00032       _h_sigma.addHistogram(2.0, 2.5, bookHisto1D(1, 1, 5));
00033       
00034       _h_invMass.addHistogram(0.0, 0.5, bookHisto1D(2, 1, 1));
00035       _h_invMass.addHistogram(0.5, 1.0, bookHisto1D(2, 1, 2));
00036       _h_invMass.addHistogram(1.0, 1.5, bookHisto1D(2, 1, 3));
00037       _h_invMass.addHistogram(1.5, 2.0, bookHisto1D(2, 1, 4));
00038       _h_invMass.addHistogram(2.0, 2.5, bookHisto1D(2, 1, 5));
00039     }
00040 
00041     // Analysis
00042     void analyze(const Event &event) {
00043       const double weight = event.weight();
00044       const FastJets &fJets = applyProjection<FastJets>(event, "Jets");
00045       
00046       // Fill the jet pT spectra
00047       const Jets& jets = fJets.jetsByPt(Cuts::pt>100.*GeV && Cuts::absrap <2.5);
00048       foreach (const Jet &j, jets) {
00049         _h_sigma.fill(fabs(j.momentum().rapidity()), j.momentum().pT() / GeV, weight);
00050       }
00051 
00052       // Require two jets
00053       const Jets& dijets = fJets.jetsByPt(Cuts::pt>30.*GeV && Cuts::absrap < 2.5);
00054       if (dijets.size() > 1) {
00055         if (dijets[0].momentum().pT() / GeV > 60.) {
00056           // Fill the invariant mass histogram
00057           double ymax = max(dijets[0].momentum().absrapidity(), dijets[1].momentum().absrapidity());
00058           double invMass = FourMomentum(dijets[0].momentum() + dijets[1].momentum()).mass();
00059           _h_invMass.fill(fabs(ymax), invMass, weight);
00060         }
00061       } 
00062 
00063     }
00064 
00065 
00066     // Scale histograms by the production cross section
00067     void finalize() {
00068       _h_sigma.scale(  crossSection() / sumOfWeights() / 2.0, this);
00069       _h_invMass.scale(crossSection() / sumOfWeights() / 2.0, this);
00070     }
00071 
00072   private:
00073     BinnedHistogram<double> _h_sigma;
00074     BinnedHistogram<double> _h_invMass;
00075   };
00076 
00077   // This global object acts as a hook for the plugin system.
00078   DECLARE_RIVET_PLUGIN(CMS_2013_I1208923);
00079 }