HeavyHadrons.cc
Go to the documentation of this file.
00001 // -*- C++ -*- 00002 #include "Rivet/Projections/HeavyHadrons.hh" 00003 00004 namespace Rivet { 00005 00006 00007 void HeavyHadrons::project(const Event& e) { 00008 _theParticles.clear(); 00009 _theBs.clear(); 00010 _theCs.clear(); 00011 00012 const Particles& unstables = applyProjection<FinalState>(e, "UFS").particles(); 00013 foreach (const Particle& p, unstables) { 00014 // Exclude non-b/c-hadrons 00015 if (!PID::isHadron(p)) continue; 00016 if (!PID::hasCharm(p) && !PID::hasBottom(p)) continue; 00017 MSG_DEBUG("Found a heavy (b or c) unstable hadron: " << p.pdgId()); 00018 00019 // An unbound, or undecayed status 2 hadron: this is weird, but I guess is allowed... 00020 if (!p.genParticle() || !p.genParticle()->end_vertex()) { 00021 MSG_DEBUG("Heavy hadron " << p.pdgId() << " with no GenParticle or decay found"); 00022 _theParticles.push_back(p); 00023 if (PID::hasBottom(p)) _theBs.push_back(p); else _theCs.push_back(p); 00024 continue; 00025 } 00026 // There are descendants -- check them for b or c content 00027 /// @todo What about charm hadrons coming from bottom hadron decays? 00028 const vector<GenParticle*> children = particles_out(p.genParticle(), HepMC::children); 00029 if (PID::hasBottom(p)) { 00030 bool has_b_child = false; 00031 foreach (const GenParticle* p2, children) { 00032 if (PID::hasBottom(p2)) { 00033 has_b_child = true; 00034 break; 00035 } 00036 } 00037 if (!has_b_child) { 00038 _theParticles.push_back(p); 00039 _theBs.push_back(p); 00040 } 00041 } else if (PID::hasCharm(p)) { 00042 bool has_c_child = false; 00043 foreach (const GenParticle* p2, children) { 00044 if (PID::hasCharm(p2)) { 00045 has_c_child = true; 00046 break; 00047 } 00048 } 00049 if (!has_c_child) { 00050 _theParticles.push_back(p); 00051 _theCs.push_back(p); 00052 } 00053 } 00054 } 00055 00056 MSG_DEBUG("Num b hadrons = " << _theBs.size() << 00057 ", num c hadrons = " << _theCs.size() << 00058 ", total = " << _theParticles.size()); 00059 } 00060 00061 00062 } Generated on Fri Oct 25 2013 12:41:45 for The Rivet MC analysis system by ![]() |