Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Data Structures | Functions
tpia_mass.cc File Reference
#include <string.h>
#include <statusMessageReporting.h>
#include <tpia_mass.h>
#include <string>

Go to the source code of this file.

Data Structures

struct  ZAMass
 

Functions

double tpia_particleMass_AMU (statusMessageReporting *smr, const char *name)
 

Function Documentation

double tpia_particleMass_AMU ( statusMessageReporting smr,
const char *  name 
)

Definition at line 887 of file tpia_mass.cc.

References ZAMass::mass, n, smr_setMessageError(), and symbol.

Referenced by tpia_particle_getInternalID().

887  {
888 
889  int i, n = sizeof( ZAMasses ) / sizeof( ZAMasses[0] );
890  double mass = -1.;
891 
892  //TK modified
893  std::string target(name);
894  for( i = 0; i < n; i++ ) {
895  //TK modified
896  //if( !strcmp( ZAMasses[i].symbol, name ) ) {
897  if( ZAMasses[i].symbol == target ) {
898  mass = ZAMasses[i].mass;
899  break;
900  }
901  }
902  if( mass == -1. ) smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1, "particle %s not in mass table", name );
903  return( mass );
904 }
G4String symbol
Definition: TRTMaterials.hh:40
int smr_setMessageError(statusMessageReporting *smr, void *userInterface, const char *file, int line, int code, const char *fmt,...)
const XML_Char * name
const XML_Char * target
const G4int n
double mass
Definition: G4GIDI_mass.cc:72