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       /// @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(-0.8, 0.8, 0.15);
00038       addProjection(cfs, "CFS");
00039       
00040       _h_pT = bookHistogram1D(4, 1, 1);
00041     
00042       _h_pT_Nch_015 = bookProfile1D(11, 1, 1);
00043       _h_pT_Nch_05  = bookProfile1D(12, 1, 1);
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       
00054       _Nevt_after_cuts += weight;
00055 
00056       // Get number of particles that fulfill certain pT requirements
00057       int Nch_015 = 0;
00058       int Nch_05  = 0;
00059       foreach (const Particle& p, charged.particles()) {
00060         double pT = p.momentum().pT()/GeV;
00061         if (pT < 4.0) Nch_015++;    
00062         if (pT > 0.5  && pT < 4.0) Nch_05++;     
00063       }
00064 
00065       // Now we can fill histograms
00066       foreach (const Particle& p, charged.particles()) {
00067         double pT = p.momentum().pT()/GeV;
00068         if (pT < 4.0) _h_pT_Nch_015 ->fill(Nch_015, pT, weight);
00069         if (pT > 0.5  && pT < 4.0) _h_pT_Nch_05  ->fill(Nch_05,  pT, weight);
00070 
00071       // To get the Yield, fill appropriate weight 1/(2PI * pT * d eta)
00072         _h_pT->fill(pT, weight /(TWOPI*pT*1.6) );
00073       }
00074 
00075     }
00076 
00077 
00078     /// Normalise histograms etc., after the run
00079     void finalize() {
00080       
00081       scale(_h_pT, 1.0/_Nevt_after_cuts);
00082 
00083     }
00084 
00085     //@}
00086 
00087   private:
00088 
00089     /// @name Histograms
00090     //@{
00091 
00092     AIDA::IHistogram1D* _h_pT;
00093     
00094     AIDA::IProfile1D* _h_pT_Nch_015 ;
00095     AIDA::IProfile1D* _h_pT_Nch_05  ;
00096 
00097     double _Nevt_after_cuts;
00098     //@}
00099 
00100 
00101   };
00102 
00103 
00104 
00105   // This global object acts as a hook for the plugin system
00106   AnalysisBuilder<ALICE_2010_S8706239> plugin_ALICE_2010_S8706239;
00107 
00108 
00109 }