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