12#include "CLHEP/Random/RandFlat.h"
16 const HepPDT::ParticleDataTable* particleTable,
17 const std::string& inputFile,
18 const std::vector<std::string>& generatorSettings):
36 std::cout <<
"Error: Could not open ascii input file " <<
m_inputFile << std::endl;
40 std::cout <<
"Info: Reading ascii input file " <<
m_inputFile << std::endl;
49 CLHEP::HepRandomEngine* engine) {
50 std::vector<BeamHaloParticle> beamHaloEvent;
54 if((ret_val =
readEvent(&beamHaloEvent, engine)) != 0)
return ret_val;
89 std::cout <<
"Warning: FlukaHaloGenerator::readParticle is not yet available: "<< beamHaloParticle << std::endl;
96 CLHEP::HepRandomEngine* engine) {
100 beamHaloEvent->clear();
110 std::cout <<
"Error: Conversion from FlukaParticle to BeamHaloParticle failed." << std::endl;
114 beamHaloEvent->push_back(beamHaloParticle);
124 std::vector<std::string> row;
125 bool endOfFile =
false;
129 if(row.size() == 0) {
163 std::cout <<
"Error: Conversion from FlukaParticle to BeamHaloParticle failed." << std::endl;
168 beamHaloEvent->push_back(beamHaloParticle);
176 if(beamHaloEvent->size() == 0) {
177 std::cout <<
"Error: No particles read from " <<
m_inputFile << std::endl;
185 std::vector<BeamHaloParticle>::iterator itr = beamHaloEvent->begin();
186 std::vector<BeamHaloParticle>::iterator itr_end = beamHaloEvent->end();
188 for(;itr!=itr_end;++itr) {
189 beamHaloParticle = *itr;
195 if(
m_debug) std::cout <<
"Debug: Particle fails generator settings cuts." << std::endl;
209 if((ret_val =
readEvent(beamHaloEvent, engine)) != 0)
return ret_val;
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.
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.
BeamHaloGeneratorSettings * m_beamHaloGeneratorSettings
A pointer to a BeamHaloGeneratorSettings object used to filter particles.
std::string m_inputFile
Input file name.
virtual int genInitialize()
A function to initialise the generator.
BeamHaloGenerator(const HepPDT::ParticleDataTable *particleTable, const std::string &inputFile, const std::vector< std::string > &generatorSettings)
long m_counters[NUM_COUNTERS]
Particle or event counters of dimension enumCounters.
AsciiInput * m_asciiInput
A pointer to an AsciiInput object, used to read data from the Ascii input file.
virtual int genFinalize()
A function to finalise the generator.
bool m_debug
A flat to turn on or off debug print out.
const HepPDT::ParticleDataTable * m_particleTable
A pointer to the particle data table.
A class to describe a generic beam halo particle.
int fill(const HepPDT::ParticleDataTable *particleDataTable, MarsParticle *marsParticle)
A function to fill the data members from an input MarsParticle object.
FlukaParticle m_lastFlukaParticle
virtual int readParticle(BeamHaloParticle *beamHaloParticle)
A function to read one particle from the input ASCII file.
FlukaHaloGenerator(int type, const HepPDT::ParticleDataTable *particleTable, const std::string &inputFile, const std::vector< std::string > &generatorSettings)
virtual int genInitialize()
A function to initialise the generator.
virtual int fillEvt(HepMC::GenEvent *evt, CLHEP::HepRandomEngine *engine)
A function to create one event in HepMC format.
virtual int genFinalize()
A function to finalise the generator.
virtual int readEvent(std::vector< BeamHaloParticle > *beamHaloEvent, CLHEP::HepRandomEngine *engine)
A function to read one event in a simplified format.
FlukaParticle m_flukaParticle
void set_signal_process_id(GenEvent *e, const int i)