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