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 ] [ 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/lPoPs.cc (Version 11.3.0) and /processes/hadronic/models/lend/src/lPoPs.cc (Version 8.1.p1)


  1 #include <stdio.h>                                  1 
  2 #include <stdlib.h>                               
  3 #include <string.h>                               
  4 #include <ctype.h>                                
  5                                                   
  6 #include "PoPs.h"                                 
  7 #include "PoPs_mass.h"                            
  8                                                   
  9 #if defined __cplusplus                           
 10 namespace GIDI {                                  
 11 using namespace GIDI;                             
 12 #endif                                            
 13                                                   
 14 static struct ZLabels {                           
 15     int Z;                                        
 16     char const *Symbol;                           
 17 } Zs[] = {  {   0,  "n" }, {   1,  "H" }, {       
 18             {   9,  "F" }, {  10, "Ne" }, {  1    
 19             {  18, "Ar" }, {  19,  "K" }, {  2    
 20             {  27, "Co" }, {  28, "Ni" }, {  2    
 21             {  36, "Kr" }, {  37, "Rb" }, {  3    
 22             {  45, "Rh" }, {  46, "Pd" }, {  4    
 23             {  54, "Xe" }, {  55, "Cs" }, {  5    
 24             {  63, "Eu" }, {  64, "Gd" }, {  6    
 25             {  72, "Hf" }, {  73, "Ta" }, {  7    
 26             {  81, "Tl" }, {  82, "Pb" }, {  8    
 27             {  90, "Th" }, {  91, "Pa" }, {  9    
 28             {  99, "Es" }, { 100, "Fm" }, { 10    
 29             { 108, "Hs" }, { 109, "Mt" } };       
 30 static const int nZs = sizeof( Zs ) / sizeof(     
 31                                                   
 32 static char const *lPoPs_ZSymbol( int Z );        
 33 /*                                                
 34 ==============================================    
 35 */                                                
 36 int lPoPs_addParticleIfNeeded( statusMessageRe    
 37                                                   
 38     int index = PoPs_particleIndex( name ), ZA    
 39     char *endptr, name_[256], AStr[32];           
 40     char const *ZStr, *alias = NULL;              
 41     PoP *pop, *pop_;                              
 42  /* enum PoPs_genre genre = PoPs_genre_unknown    
 43     char const *yiNames[]   = { "p",  "h2", "h    
 44     char const *yiAliases[] = { "h1",  "d",  "    
 45  /* enum PoPs_genre yiGenres[] = { PoPs_genre_    
 46         PoPs_genre_nucleus, PoPs_genre_photon     
 47                                                   
 48     if( special == NULL ) special = "";           
 49     if( index < 0 ) {                             
 50         if( isdigit( name[0] ) ) {                
 51             ZA = (int) strtol( name, &endptr,     
 52             if( *endptr != 0 ) {                  
 53                 smr_setReportError2( smr, PoPs    
 54                 return( -1 );                     
 55             }                                     
 56             Z = ZA / 1000;                        
 57             A = ZA % 1000;                        
 58             /*level = 0;*/                        
 59             ispecial = 0;                         
 60             if( strcmp( special, "LLNL" ) == 0    
 61                 if( ( ZA > 1 ) && ( ZA < 8 ) )    
 62                     strcpy( name_, yiNames[ZA-    
 63                     alias = yiAliases[ZA-2];      
 64                  /* genre = yiGenres[ZA-2];*/     
 65                     ispecial = 1; }               
 66                 else if( ( ZA == 1801 ) || ( Z    
 67                     strcpy( name_, yiNames[0]     
 68                     alias = yiAliases[0];         
 69                  /* genre = yiGenres[0]; */       
 70                     ispecial = 1; }               
 71                 else if( ZA == 1902 ) {           
 72                     strcpy( name_, yiNames[1]     
 73                     alias = yiAliases[1];         
 74                  /* genre = yiGenres[1]; */       
 75                     ispecial = 1; }               
 76                 else if( ZA == 4809 ) {           
 77                     strcpy( name_, "Be9" );       
 78                  /* genre = PoPs_genre_atom; *    
 79                     ispecial = 1; }               
 80                 else if( ZA == 4909 ) {           
 81                     strcpy( name_, "Be9" );       
 82                  /* genre = PoPs_genre_atom; *    
 83                     ispecial = 1; }               
 84                 else if( ZA == 6912 ) {           
 85                     strcpy( name_, "C12" );       
 86                  /* genre = PoPs_genre_atom; *    
 87                     ispecial = 1; }               
 88                 else if( ZA == 8916 ) {           
 89                     strcpy( name_, "O16" );       
 90                  /* genre = PoPs_genre_atom; *    
 91                     ispecial = 1; }               
 92                 else if( ZA == 95242 ) {          
 93                     strcpy( name_, "Am242_e2"     
 94                     /*level = 2;*/                
 95                  /* genre = PoPs_genre_atom; *    
 96                     ispecial = 1; }               
 97                 else if( Z == 99 ) {              
 98                     if( ( 120 <= A ) && ( A <     
 99                         snprintf( name_, sizeo    
100                      /* genre = PoPs_genre_ato    
101                         ispecial = 1;             
102                     }                             
103                 }                                 
104             }                                     
105             if( ispecial == 0 ) {                 
106                 if( ZA == 1 ) {                   
107                     AStr[0] = 0; }                
108                 else if( A == 0 ) {               
109                     strcpy( AStr, "_natural" )    
110                 else {                            
111                     snprintf( AStr, sizeof ASt    
112                 }                                 
113                 if( ( ZStr = lPoPs_ZSymbol( Z     
114                     smr_setReportError2( smr,     
115                     return( -1 );                 
116                 }                                 
117                 snprintf( name_, sizeof name_,    
118               /* genre = PoPs_genre_atom; */      
119               /* if( ZA == 1 ) genre = PoPs_ge    
120             } }                                   
121         else {                                    
122             strcpy( name_, name );                
123             ZA = -1;                              
124             if( strcmp( name, "neutron" ) == 0    
125                 strcpy( name_, "n" );             
126                 alias = name;                     
127             /*  genre = PoPs_genre_baryon; */     
128             else if( strcmp( name, "electron"     
129                 strcpy( name_, "e-" );            
130                 alias = name;                     
131             /*  genre = PoPs_genre_lepton; */     
132             else if( strcmp( name, "positron"     
133                 strcpy( name_, "e+" );            
134                 alias = name;                     
135             /*  genre = PoPs_genre_lepton; */     
136             else if( ( strcmp( name, "h1" ) ==    
137                 ZA = 2; }                         
138             else if( ( strcmp( name, "d" ) ==     
139                 ZA = 3; }                         
140             else if( ( strcmp( name, "t" ) ==     
141                 ZA = 4; }                         
142             else if( strcmp( name, "helium3" )    
143                 ZA = 5; }                         
144             else if( ( strcmp( name, "a" ) ==     
145                 ZA = 6; }                         
146             else if( ( strcmp( name, "g" ) ==     
147                 ZA = 7; }                         
148             else if( strcmp( name, "FP" ) == 0    
149                         strcpy( name_, "Fissio    
150                     /*  genre = PoPs_genre_ato    
151             }                                     
152             if( ZA != -1 ) {                      
153                 strcpy( name_, yiNames[ZA-2] )    
154                 alias = name;                     
155              /* genre = yiGenres[ZA-2]; */        
156             }                                     
157         }                                         
158                                                   
159         if( ( pop = PoPs_particleCreateLoadInf    
160             smr_setReportError2( smr, PoPs_smr    
161             return( -1 );                         
162         }                                         
163         if( ( pop_ = PoPs_addParticleIfNeeded(    
164         index = pop_->index;                      
165                                                   
166         if( PoPs_particleIndex( name ) < 0 ) {    
167             if( ( pop = PoP_makeAlias( smr, na    
168             if( ( pop_ = PoPs_addParticleIfNee    
169         }                                         
170                                                   
171         if( alias != NULL ) {                     
172             if( PoPs_particleIndex( alias ) <     
173                 if( ( pop = PoP_makeAlias( smr    
174                 if( ( pop_ = PoPs_addParticleI    
175             }                                     
176         }                                         
177     }                                             
178     return( index );                              
179 }                                                 
180 /*                                                
181 ==============================================    
182 */                                                
183 static char const *lPoPs_ZSymbol( int Z ) {       
184                                                   
185     //Coverity #63066                             
186     if( ( Z < 0 ) || ( Z >= nZs ) ) return( NU    
187     return( Zs[Z].Symbol );                       
188 }                                                 
189                                                   
190 #if defined __cplusplus                           
191 }                                                 
192 #endif                                            
193