Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion inc/TRestGeant4PrimaryGeneratorInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ enum class EnergyDistributionFormulas {
COSMIC_NEUTRONS,
COSMIC_GAMMAS,
FISSION_NEUTRONS_U238,
ENVIRONMENTAL_GAMMAS
ENVIRONMENTAL_GAMMAS,
ENVIRONMENTAL_NEUTRONS,
};

std::string EnergyDistributionFormulasToString(const EnergyDistributionFormulas&);
Expand Down
15 changes: 15 additions & 0 deletions src/TRestGeant4PrimaryGeneratorInfo.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ string TRestGeant4PrimaryGeneratorTypes::EnergyDistributionFormulasToString(
return "FissionNeutronsU238";
case EnergyDistributionFormulas::ENVIRONMENTAL_GAMMAS:
return "EnvironmentalGammas";
case EnergyDistributionFormulas::ENVIRONMENTAL_NEUTRONS:
return "EnvironmentalNeutrons";
}
cout << "TRestGeant4PrimaryGeneratorTypes::EnergyDistributionFormulasToString - Error - Unknown energy "
"distribution formula"
Expand All @@ -202,6 +204,10 @@ EnergyDistributionFormulas TRestGeant4PrimaryGeneratorTypes::StringToEnergyDistr
EnergyDistributionFormulasToString(EnergyDistributionFormulas::ENVIRONMENTAL_GAMMAS),
TString::ECaseCompare::kIgnoreCase)) {
return EnergyDistributionFormulas::ENVIRONMENTAL_GAMMAS;
} else if (TString(type).EqualTo(
EnergyDistributionFormulasToString(EnergyDistributionFormulas::ENVIRONMENTAL_NEUTRONS),
TString::ECaseCompare::kIgnoreCase)) {
return EnergyDistributionFormulas::ENVIRONMENTAL_NEUTRONS;
} else {
cout << "TRestGeant4PrimaryGeneratorTypes::StringToEnergyDistributionFormulas - Error - Unknown "
"energyDistributionFormulas: "
Expand Down Expand Up @@ -250,6 +256,15 @@ TF1 TRestGeant4PrimaryGeneratorTypes::EnergyDistributionFormulasToRootFormula(
distribution.GetXaxis()->SetTitle("Energy (keV)");
return distribution;
}
case EnergyDistributionFormulas::ENVIRONMENTAL_NEUTRONS: {
// Environmental neutron radiation approximation
const char* title = "Environmental Neutrons";
auto distribution = TF1(title, "TMath::Exp(-x * 0.0005)", 0, 10000); // keV
distribution.SetNormalized(true);
distribution.SetTitle(title);
distribution.GetXaxis()->SetTitle("Energy (keV)");
return distribution;
}
}
cout << "TRestGeant4PrimaryGeneratorTypes::EnergyDistributionFormulasToRootFormula - Error - Unknown "
"energy distribution formula"
Expand Down
Loading