rivet is hosted by Hepforge, IPPP Durham
OPAL_1993_I342766.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/UnstableFinalState.hh"
00006 #include "Rivet/Projections/Beam.hh"
00007 
00008 namespace Rivet {
00009 
00010 
00011   /// @brief A Measurement of K*+- (892) production in hadronic Z0 decays
00012   /// @author Simone Amoroso
00013   class OPAL_1993_I342766 : public Analysis {
00014   public:
00015 
00016     /// Constructor
00017     DEFAULT_RIVET_ANALYSIS_CTOR(OPAL_1993_I342766);
00018 
00019 
00020     /// @name Analysis methods
00021     //@{
00022 
00023     /// Book histograms and initialise projections before the run
00024     void init() {
00025       // Initialise and register projections
00026       declare(Beam(), "Beams");
00027       declare(ChargedFinalState(), "FS");
00028       declare(UnstableFinalState(), "UFS");
00029       // Book histograms
00030       _histXeKStar892   = bookHisto1D( 1, 1, 1);
00031       _histMeanKStar892   = bookHisto1D( 2, 1, 1);
00032     }
00033 
00034 
00035     /// Perform the per-event analysis
00036     void analyze(const Event& event) {
00037 
00038       const FinalState& fs = apply<FinalState>(event, "FS");
00039       const size_t numParticles = fs.particles().size();
00040 
00041       // Even if we only generate hadronic events, we still need a cut on numCharged >= 2.
00042       if (numParticles < 2) {
00043     MSG_DEBUG("Failed leptonic event cut");
00044     vetoEvent;
00045       }
00046       MSG_DEBUG("Passed leptonic event cut");
00047 
00048       // Get event weight for histo filling
00049       const double weight = event.weight();
00050 
00051       // Get beams and average beam momentum
00052       const ParticlePair& beams = apply<Beam>(event, "Beams").beams();
00053       const double meanBeamMom = ( beams.first.p3().mod() +
00054                    beams.second.p3().mod() ) / 2.0;
00055       MSG_DEBUG("Avg beam momentum = " << meanBeamMom);
00056 
00057       // Final state of unstable particles to get particle spectra
00058       const UnstableFinalState& ufs = apply<UnstableFinalState>(event, "UFS");
00059 
00060       foreach (const Particle& p, ufs.particles(Cuts::abspid==323)) {
00061         double xp = p.p3().mod()/meanBeamMom;
00062         _histXeKStar892->fill(xp, weight);
00063         _histMeanKStar892->fill(_histMeanKStar892->bin(0).xMid(), weight);
00064       }
00065     }
00066 
00067 
00068     /// Normalise histograms etc., after the run
00069     void finalize() {
00070       scale(_histXeKStar892, 1./sumOfWeights());
00071       scale(_histMeanKStar892, 1./sumOfWeights());
00072     }
00073 
00074     //@}
00075 
00076 
00077   private:
00078 
00079     /// @name Histograms
00080     Histo1DPtr _histXeKStar892;
00081     Histo1DPtr _histMeanKStar892;
00082 
00083   };
00084 
00085 
00086 
00087   // The hook for the plugin system
00088   DECLARE_RIVET_PLUGIN(OPAL_1993_I342766);
00089 
00090 
00091 }