File indexing completed on 2025-01-31 09:21:50
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044 #ifndef CEXMC_PRIMARY_GENERATOR_ACTION_HH
0045 #define CEXMC_PRIMARY_GENERATOR_ACTION_HH
0046
0047 #include <G4VUserPrimaryGeneratorAction.hh>
0048 #include "CexmcException.hh"
0049
0050 class G4Event;
0051 class CexmcParticleGun;
0052 class CexmcPhysicsManager;
0053 class CexmcPrimaryGeneratorActionMessenger;
0054
0055
0056 class CexmcPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
0057 {
0058 public:
0059 explicit CexmcPrimaryGeneratorAction(
0060 CexmcPhysicsManager * physicsManager );
0061
0062 ~CexmcPrimaryGeneratorAction();
0063
0064 public:
0065 void GeneratePrimaries( G4Event * event );
0066
0067 public:
0068 void SetFwhmPosX( G4double value, G4bool fromMessenger = true );
0069
0070 void SetFwhmPosY( G4double value, G4bool fromMessenger = true );
0071
0072 void SetFwhmDirX( G4double value, G4bool fromMessenger = true );
0073
0074 void SetFwhmDirY( G4double value, G4bool fromMessenger = true );
0075
0076 void SetFwhmMomentumAmp( G4double value,
0077 G4bool fromMessenger = true );
0078
0079 G4double GetFwhmPosX( void ) const;
0080
0081 G4double GetFwhmPosY( void ) const;
0082
0083 G4double GetFwhmDirX( void ) const;
0084
0085 G4double GetFwhmDirY( void ) const;
0086
0087 G4double GetFwhmMomentumAmp( void ) const;
0088
0089 public:
0090 CexmcParticleGun * GetParticleGun( void );
0091
0092 private:
0093 CexmcParticleGun * particleGun;
0094
0095 G4double fwhmPosX;
0096
0097 G4double fwhmPosY;
0098
0099 G4double fwhmDirX;
0100
0101 G4double fwhmDirY;
0102
0103 G4double fwhmMomentumAmp;
0104
0105 private:
0106 CexmcPrimaryGeneratorActionMessenger * messenger;
0107 };
0108
0109
0110 inline void CexmcPrimaryGeneratorAction::SetFwhmPosX( G4double value,
0111 G4bool fromMessenger )
0112 {
0113 if ( fromMessenger )
0114 ThrowExceptionIfProjectIsRead( CexmcCmdIsNotAllowed );
0115
0116 fwhmPosX = value;
0117 }
0118
0119
0120 inline void CexmcPrimaryGeneratorAction::SetFwhmPosY( G4double value,
0121 G4bool fromMessenger )
0122 {
0123 if ( fromMessenger )
0124 ThrowExceptionIfProjectIsRead( CexmcCmdIsNotAllowed );
0125
0126 fwhmPosY = value;
0127 }
0128
0129
0130 inline void CexmcPrimaryGeneratorAction::SetFwhmDirX( G4double value,
0131 G4bool fromMessenger )
0132 {
0133 if ( fromMessenger )
0134 ThrowExceptionIfProjectIsRead( CexmcCmdIsNotAllowed );
0135
0136 fwhmDirX = value;
0137 }
0138
0139
0140 inline void CexmcPrimaryGeneratorAction::SetFwhmDirY( G4double value,
0141 G4bool fromMessenger )
0142 {
0143 if ( fromMessenger )
0144 ThrowExceptionIfProjectIsRead( CexmcCmdIsNotAllowed );
0145
0146 fwhmDirY = value;
0147 }
0148
0149
0150 inline void CexmcPrimaryGeneratorAction::SetFwhmMomentumAmp( G4double value,
0151 G4bool fromMessenger )
0152 {
0153 if ( fromMessenger )
0154 ThrowExceptionIfProjectIsRead( CexmcCmdIsNotAllowed );
0155
0156 fwhmMomentumAmp = value;
0157 }
0158
0159
0160 inline G4double CexmcPrimaryGeneratorAction::GetFwhmPosX( void ) const
0161 {
0162 return fwhmPosX;
0163 }
0164
0165
0166 inline G4double CexmcPrimaryGeneratorAction::GetFwhmPosY( void ) const
0167 {
0168 return fwhmPosY;
0169 }
0170
0171
0172 inline G4double CexmcPrimaryGeneratorAction::GetFwhmDirX( void ) const
0173 {
0174 return fwhmDirX;
0175 }
0176
0177
0178 inline G4double CexmcPrimaryGeneratorAction::GetFwhmDirY( void ) const
0179 {
0180 return fwhmDirY;
0181 }
0182
0183
0184 inline G4double CexmcPrimaryGeneratorAction::GetFwhmMomentumAmp( void ) const
0185 {
0186 return fwhmMomentumAmp;
0187 }
0188
0189
0190 #endif
0191