|
ATLAS Offline Software
|
Go to the documentation of this file.
14 #include "CLHEP/Units/PhysicalConstants.h"
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;
72 CLHEP::HepRandomEngine* engine) {
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);
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;
164 CLHEP::HepRandomEngine* engine) {
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;
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.
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.
long m_counters[NUM_COUNTERS]
Particle or event counters of dimension enumCounters.
virtual int genFinalize()
A function to finalise the generator.
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.
virtual int fillEvt(HepMC::GenEvent *evt, CLHEP::HepRandomEngine *engine)
A function to create one event in HepMC format.
const HepPDT::ParticleDataTable * m_particleTable
A pointer to the particle data table.
An abstract base class to provide generic beam halo generator functionality.
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.
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.
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.
MarsHaloGenerator(const HepPDT::ParticleDataTable *particleTable, const std::string &inputFile, const std::vector< std::string > &generatorSettings)
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.
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)
virtual int genInitialize()
A function to initialise the generator.