ATLAS Offline Software
Loading...
Searching...
No Matches
BeamHaloGenerator.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef BEAMHALOGENERATOR_H
6#define BEAMHALOGENERATOR_H
7
9#include <string>
10#include <vector>
11#include <memory>
12#include "AtlasHepMC/GenEvent.h"
13
14namespace HepPDT {
15 class ParticleDataTable;
16}
17namespace CLHEP {
18 class HepRandomEngine;
19}
21class AsciiInput;
24
33 public:
34
35 BeamHaloGenerator(const HepPDT::ParticleDataTable* particleTable,
36 const std::string& inputFile,
37 const std::vector<std::string>& generatorSettings);
38
39 virtual ~BeamHaloGenerator();
40
42 virtual int genInitialize();
43
45 virtual int genFinalize();
46
48 virtual int fillEvt(HepMC::GenEvent* evt,
49 CLHEP::HepRandomEngine* engine) = 0;
50
51 protected:
52
54 virtual int readEvent(std::vector<BeamHaloParticle> *beamHaloEvent,
55 CLHEP::HepRandomEngine* engine) = 0;
56
58 virtual int readParticle(BeamHaloParticle *beamHaloParticle) = 0;
59
60 public:
61
62
64 void setInterfacePlane(double interfacePlane) { m_interfacePlane = interfacePlane; }
65
67 void setEnableFlip(bool enableFlip) { m_enableFlip = enableFlip; }
68
70 void setFlipProbability(float flipProbability) { m_flipProbability = flipProbability; }
71
73 void setEnableSampling(bool enableSampling) { m_enableSampling = enableSampling; }
74
77 void setBufferFileName(const std::string& bufferFileName) { m_bufferFileName = bufferFileName; }
78
81
82 protected:
83
94
95
97 bool flipEvent(CLHEP::HepRandomEngine* engine);
98
101 int convertEvent(std::vector<BeamHaloParticle>* beamHaloEvent,
102 HepMC::GenEvent* evt,
103 CLHEP::HepRandomEngine* engine);
104
106 const HepPDT::ParticleDataTable* m_particleTable;
107
109 std::string m_inputFile;
110
113
116
119
122
125 std::string m_bufferFileName;
126
128 std::unique_ptr<BeamHaloParticleBuffer> m_beamHaloParticleBuffer;
129
132 std::unique_ptr<AsciiInput> m_asciiInput;
133
136 std::unique_ptr<BeamHaloGeneratorSettings> m_beamHaloGeneratorSettings;
137
140
147
150
153
156
157 private:
158
160 std::vector<std::string> m_generatorSettings;
161
162};
163
164#endif
165
const bool debug
A class to provide read access to an ASCII input file.
Definition AsciiInput.h:18
A GenModule algorithm to produce beam halo HepMC records from input ASCII files produced with MARS or...
A class to read a vector of strings defining particle filtering settings and provide a method for fil...
long m_eventNumber
A data member to count the event number.
double m_wsums[NUM_COUNTERS]
Sum of weights of particles or events of dimension enumCounters.
void setEnableSampling(bool enableSampling)
Turn on or off sampling from the input ASCII file.
float m_flipProbability
Flip probability.
void setBufferFileName(const std::string &bufferFileName)
Set the name of the binary buffer file, needed for sampling from a converted file.
virtual int readEvent(std::vector< BeamHaloParticle > *beamHaloEvent, CLHEP::HepRandomEngine *engine)=0
A function to read one event in a simplified format.
void setDebugEnable(bool debug)
A function to turn on or off debug print out.
int convertEvent(std::vector< BeamHaloParticle > *beamHaloEvent, HepMC::GenEvent *evt, CLHEP::HepRandomEngine *engine)
A member function to convert a vector of beam halo particles into a GenEvent.
std::unique_ptr< AsciiInput > m_asciiInput
A pointer to an AsciiInput object, used to read data from the Ascii input file.
virtual int readParticle(BeamHaloParticle *beamHaloParticle)=0
A function to read one particle from the input ASCII file.
std::string m_inputFile
Input file name.
bool m_enableFlip
Flag for flipping event.
virtual int genInitialize()
A function to initialise the generator.
BeamHaloGenerator(const HepPDT::ParticleDataTable *particleTable, const std::string &inputFile, const std::vector< std::string > &generatorSettings)
void setFlipProbability(float flipProbability)
Set probability of flipping an event about Z=0.
std::unique_ptr< BeamHaloParticleBuffer > m_beamHaloParticleBuffer
Binary particle buffer for caching converted events.
long m_counters[NUM_COUNTERS]
Particle or event counters of dimension enumCounters.
enumCounters
An enum of particle counter indices.
std::vector< std::string > m_generatorSettings
A vector of generator settings in string command form.
void setEnableFlip(bool enableFlip)
Turn on or off the event flipping code.
virtual int genFinalize()
A function to finalise the generator.
bool m_debug
A flat to turn on or off debug print out.
std::unique_ptr< BeamHaloGeneratorSettings > m_beamHaloGeneratorSettings
A pointer to a BeamHaloGeneratorSettings object used to filter particles.
virtual int fillEvt(HepMC::GenEvent *evt, CLHEP::HepRandomEngine *engine)=0
A function to create one event in HepMC format.
enumGeneratorProcessIds
An enum of generator process identifiers.
bool m_enableSampling
Flag to enable or disable sampling.
const HepPDT::ParticleDataTable * m_particleTable
A pointer to the particle data table.
void setInterfacePlane(double interfacePlane)
Set the position of the interface plane in mm.
double m_interfacePlane
The position of the interface plane in mm.
bool flipEvent(CLHEP::HepRandomEngine *engine)
A member function to check if the event should be flipped.
std::string m_bufferFileName
The name of the binary buffer file, needed for sampling from a converted file.
A class to describe a generic beam halo particle.