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