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

#include <ML2PrimaryGenerationAction.hh>

Inheritance diagram for CML2PrimaryGenerationAction:
G4VUserPrimaryGeneratorAction

Public Member Functions

 CML2PrimaryGenerationAction (void)
 
 ~CML2PrimaryGenerationAction (void)
 
void design (G4double accTargetZPosition)
 
void GeneratePrimaries (G4Event *anEvent)
 
void inizialize (SPrimaryParticle *primaryParticleData)
 
void setNRecycling (G4int val)
 
void setNLoopsPhSpParticles (G4int val)
 
void setNMaxParticlesInRamPhaseSpace (G4int val)
 
void setGunMeanEnergy (G4double val)
 
void setGunStdEnergy (G4double val)
 
void setGunRadious (G4double val)
 
void setCalculatedPhaseSpaceFileIN (G4String val)
 
void setSourceTypeName (G4String val)
 
void setRotation (G4RotationMatrix *val)
 
G4int getNrecycling ()
 
G4int getSourceTypeName ()
 
- Public Member Functions inherited from G4VUserPrimaryGeneratorAction
 G4VUserPrimaryGeneratorAction ()
 
virtual ~G4VUserPrimaryGeneratorAction ()
 

Static Public Member Functions

static
CML2PrimaryGenerationAction
GetInstance (void)
 

Detailed Description

Definition at line 65 of file ML2PrimaryGenerationAction.hh.

Constructor & Destructor Documentation

CML2PrimaryGenerationAction::CML2PrimaryGenerationAction ( void  )

Definition at line 47 of file ML2PrimaryGenerationAction.cc.

Referenced by GetInstance().

48 :particleGun(0),gamma(0),electron(0),positron(0),primaryParticleData(0),particles(0)
49 {
50 }
CML2PrimaryGenerationAction::~CML2PrimaryGenerationAction ( void  )

Definition at line 108 of file ML2PrimaryGenerationAction.cc.

109 {
110  delete particleGun;
111  delete [] particles;
112  delete particles;
113 }

Member Function Documentation

void CML2PrimaryGenerationAction::design ( G4double  accTargetZPosition)

Definition at line 80 of file ML2PrimaryGenerationAction.cc.

References id_phaseSpace, and id_randomTarget.

Referenced by main().

81 {
82  accTargetZPosition=aTZ;
83  switch (idParticleSource)
84  {
85  case id_randomTarget:
86  setGunRandom();
87  break;
88  case id_phaseSpace:
89  setGunCalculatedPhaseSpace();
90  break;
91  }
92 }
idParticleSource
void CML2PrimaryGenerationAction::GeneratePrimaries ( G4Event anEvent)
virtual

Implements G4VUserPrimaryGeneratorAction.

Definition at line 114 of file ML2PrimaryGenerationAction.cc.

References G4ParticleGun::GeneratePrimaryVertex(), G4ParticleGun::GetParticleDefinition(), G4ParticleDefinition::GetPDGEncoding(), id_phaseSpace, id_randomTarget, python.hepunit::MeV, python.hepunit::mm, SPrimaryParticle::nPrimaryParticle, SPrimaryParticle::partPDGE, G4ParticleGun::SetParticleEnergy(), G4ParticleGun::SetParticleMomentumDirection(), and G4VPrimaryGenerator::SetParticlePosition().

115 {
116  static int currentRecycle=nRecycling;
117  static G4ThreeVector pos0, dir0;
118  if (currentRecycle==nRecycling)
119  {
120  currentRecycle=0;
121  switch (idCurrentParticleSource)
122  {
123  case id_randomTarget:
124  GenerateFromRandom();
125  break;
126  case id_phaseSpace:
127  GenerateFromCalculatedPhaseSpace();
128  break;
129  }
130  pos0=pos;
131  dir0=dir;
132  }
133  currentRecycle++;
134  pos=pos0;
135  dir=dir0;
136  applySourceRotation(); // to follow the accelerator rotation
137 
138  primaryParticleData->partPDGE=particleGun->GetParticleDefinition()->GetPDGEncoding();
139  primaryParticleData->nPrimaryParticle++;
140 
141  particleGun->SetParticleEnergy(ek*MeV);
142  particleGun->SetParticlePosition(pos*mm);
144  particleGun->GeneratePrimaryVertex(anEvent);
145 }
void SetParticleMomentumDirection(G4ParticleMomentum aMomentumDirection)
virtual void GeneratePrimaryVertex(G4Event *evt)
void SetParticlePosition(G4ThreeVector aPosition)
void SetParticleEnergy(G4double aKineticEnergy)
G4ParticleDefinition * GetParticleDefinition() const
CML2PrimaryGenerationAction * CML2PrimaryGenerationAction::GetInstance ( void  )
static

