diff --git a/NPSimulation/Core/Particle.cc b/NPSimulation/Core/Particle.cc index 1915b4f32336d908986f398f3debbc5056260875..f14ceca58ad4605a6c5d130ca4052fdaf8d4d720 100644 --- a/NPSimulation/Core/Particle.cc +++ b/NPSimulation/Core/Particle.cc @@ -44,6 +44,17 @@ Particle::Particle(G4ParticleDefinition* particle,double ThetaCM,double T,G4Thre m_Position = Position; m_ShootStatus = ShootStatus; } +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... +Particle::Particle(G4ParticleDefinition* particle,double ThetaCM,double T,G4ThreeVector Direction, G4ThreeVector Position,double Delay,bool ShootStatus){ + m_ParticleDefinition = particle; + m_ThetaCM = ThetaCM; + m_T = T; + m_Direction = Direction; + m_Position = Position; + m_TimeDelay = Delay; + m_ShootStatus = ShootStatus; +} + //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... G4ParticleDefinition* Particle::GetParticleDefinition(){ @@ -60,6 +71,11 @@ double Particle::GetParticleKineticEnergy(){ return m_T; } +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... +double Particle::GetParticleTimeDelay(){ + return m_TimeDelay; +} + //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... G4ThreeVector Particle::GetParticleMomentumDirection(){ return m_Direction; @@ -90,6 +106,11 @@ void Particle::SetParticleKineticEnergy(double T){ m_T = T ; } +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... +void Particle::SetParticleTimeDelay(double delay){ + m_TimeDelay = delay ; +} + //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void Particle::SetParticleMomentumDirection(G4ThreeVector Direction){ m_Direction = Direction; diff --git a/NPSimulation/Core/Particle.hh b/NPSimulation/Core/Particle.hh index f7e46bbc2bc2369bcaa246bfbf5ed939f853ab43..ac01bfe0dd4e6dd85301a749abf30e39d564fb6c 100644 --- a/NPSimulation/Core/Particle.hh +++ b/NPSimulation/Core/Particle.hh @@ -37,6 +37,8 @@ namespace NPS{ ~Particle(); // Constructor to be used Particle(G4ParticleDefinition* particle,double ThetaCM,double T,G4ThreeVector Direction, G4ThreeVector Position,bool ShootStatus=true); + // Constructor to be used for EventGeneratorAlphaDecay + Particle(G4ParticleDefinition* particle,double ThetaCM,double T,G4ThreeVector Direction, G4ThreeVector Position,double Delay,bool ShootStatus=true); private: // Private Member G4ParticleDefinition* m_ParticleDefinition; @@ -44,6 +46,7 @@ namespace NPS{ double m_T ; G4ThreeVector m_Direction; G4ThreeVector m_Position; + double m_TimeDelay; bool m_ShootStatus; public: // Setter and Getter @@ -51,6 +54,7 @@ namespace NPS{ G4ParticleDefinition* GetParticleDefinition(); double GetParticleThetaCM(); double GetParticleKineticEnergy(); + double GetParticleTimeDelay(); G4ThreeVector GetParticleMomentumDirection(); G4ThreeVector GetParticlePosition(); bool GetShootStatus(); @@ -58,6 +62,7 @@ namespace NPS{ void SetParticleDefinition(G4ParticleDefinition*); void SetParticleThetaCM(double); void SetParticleKineticEnergy(double); + void SetParticleTimeDelay(double); void SetParticlePosition(G4ThreeVector); void SetParticleMomentumDirection(G4ThreeVector); void SetShootStatus(bool); diff --git a/NPSimulation/Core/ParticleStack.cc b/NPSimulation/Core/ParticleStack.cc index d71dc8767705f86b1a87dd5666ede2287623b858..50ae210bddc9c25fe515c9288edfead9091a26ff 100644 --- a/NPSimulation/Core/ParticleStack.cc +++ b/NPSimulation/Core/ParticleStack.cc @@ -113,7 +113,7 @@ void ParticleStack::AddBeamParticleToStack(NPS::Particle& particle){ m_InitialConditions-> SetIncidentParticleName (particle.GetParticleDefinition()->GetParticleName()); //m_InitialConditions-> SetIncidentInitialKineticEnergy (particle. GetParticleThetaCM()); m_InitialConditions-> SetIncidentInitialKineticEnergy (particle. GetParticleKineticEnergy()); - + G4ThreeVector U(1,0,0); G4ThreeVector V(0,1,0); @@ -273,6 +273,7 @@ void ParticleStack::ShootAllParticle(G4Event* anEvent){ m_particleGun->SetParticleEnergy(m_ParticleStack[i].GetParticleKineticEnergy()); m_particleGun->SetParticleMomentumDirection(m_ParticleStack[i].GetParticleMomentumDirection()); m_particleGun->SetParticlePosition(m_ParticleStack[i].GetParticlePosition()); + if(m_ParticleStack[i].GetParticleTimeDelay()) m_particleGun->SetParticleTime(m_ParticleStack[i].GetParticleTimeDelay()); m_particleGun->GeneratePrimaryVertex(anEvent); //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... m_InitialConditions-> SetParticleName ( m_ParticleStack[i].GetParticleDefinition()->GetParticleName()) ; diff --git a/NPSimulation/Detectors/Epic/Epic.cc b/NPSimulation/Detectors/Epic/Epic.cc index 6501596fcc62ae09110cf211d2326d06816f5088..a87b151f3dcc94a21cca450f56d7f94cd9718bf0 100644 --- a/NPSimulation/Detectors/Epic/Epic.cc +++ b/NPSimulation/Detectors/Epic/Epic.cc @@ -568,14 +568,14 @@ void Epic::ReadSensitive(const G4Event* ){ continue; } else{ // FF or alpha - //cout << "[FF or alpha]step #" << j << " , particle name = " << step_name.at(j) << " , z = " << step_posZ.at(j) << " , dE = " << step_DE.at(j) << " , t = " << step_time.at(j) << endl; + //cout << "[FF or alpha]step #" << j << " , particle name = " << step_name.at(j) << ", z = " << step_posZ.at(j) << " , dE = " << step_DE.at(j) << " , t = " << step_time.at(j) << endl; influence += step_DE.at(j) * TMath::Abs(step_posZ.at(j) - posZ_anode); name.push_back(step_name.at(j)); parentid.push_back(step_parentid.at(j)); trackid.push_back(step_trackid.at(j)); z.push_back(step_posZ.at(j)); de.push_back(step_DE.at(j)); - dt.push_back(step_time.at(j) - Scorer->GetTime(i)); // dt = time from the first step in SensitiveVolume + dt.push_back(step_time.at(j)); } } m_Event->Set(m_mapping_A[Anode], // set anode number diff --git a/NPSimulation/EventGenerator/EventGeneratorAlphaDecay.cc b/NPSimulation/EventGenerator/EventGeneratorAlphaDecay.cc index c9615e4a0e0e57f062d74368039ea6dde6daf648..403b0a52547e76f934f4114af8bbbd8a37cad551 100644 --- a/NPSimulation/EventGenerator/EventGeneratorAlphaDecay.cc +++ b/NPSimulation/EventGenerator/EventGeneratorAlphaDecay.cc @@ -174,8 +174,8 @@ void EventGeneratorAlphaDecay::GenerateEvent(G4Event* evt){ momentum_z = sin(theta) * sin(phi) ; momentum_x = cos(theta) ; } - - NPS::Particle particle(m_particle, theta, particle_energy, G4ThreeVector(momentum_x, momentum_y, momentum_z), G4ThreeVector(x0, y0, z0)); + //cout << "add an alpha particle to stack with global time = " << alpha_t << " s ==> " << alpha_t*1.e9 << " ns" << endl; + NPS::Particle particle(m_particle, theta, particle_energy, G4ThreeVector(momentum_x, momentum_y, momentum_z), G4ThreeVector(x0, y0, z0),alpha_t*1.e9,true); m_ParticleStack->AddParticleToStack(particle); } diff --git a/NPSimulation/EventGenerator/EventGeneratorBeam.cc b/NPSimulation/EventGenerator/EventGeneratorBeam.cc index a8684d28b867724853c9f0616783b3dd56515e42..7421c05d6ac44d51635fe56d6bf6224c334a4abf 100644 --- a/NPSimulation/EventGenerator/EventGeneratorBeam.cc +++ b/NPSimulation/EventGenerator/EventGeneratorBeam.cc @@ -112,7 +112,7 @@ void EventGeneratorBeam::GenerateEvent(G4Event* anEvent){ InitialBeamEnergy, BeamDir.unit(), BeamPos, - 1); + true); m_ParticleStack->AddBeamParticleToStack(BeamParticle);