diff --git a/Inputs/EventGenerator/11Li.beam b/Inputs/EventGenerator/11Li.beam index 5a06c27989f836364fc4ee579144f4e531185245..c32a2702bc904b44898f856c982c038e5fdda9a2 100644 --- a/Inputs/EventGenerator/11Li.beam +++ b/Inputs/EventGenerator/11Li.beam @@ -6,8 +6,8 @@ Beam ParticleZ= 3 ParticleA= 11 - BeamEnergy= 550 - BeamEnergySpread= 10 + BeamEnergy= 500 + BeamEnergySpread= 50 SigmaX= 6.232 SigmaY= 9.069 SigmaThetaX= 0.6921330164 diff --git a/NPSimulation/include/EventGeneratorBeam.hh b/NPSimulation/include/EventGeneratorBeam.hh index e8267f0e106c5c3688c3713730c370fbfc11e7ee..e18dba96b3f3f5a5573acc982280f4011999cb8f 100644 --- a/NPSimulation/include/EventGeneratorBeam.hh +++ b/NPSimulation/include/EventGeneratorBeam.hh @@ -57,6 +57,8 @@ private: // TTree to store initial value of beam and reaction private: // Source parameter G4ParticleDefinition* m_particle; // Kind of particle to shoot + G4int m_beamA; + G4int m_beamZ; G4double m_BeamEnergy; G4double m_BeamEnergySpread; G4double m_SigmaX; diff --git a/NPSimulation/src/EventGeneratorBeam.cc b/NPSimulation/src/EventGeneratorBeam.cc index 3cad15c4ddea14b64141b4745830e017b482435e..5d263936109277fc965f0ec36e28c2c0aeb9ebda 100644 --- a/NPSimulation/src/EventGeneratorBeam.cc +++ b/NPSimulation/src/EventGeneratorBeam.cc @@ -42,7 +42,10 @@ using namespace CLHEP; EventGeneratorBeam::EventGeneratorBeam() { m_InitConditions = new TInitialConditions(); - m_Target = 0; + m_Target = NULL ; + m_beamA = 0 ; + m_beamZ = 0 ; + m_particle = NULL ; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... @@ -67,8 +70,6 @@ void EventGeneratorBeam::ReadConfiguration(string Path) string LineBuffer; string DataBuffer; - ////////Reaction Setting needs/////// - G4double particleZ = 0 , particleA = 0 ; ////////////////////////////////////////////////////////////////////////////////////////// ifstream ReactionFile; ReactionFile.open(Path.c_str()); @@ -91,14 +92,11 @@ void EventGeneratorBeam::ReadConfiguration(string Path) //Pick-up next line getline(ReactionFile, LineBuffer); - - if (LineBuffer.compare(0, 4, "Beam") == 0) { G4cout << "Beam Found" << G4endl ; ReadingStatus = true ; } - while(ReadingStatus){ ReactionFile >> DataBuffer; @@ -109,16 +107,22 @@ void EventGeneratorBeam::ReadConfiguration(string Path) else if (DataBuffer.compare(0, 10, "ParticleZ=") == 0) { check_Z = true ; ReactionFile >> DataBuffer; - particleZ = atof(DataBuffer.c_str()); + m_beamZ = atof(DataBuffer.c_str()); + + if(check_A) + G4cout << "Beam Particle: Z:" << m_beamZ << " A:" << m_beamA << G4endl; + } else if (DataBuffer.compare(0, 10, "ParticleA=") == 0) { check_A = true ; ReactionFile >> DataBuffer; - particleA = atof(DataBuffer.c_str()); - G4cout << "Beam Particle: Z:" << particleZ << " A:" << particleA << G4endl; - m_particle = G4ParticleTable::GetParticleTable()->GetIon(particleZ, particleA, 0.); + m_beamA = atof(DataBuffer.c_str()); + + if(check_Z) + G4cout << "Beam Particle: Z:" << m_beamZ << " A:" << m_beamA << G4endl; + } else if (DataBuffer.compare(0, 11, "BeamEnergy=") == 0) { @@ -184,11 +188,15 @@ void EventGeneratorBeam::ReadConfiguration(string Path) //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void EventGeneratorBeam::GenerateEvent(G4Event* anEvent, G4ParticleGun* particleGun) { - //--------------write the DeDx Table ------------------- - if(m_Target!=0 && anEvent->GetEventID()==0) - m_Target->WriteDEDXTable(m_particle ,0, m_BeamEnergy+4*m_BeamEnergySpread); - - + //--------------write the DeDx Table ------------------- + if( anEvent->GetEventID()==0) + { + m_particle = G4ParticleTable::GetParticleTable()->GetIon(m_beamZ, m_beamA , 0.); + + if(m_Target!=0 ) + m_Target->WriteDEDXTable(m_particle ,0, m_BeamEnergy+4*m_BeamEnergySpread); + } + m_InitConditions->Clear(); ///////////////////////////////////////////////////////////////////////