DELPHI_2002_069_CONF_603.cc

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