rivet is hosted by Hepforge, IPPP Durham
ALEPH_1995_I382179.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/Projections/FinalState.hh"
00004 #include "Rivet/Projections/ChargedFinalState.hh"
00005 #include "Rivet/Projections/Beam.hh"
00006 
00007 namespace Rivet {
00008 
00009 
00010   /// @brief ALEPH pi+-, K+-, p and pbar differential cross-sections at the Z peak
00011   class ALEPH_1995_I382179 : public Analysis {
00012   public:
00013 
00014     /// Constructor
00015     DEFAULT_RIVET_ANALYSIS_CTOR(ALEPH_1995_I382179);
00016 
00017 
00018     /// @name Analysis methods
00019     //@{
00020 
00021     /// Book histograms and initialise projections before the run
00022     void init() {
00023 
00024       // Initialise and register projections
00025       declare(Beam(), "Beams");
00026       declare(ChargedFinalState(), "FS");
00027 
00028       // Book histograms
00029       _histXpPion = bookHisto1D( 1, 1, 1);
00030       _histXpKaon = bookHisto1D( 2, 1, 1);
00031       _histXpProton = bookHisto1D( 3, 1, 1);
00032 
00033     }
00034 
00035 
00036     /// Perform the per-event analysis
00037     void analyze(const Event& event) {
00038 
00039       // Even if we only generate hadronic events, we still need a cut on numCharged >= 2.
00040       const FinalState& fs = apply<FinalState>(event, "FS");
00041       if (fs.particles().size() < 2) {
00042     MSG_DEBUG("Failed ncharged cut");
00043     vetoEvent;
00044       }
00045       MSG_DEBUG("Passed ncharged cut");
00046 
00047       // Get event weight for histo filling
00048       const double weight = event.weight();
00049 
00050       // Get beams and average beam momentum
00051       const ParticlePair& beams = apply<Beam>(event, "Beams").beams();
00052       const double meanBeamMom = ( beams.first.p3().mod() + beams.second.p3().mod() ) / 2.0;
00053       MSG_DEBUG("Avg beam momentum = " << meanBeamMom);
00054 
00055       foreach (const Particle& p, fs.particles()) {
00056     int id = p.abspid();
00057     // charged pions
00058     if (id == PID::PIPLUS || id == PID::PIMINUS) {
00059       _histXpPion->fill(p.p3().mod()/meanBeamMom, weight);
00060     } else if(id == PID::KPLUS || id == PID::KMINUS) {
00061       _histXpKaon->fill(p.p3().mod()/meanBeamMom, weight);
00062     } else if(id == PID::PROTON || id == PID::ANTIPROTON) {
00063       _histXpProton->fill(p.p3().mod()/meanBeamMom, weight);
00064     }
00065       }
00066 
00067 
00068     }
00069 
00070 
00071     /// Normalise histograms etc., after the run
00072     void finalize() {
00073       scale(_histXpPion, 1./sumOfWeights());
00074       scale(_histXpKaon, 1./sumOfWeights());
00075       scale(_histXpProton, 1./sumOfWeights());
00076     }
00077 
00078     //@}
00079 
00080 
00081   private:
00082 
00083 
00084     /// @name Histograms
00085     Histo1DPtr _histXpPion;
00086     Histo1DPtr _histXpKaon;
00087     Histo1DPtr _histXpProton;
00088 
00089 
00090   };
00091 
00092 
00093 
00094   // The hook for the plugin system
00095   DECLARE_RIVET_PLUGIN(ALEPH_1995_I382179);
00096 
00097 
00098 }