ALICE_2010_S8706239.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_S8706239 : public Analysis {
00011   public:
00012 
00013     /// @name Constructors etc.
00014     //@{
00015 
00016     /// Constructor
00017     ALICE_2010_S8706239()
00018       : Analysis("ALICE_2010_S8706239"),
00019         _Nevt_after_cuts(0.0)
00020     {
00021       setNeedsCrossSection(false);
00022       setBeams(PROTON, PROTON);
00023     }
00024 
00025     //@}
00026 
00027 
00028   public:
00029 
00030     /// @name Analysis methods
00031     //@{
00032 
00033     /// Book histograms and initialise projections before the run
00034     void init() {
00035 
00036       ChargedFinalState cfs(-0.8, 0.8, 0.15);
00037       addProjection(cfs, "CFS");
00038 
00039       _h_pT = bookHistogram1D(4, 1, 1);
00040 
00041       _h_pT_Nch_015 = bookProfile1D(11, 1, 1);
00042       _h_pT_Nch_05  = bookProfile1D(12, 1, 1);
00043 
00044     }
00045 
00046 
00047     /// Perform the per-event analysis
00048     void analyze(const Event& event) {
00049       const double weight = event.weight();
00050 
00051       const ChargedFinalState& charged = applyProjection<ChargedFinalState>(event, "CFS");
00052 
00053       _Nevt_after_cuts += weight;
00054 
00055       // Get number of particles that fulfill certain pT requirements
00056       int Nch_015 = 0;
00057       int Nch_05  = 0;
00058       foreach (const Particle& p, charged.particles()) {
00059         double pT = p.momentum().pT()/GeV;
00060         if (pT < 4.0) Nch_015++;
00061         if (pT > 0.5  && pT < 4.0) Nch_05++;
00062       }
00063 
00064       // Now we can fill histograms
00065       foreach (const Particle& p, charged.particles()) {
00066         double pT = p.momentum().pT()/GeV;
00067         if (pT < 4.0) _h_pT_Nch_015 ->fill(Nch_015, pT, weight);
00068         if (pT > 0.5  && pT < 4.0) _h_pT_Nch_05  ->fill(Nch_05,  pT, weight);
00069 
00070       // To get the Yield, fill appropriate weight 1/(2PI * pT * d eta)
00071         _h_pT->fill(pT, weight /(TWOPI*pT*1.6) );
00072       }
00073 
00074     }
00075 
00076 
00077     /// Normalise histograms etc., after the run
00078     void finalize() {
00079       scale(_h_pT, 1.0/_Nevt_after_cuts);
00080     }
00081 
00082     //@}
00083 
00084 
00085   private:
00086 
00087     /// @name Histograms
00088     //@{
00089 
00090     AIDA::IHistogram1D* _h_pT;
00091 
00092     AIDA::IProfile1D* _h_pT_Nch_015 ;
00093     AIDA::IProfile1D* _h_pT_Nch_05  ;
00094 
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_S8706239> plugin_ALICE_2010_S8706239;
00105 
00106 
00107 }