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       setBeams(PROTON, PROTON);
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(1, 2, 1);
00031       _hist_m_125 = bookHistogram1D(2, 2, 1);
00032       _hist_T_200 = bookHistogram1D(1, 3, 1);
00033       _hist_m_200 = bookHistogram1D(2, 3, 1);
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) {
00043         vetoEvent;
00044       }
00045       std::vector<Vector3> momenta;
00046       foreach (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()>200) {
00064         _hist_T_200->fill(T, weight);
00065         _hist_m_200->fill(M, weight);
00066       } else if (jets[0].momentum().pT()>125) {
00067         _hist_T_125->fill(T, weight);
00068         _hist_m_125->fill(M, weight);
00069       } else if (jets[0].momentum().pT()>90) {
00070         _hist_T_90->fill(T, weight);
00071         _hist_m_90->fill(M, weight);
00072       }
00073     }
00074 
00075     void finalize() {
00076       normalize(_hist_T_90);
00077       normalize(_hist_m_90);
00078       normalize(_hist_T_125);
00079       normalize(_hist_m_125);
00080       normalize(_hist_T_200);
00081       normalize(_hist_m_200);
00082     }
00083 
00084   private:
00085 
00086     AIDA::IHistogram1D *_hist_T_90;
00087     AIDA::IHistogram1D *_hist_m_90;
00088     AIDA::IHistogram1D *_hist_T_125;
00089     AIDA::IHistogram1D *_hist_m_125;
00090     AIDA::IHistogram1D *_hist_T_200;
00091     AIDA::IHistogram1D *_hist_m_200;
00092   };
00093 
00094   // This global object acts as a hook for the plugin system
00095   AnalysisBuilder<CMS_2011_S8957746> plugin_CMS_2011_S8957746;
00096 }