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