From 77cdbea92ce1dce1f2188cbe2ed603a9f6d179c2 Mon Sep 17 00:00:00 2001 From: Adrien Matta <matta@lpccaen.in2p3.fr> Date: Fri, 19 Jun 2020 09:25:40 +0200 Subject: [PATCH] * fixing issue in decay of 1H 2H and alphas in excited state - name convention in geant4 is different for g.s and excited state --- Examples/Example1/run.mac | 2 +- NPLib/Physics/NPFunction.cxx | 7 +++++-- NPLib/Physics/NPFunction.h | 2 +- NPSimulation/Core/RunAction.cc | 2 +- NPSimulation/Detectors/Mugast/Mugast.cc | 4 ++-- NPSimulation/Process/Decay.cc | 7 ++++++- NPSimulation/Simulation.cc | 2 +- 7 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Examples/Example1/run.mac b/Examples/Example1/run.mac index 8eec34f7c..b379ed9bc 100644 --- a/Examples/Example1/run.mac +++ b/Examples/Example1/run.mac @@ -1 +1 @@ -/run/beamOn 1000 +/run/beamOn 10000 diff --git a/NPLib/Physics/NPFunction.cxx b/NPLib/Physics/NPFunction.cxx index 053fd0f7d..9de2b6662 100644 --- a/NPLib/Physics/NPFunction.cxx +++ b/NPLib/Physics/NPFunction.cxx @@ -279,7 +279,7 @@ namespace NPL{ //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - string ChangeNameToG4Standard(string OriginalName){ + string ChangeNameToG4Standard(string OriginalName,bool excited){ string NumberOfMass ; string Nucleid; @@ -354,6 +354,8 @@ namespace NPL{ // Special case for light particles string FinalName=Nucleid+NumberOfMass; + + if(!excited){ if (FinalName=="H1") FinalName="proton"; else if (FinalName=="H2") FinalName="deuteron"; else if (FinalName=="H3") FinalName="triton"; @@ -363,6 +365,7 @@ namespace NPL{ else if (FinalName=="t") FinalName="triton"; else if (FinalName=="a") FinalName="alpha"; else if (FinalName=="n") FinalName="neutron"; + } return(FinalName); } @@ -440,8 +443,8 @@ namespace NPL{ else if (character.str()=="z") Nucleid+="z"; } - // Special case for light particles string FinalName=NumberOfMass+Nucleid; + // Special case for light particles if (FinalName=="H1") FinalName="proton"; else if (FinalName=="H2") FinalName="deuteron"; else if (FinalName=="H3") FinalName="triton"; diff --git a/NPLib/Physics/NPFunction.h b/NPLib/Physics/NPFunction.h index b6373860d..8150a644e 100644 --- a/NPLib/Physics/NPFunction.h +++ b/NPLib/Physics/NPFunction.h @@ -58,7 +58,7 @@ namespace NPL{ void RandomGaussian2D(double MeanX, double MeanY, double SigmaX, double SigmaY, double &X, double &Y); // Change nucleus name from G4 standard to Physics standard (11Li vs Li11) - string ChangeNameToG4Standard(string name); + string ChangeNameToG4Standard(string name,bool excited=false); string ChangeNameFromG4Standard(string name); // Hyperbolic shape generator for cryogenic target deformation diff --git a/NPSimulation/Core/RunAction.cc b/NPSimulation/Core/RunAction.cc index 16289ab72..a3a503e00 100644 --- a/NPSimulation/Core/RunAction.cc +++ b/NPSimulation/Core/RunAction.cc @@ -69,10 +69,10 @@ void RunAction::EndOfRunAction(const G4Run* aRun){ for(unsigned int e = 0 ; e < sizeE ; e++){ TrajectoryVector* traj = (*events)[e]->GetTrajectoryContainer()->GetVector(); unsigned int size = traj->size(); + for(unsigned int i = 0 ; i < size ; i++) Particles.insert( (*traj)[i]->GetParticleName()); } - MaterialManager::getInstance()->WriteDEDXTable(Particles,0,10*GeV); MaterialManager::getInstance()->WriteCrossSectionTable(Particles,0,20*MeV); } diff --git a/NPSimulation/Detectors/Mugast/Mugast.cc b/NPSimulation/Detectors/Mugast/Mugast.cc index ac90486a5..2b6f78956 100644 --- a/NPSimulation/Detectors/Mugast/Mugast.cc +++ b/NPSimulation/Detectors/Mugast/Mugast.cc @@ -72,7 +72,7 @@ namespace Mugast_NS{ // Geometry //const G4double AluStripThickness = 0.4*micrometer ; - const G4double SiliconThickness = 3000*micrometer ; + const G4double SiliconThickness = 300*micrometer ; // Square @@ -230,6 +230,7 @@ G4LogicalVolume* Mugast::BuildTrapezoidDetector(){ //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... G4LogicalVolume* Mugast::BuildAnnularDetector(){ + if(!m_AnnularDetector){ G4Material* Silicon = MaterialManager::getInstance()->GetMaterialFromLibrary("Si"); G4Material* Vacuum = MaterialManager::getInstance()->GetMaterialFromLibrary("Vacuum"); @@ -382,7 +383,6 @@ G4LogicalVolume* Mugast::BuildAnnularDetector(){ // Set Silicon strip sensible logicActiveWafer->SetSensitiveDetector(m_AnnularScorer); } - return m_AnnularDetector; } diff --git a/NPSimulation/Process/Decay.cc b/NPSimulation/Process/Decay.cc index 442d98b68..30c82cdd4 100644 --- a/NPSimulation/Process/Decay.cc +++ b/NPSimulation/Process/Decay.cc @@ -61,8 +61,12 @@ void Decay::ReadConfiguration(){ m_Decay.ReadConfiguration(input); std::set<std::string> Mother = m_Decay.GetAllMotherName(); std::set<std::string>::iterator it ; - for(it = Mother.begin() ; it != Mother.end() ; it++) + for(it = Mother.begin() ; it != Mother.end() ; it++){ + // ground state name, e.g. deuteron m_MotherName.insert(NPL::ChangeNameToG4Standard(*it)); + // excited state name e.g. H2 + m_MotherName.insert(NPL::ChangeNameToG4Standard(*it,true)); + } } //////////////////////////////////////////////////////////////////////////////// @@ -130,6 +134,7 @@ void Decay::DoIt(const G4FastTrack& fastTrack,G4FastStep& fastStep){ G4ParticleDefinition* DaughterDef; unsigned int size = Daughter.size(); + if(size == 0) return; for(unsigned int i = 0 ; i < size ; i++){ diff --git a/NPSimulation/Simulation.cc b/NPSimulation/Simulation.cc index ed862a21d..a8e134536 100644 --- a/NPSimulation/Simulation.cc +++ b/NPSimulation/Simulation.cc @@ -155,7 +155,7 @@ int main(int argc, char** argv){ #endif } else{// if batch mode do not accumulate any track - UImanager->ApplyCommand("/vis/scene/endOfEventAction accumulate 0"); + UImanager->ApplyCommand("/vis/scene/endOfEventAction accumulate 0"); } // Execute user macro if(!OptionManager->IsDefault("G4MacroPath")){ -- GitLab