15 #include <G4PrimaryVertex.hh> 16 #include <G4PrimaryParticle.hh> 17 #include <G4ParticleTable.hh> 18 #include <G4ParticleDefinition.hh> 19 #include <G4Tokenizer.hh> 20 #include <G4UnitsTable.hh> 21 #include <Randomize.hh> 24 const G4String&
name,
const G4String& fluxName)
32 const G4LorentzVector&) {
35 double boxSize = 300*
cm;
36 G4LorentzVector eventVertex;
37 for (
int i=0; i<3; ++i) {
38 eventVertex[i] = 2*boxSize*G4UniformRand() - boxSize;
40 eventVertex[0] = -3.0*
meter;
41 eventVertex[2] -= 0.5*
meter;
46 G4PrimaryVertex* theVertex
47 =
new G4PrimaryVertex(G4ThreeVector(eventVertex.x(),
51 anEvent->AddPrimaryVertex(theVertex);
57 G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
58 G4ParticleDefinition* particleDef = particleTable->FindParticle(
"mu-");
63 momentum = G4RandGauss::shoot(4.0*
GeV,2*
GeV);
64 }
while (momentum<2*
GeV);
65 momentum *= G4UniformRand();
67 G4ThreeVector
dir(1.0,
68 G4RandGauss::shoot(0.0,0.15),
69 G4RandGauss::shoot(0.0,0.15));
72 std::cout <<
"Add rock muon at " 73 <<
" " << eventVertex.x()
74 <<
" " << eventVertex.y()
75 <<
" " << eventVertex.z()
76 <<
" " << eventVertex.t()
77 <<
" going " << dir.x()
83 G4PrimaryParticle* theParticle
84 =
new G4PrimaryParticle(particleDef,
88 theVertex->SetPrimary(theParticle);
static constexpr double cm
virtual GeneratorStatus GeneratePrimaryVertex(G4Event *evt, const G4LorentzVector &position)
Add a primary vertex to the event.
microsecond_as<> microsecond
Type of time stored in microseconds, in double precision.
GeneratorStatus
A status value that can be returned by GeneratePrimaryVertex.
Construct a module from components.
static constexpr double GeV
A vertex was successfully generated.
virtual ~NuMIRockKinematicsGenerator()
NuMIRockKinematicsGenerator(const G4String &name, const G4String &fluxName)
meter_as<> meter
Type of space stored in meters, in double precision.
def momentum(x1, x2, x3, scale=1.)
QTextStream & endl(QTextStream &s)