#include <iostream>
#include <string>
#include <vector>
#include <xData.h>
#include <tpia_target.h>
#include <tpia_misc.h>
#include <string.h>
#include "G4GIDI_Misc.hh"
Go to the source code of this file.
Functions | |
char * | G4GIDI_Misc_Z_A_m_ToName (int iZ, int iA, int im) |
char * | G4GIDI_Misc_channelCompound (char *particle1, char *particle2) |
int | G4GIDI_Misc_channelProductsCompare (tpia_channel *channel, int nProducts, char **productNames) |
int | getNamesOfAvailableTargets_walker (tpia_mapEntry *entry, int, void *userData) |
char* G4GIDI_Misc_channelCompound | ( | char * | particle1, | |
char * | particle2 | |||
) |
Definition at line 99 of file G4GIDI_Misc.cc.
References G4GIDI_Misc_Z_A_m_ToName(), and tpia_miscNameToZAm().
00099 { 00100 00101 int Z1, A1, m1, Z2, A2, m2; 00102 00103 if( tpia_miscNameToZAm( NULL, particle1, &Z1, &A1, &m1 ) ) return( NULL ); 00104 if( tpia_miscNameToZAm( NULL, particle2, &Z2, &A2, &m2 ) ) return( NULL ); 00105 if( A1 == 0 ) A2 = 0; 00106 if( A2 == 0 ) A1 = 0; 00107 return( G4GIDI_Misc_Z_A_m_ToName( Z1 + Z2, A1 + A2, 0 ) ); 00108 }
int G4GIDI_Misc_channelProductsCompare | ( | tpia_channel * | channel, | |
int | nProducts, | |||
char ** | productNames | |||
) |
Definition at line 112 of file G4GIDI_Misc.cc.
References tpia_channel_getFirstProduct(), and tpia_decayChannel_getNextProduct().
00112 { 00113 00114 int i; 00115 tpia_product *product; 00116 00117 if( channel->decayChannel.numberOfProducts != nProducts ) return( 0 ); 00118 for( product = tpia_channel_getFirstProduct( channel ), i = 0; product != NULL; product = tpia_decayChannel_getNextProduct( product ), i++ ) { 00119 if( strcmp( product->productID->name, productNames[i] ) ) return( 0 ); 00120 } 00121 return( 1 ); 00122 }
char* G4GIDI_Misc_Z_A_m_ToName | ( | int | iZ, | |
int | iA, | |||
int | im | |||
) |
Definition at line 76 of file G4GIDI_Misc.cc.
References tpia_misc_ZToSymbol().
Referenced by G4GIDI::freeTarget(), G4GIDI_Misc_channelCompound(), G4GIDI_Z_AMass(), G4GIDI::getAlreadyReadTarget(), and G4GIDI::getNamesOfAvailableLibraries().
00076 { 00077 00078 const char *Z = tpia_misc_ZToSymbol( iZ ); 00079 char S[128], mS[32], *name; 00080 00081 if( Z == NULL ) return( NULL ); 00082 if( iA == 0 ) { 00083 if( im != 0 ) return( NULL ); 00084 sprintf( S, "%s_natural", Z ); } 00085 else { 00086 sprintf( S, "%s_%d", Z, iA ); 00087 if( im != 0 ) { 00088 sprintf( mS, "_m%d", im ); 00089 strcat( S, mS ); 00090 } 00091 } 00092 name = (char *) xData_malloc2( NULL, strlen( S ) + 1, 0, "name" ); 00093 if( name != NULL ) strcpy( name, S ); 00094 return( name ); 00095 }
int getNamesOfAvailableTargets_walker | ( | tpia_mapEntry * | entry, | |
int | , | |||
void * | userData | |||
) |
Definition at line 127 of file G4GIDI_Misc.cc.
00127 { 00128 00129 vector<string> *listOfTargets = (vector<string> *) userData; 00130 vector<string>::iterator iter; 00131 00132 if( entry->type != tpia_mapEntry_type_target ) return( 0 ); 00133 for( iter = listOfTargets->begin( ); iter != listOfTargets->end( ); iter++ ) { 00134 if( entry->targetName == iter->c_str( ) ) return( 0 ); 00135 } 00136 listOfTargets->push_back( entry->targetName ); 00137 return( 0 ); 00138 }