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5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/hadronic/models/lend/src/PoPs_data.cc (Version 11.3.0) and /processes/hadronic/models/lend/src/PoPs_data.cc (Version 11.0.p1)


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