Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 ()
 

Detailed Description

Definition at line 46 of file OpNovicePrimaryGeneratorAction.hh.

Constructor & Destructor Documentation

OpNovicePrimaryGeneratorAction::OpNovicePrimaryGeneratorAction ( )

Definition at line 47 of file OpNovicePrimaryGeneratorAction.cc.

49  fParticleGun(0)
50 {
51  G4int n_particle = 1;
52  fParticleGun = new G4ParticleGun(n_particle);
53 
54  //create a messenger for this class
55  fGunMessenger = new OpNovicePrimaryGeneratorMessenger(this);
56 
57  //default kinematic
58  //
60  G4ParticleDefinition* particle = particleTable->FindParticle("e+");
61 
62  fParticleGun->SetParticleDefinition(particle);
63  fParticleGun->SetParticleTime(0.0*ns);
64  fParticleGun->SetParticlePosition(G4ThreeVector(0.0*cm,0.0*cm,0.0*cm));
65  fParticleGun->SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));
66  fParticleGun->SetParticleEnergy(500.0*keV);
67 }
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
CLHEP::Hep3Vector G4ThreeVector
void SetParticleMomentumDirection(G4ParticleMomentum aMomentumDirection)
int G4int
Definition: G4Types.hh:78
void SetParticlePosition(G4ThreeVector aPosition)
static constexpr double cm
Definition: G4SIunits.hh:119
void SetParticleEnergy(G4double aKineticEnergy)
static G4ParticleTable * GetParticleTable()
static constexpr double keV
Definition: G4SIunits.hh:216
#define ns
Definition: xmlparse.cc:614
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)
void SetParticleTime(G4double aTime)

Here is the call graph for this function:

OpNovicePrimaryGeneratorAction::~OpNovicePrimaryGeneratorAction ( )
virtual

Definition at line 71 of file OpNovicePrimaryGeneratorAction.cc.

72 {
73  delete fParticleGun;
74  delete fGunMessenger;
75 }

Member Function Documentation

void OpNovicePrimaryGeneratorAction::GeneratePrimaries ( G4Event anEvent)
virtual

Implements G4VUserPrimaryGeneratorAction.

Definition at line 79 of file OpNovicePrimaryGeneratorAction.cc.

80 {
81  fParticleGun->GeneratePrimaryVertex(anEvent);
82 }
virtual void GeneratePrimaryVertex(G4Event *evt)

Here is the call graph for this function:

void OpNovicePrimaryGeneratorAction::SetOptPhotonPolar ( )

Definition at line 86 of file OpNovicePrimaryGeneratorAction.cc.

87 {
88  G4double angle = G4UniformRand() * 360.0*deg;
89  SetOptPhotonPolar(angle);
90 }
static G4double angle[DIM]
#define G4UniformRand()
Definition: Randomize.hh:97
double G4double
Definition: G4Types.hh:76
static constexpr double deg
Definition: G4SIunits.hh:152

Here is the caller graph for this function:

void OpNovicePrimaryGeneratorAction::SetOptPhotonPolar ( G4double  angle)

Definition at line 94 of file OpNovicePrimaryGeneratorAction.cc.

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

Here is the call graph for this function:


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