File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ Author: Luis Obis (lobis@unizar.es)
1616 -->
1717
1818 <parameter name =" seed" value =" 17022" />
19+ <parameter name =" storeHadronicTargetInfo" value =" true" />
1920 <parameter name =" nRequestedEntries" value =" 1" />
2021
2122 <generator type =" cosmic" >
Original file line number Diff line number Diff line change @@ -211,6 +211,29 @@ void TRestGeant4Hits::InsertStep(const G4Step* step) {
211211 fKineticEnergy .emplace_back (track->GetKineticEnergy () / CLHEP::keV);
212212 fMomentumDirection .emplace_back (momentum.x (), momentum.y (), momentum.z ());
213213
214+ string isotopeName;
215+ int atomicNumber = 0 ;
216+ int atomicMassNumber = 0 ;
217+
218+ if (metadata->GetStoreHadronicTargetInfo () && track->GetCurrentStepNumber () != 0 &&
219+ process->GetProcessType () == G4ProcessType::fHadronic ) {
220+ auto hadronicProcess = dynamic_cast <const G4HadronicProcess*>(process);
221+ G4Nucleus nucleus = *(hadronicProcess->GetTargetNucleus ());
222+
223+ auto isotope = nucleus.GetIsotope ();
224+ if (isotope) {
225+ isotopeName = isotope->GetName ();
226+ atomicNumber = isotope->GetZ ();
227+ atomicMassNumber = isotope->GetN ();
228+ }
229+ }
230+
231+ if (metadata->GetStoreHadronicTargetInfo ()) {
232+ fHadronicTargetIsotopeName .emplace_back (isotopeName);
233+ fHadronicTargetIsotopeZ .emplace_back (atomicNumber);
234+ fHadronicTargetIsotopeA .emplace_back (atomicMassNumber);
235+ }
236+
214237 SimulationManager::GetOutputManager ()->AddEnergyToVolumeForParticleForProcess (energy, volumeName,
215238 particleName, processName);
216239}
You can’t perform that action at this time.
0 commit comments