CMS_2011_S8957746.cc

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