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 /// @todo Allow user to choose whether primary or final HF hadrons are to be returned 00013 00014 const Particles& unstables = applyProjection<FinalState>(e, "UFS").particles(); 00015 foreach (const Particle& p, unstables) { 00016 // Exclude non-b/c-hadrons 00017 if (!isHadron(p)) continue; 00018 if (!hasCharm(p) && !hasBottom(p)) continue; 00019 MSG_DEBUG("Found a heavy (b or c) unstable hadron: " << p.pid()); 00020 00021 // An unbound, or undecayed status 2 hadron: this is weird, but I guess is allowed... 00022 if (!p.genParticle() || !p.genParticle()->end_vertex()) { 00023 MSG_DEBUG("Heavy hadron " << p.pid() << " with no GenParticle or decay found"); 00024 _theParticles.push_back(p); 00025 if (hasBottom(p)) _theBs.push_back(p); else _theCs.push_back(p); 00026 continue; 00027 } 00028 // There are descendants -- check them for b or c content 00029 /// @todo What about charm hadrons coming from bottom hadron decays? 00030 const vector<GenParticle const *> children = particles_out(p.genParticle(), HepMC::children); 00031 if (hasBottom(p)) { 00032 bool has_b_child = false; 00033 foreach (const GenParticle* p2, children) { 00034 if (PID::hasBottom(p2->pdg_id())) { 00035 has_b_child = true; 00036 break; 00037 } 00038 } 00039 if (!has_b_child) { 00040 _theParticles.push_back(p); 00041 _theBs.push_back(p); 00042 } 00043 } else if (hasCharm(p)) { 00044 bool has_c_child = false; 00045 foreach (const GenParticle* p2, children) { 00046 if (PID::hasCharm(p2->pdg_id())) { 00047 has_c_child = true; 00048 break; 00049 } 00050 } 00051 if (!has_c_child) { 00052 _theParticles.push_back(p); 00053 _theCs.push_back(p); 00054 } 00055 } 00056 } 00057 00058 MSG_DEBUG("Num b hadrons = " << _theBs.size() << 00059 ", num c hadrons = " << _theCs.size() << 00060 ", total = " << _theParticles.size()); 00061 } 00062 00063 00064 } Generated on Wed Oct 7 2015 12:09:13 for The Rivet MC analysis system by ![]() |