Geant4 Cross Reference |
1 /* 1 2 # <<BEGIN-copyright>> 3 # <<END-copyright>> 4 */ 5 #include <string.h> 6 7 #include "PoPs.h" 8 #include "PoPs_private.h" 9 #include "PoPs_data.h" 10 11 #ifdef POPS_BDFLS 12 #include <cbdfls.h> 13 #endif 14 15 #if defined __cplusplus 16 extern "C" { 17 namespace GIDI { 18 using namespace GIDI; 19 #endif 20 21 static double PoPs_getBDFLS_mass( char const * 22 23 #if defined __cplusplus 24 } 25 } 26 #endif 27 /* 28 ============================================== 29 */ 30 31 #if defined __cplusplus 32 namespace GIDI { 33 using namespace GIDI; 34 #endif 35 36 int PoPs_particleReadDatabase( statusMessageRe 37 38 int i1, n1 = sizeof( PoPDatas ) / sizeof( 39 PoP *pop; 40 char ZAName[32]; 41 42 for( i1 = 0; i1 < n1; ++i1 ) { 43 if( ( pop = PoPs_particleCreateLoadInf 44 if( PoPs_addParticleIfNeeded( smr, pop 45 if( ( pop->genre == PoPs_genre_ato 46 snprintf( ZAName, sizeof ZANam 47 if( lPoPs_addParticleIfNeeded( 48 } } 49 else { 50 PoP_free( pop ); 51 } 52 if( smr_isOk( smr ) == 0 ) return( 1 ) 53 } 54 if( lPoPs_addParticleIfNeeded( smr, "gamma 55 if( lPoPs_addParticleIfNeeded( smr, "g", " 56 return( 0 ); 57 } 58 /* 59 ============================================== 60 */ 61 PoP *PoPs_particleCreateLoadInfo( statusMessag 62 63 PoP *pop; 64 65 if( ( pop = PoP_new( smr ) ) != NULL ) { 66 if( PoPs_particleLoadInfo( smr, name, 67 } 68 return( pop ); 69 } 70 /* 71 ============================================== 72 */ 73 int PoPs_particleLoadInfo( statusMessageReport 74 75 int i, n = sizeof( PoPDatas ) / sizeof( Po 76 77 if( ( pop->name = smr_allocateCopyString2( 78 for( i = 0; i < n; i++ ) { 79 if( strcmp( PoPDatas[i].name, name ) = 80 pop->genre = PoPDatas[i].genre; 81 pop->Z = PoPDatas[i].Z; 82 pop->A = 0; 83 if( PoPDatas[i].N >= 0 ) pop->A = 84 pop->l = PoPDatas[i].nuclearLevel; 85 pop->mass = PoPs_getBDFLS_mass( na 86 pop->massUnit = unitsDB_addUnitIfN 87 return( 0 ); 88 } 89 } 90 smr_freeMemory( (void **) &(pop->name) ); 91 smr_setReportError2( smr, smr_unknownID, 1 92 return( -1 ); 93 } 94 95 static void *BDFLS_Data = NULL; 96 97 /* 98 ============================================== 99 */ 100 static double PoPs_getBDFLS_mass( char const * 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 *) 110 else if( pop->genre == PoPs_genre_lepton ) 111 if( pop->name[0] == 'e' ) mass_ = cbdf 112 } 113 if( mass_ < 0 ) mass_ = mass; 114 mass = mass_; 115 #endif 116 return( mass ); 117 } 118 /* 119 ============================================== 120 */ 121 int PoPs_setBDFLS_File( char const *name ) { 122 123 #ifdef POPS_BDFLS 124 125 cbdfls_file *p; 126 cbdflsErrors Error; 127 128 if( BDFLS_Data != NULL ) cbdflsRelease( (c 129 BDFLS_Data = NULL; 130 if( name != NULL ) { 131 if( ( p = cbdflsOpen( name, &Error ) ) 132 BDFLS_Data = (void *) p; 133 } 134 #else 135 if( name == NULL ) BDFLS_Data = NULL; /* 136 #endif 137 return( 0 ); 138 } 139 140 #if defined __cplusplus 141 } 142 #endif 143