rivet is hosted by Hepforge, IPPP Durham
CMS_2011_S8957746.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/Projections/Thrust.hh"
00006 
00007 namespace Rivet {
00008 
00009   /// Rivet analysis class for CMS_2011_S8957746 dataset
00010   class CMS_2011_S8957746 : public Analysis {
00011   public:
00012 
00013     /// Constructor
00014     CMS_2011_S8957746()
00015       : Analysis("CMS_2011_S8957746") {  }
00016 
00017 
00018     /// Initialization, called once before running
00019     void init() {
00020       // Projections
00021       const FastJets jets(FinalState(-5.0, 5.0, 0.0*GeV), FastJets::ANTIKT, 0.5);
00022       addProjection(jets, "Jets");
00023 
00024       // Book histograms
00025       _hist_T_90  = bookHisto1D(1, 1, 1);
00026       _hist_m_90  = bookHisto1D(2, 1, 1);
00027       _hist_T_125 = bookHisto1D(3, 1, 1);
00028       _hist_m_125 = bookHisto1D(4, 1, 1);
00029       _hist_T_200 = bookHisto1D(5, 1, 1);
00030       _hist_m_200 = bookHisto1D(6, 1, 1);
00031     }
00032 
00033 
00034     void analyze(const Event& event) {
00035       const double weight = event.weight();
00036       const Jets& jets = applyProjection<FastJets>(event, "Jets").jetsByPt(30.0*GeV);
00037       if (jets.size() < 2 ||
00038           fabs(jets[0].eta()) >= 1.3 ||
00039           fabs(jets[1].eta()) >= 1.3 ||
00040           jets[0].pT() < 90*GeV) {
00041         vetoEvent;
00042       }
00043       std::vector<Vector3> momenta;
00044       foreach (const Jet& j, jets) {
00045         if (fabs(j.eta()) < 1.3) {
00046           Vector3 mom = j.momentum().vector3();
00047           mom.setZ(0.0);
00048           momenta.push_back(mom);
00049         }
00050       }
00051       if (momenta.size() == 2) {
00052         // We need to use a ghost so that Thrust.calc() doesn't return 1.
00053         momenta.push_back(Vector3(1e-10*MeV, 0., 0.));
00054       }
00055       Thrust thrust;
00056       thrust.calc(momenta);
00057 
00058       // The lowest bin also includes the underflow:
00059       const double T = max(log(1-thrust.thrust()), -12.0);
00060       const double M = max(log(thrust.thrustMajor()), -6.0);
00061       if (jets[0].pT()/GeV > 200) {
00062         _hist_T_200->fill(T, weight);
00063         _hist_m_200->fill(M, weight);
00064       } else if (jets[0].pT()/GeV > 125) {
00065         _hist_T_125->fill(T, weight);
00066         _hist_m_125->fill(M, weight);
00067       } else if (jets[0].pT()/GeV > 90) {
00068         _hist_T_90->fill(T, weight);
00069         _hist_m_90->fill(M, weight);
00070       }
00071     }
00072 
00073 
00074     void finalize() {
00075       normalize(_hist_T_90);
00076       normalize(_hist_m_90);
00077       normalize(_hist_T_125);
00078       normalize(_hist_m_125);
00079       normalize(_hist_T_200);
00080       normalize(_hist_m_200);
00081     }
00082 
00083 
00084   private:
00085 
00086     Histo1DPtr _hist_T_90;
00087     Histo1DPtr _hist_m_90;
00088     Histo1DPtr _hist_T_125;
00089     Histo1DPtr _hist_m_125;
00090     Histo1DPtr _hist_T_200;
00091     Histo1DPtr _hist_m_200;
00092 
00093   };
00094 
00095 
00096 
00097   // The hook for the plugin system
00098   DECLARE_RIVET_PLUGIN(CMS_2011_S8957746);
00099 
00100 }