9#include <simulation/kernel/EventAction.h>
10#include <framework/core/Environment.h>
11#include <framework/datastore/RelationArray.h>
12#include <framework/logging/Logger.h>
13#include <mdst/dataobjects/MCParticleGraph.h>
14#include <simulation/kernel/SensitiveDetectorBase.h>
20using namespace Belle2::Simulation;
24 G4UserEventAction(), m_mcCollectionName(mcCollectionName), m_mcParticleGraph(mcParticleGraph)
55 B2FATAL(
"EventMetaData is not valid.");
57 std::string filename = boost::str(boost::format(
"event%1%.csv") % eventNumber);
59 B2INFO(
"Opened VR event-history file " << filename);
73 vector<std::pair<unsigned int, bool> > indices;
84 for (std::map<std::string, RelationArray::EConsolidationAction>::const_iterator it = relations.begin(); it != relations.end();
bool getWriteSimSteps() const
Get the flag for writing the simulation steps into an output csv file.
static Environment & Instance()
Static method to get a reference to the Environment instance.
Class to represent Particle data in graph.
int getTrackID() const
Returns the track ID assigned to this MCParticle.
bool getIgnore() const
Get the ignore flag.
Class to build, validate and sort a particle decay chain.
@ c_clearParticles
Clear the particle list before adding the graph.
size_t size() const
Return the number of particles in the graph.
void generateList(const std::string &name="", int options=c_setNothing)
Generates the MCParticle list and stores it in the StoreArray with the given name.
int getIndex() const
Get 1-based index of the particle in the corresponding MCParticle list.
Struct to replace indices based on a sequential container.
Low-level class to create/modify relations between StoreArrays.
void consolidate()
Consolidate Relation Elements.
std::string m_mcCollectionName
The name of the MCParticle collection to which the MCParticles should be written.
std::ofstream * m_VREventStream
Output stream for writing each step of event's history for the Virtual Reality.
MCParticleGraph & m_mcParticleGraph
Reference to the MCParticle graph which is converted to a MCParticle list by this class.
bool m_writeSimSteps
Flag for writing out the simulation steps.
virtual ~EventAction()
Destructor.
StoreObjPtr< EventMetaData > m_evtMetaData
Event metadata.
EventAction(const std::string &mcCollectionName, MCParticleGraph &mcParticleGraph)
Constructor.
void EndOfEventAction(const G4Event *event)
This method is invoked at the very end of event processing.
void BeginOfEventAction(const G4Event *event)
This method is invoked before converting the primary particles to G4Track objects.
static void setActive(bool activeStatus)
Enable/Disable all Sensitive Detectors.
static const std::map< std::string, RelationArray::EConsolidationAction > & getMCParticleRelations()
Return a list of all registered Relations with MCParticles.
Abstract base class for different kinds of events.
Struct for identity transformation on indices.