Skip to content
Snippets Groups Projects
Commit 4bb4709b authored by matta's avatar matta
Browse files

*Fixing one mor bug in EventGeneratorBeam

	- For some reason, 6He and 8He (at least) are not instiate in the Ion table before the runManager initialisation but 11Li yes...
	- To fix the problem  the m_particle pointer is set at first event launch
parent 5357883c
No related branches found
No related tags found
No related merge requests found
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
Beam Beam
ParticleZ= 3 ParticleZ= 3
ParticleA= 11 ParticleA= 11
BeamEnergy= 550 BeamEnergy= 500
BeamEnergySpread= 10 BeamEnergySpread= 50
SigmaX= 6.232 SigmaX= 6.232
SigmaY= 9.069 SigmaY= 9.069
SigmaThetaX= 0.6921330164 SigmaThetaX= 0.6921330164
......
...@@ -57,6 +57,8 @@ private: // TTree to store initial value of beam and reaction ...@@ -57,6 +57,8 @@ private: // TTree to store initial value of beam and reaction
private: // Source parameter private: // Source parameter
G4ParticleDefinition* m_particle; // Kind of particle to shoot G4ParticleDefinition* m_particle; // Kind of particle to shoot
G4int m_beamA;
G4int m_beamZ;
G4double m_BeamEnergy; G4double m_BeamEnergy;
G4double m_BeamEnergySpread; G4double m_BeamEnergySpread;
G4double m_SigmaX; G4double m_SigmaX;
......
...@@ -42,7 +42,10 @@ using namespace CLHEP; ...@@ -42,7 +42,10 @@ using namespace CLHEP;
EventGeneratorBeam::EventGeneratorBeam() EventGeneratorBeam::EventGeneratorBeam()
{ {
m_InitConditions = new TInitialConditions(); m_InitConditions = new TInitialConditions();
m_Target = 0; m_Target = NULL ;
m_beamA = 0 ;
m_beamZ = 0 ;
m_particle = NULL ;
} }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
...@@ -67,8 +70,6 @@ void EventGeneratorBeam::ReadConfiguration(string Path) ...@@ -67,8 +70,6 @@ void EventGeneratorBeam::ReadConfiguration(string Path)
string LineBuffer; string LineBuffer;
string DataBuffer; string DataBuffer;
////////Reaction Setting needs///////
G4double particleZ = 0 , particleA = 0 ;
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
ifstream ReactionFile; ifstream ReactionFile;
ReactionFile.open(Path.c_str()); ReactionFile.open(Path.c_str());
...@@ -91,14 +92,11 @@ void EventGeneratorBeam::ReadConfiguration(string Path) ...@@ -91,14 +92,11 @@ void EventGeneratorBeam::ReadConfiguration(string Path)
//Pick-up next line //Pick-up next line
getline(ReactionFile, LineBuffer); getline(ReactionFile, LineBuffer);
if (LineBuffer.compare(0, 4, "Beam") == 0) { if (LineBuffer.compare(0, 4, "Beam") == 0) {
G4cout << "Beam Found" << G4endl ; G4cout << "Beam Found" << G4endl ;
ReadingStatus = true ; ReadingStatus = true ;
} }
while(ReadingStatus){ while(ReadingStatus){
ReactionFile >> DataBuffer; ReactionFile >> DataBuffer;
...@@ -109,16 +107,22 @@ void EventGeneratorBeam::ReadConfiguration(string Path) ...@@ -109,16 +107,22 @@ void EventGeneratorBeam::ReadConfiguration(string Path)
else if (DataBuffer.compare(0, 10, "ParticleZ=") == 0) { else if (DataBuffer.compare(0, 10, "ParticleZ=") == 0) {
check_Z = true ; check_Z = true ;
ReactionFile >> DataBuffer; 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) { else if (DataBuffer.compare(0, 10, "ParticleA=") == 0) {
check_A = true ; check_A = true ;
ReactionFile >> DataBuffer; ReactionFile >> DataBuffer;
particleA = atof(DataBuffer.c_str()); m_beamA = atof(DataBuffer.c_str());
G4cout << "Beam Particle: Z:" << particleZ << " A:" << particleA << G4endl;
m_particle = G4ParticleTable::GetParticleTable()->GetIon(particleZ, particleA, 0.); if(check_Z)
G4cout << "Beam Particle: Z:" << m_beamZ << " A:" << m_beamA << G4endl;
} }
else if (DataBuffer.compare(0, 11, "BeamEnergy=") == 0) { else if (DataBuffer.compare(0, 11, "BeamEnergy=") == 0) {
...@@ -184,11 +188,15 @@ void EventGeneratorBeam::ReadConfiguration(string Path) ...@@ -184,11 +188,15 @@ void EventGeneratorBeam::ReadConfiguration(string Path)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventGeneratorBeam::GenerateEvent(G4Event* anEvent, G4ParticleGun* particleGun) void EventGeneratorBeam::GenerateEvent(G4Event* anEvent, G4ParticleGun* particleGun)
{ {
//--------------write the DeDx Table ------------------- //--------------write the DeDx Table -------------------
if(m_Target!=0 && anEvent->GetEventID()==0) if( anEvent->GetEventID()==0)
m_Target->WriteDEDXTable(m_particle ,0, m_BeamEnergy+4*m_BeamEnergySpread); {
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(); m_InitConditions->Clear();
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment