Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
CexmcPrimaryGeneratorAction Class Reference

#include <CexmcPrimaryGeneratorAction.hh>

Inheritance diagram for CexmcPrimaryGeneratorAction:
G4VUserPrimaryGeneratorAction

Public Member Functions

 CexmcPrimaryGeneratorAction (CexmcPhysicsManager *physicsManager)
 
 ~CexmcPrimaryGeneratorAction ()
 
void GeneratePrimaries (G4Event *event)
 
void SetFwhmPosX (G4double value, G4bool fromMessenger=true)
 
void SetFwhmPosY (G4double value, G4bool fromMessenger=true)
 
void SetFwhmDirX (G4double value, G4bool fromMessenger=true)
 
void SetFwhmDirY (G4double value, G4bool fromMessenger=true)
 
void SetFwhmMomentumAmp (G4double value, G4bool fromMessenger=true)
 
G4double GetFwhmPosX (void) const
 
G4double GetFwhmPosY (void) const
 
G4double GetFwhmDirX (void) const
 
G4double GetFwhmDirY (void) const
 
G4double GetFwhmMomentumAmp (void) const
 
CexmcParticleGunGetParticleGun (void)
 
- Public Member Functions inherited from G4VUserPrimaryGeneratorAction
 G4VUserPrimaryGeneratorAction ()
 
virtual ~G4VUserPrimaryGeneratorAction ()
 

Detailed Description

Definition at line 56 of file CexmcPrimaryGeneratorAction.hh.

Constructor & Destructor Documentation

CexmcPrimaryGeneratorAction::CexmcPrimaryGeneratorAction ( CexmcPhysicsManager physicsManager)
explicit

Definition at line 54 of file CexmcPrimaryGeneratorAction.cc.

55  :
56  particleGun( NULL ), fwhmPosX( 0 ), fwhmPosY( 0 ), fwhmDirX( 0 ),
57  fwhmDirY( 0 ), messenger( NULL )
58 {
59  particleGun = new CexmcParticleGun( physicsManager );
60  messenger = new CexmcPrimaryGeneratorActionMessenger( this );
61 }
CexmcPrimaryGeneratorAction::~CexmcPrimaryGeneratorAction ( )

Definition at line 64 of file CexmcPrimaryGeneratorAction.cc.

65 {
66  delete particleGun;
67  delete messenger;
68 }

Member Function Documentation

void CexmcPrimaryGeneratorAction::GeneratePrimaries ( G4Event event)
virtual

Implements G4VUserPrimaryGeneratorAction.

Definition at line 71 of file CexmcPrimaryGeneratorAction.cc.

References CexmcFwhmToStddev(), G4ParticleGun::GeneratePrimaryVertex(), CexmcParticleGun::GetOrigDirection(), CexmcParticleGun::GetOrigMomentumAmp(), CexmcParticleGun::GetOrigPosition(), CexmcParticleGun::PrepareForNewEvent(), G4ParticleGun::SetParticleMomentum(), G4ParticleGun::SetParticleMomentumDirection(), G4VPrimaryGenerator::SetParticlePosition(), and G4INCL::DeJongSpin::shoot().

