|
ATLAS Offline Software
|
A class to provide conversion from a MARS format ASCII input record into HepMC format, with or without sampling.
More...
#include <MarsHaloGenerator.h>
|
virtual int | readEvent (std::vector< BeamHaloParticle > *beamHaloEvent, CLHEP::HepRandomEngine *engine) |
| A function to read one event in a simplified format. More...
|
|
virtual int | readParticle (BeamHaloParticle *beamHaloParticle) |
| A function to read one particle from the input ASCII file. More...
|
|
bool | flipEvent (CLHEP::HepRandomEngine *engine) |
| A member function to check if the event should be flipped. More...
|
|
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. More...
|
|
A class to provide conversion from a MARS format ASCII input record into HepMC format, with or without sampling.
- Author
- W. H. Bell W.Bel.nosp@m.l@ce.nosp@m.rn.ch
Definition at line 18 of file MarsHaloGenerator.h.
◆ enumCounters
An enum of particle counter indices.
Enumerator |
---|
TOT_READ | |
TOT_AFTER | |
TOT_GEN | |
NUM_COUNTERS | |
Definition at line 141 of file BeamHaloGenerator.h.
◆ enumGeneratorProcessIds
An enum of generator process identifiers.
_READ corresponds to no sampling and therefore simple conversion from input file to HepMC record.
Enumerator |
---|
MARS_READ | |
MARS_SINGLE | |
MARS_SHOWER | |
FLUKA_READ | |
FLUKA_SINGLE | |
FLUKA_SHOWER | |
Definition at line 86 of file BeamHaloGenerator.h.
◆ MarsHaloGenerator()
MarsHaloGenerator::MarsHaloGenerator |
( |
const HepPDT::ParticleDataTable * |
particleTable, |
|
|
const std::string & |
inputFile, |
|
|
const std::vector< std::string > & |
generatorSettings |
|
) |
| |
◆ ~MarsHaloGenerator()
virtual MarsHaloGenerator::~MarsHaloGenerator |
( |
| ) |
|
|
virtualdefault |
◆ convertEvent()
int BeamHaloGenerator::convertEvent |
( |
std::vector< BeamHaloParticle > * |
beamHaloEvent, |
|
|
HepMC::GenEvent * |
evt, |
|
|
CLHEP::HepRandomEngine * |
engine |
|
) |
| |
|
protectedinherited |
A member function to convert a vector of beam halo particles into a GenEvent.
Definition at line 94 of file BeamHaloGenerator.cxx.
101 const double c = 2.99792458E+11;
109 evt->weights().push_back((*itr).weight());
110 HepMC::FourVector primaryPosition = (*itr).positionAtPrimary();
111 evt->weights().push_back(primaryPosition.x());
112 evt->weights().push_back(primaryPosition.y());
113 evt->weights().push_back(primaryPosition.z());
114 evt->weights().push_back(primaryPosition.t());
118 for(;itr!=itr_end;++itr) {
119 HepMC::FourVector position = (*itr).positionAtScoringPlane();
120 HepMC::FourVector fourVector = (*itr).fourVector();
134 pz = fourVector.pz();
135 fourVector.setPz(-
pz);
148 genVertex->add_particle_out(genParticle);
149 evt->add_vertex(genVertex);
◆ fillEvt()
int MarsHaloGenerator::fillEvt |
( |
HepMC::GenEvent * |
evt, |
|
|
CLHEP::HepRandomEngine * |
engine |
|
) |
| |
|
virtual |
A function to create one event in HepMC format.
Implements BeamHaloGenerator.
Definition at line 71 of file MarsHaloGenerator.cxx.
73 std::vector<BeamHaloParticle> beamHaloEvent;
77 if((ret_val =
readEvent(&beamHaloEvent, engine)) != 0)
return ret_val;
87 evt->weights().clear();
92 evt->weights().push_back(beamHaloEvent[0].
weight());
96 evt->weights().push_back(1.0);
◆ flipEvent()
bool BeamHaloGenerator::flipEvent |
( |
CLHEP::HepRandomEngine * |
engine | ) |
|
|
protectedinherited |
A member function to check if the event should be flipped.
Definition at line 80 of file BeamHaloGenerator.cxx.
85 if(
m_debug) std::cout <<
"Debug: Flipping event" << std::endl;
◆ genFinalize()
int MarsHaloGenerator::genFinalize |
( |
| ) |
|
|
virtual |
◆ genInitialize()
int MarsHaloGenerator::genInitialize |
( |
| ) |
|
|
virtual |
A function to initialise the generator.
Reimplemented from BeamHaloGenerator.
Definition at line 24 of file MarsHaloGenerator.cxx.
31 std::cout <<
"Error: Could not open ascii input file " <<
m_inputFile << std::endl;
41 std::cout <<
"Error: Could not open binary buffer file " <<
m_bufferFileName <<
" for writing." << std::endl;
45 std::cout <<
"Info: Reading ascii input file " <<
m_inputFile <<
" into buffer" << std::endl;
52 if(ret_val < 0) { eof =
true;
continue; }
53 else if(ret_val > 0) {
continue; }
57 std::cout <<
"Warning: writeParticle failed." << std::endl;
◆ readEvent()
int MarsHaloGenerator::readEvent |
( |
std::vector< BeamHaloParticle > * |
beamHaloEvent, |
|
|
CLHEP::HepRandomEngine * |
engine |
|
) |
| |
|
protectedvirtual |
A function to read one event in a simplified format.
Implements BeamHaloGenerator.
Definition at line 163 of file MarsHaloGenerator.cxx.
169 beamHaloEvent->clear();
174 bool eof =
false, gotParticle =
false;
175 while(!eof && !gotParticle) {
177 if(ret_val < 0) { eof =
true; }
178 else if(ret_val == 0) { gotParticle =
true; }
186 if(!beamHaloParticle) {
187 std::cout <<
"Error: readRandomParticle failed." << std::endl;
198 beamHaloEvent->push_back(*beamHaloParticle);
201 delete beamHaloParticle;
◆ readParticle()
A function to read one particle from the input ASCII file.
Implements BeamHaloGenerator.
Definition at line 125 of file MarsHaloGenerator.cxx.
126 std::vector<std::string>
row;
131 if(
row.size() == 0)
return -1;
140 std::cout <<
"Warning: Conversion from MarsParticle to BeamHaloParticle failed." << std::endl;
150 if(
m_debug) std::cout <<
"Debug: Particle fails generator settings cuts." << std::endl;
◆ setBufferFileName()
void BeamHaloGenerator::setBufferFileName |
( |
const std::string & |
bufferFileName | ) |
|
|
inlineinherited |
Set the name of the binary buffer file, needed for sampling from a converted file.
Definition at line 76 of file BeamHaloGenerator.h.
◆ setDebugEnable()
void BeamHaloGenerator::setDebugEnable |
( |
bool |
debug | ) |
|
|
inlineinherited |
◆ setEnableFlip()
void BeamHaloGenerator::setEnableFlip |
( |
bool |
enableFlip | ) |
|
|
inlineinherited |
◆ setEnableSampling()
void BeamHaloGenerator::setEnableSampling |
( |
bool |
enableSampling | ) |
|
|
inlineinherited |
◆ setFlipProbability()
void BeamHaloGenerator::setFlipProbability |
( |
float |
flipProbability | ) |
|
|
inlineinherited |
◆ setInterfacePlane()
void BeamHaloGenerator::setInterfacePlane |
( |
double |
interfacePlane | ) |
|
|
inlineinherited |
◆ m_asciiInput
◆ m_beamHaloGeneratorSettings
◆ m_beamHaloParticleBuffer
◆ m_bufferFileName
std::string BeamHaloGenerator::m_bufferFileName |
|
protectedinherited |
The name of the binary buffer file, needed for sampling from a converted file.
Definition at line 124 of file BeamHaloGenerator.h.
◆ m_counters
◆ m_debug
bool BeamHaloGenerator::m_debug |
|
protectedinherited |
◆ m_enableFlip
bool BeamHaloGenerator::m_enableFlip |
|
protectedinherited |
◆ m_enableSampling
bool BeamHaloGenerator::m_enableSampling |
|
protectedinherited |
◆ m_eventNumber
long BeamHaloGenerator::m_eventNumber |
|
protectedinherited |
◆ m_flipProbability
float BeamHaloGenerator::m_flipProbability |
|
protectedinherited |
◆ m_generatorSettings
std::vector<std::string> BeamHaloGenerator::m_generatorSettings |
|
privateinherited |
◆ m_inputFile
std::string BeamHaloGenerator::m_inputFile |
|
protectedinherited |
◆ m_interfacePlane
double BeamHaloGenerator::m_interfacePlane |
|
protectedinherited |
◆ m_particleTable
const HepPDT::ParticleDataTable* BeamHaloGenerator::m_particleTable |
|
protectedinherited |
◆ m_wsums
Sum of weights of particles or events of dimension enumCounters.
Definition at line 151 of file BeamHaloGenerator.h.
The documentation for this class was generated from the following files:
HepMC::GenVertex * GenVertexPtr
JetConstituentVector::iterator iterator
bool m_enableFlip
Flag for flipping event.
A class to describe a generic beam halo particle.
virtual int readEvent(std::vector< BeamHaloParticle > *beamHaloEvent, CLHEP::HepRandomEngine *engine)
A function to read one event in a simplified format.
double m_wsums[NUM_COUNTERS]
Sum of weights of particles or events of dimension enumCounters.
double m_interfacePlane
The position of the interface plane in mm.
A class to describe a MARS particle read from an input ASCII file.
bool m_enableSampling
Flag to enable or disable sampling.
std::string m_bufferFileName
The name of the binary buffer file, needed for sampling from a converted file.
GenParticle * GenParticlePtr
long m_counters[NUM_COUNTERS]
Particle or event counters of dimension enumCounters.
BeamHaloGenerator(const HepPDT::ParticleDataTable *particleTable, const std::string &inputFile, const std::vector< std::string > &generatorSettings)
int writeParticle(BeamHaloParticle *particle)
A member function to append a particle to the binary file.
AsciiInput * m_asciiInput
A pointer to an AsciiInput object, used to read data from the Ascii input file.
const HepPDT::ParticleDataTable * m_particleTable
A pointer to the particle data table.
virtual int genFinalize()
A function to finalise the generator.
int fill(const HepPDT::ParticleDataTable *particleDataTable, MarsParticle *marsParticle)
A function to fill the data members from an input MarsParticle object.
GenVertexPtr newGenVertexPtr(const HepMC::FourVector &pos=HepMC::FourVector(0.0, 0.0, 0.0, 0.0), const int i=0)
int read(std::vector< std::string > *eventAsStringVector)
A function to read the values from a single row definition and fill the data members.
bool m_debug
A flat to turn on or off debug print out.
BeamHaloGeneratorSettings * m_beamHaloGeneratorSettings
A pointer to a BeamHaloGeneratorSettings object used to filter particles.
float m_flipProbability
Flip probability.
BeamHaloParticle * readRandomParticle(CLHEP::HepRandomEngine *engine)
A member function to read a random particle from the binary file.
virtual int readParticle(BeamHaloParticle *beamHaloParticle)
A function to read one particle from the input ASCII file.
long m_eventNumber
A data member to count the event number.
bool checkParticle(BeamHaloParticle *beamHaloParticle)
Check if the supplied beam halo particle passes the generator settings.
double weight() const
A function to return the weight of this particle within the input beam background simulation file.
GenParticlePtr newGenParticlePtr(const HepMC::FourVector &mom=HepMC::FourVector(0.0, 0.0, 0.0, 0.0), int pid=0, int status=0)
virtual int genInitialize()
A function to initialise the generator.
std::string m_inputFile
Input file name.
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.
BeamHaloParticleBuffer * m_beamHaloParticleBuffer
Binary particle buffer for caching converted events.
void set_signal_process_id(GenEvent *e, const int i)
bool flipEvent(CLHEP::HepRandomEngine *engine)
A member function to check if the event should be flipped.