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#ifndef EVENTACTION_H_
10#define EVENTACTION_H_
11
12#include <framework/dataobjects/EventMetaData.h>
13#include <framework/datastore/StoreObjPtr.h>
14#include <mdst/dataobjects/MCParticleGraph.h>
15
16#include <G4UserEventAction.hh>
17
18#include <fstream>
19
20class G4Event;
21
22namespace Belle2 {
28 class MCParticleGraph;
29
30 namespace Simulation {
31
36 class EventAction : public G4UserEventAction {
37
38 public:
44 EventAction(const std::string& mcCollectionName, MCParticleGraph& mcParticleGraph);
45
49 virtual ~EventAction();
50
56 void BeginOfEventAction(const G4Event* event);
57
63 void EndOfEventAction(const G4Event* event);
64
68 std::ofstream* getVREventStream() const { return m_VREventStream; }
69
70 protected:
71
72 std::string m_mcCollectionName;
75 private:
76
77 bool m_writeSimSteps{false};
78 std::ofstream* m_VREventStream{nullptr};
81 };
82
83 } // end namespace Simulation
85} // end namespace Belle2
86
87#endif /* EVENTACTION_H_ */
Class to build, validate and sort a particle decay chain.
The Event Action class.
Definition: EventAction.h:36
std::string m_mcCollectionName
The name of the MCParticle collection to which the MCParticles should be written.
Definition: EventAction.h:72
std::ofstream * m_VREventStream
Output stream for writing each step of event's history for the Virtual Reality.
Definition: EventAction.h:78
MCParticleGraph & m_mcParticleGraph
Reference to the MCParticle graph which is converted to a MCParticle list by this class.
Definition: EventAction.h:73
bool m_writeSimSteps
Flag for writing out the simulation steps.
Definition: EventAction.h:77
virtual ~EventAction()
Destructor.
Definition: EventAction.cc:36
StoreObjPtr< EventMetaData > m_evtMetaData
Event metadata.
Definition: EventAction.h:79
std::ofstream * getVREventStream() const
This method gets the output stream for the event-history steps.
Definition: EventAction.h:68
void EndOfEventAction(const G4Event *event)
This method is invoked at the very end of event processing.
Definition: EventAction.cc:64
void BeginOfEventAction(const G4Event *event)
This method is invoked before converting the primary particles to G4Track objects.
Definition: EventAction.cc:46
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
Abstract base class for different kinds of events.