LHCB_2010_S8758301.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/RivetAIDA.hh"
00004 #include "Rivet/Tools/Logging.hh"
00005 #include "Rivet/Projections/UnstableFinalState.hh"
00006 #include "Rivet/Tools/ParticleIdUtils.hh"
00007 
00008 namespace Rivet {
00009 
00010 
00011   class LHCB_2010_S8758301 : public Analysis {
00012   public:
00013 
00014     /// @name Constructors etc.
00015     //@{
00016 
00017     /// Constructor
00018     LHCB_2010_S8758301()
00019       : Analysis("LHCB_2010_S8758301"),
00020       sumKs0_30(0.0), sumKs0_35(0.0), sumKs0_40(0.0)
00021 
00022     {
00023       /// @todo Set whether your finalize method needs the generator cross section
00024       setNeedsCrossSection(false);
00025       setBeams(PROTON, PROTON);
00026     }
00027 
00028     //@}
00029 
00030 
00031   public:
00032 
00033     /// @name Analysis methods
00034     //@{
00035 
00036     /// Book histograms and initialise projections before the run
00037     void init() {
00038 
00039       addProjection(UnstableFinalState(), "UFS");
00040 
00041       _h_K0s_pt_y_30 = bookHistogram1D(1,1,1);
00042       _h_K0s_pt_y_35 = bookHistogram1D(1,1,2);
00043       _h_K0s_pt_y_40 = bookHistogram1D(1,1,3);
00044 
00045     }
00046 
00047 
00048     /// Perform the per-event analysis
00049     void analyze(const Event& event) {
00050       const double weight = event.weight();
00051       const UnstableFinalState& ufs = applyProjection<UnstableFinalState>(event, "UFS");
00052 
00053       foreach (const Particle& p, ufs.particles()) {
00054         const PdgId id = abs(p.pdgId());
00055 
00056         if (id == 310) {
00057           double y  = p.momentum().rapidity();
00058           double pT = p.momentum().perp();
00059           if (y > 2.5 && y < 3.0) {
00060             //_h_K0s_pt_y_30->fill(pT, weight/(0.5*0.2));
00061             _h_K0s_pt_y_30->fill(pT, weight);
00062             sumKs0_30 += weight;
00063           }
00064           else if (y > 3.0 && y < 3.5) {
00065             //_h_K0s_pt_y_35->fill(pT, weight/(0.5*0.2));
00066             _h_K0s_pt_y_35->fill(pT, weight);
00067             sumKs0_35 += weight;
00068           }
00069           else if (y > 3.5 && y < 4.0) {
00070             //_h_K0s_pt_y_40->fill(pT, weight/(0.5*0.2));
00071             _h_K0s_pt_y_40->fill(pT, weight);
00072             sumKs0_40 += weight;
00073           }
00074         }
00075       }
00076       
00077 
00078     }
00079 
00080 
00081     /// Normalise histograms etc., after the run
00082     void finalize() {
00083 
00084 
00085       // here we normalise to reference data... 
00086       scale(_h_K0s_pt_y_30, 4.880000e+02/sumKs0_30);
00087       scale(_h_K0s_pt_y_35, 4.442000e+02/sumKs0_35);
00088       scale(_h_K0s_pt_y_40, 3.868000e+02/sumKs0_40);
00089 
00090 
00091 
00092     }
00093 
00094     //@}
00095 
00096 
00097   private:
00098 
00099     // Data members like post-cuts event weight counters go here
00100 
00101 
00102   private:
00103 
00104     /// @name Histograms
00105     //@{
00106 
00107 
00108     AIDA::IHistogram1D *_h_K0s_pt_y_30;
00109     AIDA::IHistogram1D *_h_K0s_pt_y_35;
00110     AIDA::IHistogram1D *_h_K0s_pt_y_40;
00111 
00112     double sumKs0_30;
00113     double sumKs0_35;
00114     double sumKs0_40;
00115 
00116     //@}
00117 
00118 
00119   };
00120 
00121 
00122 
00123   // This global object acts as a hook for the plugin system
00124   AnalysisBuilder<LHCB_2010_S8758301> plugin_LHCB_2010_S8758301;
00125 
00126 
00127 }