Belle II Software  release-06-02-00
PrintMCParticlesModule.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #pragma once
10 
11 #include <framework/core/Module.h>
12 #include <framework/datastore/StoreArray.h>
13 
14 #include <string>
15 #include <vector>
16 
17 namespace Belle2 {
23  class MCParticle;
24 
32  class PrintMCParticlesModule : public Module {
33 
34  public:
35 
41 
44 
46  virtual void initialize() override;
48  virtual void event() override;
49 
50  protected:
51 
57  void printTree(const std::vector<MCParticle*>& particles, int level = 1, const std::string& indent = "");
58 
60  void filterPrimaryOnly(std::vector<MCParticle*>& particles) const;
61 
62  std::stringstream m_output;
63  std::string m_particleList;
65  int m_maxLevel;
69  bool m_showStatus;
71  };
72 
74 } // end namespace Belle2
Base class for Modules.
Definition: Module.h:72
The PrintMCParticles module.
std::stringstream m_output
Buffer to keep all the output while building the tree.
virtual void initialize() override
init.
bool m_showProperties
Show remaining properties.
virtual void event() override
Method is called for each event.
virtual ~PrintMCParticlesModule()
Destructor.
StoreArray< MCParticle > m_mcparticles
store array for the MCParticles
bool m_showStatus
Show extended status information.
int m_maxLevel
Show only up to specified depth level.
bool m_showVertices
Show particle production vertices.
void filterPrimaryOnly(std::vector< MCParticle * > &particles) const
if m_onlyPrimary is set remove all non primary particles from the given vector inplace
void printTree(const std::vector< MCParticle * > &particles, int level=1, const std::string &indent="")
Loops recursively over the MCParticle list and prints information about each particle.
bool m_showMomenta
Show particle momenta.
std::string m_particleList
The name of the MCParticle collection.
bool m_onlyPrimaries
Print only primary particles.
Abstract base class for different kinds of events.