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