72 {
73  particleGun->PrepareForNewEvent();
74 
75  const G4ThreeVector & origPos( particleGun->GetOrigPosition() );
76  const G4ThreeVector & origDir( particleGun->GetOrigDirection() );
77  G4double origMomentumAmp( particleGun->GetOrigMomentumAmp() );
78 
79  G4double randPosX( G4RandGauss::shoot( origPos.x(),
80  fwhmPosX * CexmcFwhmToStddev ) );
81  G4double randPosY( G4RandGauss::shoot( origPos.y(),
82  fwhmPosY * CexmcFwhmToStddev ) );
83  G4ThreeVector newPos( randPosX, randPosY, origPos.z() );
84 
85  G4double randAngleX( G4RandGauss::shoot( origDir.x(),
86  fwhmDirX * CexmcFwhmToStddev ) );
87  G4double randAngleY( G4RandGauss::shoot( origDir.y(),
88  fwhmDirY * CexmcFwhmToStddev ) );
89  G4ThreeVector newAngle( randAngleX, randAngleY, origDir.z() );
90 
91  G4double newMomentumAmp( G4RandGauss::shoot( origMomentumAmp,
92  fwhmMomentumAmp * origMomentumAmp *
94 
95  particleGun->SetParticlePosition( newPos );
96  particleGun->SetParticleMomentumDirection( newAngle );
97  particleGun->SetParticleMomentum( newMomentumAmp );
98 
99  particleGun->GeneratePrimaryVertex( event );
100 }
ThreeVector shoot(const G4int Ap, const G4int Af)
void SetParticleMomentum(G4double aMomentum)
const G4ThreeVector & GetOrigPosition(void) const
G4double GetOrigMomentumAmp(void) const
void SetParticleMomentumDirection(G4ParticleMomentum aMomentumDirection)
virtual void GeneratePrimaryVertex(G4Event *evt)
void SetParticlePosition(G4ThreeVector aPosition)
void PrepareForNewEvent(void)
const G4double CexmcFwhmToStddev(0.42466)
double G4double
Definition: G4Types.hh:76
const G4ThreeVector & GetOrigDirection(void) const
G4double CexmcPrimaryGeneratorAction::GetFwhmDirX ( void  ) const
inline

Definition at line 172 of file CexmcPrimaryGeneratorAction.hh.

173 {
174  return fwhmDirX;
175 }
G4double CexmcPrimaryGeneratorAction::GetFwhmDirY ( void  ) const
inline

Definition at line 178 of file CexmcPrimaryGeneratorAction.hh.

179 {
180  return fwhmDirY;
181 }
G4double CexmcPrimaryGeneratorAction::GetFwhmMomentumAmp ( void  ) const
inline

Definition at line 184 of file CexmcPrimaryGeneratorAction.hh.

185 {
186  return fwhmMomentumAmp;
187 }
G4double CexmcPrimaryGeneratorAction::GetFwhmPosX ( void  ) const
inline

Definition at line 160 of file CexmcPrimaryGeneratorAction.hh.

161 {
162  return fwhmPosX;
163 }
G4double CexmcPrimaryGeneratorAction::GetFwhmPosY ( void  ) const
inline

Definition at line 166 of file CexmcPrimaryGeneratorAction.hh.

167 {
168  return fwhmPosY;
169 }
CexmcParticleGun * CexmcPrimaryGeneratorAction::GetParticleGun ( void  )

Definition at line 103 of file CexmcPrimaryGeneratorAction.cc.

Referenced by CexmcChargeExchangeReconstructor::CexmcChargeExchangeReconstructor().

104 {
105  return particleGun;
106 }
void CexmcPrimaryGeneratorAction::SetFwhmDirX ( G4double  value,
G4bool  fromMessenger = true 
)
inline

Definition at line 130 of file CexmcPrimaryGeneratorAction.hh.

References CexmcCmdIsNotAllowed, and ThrowExceptionIfProjectIsRead().

Referenced by CexmcPrimaryGeneratorActionMessenger::SetNewValue().

132 {
133  if ( fromMessenger )
135 
136  fwhmDirX = value;
137 }
const XML_Char int const XML_Char * value
void ThrowExceptionIfProjectIsRead(CexmcExceptionType type, G4bool extraCond=true)
void CexmcPrimaryGeneratorAction::SetFwhmDirY ( G4double  value,
G4bool  fromMessenger = true 
)
inline

Definition at line 140 of file CexmcPrimaryGeneratorAction.hh.

References CexmcCmdIsNotAllowed, and ThrowExceptionIfProjectIsRead().

Referenced by CexmcPrimaryGeneratorActionMessenger::SetNewValue().

142 {
143  if ( fromMessenger )
145 
146  fwhmDirY = value;
147 }
const XML_Char int const XML_Char * value
void ThrowExceptionIfProjectIsRead(CexmcExceptionType type, G4bool extraCond=true)
void CexmcPrimaryGeneratorAction::SetFwhmMomentumAmp ( G4double  value,
G4bool  fromMessenger = true 
)
inline

Definition at line 150 of file CexmcPrimaryGeneratorAction.hh.

References CexmcCmdIsNotAllowed, and ThrowExceptionIfProjectIsRead().

Referenced by CexmcPrimaryGeneratorActionMessenger::SetNewValue().

152 {
153  if ( fromMessenger )
155 
156  fwhmMomentumAmp = value;
157 }
const XML_Char int const XML_Char * value
void ThrowExceptionIfProjectIsRead(CexmcExceptionType type, G4bool extraCond=true)
void CexmcPrimaryGeneratorAction::SetFwhmPosX ( G4double  value,
G4bool  fromMessenger = true 
)
inline

Definition at line 110 of file CexmcPrimaryGeneratorAction.hh.

References CexmcCmdIsNotAllowed, and ThrowExceptionIfProjectIsRead().

Referenced by CexmcPrimaryGeneratorActionMessenger::SetNewValue().

112 {
113  if ( fromMessenger )
115 
116  fwhmPosX = value;
117 }
const XML_Char int const XML_Char * value
void ThrowExceptionIfProjectIsRead(CexmcExceptionType type, G4bool extraCond=true)
void CexmcPrimaryGeneratorAction::SetFwhmPosY ( G4double  value,
G4bool  fromMessenger = true 
)
inline

Definition at line 120 of file CexmcPrimaryGeneratorAction.hh.

References CexmcCmdIsNotAllowed, and ThrowExceptionIfProjectIsRead().

Referenced by CexmcPrimaryGeneratorActionMessenger::SetNewValue().

122 {
123  if ( fromMessenger )
125 
126  fwhmPosY = value;
127 }
const XML_Char int const XML_Char * value
void ThrowExceptionIfProjectIsRead(CexmcExceptionType type, G4bool extraCond=true)

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