rivet is hosted by Hepforge, IPPP Durham
OPAL_1995_S3198391.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/RivetYODA.hh"
00004 #include "Rivet/Tools/ParticleIdUtils.hh"
00005 #include "Rivet/Projections/Beam.hh"
00006 #include "Rivet/Projections/FinalState.hh"
00007 #include "Rivet/Projections/ChargedFinalState.hh"
00008 #include "Rivet/Projections/UnstableFinalState.hh"
00009 
00010 namespace Rivet {
00011 
00012 
00013   /// @brief OPAL Delta++ fragmentation function paper
00014   /// @author Peter Richardson
00015   class OPAL_1995_S3198391 : public Analysis {
00016   public:
00017 
00018     /// Constructor
00019     OPAL_1995_S3198391()
00020       : Analysis("OPAL_1995_S3198391")
00021     {}
00022 
00023 
00024     /// @name Analysis methods
00025     //@{
00026 
00027     void init() {
00028       addProjection(Beam(), "Beams");
00029       addProjection(ChargedFinalState(), "FS");
00030       addProjection(UnstableFinalState(), "UFS");
00031       _histXpDelta   = bookHisto1D( 1, 1, 1);
00032     }
00033 
00034 
00035     void analyze(const Event& e) {
00036       // First, veto on leptonic events by requiring at least 4 charged FS particles
00037       const FinalState& fs = applyProjection<FinalState>(e, "FS");
00038       const size_t numParticles = fs.particles().size();
00039 
00040       // Even if we only generate hadronic events, we still need a cut on numCharged >= 2.
00041       if (numParticles < 2) {
00042         MSG_DEBUG("Failed leptonic event cut");
00043         vetoEvent;
00044       }
00045       MSG_DEBUG("Passed leptonic event cut");
00046 
00047       // Get event weight for histo filling
00048       const double weight = e.weight();
00049 
00050       // Get beams and average beam momentum
00051       const ParticlePair& beams = applyProjection<Beam>(e, "Beams").beams();
00052       const double meanBeamMom = ( beams.first.momentum().vector3().mod() +
00053                                    beams.second.momentum().vector3().mod() ) / 2.0;
00054       MSG_DEBUG("Avg beam momentum = " << meanBeamMom);
00055 
00056       // Final state of unstable particles to get particle spectra
00057       const UnstableFinalState& ufs = applyProjection<UnstableFinalState>(e, "UFS");
00058 
00059       foreach (const Particle& p, ufs.particles()) {
00060         if(abs(p.pdgId())==2224) {
00061           double xp = p.momentum().vector3().mod()/meanBeamMom;
00062           _histXpDelta->fill(xp, weight);
00063         }
00064       }
00065     }
00066 
00067 
00068     /// Finalize
00069     void finalize() {
00070       scale(_histXpDelta, 1./sumOfWeights());
00071     }
00072 
00073     //@}
00074 
00075 
00076   private:
00077 
00078       Histo1DPtr _histXpDelta;
00079     //@}
00080 
00081   };
00082 
00083   // The hook for the plugin system
00084   DECLARE_RIVET_PLUGIN(OPAL_1995_S3198391);
00085 
00086 }