Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
G4GIDI_Misc.cc File Reference
#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)
 

Function Documentation

char* G4GIDI_Misc_channelCompound ( char *  particle1,
char *  particle2 
)

Definition at line 99 of file G4GIDI_Misc.cc.

References G4GIDI_Misc_Z_A_m_ToName(), python.hepunit::m2, and tpia_miscNameToZAm().

99  {
100 
101  int Z1, A1, m1, Z2, A2, m2;
102 
103  if( tpia_miscNameToZAm( NULL, particle1, &Z1, &A1, &m1 ) ) return( NULL );
104  if( tpia_miscNameToZAm( NULL, particle2, &Z2, &A2, &m2 ) ) return( NULL );
105  if( A1 == 0 ) A2 = 0;
106  if( A2 == 0 ) A1 = 0;
107  return( G4GIDI_Misc_Z_A_m_ToName( Z1 + Z2, A1 + A2, 0 ) );
108 }
char * G4GIDI_Misc_Z_A_m_ToName(int iZ, int iA, int im)
Definition: G4GIDI_Misc.cc:76
int tpia_miscNameToZAm(statusMessageReporting *smr, const char *name, int *Z, int *A, int *m)
Definition: tpia_misc.cc:105
int G4GIDI_Misc_channelProductsCompare ( tpia_channel channel,
int  nProducts,
char **  productNames 
)

Definition at line 112 of file G4GIDI_Misc.cc.

References tpia_channel_s::decayChannel, tpia_particle_s::name, tpia_decayChannel_s::numberOfProducts, tpia_product_s::productID, tpia_channel_getFirstProduct(), and tpia_decayChannel_getNextProduct().

112  {
113 
114  int i;
115  tpia_product *product;
116 
117  if( channel->decayChannel.numberOfProducts != nProducts ) return( 0 );
118  for( product = tpia_channel_getFirstProduct( channel ), i = 0; product != NULL; product = tpia_decayChannel_getNextProduct( product ), i++ ) {
119  if( strcmp( product->productID->name, productNames[i] ) ) return( 0 );
120  }
121  return( 1 );
122 }
tpia_decayChannel decayChannel
Definition: tpia_target.h:264
tpia_product * tpia_channel_getFirstProduct(tpia_channel *channel)
tpia_particle * productID
Definition: tpia_target.h:236
tpia_product * tpia_decayChannel_getNextProduct(tpia_product *product)
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(), and xData_malloc2.

Referenced by G4GIDI::dataFilename(), G4GIDI::freeTarget(), G4GIDI_Misc_channelCompound(), G4GIDI_Z_AMass(), G4GIDI::getAlreadyReadTarget(), G4GIDI::getNamesOfAvailableLibraries(), G4GIDI::isThisDataAvailable(), and G4GIDI::readTarget().

76  {
77 
78  const char *Z = tpia_misc_ZToSymbol( iZ );
79  char S[128], mS[32], *name;
80 
81  if( Z == NULL ) return( NULL );
82  if( iA == 0 ) {
83  if( im != 0 ) return( NULL );
84  sprintf( S, "%s_natural", Z ); }
85  else {
86  sprintf( S, "%s_%d", Z, iA );
87  if( im != 0 ) {
88  sprintf( mS, "_m%d", im );
89  strcat( S, mS );
90  }
91  }
92  name = (char *) xData_malloc2( NULL, strlen( S ) + 1, 0, "name" );
93  if( name != NULL ) strcpy( name, S );
94  return( name );
95 }
const XML_Char * name
#define xData_malloc2(smr, size, zero, forItem)
Definition: xData.h:313
const char * tpia_misc_ZToSymbol(int iZ)
Definition: tpia_misc.cc:83
int getNamesOfAvailableTargets_walker ( tpia_mapEntry entry,
int  ,
void userData 
)

Definition at line 127 of file G4GIDI_Misc.cc.

References tpia_mapEntry_s::targetName, tpia_mapEntry_type_target, and tpia_mapEntry_s::type.

127  {
128 
129  vector<string> *listOfTargets = (vector<string> *) userData;
130  vector<string>::iterator iter;
131 
132  if( entry->type != tpia_mapEntry_type_target ) return( 0 );
133  for( iter = listOfTargets->begin( ); iter != listOfTargets->end( ); iter++ ) {
134  if( entry->targetName == iter->c_str( ) ) return( 0 );
135  }
136  listOfTargets->push_back( entry->targetName );
137  return( 0 );
138 }
enum tpia_mapEntry_type type
Definition: tpia_map.h:64
#define userData
Definition: xmlparse.cc:555
char * targetName
Definition: tpia_map.h:69