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;}
virtual void AbortRun(G4bool softAbort=false)
ThreeVector shoot(const G4int Ap, const G4int Af)
SPrimaryParticle * primaryParticleData
G4ParticleDefinition * positron
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
G4ParticleDefinition * electron
void fillParticlesContainer()
CLHEP::Hep3Vector G4ThreeVector
CLHEP::HepRotation G4RotationMatrix
G4double accTargetZPosition
G4int GetPDGEncoding() const
void SetParticleMomentumDirection(G4ParticleMomentum aMomentumDirection)
static CML2PrimaryGenerationAction * instance
virtual void GeneratePrimaryVertex(G4Event *evt)
G4String calculatedPhaseSpaceFileIN
void design(G4double accTargetZPosition)
G4ParticleDefinition * gamma
void inizialize(SPrimaryParticle *primaryParticleData)
void SetParticlePosition(G4ThreeVector aPosition)
void setGunCalculatedPhaseSpace()
int idCurrentParticleSource
~CML2PrimaryGenerationAction(void)
void SetNumberOfParticles(G4int i)
static const double twopi
CML2PrimaryGenerationAction(void)
void GeneratePrimaries(G4Event *anEvent)
void SetParticleEnergy(G4double aKineticEnergy)
static G4RunManager * GetRunManager()
void GenerateFromCalculatedPhaseSpace()
G4int nMaxParticlesInRamPhaseSpace
static G4ParticleTable * GetParticleTable()
void applySourceRotation()
CML2PrimaryGenerationActionMessenger * PrimaryGenerationActionMessenger
const G4double x[NPOINTSGL]
G4ParticleDefinition * GetParticleDefinition() const
G4ParticleGun * particleGun
static CML2PrimaryGenerationAction * GetInstance(void)
G4ThreeVector G4ParticleMomentum
void GenerateFromRandom()
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)