rivet is hosted by Hepforge, IPPP Durham
OPAL_2003_I599181.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/Projections/UnstableFinalState.hh"
00004 #include "Rivet/Projections/Beam.hh"
00005 
00006 namespace Rivet {
00007 
00008 
00009   /// @brief OPAL b-fragmentation measurement for weak B-hadron decays
00010   /// @author Simone Amoroso
00011   class OPAL_2003_I599181 : public Analysis {
00012   public:
00013 
00014     /// Constructor
00015     DEFAULT_RIVET_ANALYSIS_CTOR(OPAL_2003_I599181);
00016 
00017 
00018     /// @name Analysis methods
00019     //@{
00020 
00021     /// Book histograms and initialise projections before the run
00022     void init() {
00023 
00024       // Initialise and register projections
00025       declare(Beam(), "Beams");
00026       declare(UnstableFinalState(), "UFS");
00027 
00028       // Book histograms
00029       _histXbweak     = bookHisto1D(1, 1, 1);
00030       _histMeanXbweak = bookProfile1D(2, 1, 1);
00031 
00032     }
00033 
00034 
00035     /// Perform the per-event analysis
00036     void analyze(const Event& event) {
00037 
00038 
00039       // Get event weight for histo filling
00040       const double weight = event.weight();
00041 
00042       // Get beams and average beam momentum
00043       const ParticlePair& beams = apply<Beam>(event, "Beams").beams();
00044       const double meanBeamMom = ( beams.first.p3().mod() +beams.second.p3().mod() ) / 2.0;
00045       MSG_DEBUG("Avg beam momentum = " << meanBeamMom);
00046 
00047       const UnstableFinalState& ufs = apply<UnstableFinalState>(event, "UFS");
00048       // Get Bottom hadrons
00049       const Particles bhads = filter_select(ufs.particles(), isBottomHadron);
00050 
00051       for (const Particle& bhad : bhads) {
00052         // Check for weak decay, i.e. no more bottom present in children
00053         if (bhad.children(lastParticleWith(hasBottom)).empty()) {
00054           const double xp = bhad.E()/meanBeamMom;
00055           _histXbweak->fill(xp, weight);
00056           _histMeanXbweak->fill(_histMeanXbweak->bin(0).xMid(), xp, weight);
00057         }
00058       }
00059     }
00060 
00061 
00062     /// Normalise histograms etc., after the run
00063     void finalize() {
00064       normalize(_histXbweak);
00065     }
00066 
00067     //@}
00068 
00069 
00070   private:
00071 
00072     Histo1DPtr _histXbweak;
00073     Profile1DPtr _histMeanXbweak;
00074 
00075   };
00076 
00077 
00078 
00079   // The hook for the plugin system
00080   DECLARE_RIVET_PLUGIN(OPAL_2003_I599181);
00081 
00082 
00083 }