45 using namespace CLHEP;
48 :particleGun(0),gamma(0),
electron(0),
positron(0),primaryParticleData(0),particles(0)
164 static bool bFirstTime=
true;
198 static int currentFilePosition=0;
199 static int currentFileSize=0;
200 int startDataFilePosition;
209 static bool bFirstTime=
true;
212 in.seekg(-1,std::ios::end);
213 currentFileSize=in.tellg();
214 in.seekg(0,std::ios::beg);
219 in.getline(a,1000,
'\n');
220 in.getline(a,1000,
'\n');
221 startDataFilePosition=in.tellg();
222 if (currentFilePosition>0)
223 {in.seekg(currentFilePosition, std::ios::beg);}
228 static bool checkFileRewind=
false;
229 static bool bRewindTheFile=
false;
230 static int nPhSpFileRewind=0;
238 in.seekg(startDataFilePosition, std::ios::beg);
239 checkFileRewind=
true;
240 bRewindTheFile=
false;
241 std::cout<<
"\n################\nI have reached the end of the phase space file "<<++nPhSpFileRewind <<
" times, I rewind the file\n" <<
G4endl;
242 std::cout <<
"loaded " <<i <<
"/"<< nMaxParticlesInRamPhaseSpace<<
" particles" <<
G4endl;
245 in >>
x; in >>
y; in >>
z;
250 in >>
x; in >>
y; in >>
z;
257 if (in.eof()) {bRewindTheFile=
true;}
258 if (checkFileRewind) {checkFileRewind=
false;}
260 std::cout <<
"loaded " <<i <<
"/"<< nMaxParticlesInRamPhaseSpace<<
" particles" <<
G4endl;
261 currentFilePosition=in.tellg();
262 if (currentFilePosition>=currentFileSize)
263 {currentFilePosition=startDataFilePosition;}
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
virtual void AbortRun(G4bool softAbort=false)
void set(double x, double y, double z)
static G4RunManager * GetRunManager()
void GenerateFromRandom()
static CML2PrimaryGenerationAction * instance
std::vector< ExP01TrackerHit * > a
static G4ParticleTable * GetParticleTable()
static constexpr double MeV
G4ParticleDefinition * electron
static constexpr double mm
SPrimaryParticle * primaryParticleData
CLHEP::HepRotation G4RotationMatrix
G4ParticleDefinition * gamma
G4int nMaxParticlesInRamPhaseSpace
void GenerateFromCalculatedPhaseSpace()
G4double accTargetZPosition
void SetParticlePosition(G4ThreeVector aPosition)
~CML2PrimaryGenerationAction(void)
G4ParticleDefinition * positron
static CML2PrimaryGenerationAction * GetInstance(void)
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)
CML2PrimaryGenerationActionMessenger * PrimaryGenerationActionMessenger
static constexpr double twopi
void setGunCalculatedPhaseSpace()
CML2PrimaryGenerationAction(void)
ThreeVector shoot(const G4int Ap, const G4int Af)
void fillParticlesContainer()
void applySourceRotation()
virtual void GeneratePrimaryVertex(G4Event *evt)
G4int GetPDGEncoding() const
void design(G4double accTargetZPosition)
void SetParticleEnergy(G4double aKineticEnergy)
G4ParticleGun * particleGun
G4String calculatedPhaseSpaceFileIN
G4ParticleDefinition * GetParticleDefinition() const
void SetNumberOfParticles(G4int i)
int idCurrentParticleSource
void SetParticleMomentumDirection(G4ParticleMomentum aMomentumDirection)
void GeneratePrimaries(G4Event *anEvent)
void inizialize(SPrimaryParticle *primaryParticleData)