rivet is hosted by Hepforge, IPPP Durham
DELPHI_2002_069_CONF_603.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 
00007 
00008 /// @todo Use inline PID functions instead
00009 #define IS_PARTON_PDGID(id) ( abs(id) <= 100 && abs(id) != 22 && (abs(id) < 11 || abs(id) > 18) )
00010 #define IS_BHADRON_PDGID(id) ( ((abs(id)/100)%10 == 5) || (abs(id) >= 5000 && abs(id) <= 5999) )
00011 
00012 namespace Rivet {
00013 
00014 
00015   /// @brief DELPHI b-fragmentation measurement
00016   /// @author Hendrik Hoeth
00017   class DELPHI_2002_069_CONF_603 : public Analysis {
00018   public:
00019 
00020     /// Constructor
00021     DELPHI_2002_069_CONF_603()
00022       : Analysis("DELPHI_2002_069_CONF_603")
00023     {
00024     }
00025 
00026 
00027     /// @name Analysis methods
00028     //@{
00029 
00030     /// Book projections and histograms
00031     void init() {
00032       addProjection(Beam(), "Beams");
00033       addProjection(ChargedFinalState(), "FS");
00034 
00035       _histXbprim     = bookHisto1D(1, 1, 1);
00036       _histXbweak     = bookHisto1D(2, 1, 1);
00037       _histMeanXbprim = bookProfile1D(4, 1, 1);
00038       _histMeanXbweak = bookProfile1D(5, 1, 1);
00039     }
00040 
00041 
00042     void analyze(const Event& e) {
00043       const FinalState& fs = applyProjection<FinalState>(e, "FS");
00044       const size_t numParticles = fs.particles().size();
00045 
00046       // Even if we only generate hadronic events, we still need a cut on numCharged >= 2.
00047       if (numParticles < 2) {
00048         MSG_DEBUG("Failed ncharged cut");
00049         vetoEvent;
00050       }
00051       MSG_DEBUG("Passed ncharged cut");
00052 
00053       // Get event weight for histo filling
00054       const double weight = e.weight();
00055 
00056       // Get beams and average beam momentum
00057       const ParticlePair& beams = applyProjection<Beam>(e, "Beams").beams();
00058       const double meanBeamMom = ( beams.first.momentum().vector3().mod() +
00059                                    beams.second.momentum().vector3().mod() ) / 2.0;
00060       MSG_DEBUG("Avg beam momentum = " << meanBeamMom);
00061 
00062 
00063       foreach (const GenParticle* p, particles(e.genEvent())) {
00064         const GenVertex* pv = p->production_vertex();
00065         const GenVertex* dv = p->end_vertex();
00066         if (IS_BHADRON_PDGID(p->pdg_id())) {
00067           const double xp = p->momentum().e()/meanBeamMom;
00068 
00069           // If the B-hadron has a parton as parent, call it primary B-hadron:
00070           if (pv) {
00071             bool is_primary = false;
00072             for (GenVertex::particles_in_const_iterator pp = pv->particles_in_const_begin(); pp != pv->particles_in_const_end() ; ++pp) {
00073               if (IS_PARTON_PDGID((*pp)->pdg_id())) is_primary = true;
00074             }
00075             if (is_primary) {
00076               _histXbprim->fill(xp, weight);
00077               _histMeanXbprim->fill(_histMeanXbprim->bin(0).midpoint(), xp, weight);
00078             }
00079           }
00080 
00081           // If the B-hadron has no B-hadron as a child, it decayed weakly:
00082           if (dv) {
00083             bool is_weak = true;
00084             for (GenVertex::particles_out_const_iterator pp = dv->particles_out_const_begin() ;
00085                  pp != dv->particles_out_const_end() ; ++pp) {
00086               if (IS_BHADRON_PDGID((*pp)->pdg_id())) {
00087                 is_weak = false;
00088               }
00089             }
00090             if (is_weak) {
00091               _histXbweak->fill(xp, weight);
00092               _histMeanXbweak->fill(_histMeanXbweak->bin(0).midpoint(), xp, weight);
00093             }
00094           }
00095 
00096         }
00097       }
00098     }
00099 
00100 
00101     // Finalize
00102     void finalize() {
00103       normalize(_histXbprim);
00104       normalize(_histXbweak);
00105     }
00106 
00107 
00108   private:
00109 
00110     /// Store the weighted sums of numbers of charged / charged+neutral
00111     /// particles - used to calculate average number of particles for the
00112     /// inclusive single particle distributions' normalisations.
00113 
00114     Histo1DPtr _histXbprim;
00115     Histo1DPtr _histXbweak;
00116 
00117     Profile1DPtr _histMeanXbprim;
00118     Profile1DPtr _histMeanXbweak;
00119 
00120     //@}
00121 
00122   };
00123 
00124 
00125 
00126   // The hook for the plugin system
00127   DECLARE_RIVET_PLUGIN(DELPHI_2002_069_CONF_603);
00128 
00129 }