Definition at line 53 of file ML2PrimaryGenerationAction.cc.

References CML2PrimaryGenerationAction().

Referenced by main(), CML2WorldConstruction::newGeometry(), and CML2AcceleratorConstructionMessenger::SetNewValue().

54 {
55  if (instance == 0)
56  {
57  instance = new CML2PrimaryGenerationAction();
58  }
59  return instance;
60 }
G4int CML2PrimaryGenerationAction::getNrecycling ( )
inline

Definition at line 96 of file ML2PrimaryGenerationAction.hh.

Referenced by main().

96 {return nRecycling;};
G4int CML2PrimaryGenerationAction::getSourceTypeName ( )
inline

Definition at line 97 of file ML2PrimaryGenerationAction.hh.

97 {return idParticleSource;};
idParticleSource
void CML2PrimaryGenerationAction::inizialize ( SPrimaryParticle primaryParticleData)

Definition at line 61 of file ML2PrimaryGenerationAction.cc.

References G4ParticleTable::FindParticle(), G4ParticleTable::GetParticleTable(), SPrimaryParticle::nPrimaryParticle, and SPrimaryParticle::partPDGE.

Referenced by main().

62 {
63  rm=new G4RotationMatrix();
64  PrimaryGenerationActionMessenger=new CML2PrimaryGenerationActionMessenger(this);
65  particle=new Sparticle;
66  nParticle=nPhSpParticles=nRandomParticles=0;
67 
69 
70  gamma=particleTable->FindParticle("gamma");
71  electron=particleTable->FindParticle("e-");
72  positron=particleTable->FindParticle("e+");
73  particleGun=new G4ParticleGun();
74 
75  primaryParticleData=pData;
76  primaryParticleData->nPrimaryParticle=0;
77  primaryParticleData->partPDGE=0;
78 }
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
CLHEP::HepRotation G4RotationMatrix
static G4ParticleTable * GetParticleTable()
void CML2PrimaryGenerationAction::setCalculatedPhaseSpaceFileIN ( G4String  val)
inline

Definition at line 82 of file ML2PrimaryGenerationAction.hh.

Referenced by CML2PrimaryGenerationActionMessenger::SetNewValue().

82 {calculatedPhaseSpaceFileIN=val;}
void CML2PrimaryGenerationAction::setGunMeanEnergy ( G4double  val)
inline

Definition at line 79 of file ML2PrimaryGenerationAction.hh.

Referenced by CML2PrimaryGenerationActionMessenger::SetNewValue().

79 {GunMeanEnegy=val;}
void CML2PrimaryGenerationAction::setGunRadious ( G4double  val)
inline

Definition at line 81 of file ML2PrimaryGenerationAction.hh.

Referenced by CML2PrimaryGenerationActionMessenger::SetNewValue().

81 {GunRadious=val;}
void CML2PrimaryGenerationAction::setGunStdEnergy ( G4double  val)
inline

Definition at line 80 of file ML2PrimaryGenerationAction.hh.

Referenced by CML2PrimaryGenerationActionMessenger::SetNewValue().

80 {GunStdEnegy=val;}
void CML2PrimaryGenerationAction::setNLoopsPhSpParticles ( G4int  val)
inline

Definition at line 76 of file ML2PrimaryGenerationAction.hh.

76 {nLoopsPhSpParticles=val;}
void CML2PrimaryGenerationAction::setNMaxParticlesInRamPhaseSpace ( G4int  val)
inline

Definition at line 77 of file ML2PrimaryGenerationAction.hh.

References G4endl.

Referenced by CML2PrimaryGenerationActionMessenger::SetNewValue().

77 {nMaxParticlesInRamPhaseSpace=val;std::cout<<"Current nMaxParticlesInRamPhaseSpace: " << nMaxParticlesInRamPhaseSpace<< G4endl;}
#define G4endl
Definition: G4ios.hh:61
void CML2PrimaryGenerationAction::setNRecycling ( G4int  val)
inline

Definition at line 75 of file ML2PrimaryGenerationAction.hh.

Referenced by CML2PrimaryGenerationActionMessenger::SetNewValue().

75 {nRecycling=val;}
void CML2PrimaryGenerationAction::setRotation ( G4RotationMatrix val)
inline
void CML2PrimaryGenerationAction::setSourceTypeName ( G4String  val)
inline

Definition at line 83 of file ML2PrimaryGenerationAction.hh.

References id_phaseSpace, and id_randomTarget.

Referenced by CML2PrimaryGenerationActionMessenger::SetNewValue().

84  {
85  sourceTypeName=val;
86  if (sourceTypeName=="randomTarget")
87  {
89  }
90  else if (sourceTypeName=="phaseSpace")
91  {
93  }
94  }
idParticleSource

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