rivet is hosted by Hepforge, IPPP Durham
DELPHI_1999_S3960137.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 DELPHI rho,f_0 and f_2 fragmentation function paper
00014   /// @author Peter Richardson
00015   class DELPHI_1999_S3960137 : public Analysis {
00016   public:
00017 
00018     /// Constructor
00019     DELPHI_1999_S3960137()
00020       : Analysis("DELPHI_1999_S3960137")
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       _histXpRho = bookHisto1D( 1, 1, 1);
00032       _histXpf0  = bookHisto1D( 1, 1, 2);
00033       _histXpf2  = bookHisto1D( 1, 1, 3);
00034     }
00035 
00036 
00037     void analyze(const Event& e) {
00038       // First, veto on leptonic events by requiring at least 4 charged FS particles
00039       const FinalState& fs = applyProjection<FinalState>(e, "FS");
00040       const size_t numParticles = fs.particles().size();
00041 
00042       // Even if we only generate hadronic events, we still need a cut on numCharged >= 2.
00043       if (numParticles < 2) {
00044         MSG_DEBUG("Failed leptonic event cut");
00045         vetoEvent;
00046       }
00047       MSG_DEBUG("Passed leptonic event cut");
00048 
00049       // Get event weight for histo filling
00050       const double weight = e.weight();
00051 
00052       // Get beams and average beam momentum
00053       const ParticlePair& beams = applyProjection<Beam>(e, "Beams").beams();
00054       const double meanBeamMom = ( beams.first.momentum().vector3().mod() +
00055                                    beams.second.momentum().vector3().mod() ) / 2.0;
00056       MSG_DEBUG("Avg beam momentum = " << meanBeamMom);
00057 
00058       // Final state of unstable particles to get particle spectra
00059       const UnstableFinalState& ufs = applyProjection<UnstableFinalState>(e, "UFS");
00060 
00061       foreach (const Particle& p, ufs.particles()) {
00062         const int id = abs(p.pdgId());
00063         double xp = p.momentum().vector3().mod()/meanBeamMom;
00064         switch (id) {
00065         case 9010221:
00066           _histXpf0->fill(xp, weight);
00067           break;
00068         case 225:
00069           _histXpf2->fill(xp, weight);
00070           break;
00071         case 113:
00072           _histXpRho->fill(xp, weight);
00073           break;
00074         }
00075       }
00076     }
00077 
00078 
00079     /// Finalize
00080     void finalize() {
00081       scale(_histXpf0 , 1./sumOfWeights());
00082       scale(_histXpf2 , 1./sumOfWeights());
00083       scale(_histXpRho, 1./sumOfWeights());
00084     }
00085 
00086     //@}
00087 
00088 
00089   private:
00090 
00091       Histo1DPtr _histXpf0;
00092       Histo1DPtr _histXpf2;
00093       Histo1DPtr _histXpRho;
00094     //@}
00095 
00096   };
00097 
00098   // The hook for the plugin system
00099   DECLARE_RIVET_PLUGIN(DELPHI_1999_S3960137);
00100 
00101 }