Public Member Functions | Private Attributes | List of all members
EDepSim::NuMIRockKinematicsGenerator Class Reference

#include <EDepSimNuMIRockKinematicsGenerator.hh>

Inheritance diagram for EDepSim::NuMIRockKinematicsGenerator:
EDepSim::VKinematicsGenerator

Public Member Functions

 NuMIRockKinematicsGenerator (const G4String &name, const G4String &fluxName)
 
virtual ~NuMIRockKinematicsGenerator ()
 
virtual GeneratorStatus GeneratePrimaryVertex (G4Event *evt, const G4LorentzVector &position)
 Add a primary vertex to the event. More...
 
- Public Member Functions inherited from EDepSim::VKinematicsGenerator
 VKinematicsGenerator (const G4String &name)
 
virtual ~VKinematicsGenerator ()
 
G4String GetName () const
 Return the name of the generator. More...
 

Private Attributes

std::string fFluxName
 The static part of the file name field. More...
 

Additional Inherited Members

- Public Types inherited from EDepSim::VKinematicsGenerator
enum  GeneratorStatus { kFail = 0, kSuccess, kLastVertex, kEndEvent }
 A status value that can be returned by GeneratePrimaryVertex. More...
 

Detailed Description

Definition at line 12 of file EDepSimNuMIRockKinematicsGenerator.hh.

Constructor & Destructor Documentation

EDepSim::NuMIRockKinematicsGenerator::NuMIRockKinematicsGenerator ( const G4String &  name,
const G4String &  fluxName 
)

Construct a new generator. The name is the name of the generator (e.g. GENIE, rock, &c). The fluxName is the name of the neutrino spectrum.

Definition at line 23 of file EDepSimNuMIRockKinematicsGenerator.cc.

static QCString name
Definition: declinfo.cpp:673
std::string fFluxName
The static part of the file name field.
EDepSim::NuMIRockKinematicsGenerator::~NuMIRockKinematicsGenerator ( )
virtual

Definition at line 27 of file EDepSimNuMIRockKinematicsGenerator.cc.

27 { }

Member Function Documentation

EDepSim::VKinematicsGenerator::GeneratorStatus EDepSim::NuMIRockKinematicsGenerator::GeneratePrimaryVertex ( G4Event *  evt,
const G4LorentzVector &  position 
)
virtual

Add a primary vertex to the event.

Implements EDepSim::VKinematicsGenerator.

Definition at line 30 of file EDepSimNuMIRockKinematicsGenerator.cc.

32  {
33 
34  // Make a position vertex...
35  double boxSize = 300*cm;
36  G4LorentzVector eventVertex;
37  for (int i=0; i<3; ++i) {
38  eventVertex[i] = 2*boxSize*G4UniformRand() - boxSize;
39  }
40  eventVertex[0] = -3.0*meter;
41  eventVertex[2] -= 0.5*meter;
42  eventVertex[3] = 10.0*microsecond*G4UniformRand();
43 
44  // Create a new vertex to add the new particles, and add the vertex to the
45  // event.
46  G4PrimaryVertex* theVertex
47  = new G4PrimaryVertex(G4ThreeVector(eventVertex.x(),
48  eventVertex.y(),
49  eventVertex.z()),
50  eventVertex.t());
51  anEvent->AddPrimaryVertex(theVertex);
52 
53  // Fill the particles to be tracked (status ==1). These particles are
54  // attached to the primary vertex. Also save the incident neutrino
55  // particle and the incident target nucleus; these particles are attached
56  // to informational vertex.
57  G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
58  G4ParticleDefinition* particleDef = particleTable->FindParticle("mu-");
59 
60  // Get the momentum.
61  double momentum;;
62  do {
63  momentum = G4RandGauss::shoot(4.0*GeV,2*GeV);
64  } while (momentum<2*GeV);
65  momentum *= G4UniformRand();
66 
67  G4ThreeVector dir(1.0,
68  G4RandGauss::shoot(0.0,0.15),
69  G4RandGauss::shoot(0.0,0.15));
70  dir = dir.unit();
71 
72  std::cout << "Add rock muon at "
73  << " " << eventVertex.x()
74  << " " << eventVertex.y()
75  << " " << eventVertex.z()
76  << " " << eventVertex.t()
77  << " going " << dir.x()
78  << " " << dir.y()
79  << " " << dir.z()
80  << std::endl;
81 
82  // Create the particle.
83  G4PrimaryParticle* theParticle
84  = new G4PrimaryParticle(particleDef,
85  momentum*dir.x(),
86  momentum*dir.y(),
87  momentum*dir.z());
88  theVertex->SetPrimary(theParticle);
89 
90  return kSuccess;
91 }
static constexpr double cm
Definition: Units.h:68
microsecond_as<> microsecond
Type of time stored in microseconds, in double precision.
Definition: spacetime.h:119
string dir
static constexpr double GeV
Definition: Units.h:28
A vertex was successfully generated.
meter_as<> meter
Type of space stored in meters, in double precision.
Definition: spacetime.h:400
def momentum(x1, x2, x3, scale=1.)
QTextStream & endl(QTextStream &s)

Member Data Documentation

std::string EDepSim::NuMIRockKinematicsGenerator::fFluxName
private

The static part of the file name field.

Definition at line 27 of file EDepSimNuMIRockKinematicsGenerator.hh.


The documentation for this class was generated from the following files: