Skip to content

Commit

Permalink
implementation of comments: codestyle and optimization of particleMas…
Browse files Browse the repository at this point in the history
…s function
  • Loading branch information
LeanderSchlegel committed Apr 23, 2024
1 parent e900b39 commit 8376c76
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* Fixed wrong mass inheritance for secondaries other than nuclei or electron/positron

### New features:
* Added new backwards-compatible function particleMass that returns particle mass also for non-nuclei

### Interface changes:
* Added new backwards-compatible function particleMass that returns particle mass also for non-nuclei

### Features that are deprecated and will be removed after this release
* EBL model from Finke et al. 2022
Expand Down
2 changes: 2 additions & 0 deletions include/crpropa/ParticleMass.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace crpropa {
@returns The mass of a the particle
*/
double particleMass(int id);

/** Get the nucleus mass by lookup from a table.
The masses are the atomic masses from the NIST database:
http://www.nist.gov/pml/data/comp.cfm
Expand All @@ -25,6 +26,7 @@ namespace crpropa {
@returns The mass of a the nucleus
*/
double nuclearMass(int id);

/** Get the nucleus mass by lookup from a table.
The masses are the atomic masses from the NIST database:
http://www.nist.gov/pml/data/comp.cfm
Expand Down
7 changes: 2 additions & 5 deletions src/ParticleMass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,11 @@ struct NuclearMassTable {
static NuclearMassTable nuclearMassTable;

double particleMass(int id) {
double m;
if (isNucleus(id))
return nuclearMass(id);
if (abs(id) == 11)
m = mass_electron;
else
m = 0.0;
return m;
return mass_electron;
return 0.0;
}

double nuclearMass(int id) {
Expand Down

0 comments on commit 8376c76

Please sign in to comment.