9#include "../include/PrintTauTauMCParticlesModule.h"
10#include <mdst/dataobjects/MCParticle.h>
12#include <framework/datastore/StoreArray.h>
14#include <boost/format.hpp>
15#include <boost/foreach.hpp>
17#include <TDatabasePDG.h>
33 B2DEBUG(100,
"PrintTauTauMCParticles called:");
40 addParam(
"maxLevel",
m_maxLevel,
"Show only up to specified depth level, -1 means no limit", -1);
49 B2INFO(
"Content from MCParticle Collection '" +
m_particleList +
"':");
50 for (
int i = 0; i < MCParticles.
getEntries(); i++) {
58 sprintf(buf,
"PMC: %3d %4u %8d %4d %4d %4d %9.4f %9.4f %9.4f %9.4f",
59 p.getIndex(), p.getStatus(), p.getPDG(), moID,
60 p.getFirstDaughter(), p.getLastDaughter(),
61 p.get4Vector().Px(), p.get4Vector().Py(),
62 p.get4Vector().Pz(), p.get4Vector().E());
66 for (
int i = 0; i < MCParticles.
getEntries(); i++) {
68 if (!(mc.getMother() != NULL && mc.getMother()->getIndex() <= 3))
continue;
81 for (
int i = 0; i < 2 * level; i++) indent +=
" ";
82 TDatabasePDG* pdb = TDatabasePDG::Instance();
83 TParticlePDG* pdef = pdb->GetParticle(mc.getPDG());
84 string name = pdef ? (string(
" (") + pdef->GetTitle() +
")") :
"";
86 if (
m_seen[mc.getIndex()]) {
87 B2INFO(boost::format(
"%4d %s%10d%s*") % mc.getIndex() % indent % mc.getPDG() % name);
90 const ROOT::Math::XYZVector& p = mc.getMomentum();
91 const ROOT::Math::XYZVector& v = mc.getVertex();
92 B2INFO(boost::format(
"%3d %s%5d%s%20tp:(%10.3e, %10.3e, %10.3e) v:(%10.3e, %10.3e, %10.3e), t:%10.3e,%10.3e, s:%d, c:%d")
93 % mc.getIndex() % indent % mc.getPDG() % name
94 % p.X() % p.Y() % p.Z()
95 % v.X() % v.Y() % v.Z()
96 % mc.getProductionTime() % mc.getDecayTime()
97 % mc.getStatus() % mc.getCharge()
100 const vector<MCParticle*> daughters = mc.getDaughters();
101 BOOST_FOREACH(
MCParticle * daughter, daughters) {
104 m_seen[mc.getIndex()] =
true;
A Class to store the Monte Carlo particle information.
@ c_PrimaryParticle
bit 0: Particle is primary particle.
void setDescription(const std::string &description)
Sets the description of the module.
virtual void event() override
Method is called for each event.
std::vector< bool > m_seen
Tag the particles which were already visited using their index.
int m_maxLevel
Show only up to specified depth level.
std::string m_particleList
The name of the MCParticle collection.
PrintTauTauMCParticlesModule()
Constructor.
bool m_onlyPrimaries
Print only primary particles.
void printTree(const MCParticle &mc, int level=0)
Loops recursively over the MCParticle list and prints information about each particle.
Accessor to arrays stored in the data store.
int getEntries() const
Get the number of objects in the array.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.