rivet is hosted by Hepforge, IPPP Durham
OPAL_1996_S3257789.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 J/Psi fragmentation function paper
00012   /// @author Peter Richardson
00013   class OPAL_1996_S3257789 : public Analysis {
00014   public:
00015 
00016     /// Constructor
00017     OPAL_1996_S3257789()
00018       : Analysis("OPAL_1996_S3257789"), _weightSum(0.)
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       _histXpJPsi   = bookHisto1D( 1, 1, 1);
00030       _multJPsi     = bookHisto1D( 2, 1, 1);
00031       _multPsiPrime = bookHisto1D( 2, 1, 2);
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())==443) {
00061           double xp = p.momentum().vector3().mod()/meanBeamMom;
00062           _histXpJPsi->fill(xp, weight);
00063           _multJPsi->fill(91.2,weight);
00064           _weightSum += weight;
00065         }
00066         else if(abs(p.pdgId())==100443) {
00067           _multPsiPrime->fill(91.2,weight);
00068         }
00069       }
00070     }
00071 
00072 
00073     /// Finalize
00074     void finalize() {
00075       if(_weightSum>0.)
00076         scale(_histXpJPsi  , 0.1/_weightSum);
00077       scale(_multJPsi    , 1./sumOfWeights());
00078       scale(_multPsiPrime, 1./sumOfWeights());
00079     }
00080 
00081     //@}
00082 
00083 
00084   private:
00085 
00086     double _weightSum;
00087     Histo1DPtr _histXpJPsi;
00088     Histo1DPtr _multJPsi;
00089     Histo1DPtr _multPsiPrime;
00090     //@}
00091 
00092   };
00093 
00094   // The hook for the plugin system
00095   DECLARE_RIVET_PLUGIN(OPAL_1996_S3257789);
00096 
00097 }