Belle II Software  release-08-01-10
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 #include <framework/datastore/StoreObjPtr.h>
14 
15 #include <string>
16 #include <vector>
17 
18 namespace Belle2 {
24  class MCParticle;
25  class StringWrapper;
26 
34  class PrintMCParticlesModule : public Module {
35 
36  public:
37 
43 
46 
48  virtual void initialize() override;
50  virtual void event() override;
51 
52  protected:
53 
59  void printTree(const std::vector<MCParticle*>& particles, int level = 1, const std::string& indent = "");
60 
62  void filterPrimaryOnly(std::vector<MCParticle*>& particles) const;
63 
64  std::stringstream m_output;
65  std::string m_particleList;
67  int m_maxLevel;
71  bool m_showStatus;
75  };
76 
78 } // 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
StoreObjPtr< StringWrapper > m_stringWrapper
string wrapper to store the MCDecayString
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_suppressPrint
Suppress print the information.
bool m_onlyPrimaries
Print only primary particles.
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
Abstract base class for different kinds of events.