11 #include "CLHEP/Random/RandFlat.h"
12 #include "CLHEP/Units/PhysicalConstants.h"
19 m_particleTable(particleTable),
23 m_flipProbability(0.),
24 m_enableSampling(false),
25 m_bufferFileName(
"buffer.bin"),
26 m_beamHaloParticleBuffer(0),
28 m_beamHaloGeneratorSettings(0),
59 std::cout <<
"=================================================================" << std::endl;
60 std::cout <<
"| | Total Number | Total Weight |" << std::endl;
61 std::cout <<
"|---------------------------------------------------------------|" << std::endl;
62 std::cout <<
"| Particles read from input file | ";
64 std::cout << std::setw(12) << std::setprecision(8) <<
m_wsums[
TOT_READ] <<
" |" << std::endl;
65 std::cout <<
"| Particles after cuts | ";
67 std::cout << std::setw(12) << std::setprecision(8) <<
m_wsums[
TOT_AFTER] <<
" |" << std::endl;
68 std::cout <<
"| Particles generated | ";
70 std::cout << std::setw(12) << std::setprecision(8) <<
m_wsums[
TOT_GEN] <<
" |" << std::endl;
71 std::cout <<
"=================================================================" << std::endl;
73 std::cout << std::setprecision(6);
85 if(
m_debug) std::cout <<
"Debug: Flipping event" << std::endl;
96 CLHEP::HepRandomEngine* engine) {
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);