Geant4  10.02.p03
OpNovicePrimaryGeneratorAction Class Reference

#include <OpNovicePrimaryGeneratorAction.hh>

Inheritance diagram for OpNovicePrimaryGeneratorAction:
Collaboration diagram for OpNovicePrimaryGeneratorAction:

Public Member Functions

 OpNovicePrimaryGeneratorAction ()
 
virtual ~OpNovicePrimaryGeneratorAction ()
 
virtual void GeneratePrimaries (G4Event *)
 
void SetOptPhotonPolar ()
 
void SetOptPhotonPolar (G4double)
 
- Public Member Functions inherited from G4VUserPrimaryGeneratorAction
 G4VUserPrimaryGeneratorAction ()
 
virtual ~G4VUserPrimaryGeneratorAction ()
 

Private Attributes

G4ParticleGunfParticleGun
 
OpNovicePrimaryGeneratorMessengerfGunMessenger
 

Detailed Description

Definition at line 43 of file OpNovicePrimaryGeneratorAction.hh.

Constructor & Destructor Documentation

◆ OpNovicePrimaryGeneratorAction()

OpNovicePrimaryGeneratorAction::OpNovicePrimaryGeneratorAction ( )

Definition at line 44 of file OpNovicePrimaryGeneratorAction.cc.

46  fParticleGun(0)
47 {
48  G4int n_particle = 1;
49  fParticleGun = new G4ParticleGun(n_particle);
50 
51  //create a messenger for this class
53 
54  //default kinematic
55  //
57  G4ParticleDefinition* particle = particleTable->FindParticle("e+");
58 
64 }
static const double cm
Definition: G4SIunits.hh:118
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
CLHEP::Hep3Vector G4ThreeVector
void SetParticleMomentumDirection(G4ParticleMomentum aMomentumDirection)
int G4int
Definition: G4Types.hh:78
void SetParticlePosition(G4ThreeVector aPosition)
void SetParticleEnergy(G4double aKineticEnergy)
static G4ParticleTable * GetParticleTable()
static const double keV
Definition: G4SIunits.hh:213
#define ns
Definition: xmlparse.cc:614
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)
void SetParticleTime(G4double aTime)
OpNovicePrimaryGeneratorMessenger * fGunMessenger
Here is the call graph for this function:

◆ ~OpNovicePrimaryGeneratorAction()

OpNovicePrimaryGeneratorAction::~OpNovicePrimaryGeneratorAction ( )
virtual

Definition at line 68 of file OpNovicePrimaryGeneratorAction.cc.

69 {
70  delete fParticleGun;
71  delete fGunMessenger;
72 }
OpNovicePrimaryGeneratorMessenger * fGunMessenger

Member Function Documentation

◆ GeneratePrimaries()

void OpNovicePrimaryGeneratorAction::GeneratePrimaries ( G4Event anEvent)
virtual

Implements G4VUserPrimaryGeneratorAction.

Definition at line 76 of file OpNovicePrimaryGeneratorAction.cc.

77 {
79 }
virtual void GeneratePrimaryVertex(G4Event *evt)
Here is the call graph for this function:

◆ SetOptPhotonPolar() [1/2]

void OpNovicePrimaryGeneratorAction::SetOptPhotonPolar ( )

Definition at line 83 of file OpNovicePrimaryGeneratorAction.cc.

84 {
85  G4double angle = G4UniformRand() * 360.0*deg;
86  SetOptPhotonPolar(angle);
87 }
static G4double angle[DIM]
#define G4UniformRand()
Definition: Randomize.hh:97
static const double deg
Definition: G4SIunits.hh:151
double G4double
Definition: G4Types.hh:76
Here is the caller graph for this function:

◆ SetOptPhotonPolar() [2/2]

void OpNovicePrimaryGeneratorAction::SetOptPhotonPolar ( G4double  angle)

Definition at line 91 of file OpNovicePrimaryGeneratorAction.cc.

92 {
93  if (fParticleGun->GetParticleDefinition()->GetParticleName()!="opticalphoton")
94  {
95  G4cout << "--> warning from PrimaryGeneratorAction::SetOptPhotonPolar() :"
96  "the particleGun is not an opticalphoton" << G4endl;
97  return;
98  }
99 
100  G4ThreeVector normal (1., 0., 0.);
102  G4ThreeVector product = normal.cross(kphoton);
103  G4double modul2 = product*product;
104 
105  G4ThreeVector e_perpend (0., 0., 1.);
106  if (modul2 > 0.) e_perpend = (1./std::sqrt(modul2))*product;
107  G4ThreeVector e_paralle = e_perpend.cross(kphoton);
108 
109  G4ThreeVector polar = std::cos(angle)*e_paralle + std::sin(angle)*e_perpend;
111 }
static G4double angle[DIM]
static double normal(HepRandomEngine *eptr)
Definition: RandPoisson.cc:77
G4ParticleMomentum GetParticleMomentumDirection() const
void SetParticlePolarization(G4ThreeVector aVal)
const G4String & GetParticleName() const
G4GLOB_DLL std::ostream G4cout
Hep3Vector cross(const Hep3Vector &) const
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
G4ParticleDefinition * GetParticleDefinition() const
Here is the call graph for this function:

Member Data Documentation

◆ fGunMessenger

OpNovicePrimaryGeneratorMessenger* OpNovicePrimaryGeneratorAction::fGunMessenger
private

Definition at line 57 of file OpNovicePrimaryGeneratorAction.hh.

◆ fParticleGun

G4ParticleGun* OpNovicePrimaryGeneratorAction::fParticleGun
private

Definition at line 56 of file OpNovicePrimaryGeneratorAction.hh.


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