Geant4-11
Functions | Variables
PoPs_data.cc File Reference
#include <string.h>
#include "PoPs.h"
#include "PoPs_private.h"
#include "PoPs_data.h"

Go to the source code of this file.

Functions

static double PoPs_getBDFLS_mass (char const *name, PoP *pop, double mass)
 
PoPPoPs_particleCreateLoadInfo (statusMessageReporting *smr, const char *name)
 
int PoPs_particleLoadInfo (statusMessageReporting *smr, const char *name, PoP *pop)
 
int PoPs_particleReadDatabase (statusMessageReporting *smr, char const *)
 
int PoPs_setBDFLS_File (char const *name)
 

Variables

static void * BDFLS_Data = NULL
 

Function Documentation

◆ PoPs_getBDFLS_mass()

static double PoPs_getBDFLS_mass ( char const *  name,
PoP pop,
double  mass 
)
static

Definition at line 100 of file PoPs_data.cc.

100 {
101
102#ifdef POPS_BDFLS
103
104 int ZA = 1000 * pop->Z + pop->A;
105 double mass_ = -1;
106
107 if( BDFLS_Data == NULL ) return( mass );
108 if( ZA > 0 ) {
109 mass_ = cbdflsGetMass( (cbdfls_file *) BDFLS_Data, ZA ); }
110 else if( pop->genre == PoPs_genre_lepton ) {
111 if( pop->name[0] == 'e' ) mass_ = cbdflsGetMass( (cbdfls_file *) BDFLS_Data, 8 );
112 }
113 if( mass_ < 0 ) mass_ = mass;
114 mass = mass_;
115#endif
116 return( mass );
117}
@ PoPs_genre_lepton
Definition: PoPs.h:36
static void * BDFLS_Data
Definition: PoPs_data.cc:95
int Z
Definition: PoPs.h:49
enum PoPs_genre genre
Definition: PoPs.h:47
char const * name
Definition: PoPs.h:48
int A
Definition: PoPs.h:49

References BDFLS_Data, and PoPs_genre_lepton.

Referenced by PoPs_particleLoadInfo().

◆ PoPs_particleCreateLoadInfo()

PoP * PoPs_particleCreateLoadInfo ( statusMessageReporting smr,
const char *  name 
)

Definition at line 61 of file PoPs_data.cc.

61 {
62
63 PoP *pop;
64
65 if( ( pop = PoP_new( smr ) ) != NULL ) {
66 if( PoPs_particleLoadInfo( smr, name, pop ) != 0 ) pop = PoP_free( pop );
67 }
68 return( pop );
69}
PoP * PoP_new(statusMessageReporting *smr)
Definition: PoPs.cc:522
PoP * PoP_free(PoP *pop)
Definition: PoPs.cc:558
int PoPs_particleLoadInfo(statusMessageReporting *smr, const char *name, PoP *pop)
Definition: PoPs_data.cc:73
const char * name(G4int ptype)
Definition: PoPs.h:45

References G4InuclParticleNames::name(), PoP_free(), PoP_new(), and PoPs_particleLoadInfo().

Referenced by lPoPs_addParticleIfNeeded(), and PoPs_particleReadDatabase().

◆ PoPs_particleLoadInfo()

int PoPs_particleLoadInfo ( statusMessageReporting smr,
const char *  name,
PoP pop 
)

Definition at line 73 of file PoPs_data.cc.

73 {
74
75 int i, n = sizeof( PoPDatas ) / sizeof( PoPDatas[0] );
76
77 if( ( pop->name = smr_allocateCopyString2( smr, name, "name" ) ) == NULL ) return( -1 );
78 for( i = 0; i < n; i++ ) {
79 if( strcmp( PoPDatas[i].name, name ) == 0 ) {
80 pop->genre = PoPDatas[i].genre;
81 pop->Z = PoPDatas[i].Z;
82 pop->A = 0;
83 if( PoPDatas[i].N >= 0 ) pop->A = pop->Z + PoPDatas[i].N;
84 pop->l = PoPDatas[i].nuclearLevel;
85 pop->mass = PoPs_getBDFLS_mass( name, pop, PoPDatas[i].mass );
86 pop->massUnit = unitsDB_addUnitIfNeeded( smr, "amu" );
87 return( 0 );
88 }
89 }
90 smr_freeMemory( (void **) &(pop->name) );
91 smr_setReportError2( smr, smr_unknownID, 1, "particle %s not in database", name );
92 return( -1 );
93}
static double PoPs_getBDFLS_mass(char const *name, PoP *pop, double mass)
Definition: PoPs_data.cc:100
static struct PoPDatas PoPDatas[]
Definition: PoPs_data.h:314
char const * unitsDB_addUnitIfNeeded(statusMessageReporting *smr, char const *unit)
Definition: PoPs.cc:700
#define smr_setReportError2(smr, libraryID, code, fmt,...)
#define smr_allocateCopyString2(smr, s, forItem)
void * smr_freeMemory(void **p)
#define smr_unknownID
enum PoPs_genre genre
Definition: PoPs_data.h:181
int nuclearLevel
Definition: PoPs_data.h:182
char const * massUnit
Definition: PoPs.h:51
double mass
Definition: PoPs.h:50
int l
Definition: PoPs.h:49

