rivet is hosted by Hepforge, IPPP Durham
ALICE_2010_S8706239.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_S8706239 : public Analysis {
00009   public:
00010 
00011     /// @name Constructors etc.
00012     //@{
00013 
00014     /// Constructor
00015     ALICE_2010_S8706239()
00016       : Analysis("ALICE_2010_S8706239"),
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(-0.8, 0.8, 0.15);
00032       addProjection(cfs, "CFS");
00033 
00034       _h_pT = bookHisto1D(4, 1, 1);
00035 
00036       _h_pT_Nch_015 = bookProfile1D(11, 1, 1);
00037       _h_pT_Nch_05  = bookProfile1D(12, 1, 1);
00038 
00039     }
00040 
00041 
00042     /// Perform the per-event analysis
00043     void analyze(const Event& event) {
00044       const double weight = event.weight();
00045 
00046       const ChargedFinalState& charged = applyProjection<ChargedFinalState>(event, "CFS");
00047 
00048       _Nevt_after_cuts += weight;
00049 
00050       // Get number of particles that fulfill certain pT requirements
00051       int Nch_015 = 0;
00052       int Nch_05  = 0;
00053       foreach (const Particle& p, charged.particles()) {
00054         double pT = p.pT()/GeV;
00055         if (pT < 4.0) Nch_015++;
00056         if (pT > 0.5  && pT < 4.0) Nch_05++;
00057       }
00058 
00059       // Now we can fill histograms
00060       foreach (const Particle& p, charged.particles()) {
00061         double pT = p.pT()/GeV;
00062         if (pT < 4.0) _h_pT_Nch_015 ->fill(Nch_015, pT, weight);
00063         if (pT > 0.5  && pT < 4.0) _h_pT_Nch_05  ->fill(Nch_05,  pT, weight);
00064 
00065       // To get the Yield, fill appropriate weight 1/(2PI * pT * d eta)
00066         _h_pT->fill(pT, weight /(TWOPI*pT*1.6) );
00067       }
00068 
00069     }
00070 
00071 
00072     /// Normalise histograms etc., after the run
00073     void finalize() {
00074       scale(_h_pT, 1.0/_Nevt_after_cuts);
00075     }
00076 
00077     //@}
00078 
00079 
00080   private:
00081 
00082     /// @name Histograms
00083     //@{
00084 
00085     Histo1DPtr _h_pT;
00086 
00087     Profile1DPtr _h_pT_Nch_015 ;
00088     Profile1DPtr _h_pT_Nch_05  ;
00089 
00090     double _Nevt_after_cuts;
00091     //@}
00092 
00093 
00094   };
00095 
00096 
00097 
00098   // The hook for the plugin system
00099   DECLARE_RIVET_PLUGIN(ALICE_2010_S8706239);
00100 
00101 }