9#include <generators/modules/HepevtOutputModule.h>
11#include <framework/datastore/StoreArray.h>
12#include <framework/datastore/StoreObjPtr.h>
13#include <framework/dataobjects/EventMetaData.h>
14#include <mdst/dataobjects/MCParticle.h>
33 setDescription(
"HepEvt file output. This module loads an event record from the MCParticle collection and store the content back into the HEPEVT format. HEPEVT format is a standard event record format to contain an event record in a Monte Carlo-independent format.");
37 addParam(
"MirrorPz",
m_mirrorPz,
"If the directions of HER and LER are switched, mirror Pz.",
false);
39 addParam(
"FullFormat",
m_fullFormat,
"Write the full HepEvt format to file. Set it to false for a compact format.",
true);
59 for (
int iPart = 0; iPart < nPart; ++iPart) {
65 m_fileStream << format(
"%10d%10d\n") % eventMetaDataPtr->getEvent() % (nPart - nVirtualPart);
67 for (
int iPart = 0; iPart < nPart; ++iPart) {
bool m_mirrorPz
If the directions of HER and LER are switched, mirror Pz.
virtual void initialize() override
Initializes the module.
bool m_storeVirtualParticles
Flag which specifies if virtual particles are stored in the HEPEvt file.
HepevtOutputModule()
Constructor.
virtual void event() override
Method is called for each event.
virtual void terminate() override
Terminates the module.
bool m_fullFormat
Flag which specifies if the full HepEvt format should be written (true), or a compact format (false).
std::ofstream m_fileStream
The text file stream.
std::string m_filename
The output filename.
A Class to store the Monte Carlo particle information.
float getEnergy() const
Return particle energy in GeV.
int getIndex() const
Get 1-based index of the particle in the corresponding MCParticle list.
float getMass() const
Return the particle mass in GeV.
ROOT::Math::XYZVector getVertex() const
Return production vertex position, shorthand for getProductionVertex().
int getLastDaughter() const
Get 1-based index of last daughter, 0 if no daughters.
int getPDG() const
Return PDG code of particle.
float getProductionTime() const
Return production time in ns.
ROOT::Math::XYZVector getMomentum() const
Return momentum.
int getFirstDaughter() const
Get 1-based index of first daughter, 0 if no daughters.
void setDescription(const std::string &description)
Sets the description of the module.
Accessor to arrays stored in the data store.
int getEntries() const
Get the number of objects in the array.
Type-safe access to single objects in the data store.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
bool isInitial() const
Check if particle is an initial particle such as ISR.
MCParticle * getMother() const
Returns a pointer to the mother particle.
bool isVirtual() const
Check if particle is virtual.
Abstract base class for different kinds of events.