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