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