Belle II Software development
EventAction.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/datastore/StoreObjPtr.h>
12#include <mdst/dataobjects/MCParticleGraph.h>
13
14#include <G4UserEventAction.hh>
15
16#include <fstream>
17
18class G4Event;
19
20namespace Belle2 {
25
26 class EventMetaData;
27
28 namespace Simulation {
29
34 class EventAction : public G4UserEventAction {
35
36 public:
42 EventAction(const std::string& mcCollectionName, MCParticleGraph& mcParticleGraph);
43
47 virtual ~EventAction();
48
54 void BeginOfEventAction(const G4Event* event);
55
61 void EndOfEventAction(const G4Event* event);
62
66 std::ofstream* getVREventStream() const { return m_VREventStream; }
67
68 protected:
69
70 std::string m_mcCollectionName;
72
73 private:
74
75 bool m_writeSimSteps{false};
76 std::ofstream* m_VREventStream{nullptr};
78
79 };
80
81 } // end namespace Simulation
83} // end namespace Belle2
Store event, run, and experiment numbers.
Class to build, validate and sort a particle decay chain.
std::string m_mcCollectionName
The name of the MCParticle collection to which the MCParticles should be written.
Definition EventAction.h:70
std::ofstream * m_VREventStream
Output stream for writing each step of event's history for the Virtual Reality.
Definition EventAction.h:76
MCParticleGraph & m_mcParticleGraph
Reference to the MCParticle graph which is converted to a MCParticle list by this class.
Definition EventAction.h:71
bool m_writeSimSteps
Flag for writing out the simulation steps.
Definition EventAction.h:75
virtual ~EventAction()
Destructor.
StoreObjPtr< EventMetaData > m_evtMetaData
Event metadata.
Definition EventAction.h:77
EventAction(const std::string &mcCollectionName, MCParticleGraph &mcParticleGraph)
Constructor.
std::ofstream * getVREventStream() const
This method gets the output stream for the event-history steps.
Definition EventAction.h:66
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.
Type-safe access to single objects in the data store.
Definition StoreObjPtr.h:96
Abstract base class for different kinds of events.