Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
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

◆ G4GIDI_Misc_channelCompound()

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

Definition at line 99 of file G4GIDI_Misc.cc.

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

◆ G4GIDI_Misc_channelProductsCompare()

int G4GIDI_Misc_channelProductsCompare ( tpia_channel channel,
int  nProducts,
char **  productNames 
)

Definition at line 112 of file G4GIDI_Misc.cc.

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_particle * productID
Definition: tpia_target.h:236
tpia_product * tpia_channel_getFirstProduct(tpia_channel *channel)
tpia_product * tpia_decayChannel_getNextProduct(tpia_product *product)

◆ G4GIDI_Misc_Z_A_m_ToName()

char * G4GIDI_Misc_Z_A_m_ToName ( int  iZ,
int  iA,
int  im 
)

Definition at line 76 of file G4GIDI_Misc.cc.

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 char * tpia_misc_ZToSymbol(int iZ)
Definition: tpia_misc.cc:83
#define xData_malloc2(smr, size, zero, forItem)
Definition: xData.h:313

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

◆ getNamesOfAvailableTargets_walker()

int getNamesOfAvailableTargets_walker ( tpia_mapEntry entry,
int  ,
void *  userData 
)

Definition at line 127 of file G4GIDI_Misc.cc.

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}
char * targetName
Definition: tpia_map.h:69
enum tpia_mapEntry_type type
Definition: tpia_map.h:64
@ tpia_mapEntry_type_target
Definition: tpia_map.h:51
#define userData
Definition: xmlparse.cc:555