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