50 generatorInput(
singleFixed), verboseLevel(0), n_particle(1),
51 particleName(
"pi-"), particleEnergy(100*
GeV), particlePosition(0.,0.,0.),
91 if (isInitialized == 0) initialize();
100 G4double randomX = std::sin(theta)*std::cos(phi);
101 G4double randomY = std::sin(theta)*std::sin(phi);
107 if (verboseLevel >= 2 ) {
108 G4cout <<
"Energy " << particleEnergy/
GeV <<
" GeV; Theta "
109 << theta/
deg <<
" degree; Phi " << phi/
deg <<
" degree" <<
G4endl;
110 G4cout <<
"Shooting in " << particleDir <<
" direction "<<
G4endl;
115 if (scanSteps == 0) {
116 scanPhiStep = (phiMax - phiMin) / phiSteps;
117 phiValue = phiMin - scanPhiStep;
121 scanEtaStep = (etaMax - etaMin) / etaSteps;
122 scanPhiStep = (phiMax - phiMin) / phiSteps;
124 if (verboseLevel > 2 ) {
125 G4cout <<
" scanEtaStep " << scanEtaStep <<
" # of Steps " << etaSteps
127 G4cout <<
" scanPhiStep " << scanPhiStep <<
" # of Steps " << phiSteps
133 if (phiMax - phiValue < 1.E-6 * scanPhiStep) {
134 if (etaMax - etaValue < 1.E-6 * scanEtaStep) {
138 etaValue += scanEtaStep;
142 phiValue += scanPhiStep;
146 G4double scanX = std::sin(theta)*std::cos(phiValue);
147 G4double scanY = std::sin(theta)*std::sin(phiValue);
149 if (verboseLevel >= 2 ) {
150 G4cout <<
"Scan eta " << etaValue <<
" Phi " << phiValue/
deg
156 if (verboseLevel > 2 ) {
157 G4cout <<
"Shooting in " << particleDir <<
" direction "<<
G4endl;
201 G4cerr <<
"CCalPrimaryGeneratorAction::SetMinimumEnergy: value " << p/
GeV
202 <<
"GeV is out of bounds, it will not be used" <<
G4endl;
207 if (verboseLevel >= 1 ) {
208 G4cout <<
" CCalPrimaryGeneratorAction: setting min. value of energy to "
219 G4cerr <<
"CCalPrimaryGeneratorAction::SetMaximumEnergy: value " << p/
GeV
220 <<
"GeV is out of bounds, it will not be used" <<
G4endl;
225 if (verboseLevel >= 1 ) {
226 G4cout <<
" CCalPrimaryGeneratorAction: setting max. value of energy to "
236 if (std::fabs(p)>2.*
pi) {
237 G4cerr <<
"CCalPrimaryGeneratorAction::SetMinimumPhi: setting value quite "
239 G4cerr <<
" Should be given in radians - Please check" <<
G4endl;
241 phiMin = std::fabs(p);
243 if (verboseLevel >= 1 ) {
244 G4cout <<
" CCalPrimaryGeneratorAction: setting min. value of phi to "
254 if (std::fabs(p)>2.*
pi) {
255 G4cerr <<
"CCalPrimaryGeneratorAction::SetMaximumPhi: setting value quite "
257 G4cerr <<
" Should be given in radians - Please check" <<
G4endl;
259 phiMax = std::fabs(p);
261 if (verboseLevel >= 1 ) {
262 G4cout <<
" CCalPrimaryGeneratorAction: setting max. value of phi to "
273 G4cerr <<
"CCalPrimaryGeneratorAction::SetStepsPhi: value " << val
274 <<
" is out of bounds, it will not be used" <<
G4endl;
279 if (verboseLevel >= 1 ) {
280 G4cout <<
" CCalPrimaryGeneratorAction: setting no. of steps in phi to "
292 if (verboseLevel >= 1 ) {
293 G4cout <<
" CCalPrimaryGeneratorAction: setting min. value of eta to "
304 if (verboseLevel >= 1 ) {
305 G4cout <<
" CCalPrimaryGeneratorAction: setting max. value of eta to "
315 G4cerr<<
"CCalPrimaryGeneratorAction::SetStepsEta: value " << val <<
" is out of bounds, it will not be used"<<
G4endl;
320 if (verboseLevel >= 1 ) {
321 G4cout <<
" CCalPrimaryGeneratorAction: setting no. of steps in eta to "
337 void CCalPrimaryGeneratorAction::initialize(){
345 void CCalPrimaryGeneratorAction::print(
G4int val){
348 if (verboseLevel >= val) {
352 <<
"**********************************************************************" <<
G4endl
354 <<
"* CCalPrimaryGeneratorAction DEFAULT Random Energy/Direction setting:*" <<
G4endl
357 <<
"* Energy in [ "<< energyMin/
GeV <<
" - " << energyMax/
GeV <<
"] (GeV) "<<
G4endl
358 <<
"* Phi angle in [ "<< phiMin <<
" - " << phiMax <<
"] (rad) "<<
G4endl
360 <<
"* Eta in [ "<< etaMin <<
" - " << etaMax <<
"] "<<
G4endl
363 <<
"**********************************************************************" <<
G4endl;
366 <<
"**********************************************************************" <<
G4endl
368 <<
"* CCalPrimaryGeneratorAction DEFAULT Scan Direction settings : *" <<
G4endl
371 <<
"* Phi angle in [ " << phiMin/
degree <<
" - " << phiMax/
degree <<
"] (deg) " <<
G4endl
372 <<
"* Eta in [ " << etaMin <<
" - " << etaMax <<
"] " <<
G4endl
373 <<
"* Steps along eta " << etaSteps <<
" and along phi " << phiSteps <<
G4endl
376 <<
"**********************************************************************" <<
G4endl;
379 <<
"*******************************************************************" <<
G4endl
381 <<
"* CCalPrimaryGeneratorAction: Current settings : *" <<
G4endl
390 <<
"*******************************************************************" <<
G4endl;
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
void SetVerboseLevel(G4int val)
CLHEP::Hep3Vector G4ThreeVector
void GeneratePrimaries(G4Event *anEvent)
void SetMinimumEta(G4double p)
~CCalPrimaryGeneratorAction()
void SetMaximumEta(G4double p)
void SetParticleMomentumDirection(G4ParticleMomentum aMomentumDirection)
G4ThreeVector GetParticlePosition()
void SetStepsPhi(G4int val)
virtual void GeneratePrimaryVertex(G4Event *evt)
const G4String & GetParticleName() const
CCalPrimaryGeneratorAction()
void SetStepsEta(G4int val)
static constexpr double TeV
void SetScan(G4String val)
G4ParticleMomentum GetParticleMomentumDirection() const
void SetParticlePosition(G4ThreeVector aPosition)
G4GLOB_DLL std::ostream G4cout
static constexpr double degree
void SetRandom(G4String val)
void SetGunPosition(const G4ThreeVector &pos) const
void SetMinimumEnergy(G4double p)
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
G4int GetNumberOfParticles() const
void SetParticleEnergy(G4double aKineticEnergy)
static G4RunManager * GetRunManager()
void SetMinimumPhi(G4double p)
static G4ParticleTable * GetParticleTable()
void SetRunIDCounter(G4int i)
G4ParticleDefinition * GetParticleDefinition() const
static constexpr double GeV
static constexpr double pi
void SetMaximumEnergy(G4double p)
void SetMaximumPhi(G4double p)
static constexpr double deg
static const G4double pos
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)
G4double GetParticleEnergy() const
G4GLOB_DLL std::ostream G4cerr