Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes | List of all members
VG01PrimaryGeneratorAction Class Reference

Configurable primary generator action to demonstrate use of VecGeom Navigation. More...

#include <Doxymodules_geometry.h>

Inheritance diagram for VG01PrimaryGeneratorAction:
G4VUserPrimaryGeneratorAction

Public Types

enum  EGeneratorMode { kFixedMode , kUniformMode , kAxisMode , kFreeMode }
 

Public Member Functions

 VG01PrimaryGeneratorAction (EGeneratorMode mode=kUniformMode)
 
 ~VG01PrimaryGeneratorAction ()
 
void GeneratePrimaries (G4Event *anEvent) override
 
void SetGeneratorMode (EGeneratorMode val)
 
EGeneratorMode GetGeneratorMode ()
 

Private Attributes

G4ParticleGunfParticleGun
 
EGeneratorMode fMode
 

Detailed Description

Configurable primary generator action to demonstrate use of VecGeom Navigation.

Definition at line 28 of file Doxymodules_geometry.h.

Member Enumeration Documentation

◆ EGeneratorMode

Constructor & Destructor Documentation

◆ VG01PrimaryGeneratorAction()

VG01PrimaryGeneratorAction::VG01PrimaryGeneratorAction ( EGeneratorMode  mode = kUniformMode)

Definition at line 45 of file VG01PrimaryGeneratorAction.cc.

47 fParticleGun(0),
48 fMode(mode)
49{
50 G4int n_particle = 1;
51 fParticleGun = new G4ParticleGun(n_particle);
52
53 G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
54 G4String particleName;
55 fParticleGun->SetParticleDefinition(
56 particleTable->FindParticle(particleName="geantino"));
57 fParticleGun->SetParticleEnergy(1.0*GeV);
58 fParticleGun->SetParticlePosition(G4ThreeVector(0,0,0) ); // -1.2*m, 0.1, 0.1));
59}

◆ ~VG01PrimaryGeneratorAction()

VG01PrimaryGeneratorAction::~VG01PrimaryGeneratorAction ( )

Definition at line 63 of file VG01PrimaryGeneratorAction.cc.

64{
65 delete fParticleGun;
66}

Member Function Documentation

◆ GeneratePrimaries()

void VG01PrimaryGeneratorAction::GeneratePrimaries ( G4Event anEvent)
override

Definition at line 70 of file VG01PrimaryGeneratorAction.cc.

71{
72 G4ThreeVector dir(1.0,0.0,0.0);
73
74 // G4ThreeVector FixedMode[3] =
75 // { G4ThreeVector(1,0,0), G4ThreeVector(1,0.1,0), G4ThreeVector( 1, 0, 0.1)};
76 G4ThreeVector AxisModeVectors[3] =
77 { G4ThreeVector(1,0,0), G4ThreeVector(0,1,0), G4ThreeVector( 0, 0, 1.0)};
78
79 if( fMode == kFreeMode ){
80 // Do not fix the direction
81 // -- UI commands to particle mode can change it!
82 fParticleGun->GeneratePrimaryVertex(anEvent);
83 return;
84 //----
85 }
86 else if( fMode == kFixedMode )
87 {
88 G4int i = anEvent->GetEventID() % 3;
89 dir= G4ThreeVector(1.0,0.0,0.0);
90 switch(i)
91 {
92 case 0:
93 break;
94 case 1:
95 dir.setY(0.1);
96 break;
97 case 2:
98 dir.setZ(0.1);
99 break;
100 }
101 }
102 else if( fMode == kUniformMode )
103 {
104 dir = G4RandomDirection();
105 }
106 else if ( fMode == kAxisMode )
107 {
108 G4int i = anEvent->GetEventID() % 3;
109 dir = AxisModeVectors[i];
110 }
111
112 fParticleGun->SetParticleMomentumDirection(dir);
113 fParticleGun->GeneratePrimaryVertex(anEvent);
114}

◆ SetGeneratorMode()

void VG01PrimaryGeneratorAction::SetGeneratorMode ( EGeneratorMode  val)
inline

Definition at line 67 of file VG01PrimaryGeneratorAction.hh.

67{ fMode = val;}

◆ GetGeneratorMode()

EGeneratorMode VG01PrimaryGeneratorAction::GetGeneratorMode ( )
inline

Definition at line 68 of file VG01PrimaryGeneratorAction.hh.

68{ return fMode;}

Member Data Documentation

◆ fParticleGun

G4ParticleGun* VG01PrimaryGeneratorAction::fParticleGun
private

Definition at line 71 of file VG01PrimaryGeneratorAction.hh.

◆ fMode

EGeneratorMode VG01PrimaryGeneratorAction::fMode
private

Definition at line 72 of file VG01PrimaryGeneratorAction.hh.


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

Applications | User Support | Publications | Collaboration