InitialQuarks.cc
Go to the documentation of this file.00001
00002 #include "Rivet/Projections/InitialQuarks.hh"
00003 #include "Rivet/Tools/Logging.hh"
00004 #include "Rivet/Cmp.hh"
00005
00006
00007 #define IS_PARTON_PDGID(id) ( abs(id) <= 100 && abs(id) != 22 && (abs(id) < 11 || abs(id) > 18) )
00008
00009
00010 namespace Rivet {
00011
00012
00013 int InitialQuarks::compare(const Projection& p) const {
00014 return EQUIVALENT;
00015 }
00016
00017
00018 void InitialQuarks::project(const Event& e) {
00019 _theParticles.clear();
00020
00021 foreach (const GenParticle* p, Rivet::particles(e.genEvent())) {
00022 const GenVertex* pv = p->production_vertex();
00023 const GenVertex* dv = p->end_vertex();
00024 const PdgId pid = abs(p->pdg_id());
00025 bool passed = (inRange(pid, 1, 5));
00026 if (passed) {
00027 if (pv != 0) {
00028 foreach (const GenParticle* pp, particles_in(pv)) {
00029
00030 const PdgId pid = abs(pp->pdg_id());
00031 passed = (pid == ELECTRON || abs(pp->pdg_id()) == ZBOSON);
00032 }
00033 } else {
00034 passed = false;
00035 }
00036 }
00037
00038 if (getLog().isActive(Log::TRACE)) {
00039 const int st = p->status();
00040 const double pT = p->momentum().perp();
00041 const double eta = p->momentum().eta();
00042 MSG_TRACE(std::boolalpha
00043 << "ID = " << p->pdg_id() << ", status = " << st << ", pT = " << pT
00044 << ", eta = " << eta << ": result = " << passed);
00045 if (pv != 0) {
00046 foreach (const GenParticle* pp, particles_in(pv)) {
00047 MSG_TRACE(std::boolalpha << " parent ID = " << pp->pdg_id());
00048 }
00049 }
00050 if (dv != 0) {
00051 foreach (const GenParticle* pp, particles_out(dv)) {
00052 MSG_TRACE(std::boolalpha
00053 << " child ID = " << pp->pdg_id());
00054 }
00055 }
00056 }
00057 if (passed) _theParticles.push_back(Particle(*p));
00058 }
00059 MSG_DEBUG("Number of initial quarks = " << _theParticles.size());
00060 if (!_theParticles.empty()) {
00061 for (size_t i = 0; i < _theParticles.size(); i++) {
00062 MSG_DEBUG("Initial quark[" << i << "] = " << _theParticles[i].pdgId());
00063 }
00064 }
00065 }
00066
00067
00068 }