References PoP_s::A, PoP_s::genre, PoPDatas::genre, PoP_s::l, PoP_s::mass, PoP_s::massUnit, CLHEP::detail::n, PoPDatas::N, G4InuclParticleNames::name(), PoP_s::name, PoPDatas::nuclearLevel, PoPDatas, PoPs_getBDFLS_mass(), smr_allocateCopyString2, smr_freeMemory(), smr_setReportError2, smr_unknownID, unitsDB_addUnitIfNeeded(), PoP_s::Z, and PoPDatas::Z.

Referenced by PoPs_particleCreateLoadInfo().

◆ PoPs_particleReadDatabase()

int PoPs_particleReadDatabase ( statusMessageReporting smr,
char const *  name 
)

Definition at line 36 of file PoPs_data.cc.

36 {
37
38 int i1, n1 = sizeof( PoPDatas ) / sizeof( PoPDatas[0] );
39 PoP *pop;
40 char ZAName[32];
41
42 for( i1 = 0; i1 < n1; ++i1 ) {
43 if( ( pop = PoPs_particleCreateLoadInfo( smr, PoPDatas[i1].name ) ) == NULL ) return( 1 );
44 if( PoPs_addParticleIfNeeded( smr, pop ) == pop ) {
45 if( ( pop->genre == PoPs_genre_atom ) && ( pop->Z < 110 ) ) {
46 sprintf( ZAName, "%d%.3d", pop->Z, pop->A );
47 if( lPoPs_addParticleIfNeeded( smr, ZAName, "LLNL" ) < 0 ) return( 1 );
48 } }
49 else {
50 PoP_free( pop );
51 }
52 if( smr_isOk( smr ) == 0 ) return( 1 );
53 }
54 if( lPoPs_addParticleIfNeeded( smr, "gamma", "LLNL" ) < 0 ) return( 1 );
55 if( lPoPs_addParticleIfNeeded( smr, "g", "LLNL" ) < 0 ) return( 1 );
56 return( 0 );
57}
int lPoPs_addParticleIfNeeded(statusMessageReporting *smr, char const *name, char const *special)
Definition: lPoPs.cc:36
PoP * PoPs_addParticleIfNeeded(statusMessageReporting *smr, PoP *pop)
Definition: PoPs.cc:113
@ PoPs_genre_atom
Definition: PoPs.h:37
PoP * PoPs_particleCreateLoadInfo(statusMessageReporting *smr, const char *name)
Definition: PoPs_data.cc:61
int smr_isOk(statusMessageReporting *smr)

References PoP_s::A, PoP_s::genre, lPoPs_addParticleIfNeeded(), G4InuclParticleNames::name(), PoP_free(), PoPDatas, PoPs_addParticleIfNeeded(), PoPs_genre_atom, PoPs_particleCreateLoadInfo(), smr_isOk(), and PoP_s::Z.

Referenced by PoPs_readDatabase().

◆ PoPs_setBDFLS_File()

int PoPs_setBDFLS_File ( char const *  name)

Definition at line 121 of file PoPs_data.cc.

121 {
122
123#ifdef POPS_BDFLS
124
125 cbdfls_file *p;
126 cbdflsErrors Error;
127
128 if( BDFLS_Data != NULL ) cbdflsRelease( (cbdfls_file *) BDFLS_Data );
129 BDFLS_Data = NULL;
130 if( name != NULL ) {
131 if( ( p = cbdflsOpen( name, &Error ) ) == NULL ) return( 1 );
132 BDFLS_Data = (void *) p;
133 }
134#else
135 if( name == NULL ) BDFLS_Data = NULL; /* Do something with name so compilers do not complain. */
136#endif
137 return( 0 );
138}

References BDFLS_Data, and G4InuclParticleNames::name().

Variable Documentation

◆ BDFLS_Data

void* BDFLS_Data = NULL
static

Definition at line 95 of file PoPs_data.cc.

Referenced by PoPs_getBDFLS_mass(), and PoPs_setBDFLS_File().