rivet is hosted by Hepforge, IPPP Durham
ALICE_2010_S8625980.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/RivetYODA.hh"
00004 #include "Rivet/Tools/Logging.hh"
00005 #include "Rivet/Projections/ChargedFinalState.hh"
00006 
00007 namespace Rivet {
00008 
00009 
00010   class ALICE_2010_S8625980 : public Analysis {
00011   public:
00012 
00013     /// @name Constructors etc.
00014     //@{
00015 
00016     /// Constructor
00017     ALICE_2010_S8625980()
00018       : Analysis("ALICE_2010_S8625980"),
00019         _Nevt_after_cuts(0.0)
00020     {    }
00021 
00022     //@}
00023 
00024 
00025   public:
00026 
00027     /// @name Analysis methods
00028     //@{
00029 
00030     /// Book histograms and initialise projections before the run
00031     void init() {
00032 
00033       ChargedFinalState cfs(-1.0, 1.0);
00034       addProjection(cfs, "CFS");
00035 
00036       if (fuzzyEquals(sqrtS()/GeV, 900, 1E-3)) {
00037         _h_dN_deta    = bookHisto1D(4, 1, 1);
00038       } else if (fuzzyEquals(sqrtS()/GeV, 2360, 1E-3)) {
00039         _h_dN_deta    = bookHisto1D(5, 1, 1);
00040       } else if (fuzzyEquals(sqrtS()/GeV, 7000, 1E-3)) {
00041         _h_dN_deta    = bookHisto1D(6, 1, 1);
00042         _h_dN_dNch    = bookHisto1D(3, 1, 1);
00043       }
00044 
00045     }
00046 
00047 
00048     /// Perform the per-event analysis
00049     void analyze(const Event& event) {
00050       const double weight = event.weight();
00051 
00052       const ChargedFinalState& charged = applyProjection<ChargedFinalState>(event, "CFS");
00053       if (charged.size() < 1) {
00054         vetoEvent;
00055       }
00056       _Nevt_after_cuts += weight;
00057 
00058 
00059       foreach (const Particle& p, charged.particles()) {
00060         const double eta = p.momentum().pseudorapidity();
00061         _h_dN_deta->fill(eta, weight);
00062       }
00063 
00064       if (fuzzyEquals(sqrtS()/GeV, 7000, 1E-3)) {
00065         _h_dN_dNch->fill(charged.size(), weight);
00066       }
00067     }
00068 
00069 
00070     /// Normalise histograms etc., after the run
00071     void finalize() {
00072 
00073       if (fuzzyEquals(sqrtS()/GeV, 7000, 1E-3)) {
00074         normalize(_h_dN_dNch);
00075       }
00076       scale(_h_dN_deta, 1.0/_Nevt_after_cuts);
00077 
00078     }
00079 
00080     //@}
00081 
00082 
00083   private:
00084 
00085     /// @name Histograms
00086     //@{
00087 
00088     Histo1DPtr _h_dN_deta;
00089     Histo1DPtr _h_dN_dNch;
00090     double _Nevt_after_cuts;
00091     //@}
00092 
00093 
00094   };
00095 
00096 
00097 
00098   // The hook for the plugin system
00099   DECLARE_RIVET_PLUGIN(ALICE_2010_S8625980);
00100 
00101 }