Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
tpia_target.h File Reference
#include <xData.h>
#include <tpia_defs.h>
#include <tpia_map.h>
#include <tpi_IDs.h>
#include <tpia_mass.h>

Go to the source code of this file.

Classes

struct  tpia_particle_s
 
struct  tpia_samplingMethods_s
 
struct  tpia_data_frame_s
 
struct  tpia_1dData_s
 
struct  tpia_decaySamplingInfo_s
 
struct  tpia_productOutgoingData_s
 
struct  tpia_multiplicity_s
 
struct  tpia_EqualProbableBinSpectrum_s
 
struct  tpia_EqualProbableBinSpectra_s
 
struct  tpia_LegendreBin_s
 
struct  tpia_angularEnergyBin_s
 
struct  tpia_decayChannel_s
 
struct  tpia_angular_s
 
struct  tpia_Legendre_s
 
struct  tpia_angularEnergy_s
 
struct  tpia_product_s
 
struct  tpia_channel_s
 
struct  tpia_target_heated_s
 
struct  tpia_target_heated_info_s
 
struct  tpia_target_s
 

Macros

#define tpia_mode_MonteCarlo   1
 
#define tpia_mode_Pn   2
 
#define tpia_maxNumberOfFrames   8
 
#define tpia_referenceFrame_None   0
 
#define tpia_referenceFrame_COM   1
 
#define tpia_referenceFrame_lab   2
 
#define tpia_referenceFrame_Max   tpia_referenceFrame_lab
 
#define tpia_crossSectionType_grouped   1
 
#define tpia_crossSectionType_pointwise   2
 
#define tpia_m_depositionEnergy   1
 
#define tpia_m_multiplicity   ( 1 << 1 )
 
#define tpia_m_decayChannel   ( 1 << 2 )
 
#define tpia_m_commonShift   3
 
#define tpia_m_angular   ( 1 << 3 )
 
#define tpia_m_formFactor   ( 1 << 4 )
 
#define tpia_m_Legendre   ( 1 << 5 )
 
#define tpia_m_angular_energy   ( 1 << 6 )
 
#define tpia_speedOfLight_cm_sec   2.99792458e10
 
#define tpia_AMU2MeV   931.494028
 
#define tpia_samplingMethods_isConstant(method)   ( strcmp ( method , "constant" ) == 0 )
 
#define tpia_samplingMethods_isLinear(method)   ( strcmp ( method , "linear" ) == 0 )
 

Typedefs

typedef struct tpia_particle_s tpia_particle
 
typedef struct tpia_target_s tpia_target
 
typedef struct tpia_target_heated_info_s tpia_target_heated_info
 
typedef struct tpia_target_heated_sorted_s tpia_target_heated_sorted
 
typedef struct tpia_target_heated_s tpia_target_heated
 
typedef struct tpia_decaySamplingInfo_s tpia_decaySamplingInfo
 
typedef struct tpia_productOutgoingData_s tpia_productOutgoingData
 
typedef struct tpia_multiplicity_s tpia_multiplicity
 
typedef struct tpia_samplingMethods_s tpia_samplingMethods
 
typedef struct tpia_EqualProbableBinSpectra_s tpia_EqualProbableBinSpectra
 
typedef struct tpia_EqualProbableBinSpectrum_s tpia_EqualProbableBinSpectrum
 
typedef struct tpia_LegendreBin_s tpia_LegendreBin
 
typedef struct tpia_angularEnergyBin_s tpia_angularEnergyBin
 
typedef struct tpia_angular_s tpia_angular
 
typedef struct tpia_Legendre_s tpia_Legendre
 
typedef struct tpia_angularEnergy_s tpia_angularEnergy
 
typedef struct tpia_decayChannel_s tpia_decayChannel
 
typedef struct tpia_product_s tpia_product
 
typedef struct tpia_1dData_s tpia_1dData
 
typedef struct tpia_2dData_s tpia_2dData
 
typedef struct tpia_channel_s tpia_channel
 
typedef struct tpia_data_frame_s tpia_data_frame
 

Functions

tpia_targettpia_target_create (statusMessageReporting *smr)
 
int tpia_target_initialize (statusMessageReporting *smr, tpia_target *target)
 
tpia_targettpia_target_createRead (statusMessageReporting *smr, const char *fileName)
 
int tpia_target_readFromMap (statusMessageReporting *smr, tpia_target *target, tpia_map *map, const char *evaluation, const char *projectileName, const char *targetName)
 
tpia_targettpia_target_createReadFromMap (statusMessageReporting *smr, tpia_map *map, const char *evaluation, const char *projectileName, const char *targetName)
 
tpia_targettpia_target_free (statusMessageReporting *smr, tpia_target *target)
 
int tpia_target_release (statusMessageReporting *smr, tpia_target *target)
 
int tpia_target_read (statusMessageReporting *smr, tpia_target *target, const char *fileName)
 
char * tpia_target_getAttributesValue (statusMessageReporting *smr, tpia_target *target, char const *name)
 
int tpia_target_getTemperatures (statusMessageReporting *smr, tpia_target *target, double *temperatures)
 
int tpia_target_readHeatedTarget (statusMessageReporting *smr, tpia_target *target, int index, int checkElememtsForAccess)
 
tpia_target_heatedtpia_target_getHeatedTargetAtIndex_ReadIfNeeded (statusMessageReporting *smr, tpia_target *target, int index)
 
int tpia_target_numberOfChannels (statusMessageReporting *smr, tpia_target *target)
 
int tpia_target_numberOfProductionChannels (statusMessageReporting *smr, tpia_target *target)
 
xData_Int tpia_target_getEnergyGridAtTIndex (statusMessageReporting *smr, tpia_target *target, int index, double **energyGrid)
 
tpia_1dDatatpia_target_getTotalCrossSectionAtTIndex (statusMessageReporting *smr, tpia_target *target, int index, int crossSectionType)
 
double tpia_target_getTotalCrossSectionAtTAndE (statusMessageReporting *smr, tpia_target *target, double T, xData_Int iEg, double e_in, int crossSectionType)
 
double tpia_target_getIndexChannelCrossSectionAtE (statusMessageReporting *smr, tpia_target *target, int index, double T, xData_Int iEg, double e_in, int crossSectionType)
 
int tpia_target_sampleIndexChannelProductsAtE (statusMessageReporting *smr, tpia_target *target, int index, double T, tpia_decaySamplingInfo *decaySamplingInfo, int nProductData, tpia_productOutgoingData *productData)
 
tpia_target_heatedtpia_target_heated_create (statusMessageReporting *smr)
 
int tpia_target_heated_initialize (statusMessageReporting *smr, tpia_target_heated *target)
 
tpia_target_heatedtpia_target_heated_createRead (statusMessageReporting *smr, const char *fileName, int checkElememtsForAccess)
 
tpia_target_heatedtpia_target_heated_free (statusMessageReporting *smr, tpia_target_heated *target)
 
int tpia_target_heated_release (statusMessageReporting *smr, tpia_target_heated *target)
 
int tpia_target_heated_read (statusMessageReporting *smr, tpia_target_heated *target, const char *fileName, int checkElememtsForAccess)
 
int tpia_target_heated_numberOfChannels (statusMessageReporting *smr, tpia_target_heated *target)
 
int tpia_target_heated_numberOfProductionChannels (statusMessageReporting *smr, tpia_target_heated *target)
 
tpia_channeltpia_target_heated_getChannelAtIndex (tpia_target_heated *target, int index)
 
tpia_channeltpia_target_heated_getChannelAtIndex_smr (statusMessageReporting *smr, tpia_target_heated *target, int index)
 
tpia_channeltpia_target_heated_getProductionChannelAtIndex (tpia_target_heated *target, int index)
 
xData_Int tpia_target_heated_getEnergyGrid (statusMessageReporting *smr, tpia_target_heated *target, double **energyGrid)
 
xData_Int tpia_target_heated_getEIndex (tpia_target_heated *target, double e_in)
 
double tpia_target_heated_getTotalCrossSectionAtE (statusMessageReporting *smr, tpia_target_heated *target, xData_Int gE, double e_in, int crossSectionType)
 
double tpia_target_heated_getIndexChannelCrossSectionAtE (statusMessageReporting *smr, tpia_target_heated *target, int index, xData_Int iEg, double e_in, int crossSectionType)
 
int tpia_target_heated_sampleIndexChannelProductsAtE (statusMessageReporting *smr, tpia_target_heated *target, int index, tpia_decaySamplingInfo *decaySamplingInfo, int nProductData, tpia_productOutgoingData *productData)
 
tpia_channeltpia_channel_create (statusMessageReporting *smr)
 
int tpia_channel_initialize (statusMessageReporting *smr, tpia_channel *channel)
 
tpia_channeltpia_channel_createGetFromElement (statusMessageReporting *smr, tpia_target_heated *target, xData_element *channelElement, int pointwiseRequired)
 
tpia_channeltpia_channel_free (statusMessageReporting *smr, tpia_channel *channel)
 
int tpia_channel_release (statusMessageReporting *smr, tpia_channel *channel)
 
int tpia_channel_getFromElement (statusMessageReporting *smr, tpia_target_heated *target, xData_element *channelElement, tpia_channel *channel, int pointwiseRequired)
 
tpia_producttpia_channel_getFirstProduct (tpia_channel *channel)
 
tpia_producttpia_channel_getProductByIndex (statusMessageReporting *smr, tpia_channel *channel, int index)
 
int tpia_channel_numberOfProducts (statusMessageReporting *smr, tpia_channel *channel)
 
int tpia_channel_isProduction (statusMessageReporting *smr, tpia_channel *channel)
 
double tpia_channel_getCrossSectionAtE (statusMessageReporting *smr, tpia_channel *channel, xData_Int iEg, double e_in, int crossSectionType)
 
tpia_particletpia_particle_create (statusMessageReporting *smr)
 
int tpia_particle_initialize (statusMessageReporting *smr, tpia_particle *particle)
 
tpia_particletpia_particle_free (statusMessageReporting *smr, tpia_particle *particle)
 
int tpia_particle_release (statusMessageReporting *smr, tpia_particle *particle)
 
int tpia_particle_freeInternalList (statusMessageReporting *smr)
 
tpia_particletpia_particle_getInternalID (statusMessageReporting *smr, const char *const name)
 
int tpia_particle_printInternalSortedList (statusMessageReporting *smr)
 
tpia_producttpia_product_create (statusMessageReporting *smr)
 
int tpia_product_initialize (statusMessageReporting *smr, tpia_product *product)
 
tpia_producttpia_product_createGetFromElement (statusMessageReporting *smr, tpia_channel *channel, tpia_product *parentProduct, xData_element *productElement)
 
tpia_producttpia_product_free (statusMessageReporting *smr, tpia_product *product)
 
int tpia_product_release (statusMessageReporting *smr, tpia_product *product)
 
int tpia_product_getFromElement (statusMessageReporting *smr, tpia_channel *channel, tpia_product *parentProduct, xData_element *productElement, tpia_product *product)
 
int tpia_product_getDecayChannelFromElement (statusMessageReporting *smr, xData_element *parentElement, tpia_channel *channel, tpia_product *parentProduct, tpia_product **priorProductNext)
 
long tpia_product_dataRequired (statusMessageReporting *smr, tpia_product *product)
 
tpia_producttpia_product_getFirstProduct (tpia_product *product)
 
tpia_producttpia_product_getProductByIndex (statusMessageReporting *smr, tpia_product *product, int index)
 
int tpia_product_doesDecay (statusMessageReporting *smr, tpia_product *product)
 
int tpia_product_numberOfProducts (statusMessageReporting *smr, tpia_product *product)
 
int tpia_product_isDataPresent (statusMessageReporting *smr, tpia_product *product, int b_data)
 
int tpia_product_sampleMultiplicity (statusMessageReporting *smr, tpia_product *product, double e_in, double r)
 
tpia_producttpia_decayChannel_getFirstProduct (tpia_decayChannel *decayChannel)
 
tpia_producttpia_decayChannel_getNextProduct (tpia_product *product)
 
int tpia_decayChannel_sampleProductsAtE (statusMessageReporting *smr, tpia_decayChannel *decayChannel, tpia_decaySamplingInfo *decaySamplingInfo, int nProductData, tpia_productOutgoingData *productData)
 
int tpia_kinetics_2BodyReaction (statusMessageReporting *smr, tpia_decayChannel *decayChannel, double K, double mu, double phi, tpia_productOutgoingData *outgoingData)
 
int tpia_kinetics_COMKineticEnergy2LabEnergyAndMomentum (statusMessageReporting *smr, double beta, double e_kinetic_com, double mu, double phi, double m3cc, double m4cc, tpia_productOutgoingData *outgoingData)
 
int tpia_frame_clear (statusMessageReporting *smr, tpia_data_frame *frame)
 
int tpia_frame_setFromElement (statusMessageReporting *smr, xData_element *element, int dimension, tpia_data_frame *frame)
 
int tpia_frame_setFromString (statusMessageReporting *smr, const char *forItem, const char *value, int dimension, tpia_data_frame *frame)
 
int tpia_frame_getDimensions (statusMessageReporting *smr, tpia_data_frame *frame)
 
char * tpia_frame_toString (statusMessageReporting *smr, const char *fromItem, tpia_data_frame *frame)
 
int tpia_frame_setColumns (statusMessageReporting *smr, tpia_data_frame *frame, int nColumns, int *values)
 
int tpia_frame_setColumn (statusMessageReporting *smr, tpia_data_frame *frame, int column, int value)
 
int tpia_frame_getColumn (statusMessageReporting *smr, tpia_data_frame *frame, int column)
 
tpia_multiplicitytpia_multiplicity_create (statusMessageReporting *smr)
 
int tpia_multiplicity_initialize (statusMessageReporting *smr, tpia_multiplicity *multiplicity)
 
tpia_multiplicitytpia_multiplicity_free (statusMessageReporting *smr, tpia_multiplicity *multiplicity)
 
int tpia_multiplicity_release (statusMessageReporting *smr, tpia_multiplicity *multiplicity)
 
tpia_multiplicitytpia_multiplicity_createGetFromElement (statusMessageReporting *smr, xData_element *multiplicityElement, int nGroups)
 
int tpia_multiplicity_getFromElement (statusMessageReporting *smr, xData_element *multiplicityElement, tpia_multiplicity *multiplicity, int nGroups)
 
int tpia_multiplicity_getTimeScaleFromElement (statusMessageReporting *smr, xData_element *element, const char **timeScale, int *isDelayedNeutrons, double *dTimeScale)
 
int tpia_angular_initialize (statusMessageReporting *smr, tpia_angular *angular)
 
int tpia_angular_release (statusMessageReporting *smr, tpia_angular *angular)
 
int tpia_angular_getFromElement (statusMessageReporting *smr, xData_element *angularElement, tpia_angular *angular)
 
int tpia_angular_SampleMu (statusMessageReporting *smr, tpia_angular *angular, tpia_decaySamplingInfo *decaySamplingInfo)
 
int tpia_Legendre_initialize (statusMessageReporting *smr, tpia_Legendre *Legendre)
 
int tpia_Legendre_release (statusMessageReporting *smr, tpia_Legendre *Legendre)
 
int tpia_Legendre_getFromElement (statusMessageReporting *smr, xData_element *LegendreElement, tpia_Legendre *Legendre)
 
int tpia_Legendre_SampleEp (statusMessageReporting *smr, tpia_Legendre *Legendre, int sampleMu, tpia_decaySamplingInfo *decaySamplingInfo)
 
int tpia_angularEnergy_initialize (statusMessageReporting *smr, tpia_angularEnergy *angularEnergy)
 
int tpia_angularEnergy_release (statusMessageReporting *smr, tpia_angularEnergy *angularEnergy)
 
int tpia_angularEnergy_getFromElement (statusMessageReporting *smr, xData_element *angularEnergyElement, tpia_angularEnergy *angularEnergy)
 
int tpia_angularEnergy_SampleEp (statusMessageReporting *smr, tpia_angularEnergy *angularEnergy, tpia_decaySamplingInfo *decaySamplingInfo)
 
int tpia_samplingMethods_initialize (statusMessageReporting *smr, tpia_samplingMethods *samplingMethods)
 
int tpia_misc_NumberOfZSymbols (void)
 
const char * tpia_misc_ZToSymbol (int iZ)
 
int tpia_misc_symbolToZ (const char *Z)
 
int tpia_miscNameToZAm (statusMessageReporting *smr, const char *name, int *Z, int *A, int *m)
 
char * tpia_misc_pointerToAttributeIfAllOk (statusMessageReporting *smr, xData_element *element, const char *path, int required, xData_attributionList *attributes, const char *name, const char *file, int line)
 
double * tpia_misc_get2dx_y_data (statusMessageReporting *smr, xData_element *element, xData_Int *length)
 
double * tpia_misc_get2dxindex_y_data (statusMessageReporting *smr, xData_element *element, xData_Int *start, xData_Int *end, double *xValues)
 
double * tpia_misc_get2d_xShared_yHistogram_data (statusMessageReporting *smr, xData_element *element, xData_Int *start, xData_Int *end, xData_Int *length)
 
int tpia_misc_get2d_xShared_yHistogram_data_Grouped (statusMessageReporting *smr, xData_element *element, tpia_1dData *group)
 
double tpia_misc_getPointwiseCrossSectionAtE (statusMessageReporting *smr, tpia_1dData *crossSection, double *energyGrid, xData_Int index, double e_in)
 
double tpia_misc_drng (double(*rng)(void *), void *rngState)
 
int tpia_misc_sampleEqualProbableBin (statusMessageReporting *smr, tpia_decaySamplingInfo *decaySamplingInfo, double e_in, int nBins, tpia_EqualProbableBinSpectra *binned, double *value_)
 

Variables

DLL_LEND const char * tpia_productGenre_unknown
 
DLL_LEND const char * tpia_productGenre_twoBody_angular
 
DLL_LEND const char * tpia_productGenre_twoBody_formFactor
 
DLL_LEND const char * tpia_productGenre_NBody_Legendre
 
DLL_LEND const char * tpia_productGenre_NBody_angular_energy
 
DLL_LEND const char * tpia_productGenre_NBody_uncorrelate_Legendre
 
DLL_LEND const char * tpia_productGenre_NBody_pairProduction
 
DLL_LEND const char * tpia_samplingMethods_constant
 
DLL_LEND const char * tpia_samplingMethods_linear
 

Macro Definition Documentation

◆ tpia_AMU2MeV

#define tpia_AMU2MeV   931.494028

Definition at line 101 of file tpia_target.h.

◆ tpia_crossSectionType_grouped

#define tpia_crossSectionType_grouped   1

Definition at line 88 of file tpia_target.h.

◆ tpia_crossSectionType_pointwise

#define tpia_crossSectionType_pointwise   2

Definition at line 89 of file tpia_target.h.

◆ tpia_m_angular

#define tpia_m_angular   ( 1 << 3 )

Definition at line 95 of file tpia_target.h.

◆ tpia_m_angular_energy

#define tpia_m_angular_energy   ( 1 << 6 )

Definition at line 98 of file tpia_target.h.

◆ tpia_m_commonShift

#define tpia_m_commonShift   3

Definition at line 94 of file tpia_target.h.

◆ tpia_m_decayChannel

#define tpia_m_decayChannel   ( 1 << 2 )

Definition at line 93 of file tpia_target.h.

◆ tpia_m_depositionEnergy

#define tpia_m_depositionEnergy   1

Definition at line 91 of file tpia_target.h.

◆ tpia_m_formFactor

#define tpia_m_formFactor   ( 1 << 4 )

Definition at line 96 of file tpia_target.h.

◆ tpia_m_Legendre

#define tpia_m_Legendre   ( 1 << 5 )

Definition at line 97 of file tpia_target.h.

◆ tpia_m_multiplicity

#define tpia_m_multiplicity   ( 1 << 1 )

Definition at line 92 of file tpia_target.h.

◆ tpia_maxNumberOfFrames

#define tpia_maxNumberOfFrames   8

Definition at line 82 of file tpia_target.h.

◆ tpia_mode_MonteCarlo

#define tpia_mode_MonteCarlo   1

Definition at line 80 of file tpia_target.h.

◆ tpia_mode_Pn

#define tpia_mode_Pn   2

Definition at line 81 of file tpia_target.h.

◆ tpia_referenceFrame_COM

#define tpia_referenceFrame_COM   1

Definition at line 84 of file tpia_target.h.

◆ tpia_referenceFrame_lab

#define tpia_referenceFrame_lab   2

Definition at line 85 of file tpia_target.h.

◆ tpia_referenceFrame_Max

#define tpia_referenceFrame_Max   tpia_referenceFrame_lab

Definition at line 86 of file tpia_target.h.

◆ tpia_referenceFrame_None

#define tpia_referenceFrame_None   0

Definition at line 83 of file tpia_target.h.

◆ tpia_samplingMethods_isConstant

#define tpia_samplingMethods_isConstant (   method)    ( strcmp ( method , "constant" ) == 0 )

Definition at line 120 of file tpia_target.h.

◆ tpia_samplingMethods_isLinear

#define tpia_samplingMethods_isLinear (   method)    ( strcmp ( method , "linear" ) == 0 )

Definition at line 121 of file tpia_target.h.

◆ tpia_speedOfLight_cm_sec

#define tpia_speedOfLight_cm_sec   2.99792458e10

Definition at line 100 of file tpia_target.h.

Typedef Documentation

◆ tpia_1dData

typedef struct tpia_1dData_s tpia_1dData

Definition at line 70 of file tpia_target.h.

◆ tpia_2dData

typedef struct tpia_2dData_s tpia_2dData

Definition at line 71 of file tpia_target.h.

◆ tpia_angular

typedef struct tpia_angular_s tpia_angular

Definition at line 65 of file tpia_target.h.

◆ tpia_angularEnergy

Definition at line 67 of file tpia_target.h.

◆ tpia_angularEnergyBin

Definition at line 64 of file tpia_target.h.

◆ tpia_channel

typedef struct tpia_channel_s tpia_channel

Definition at line 72 of file tpia_target.h.

◆ tpia_data_frame

Definition at line 73 of file tpia_target.h.

◆ tpia_decayChannel

Definition at line 68 of file tpia_target.h.

◆ tpia_decaySamplingInfo

Definition at line 57 of file tpia_target.h.

◆ tpia_EqualProbableBinSpectra

◆ tpia_EqualProbableBinSpectrum

◆ tpia_Legendre

Definition at line 66 of file tpia_target.h.

◆ tpia_LegendreBin

Definition at line 63 of file tpia_target.h.

◆ tpia_multiplicity

Definition at line 59 of file tpia_target.h.

◆ tpia_particle

Definition at line 52 of file tpia_target.h.

◆ tpia_product

typedef struct tpia_product_s tpia_product

Definition at line 69 of file tpia_target.h.

◆ tpia_productOutgoingData

Definition at line 58 of file tpia_target.h.

◆ tpia_samplingMethods

Definition at line 60 of file tpia_target.h.

◆ tpia_target

typedef struct tpia_target_s tpia_target

Definition at line 53 of file tpia_target.h.

◆ tpia_target_heated

Definition at line 56 of file tpia_target.h.

◆ tpia_target_heated_info

Definition at line 54 of file tpia_target.h.

◆ tpia_target_heated_sorted

typedef struct tpia_target_heated_sorted_s tpia_target_heated_sorted

Definition at line 55 of file tpia_target.h.

Function Documentation

◆ tpia_angular_getFromElement()

int tpia_angular_getFromElement ( statusMessageReporting smr,
xData_element angularElement,
tpia_angular angular 
)

Definition at line 70 of file tpia_angular.cc.

70 {
71
72 xData_Int n, nBins;
73
74 if( ( tpia_frame_setFromElement( smr, angularElement, 3, &(angular->frame) ) ) != 0 ) return( 1 );
75 if( ( angular->binned.energies = tpia_misc_getEqualProbableBin( smr, angularElement, &n, &nBins ) ) != NULL ) {
76 angular->binned.iValue = 0;
77 angular->binned.dValue = 0;
78 angular->binned.nBins = (int) nBins;
79 angular->binned.numberOfEs = (int) n;
80 return( 0 );
81 }
82 return( 1 );
83}
tpia_EqualProbableBinSpectrum * energies
Definition: tpia_target.h:196
tpia_EqualProbableBinSpectra binned
Definition: tpia_target.h:218
tpia_data_frame frame
Definition: tpia_target.h:217
tpia_EqualProbableBinSpectrum * tpia_misc_getEqualProbableBin(statusMessageReporting *smr, xData_element *parent, xData_Int *n, xData_Int *nBins)
Definition: tpia_misc.cc:317
int tpia_frame_setFromElement(statusMessageReporting *smr, xData_element *element, int dimension, tpia_data_frame *frame)
Definition: tpia_frame.cc:61
int xData_Int
Definition: xData.h:50

◆ tpia_angular_initialize()

int tpia_angular_initialize ( statusMessageReporting smr,
tpia_angular angular 
)

Definition at line 49 of file tpia_angular.cc.

49 {
50
51 memset( angular, 0, sizeof( tpia_angular ) );
52 if( tpia_frame_setFromString( smr, "", "", 0, &(angular->frame) ) ) return( 1 );
53 angular->binned.numberOfEs = 0;
54 angular->binned.energies = NULL;
55 return( 0 );
56}
int tpia_frame_setFromString(statusMessageReporting *smr, const char *forItem, const char *value, int dimension, tpia_data_frame *frame)
Definition: tpia_frame.cc:74

Referenced by tpia_product_initialize().

◆ tpia_angular_release()

int tpia_angular_release ( statusMessageReporting smr,
tpia_angular angular 
)

Definition at line 60 of file tpia_angular.cc.

60 {
61
62 //angular->binned.energies = xData_free( smr, angular->binned.energies );
64 angular->binned.numberOfEs = 0;
65 return( 0 );
66}
void * xData_free(statusMessageReporting *smr, void *p)
Definition: xDataMisc.cc:89

Referenced by tpia_product_release().

◆ tpia_angular_SampleMu()

int tpia_angular_SampleMu ( statusMessageReporting smr,
tpia_angular angular,
tpia_decaySamplingInfo decaySamplingInfo 
)

Definition at line 87 of file tpia_angular.cc.

87 {
88
89 tpia_EqualProbableBinSpectra *binned = &(angular->binned);
90 int nBins = binned->nBins, status = 1;
91 double mu;
92/*
93Currently, only equal probable binning is supported.
94Need to return frame info for mu also.
95*/
96 if( binned->numberOfEs > 0 ) {
97 tpia_misc_sampleEqualProbableBin( smr, decaySamplingInfo, decaySamplingInfo->e_in, nBins, binned, &mu );
98 if( mu < -1. ) mu = -1.;
99 if( mu > 1. ) mu = 1.;
100 decaySamplingInfo->mu = mu;
101 status = 0;
102 }
103
104 return( status );
105}
int tpia_misc_sampleEqualProbableBin(statusMessageReporting *smr, tpia_decaySamplingInfo *decaySamplingInfo, double e_in, int nBins, tpia_EqualProbableBinSpectra *binned, double *value_)
Definition: tpia_misc.cc:420

Referenced by G4GIDI_target::getElasticFinalState(), and tpia_decayChannel_sampleProductsAtE().

◆ tpia_angularEnergy_getFromElement()

int tpia_angularEnergy_getFromElement ( statusMessageReporting smr,
xData_element angularEnergyElement,
tpia_angularEnergy angularEnergy 
)

Definition at line 73 of file tpia_angularEnergy.cc.

73 {
74
75 int i, j, status = 1;
76 xData_Int nBins, size, n, index;
77 xData_element *epbElement, *element;
80
81 xData_addToAccessed( smr, angularEnergyElement, 1 );
82 if( ( tpia_frame_setFromElement( smr, angularEnergyElement, 4, &(angularEnergy->frame) ) ) != 0 ) return( 1 );
83 //if( ( epbElement = xData_getOneElementByTagName( smr, angularEnergyElement, "equalProbableBins", 0 ) ) == NULL ) return( 1 );
84 if( ( epbElement = xData_getOneElementByTagName( smr, angularEnergyElement, (char*)"equalProbableBins", 0 ) ) == NULL ) return( 1 );
85 xData_addToAccessed( smr, epbElement, 1 );
86 if( xData_convertAttributeTo_xData_Int( smr, epbElement, "nBins", &nBins ) != 0 ) {
87 tpia_misc_setMessageError_Element( smr, NULL, epbElement, __FILE__, __LINE__, 1, "missing or invalid nBins attribute" );
88 return( 1 );
89 }
90 list = xData_getElementsByTagNameAndSort( smr, epbElement, "energy", NULL, NULL );
91 if( list->n == 0 ) {
92 tpia_misc_setMessageError_Element( smr, NULL, epbElement, __FILE__, __LINE__, 1, "bins does not contain any energy elements" ); }
93 else {
94 size = list->n * sizeof( tpia_EqualProbableBinSpectra );
95 angularEnergy->binned.nBins = (int) nBins;
96 //if( ( angularEnergy->binned.energies = xData_malloc2( smr, size, 1, "energies" ) ) != NULL ) {
97 if( ( angularEnergy->binned.energies = (tpia_EqualProbableBinSpectra*) xData_malloc2( smr, size, 1, "energies" ) ) != NULL ) {
98 status = 0;
99 for( i = 0, mus = angularEnergy->binned.energies; i < list->n; i++, mus++ ) {
100 mus->iValue = 0;
101 element = list->items[i].element;
102 if( xData_convertAttributeTo_xData_Int( smr, element, "index", &index ) != 0 ) {
103 tpia_misc_setMessageError_Element( smr, NULL, element, __FILE__, __LINE__, 1, "missing or invalid index attribute" );
104 status = 1;
105 break;
106 }
107 if( index != i ) {
108 tpia_misc_setMessageError_Element( smr, NULL, element, __FILE__, __LINE__, 1, "index = %lld is not incremental", index );
109 status = 1;
110 break;
111 }
112 if( ( j = xData_convertAttributeToDouble( smr, element, "value", &(mus->dValue) ) ) != 0 ) {
113 if( j == 1 ) {
114 tpia_misc_setMessageError_Element( smr, NULL, element, __FILE__, __LINE__, 1, "element does not have value attribute" ); }
115 else {
116 tpia_misc_setMessageError_Element( smr, NULL, element, __FILE__, __LINE__, 1, "failed to convert value attribute to double" );
117 }
118 status = 1;
119 break;
120 }
121 if( ( mus->energies = tpia_misc_getEqualProbableBins( smr, element, "mu", nBins, &n ) ) == NULL ) {
122 status = 1;
123 break; }
124 else {
125 mus->numberOfEs = n;
126 }
127 angularEnergy->binned.numberOfEs++;
128 }
129 }
130 }
131 xData_freeElementList( smr, list );
132 return( status );
133}
tpia_EqualProbableBinSpectra * energies
Definition: tpia_target.h:206
tpia_angularEnergyBin binned
Definition: tpia_target.h:228
tpia_data_frame frame
Definition: tpia_target.h:227
xData_element * element
Definition: xData.h:145
xData_elementListItem * items
Definition: xData.h:151
int tpia_misc_setMessageError_Element(statusMessageReporting *smr, void *userInterface, xData_element *element, const char *file, int line, int code, const char *fmt,...)
Definition: tpia_misc.cc:183
tpia_EqualProbableBinSpectrum * tpia_misc_getEqualProbableBins(statusMessageReporting *smr, xData_element *parent, const char *name, xData_Int nBins, xData_Int *n)
Definition: tpia_misc.cc:333
struct tpia_EqualProbableBinSpectra_s tpia_EqualProbableBinSpectra
Definition: tpia_target.h:61
int xData_convertAttributeToDouble(statusMessageReporting *smr, xData_element *element, const char *name, double *d)
Definition: xData.cc:730
void xData_freeElementList(statusMessageReporting *smr, xData_elementList *list)
Definition: xData.cc:832
xData_elementList * xData_getElementsByTagNameAndSort(statusMessageReporting *smr, xData_element *element, const char *tagName, const char *sortAttributeName, xData_sortElementFunc sortFunction)
Definition: xData.cc:788
xData_element * xData_getOneElementByTagName(statusMessageReporting *smr, xData_element *element, char *name, int required)
Definition: xData.cc:810
int xData_addToAccessed(statusMessageReporting *smr, xData_element *element, int increment)
Definition: xData.cc:1078
xData_Int xData_convertAttributeTo_xData_Int(statusMessageReporting *smr, xData_element *element, const char *name, xData_Int *n)
Definition: xData.cc:710
#define xData_malloc2(smr, size, zero, forItem)
Definition: xData.h:313

◆ tpia_angularEnergy_initialize()

int tpia_angularEnergy_initialize ( statusMessageReporting smr,
tpia_angularEnergy angularEnergy 
)

Definition at line 49 of file tpia_angularEnergy.cc.

49 {
50
51 memset( angularEnergy, 0, sizeof( tpia_angularEnergy ) );
52 if( tpia_frame_setFromString( smr, "", "", 0, &(angularEnergy->frame) ) ) return( 1 );
53 angularEnergy->binned.numberOfEs = 0;
54 angularEnergy->binned.energies = NULL;
55 return( 0 );
56}

Referenced by tpia_angularEnergy_release().

◆ tpia_angularEnergy_release()

int tpia_angularEnergy_release ( statusMessageReporting smr,
tpia_angularEnergy angularEnergy 
)

Definition at line 60 of file tpia_angularEnergy.cc.

60 {
61
62 int i;
63
64 for( i = 0; i < angularEnergy->binned.numberOfEs; i++ ) xData_free( smr, angularEnergy->binned.energies[i].energies );
65 //angularEnergy->binned.energies = xData_free( smr, angularEnergy->binned.energies );
66 angularEnergy->binned.energies = (tpia_EqualProbableBinSpectra*) xData_free( smr, angularEnergy->binned.energies );
67 tpia_angularEnergy_initialize( smr, angularEnergy );
68 return( 0 );
69}
int tpia_angularEnergy_initialize(statusMessageReporting *smr, tpia_angularEnergy *angularEnergy)

Referenced by tpia_product_release().

◆ tpia_angularEnergy_SampleEp()

int tpia_angularEnergy_SampleEp ( statusMessageReporting smr,
tpia_angularEnergy angularEnergy,
tpia_decaySamplingInfo decaySamplingInfo 
)

Definition at line 137 of file tpia_angularEnergy.cc.

137 {
138
139 int iE1, iE2;
140 tpia_EqualProbableBinSpectra *energies = angularEnergy->binned.energies;
141 double Ep, Ep1, Ep2, f, e_in = decaySamplingInfo->e_in;
142/*
143Currently, only equal probable binning is supported.
144Need to return frame info for Ep also.
145*/
146
147 if( !smr_isOk( smr ) ) return( 1 );
148 if( angularEnergy->binned.numberOfEs == 0 ) return( 1 );
149 for( iE2 = 0; iE2 < angularEnergy->binned.numberOfEs; iE2++ ) if( energies[iE2].dValue >= e_in ) break;
150 if( iE2 == 0 ) {
151 iE1 = iE2; }
152 else if( iE2 == angularEnergy->binned.numberOfEs ) {
153 iE1 = iE2 = angularEnergy->binned.numberOfEs - 1; }
154 else {
155 iE1 = iE2 - 1;
156 }
157 tpia_misc_sampleEqualProbableBin( smr, decaySamplingInfo, decaySamplingInfo->mu, angularEnergy->binned.nBins, &(energies[iE1]), &Ep1 );
158 if( iE1 == iE2 ) {
159 Ep = Ep1; }
160 else {
161 tpia_misc_sampleEqualProbableBin( smr, decaySamplingInfo, decaySamplingInfo->mu, angularEnergy->binned.nBins, &(energies[iE2]), &Ep2 );
162 f = ( energies[iE2].dValue - e_in ) / ( energies[iE2].dValue - energies[iE1].dValue );
163 Ep = f * Ep1 + ( 1 - f ) * Ep2;
164 }
165 decaySamplingInfo->Ep = Ep;
166
167 return( 0 );
168}
int smr_isOk(statusMessageReporting *smr)

Referenced by tpia_decayChannel_sampleProductsAtE().

◆ tpia_channel_create()

tpia_channel * tpia_channel_create ( statusMessageReporting smr)

Definition at line 50 of file tpia_channel.cc.

50 {
51
52 tpia_channel *channel;
53
54 //if( ( channel = xData_malloc2( smr, sizeof( tpia_channel ), 0, "channel" ) ) == NULL ) return( NULL );
55 if( ( channel = (tpia_channel*) xData_malloc2( smr, sizeof( tpia_channel ), 0, "channel" ) ) == NULL ) return( NULL );
56 if( tpia_channel_initialize( smr, channel ) ) channel = tpia_channel_free( smr, channel );
57 return( channel );
58}
tpia_channel * tpia_channel_free(statusMessageReporting *smr, tpia_channel *channel)
Definition: tpia_channel.cc:83
int tpia_channel_initialize(statusMessageReporting *, tpia_channel *channel)
Definition: tpia_channel.cc:63

Referenced by tpia_channel_createGetFromElement().

◆ tpia_channel_createGetFromElement()

tpia_channel * tpia_channel_createGetFromElement ( statusMessageReporting smr,
tpia_target_heated target,
xData_element channelElement,
int  pointwiseRequired 
)

Definition at line 71 of file tpia_channel.cc.

72 {
73
74 tpia_channel *channel;
75
76 if( ( channel = tpia_channel_create( smr ) ) == NULL ) return( NULL );
77 if( tpia_channel_getFromElement( smr, target, channelElement, channel, pointwiseRequired ) != 0 ) channel = tpia_channel_free( smr, channel );
78 return( channel );
79}
int tpia_channel_getFromElement(statusMessageReporting *smr, tpia_target_heated *target, xData_element *channelElement, tpia_channel *channel, int pointwiseRequired)
tpia_channel * tpia_channel_create(statusMessageReporting *smr)
Definition: tpia_channel.cc:50

Referenced by tpia_target_heated_read().

◆ tpia_channel_free()

tpia_channel * tpia_channel_free ( statusMessageReporting smr,
tpia_channel channel 
)

Definition at line 83 of file tpia_channel.cc.

83 {
84
85 tpia_channel_release( smr, channel );
86 xData_free( smr, channel );
87 return( NULL );
88}
int tpia_channel_release(statusMessageReporting *smr, tpia_channel *channel)
Definition: tpia_channel.cc:92

Referenced by tpia_channel_create(), tpia_channel_createGetFromElement(), and tpia_target_heated_release().

◆ tpia_channel_getCrossSectionAtE()

double tpia_channel_getCrossSectionAtE ( statusMessageReporting smr,
tpia_channel channel,
xData_Int  iEg,
double  e_in,
int  crossSectionType 
)

Definition at line 222 of file tpia_channel.cc.

223 {
224
225 double xsec = 0.;
226
227 if( crossSectionType == tpia_crossSectionType_grouped ) {
228 xsec = 0; }
229 else if( crossSectionType == tpia_crossSectionType_pointwise ) {
231 tpia_target_heated_getEIndex( channel->target, e_in ), e_in );
232 }
233 return( xsec );
234}
tpia_target_heated * target
Definition: tpia_target.h:251
tpia_1dData crossSectionPointwise
Definition: tpia_target.h:261
double tpia_misc_getPointwiseCrossSectionAtE(statusMessageReporting *smr, tpia_1dData *crossSection, double *energyGrid, xData_Int index, double e_in)
Definition: tpia_misc.cc:298
#define tpia_crossSectionType_grouped
Definition: tpia_target.h:88
xData_Int tpia_target_heated_getEIndex(tpia_target_heated *target, double e_in)
#define tpia_crossSectionType_pointwise
Definition: tpia_target.h:89

Referenced by tpia_target_heated_getIndexChannelCrossSectionAtE().

◆ tpia_channel_getFirstProduct()

tpia_product * tpia_channel_getFirstProduct ( tpia_channel channel)

Definition at line 185 of file tpia_channel.cc.

185 {
186
187 return( tpia_decayChannel_getFirstProduct( &(channel->decayChannel) ) );
188}
tpia_decayChannel decayChannel
Definition: tpia_target.h:264
tpia_product * tpia_decayChannel_getFirstProduct(tpia_decayChannel *decayChannel)

Referenced by G4GIDI_Misc_channelProductsCompare(), and tpia_channel_getProductByIndex().

◆ tpia_channel_getFromElement()

int tpia_channel_getFromElement ( statusMessageReporting smr,
tpia_target_heated target,
xData_element channelElement,
tpia_channel channel,
int  pointwiseRequired 
)

Definition at line 114 of file tpia_channel.cc.

115 {
116
117 xData_Int ll;
118 char *p;
119 xData_element *element, *pElement, *gElement, *eElement;
120
121 xData_addToAccessed( smr, channelElement, 1 );
122 channel->target = target;
123 xData_copyAttributionList( smr, &(channel->attributes), &(channelElement->attributes) );
124 channel->outputChannel = tpia_misc_pointerToAttributeIfAllOk2(smr, channelElement, 1, &(channel->attributes), "outputChannel" );
125 channel->genre = tpia_misc_pointerToAttributeIfAllOk2( smr, channelElement, 1, &(channel->attributes), "genre" );
126 channel->QString = tpia_misc_pointerToAttributeIfAllOk2( smr, channelElement, 1, &(channel->attributes), "Q" );
127 channel->fission = tpia_misc_pointerToAttributeIfAllOk2( smr, channelElement, 0, &(channel->attributes), "fission" );
128 if( smr_isOk( smr ) ) {
129 ll = 0;
130 if( xData_convertAttributeTo_xData_Int( smr, channelElement, "ENDL_C", &ll ) >= 0 ) channel->ENDL_C = (int) ll;
131 }
132 if( smr_isOk( smr ) ) {
133 ll = 0;
134 if( xData_convertAttributeTo_xData_Int( smr, channelElement, "ENDF_MT2", &ll ) >= 0 ) channel->ENDF_MT = (int) ll;
135 }
136 if( smr_isOk( smr ) ) {
137 channel->QIsFloat = 1;
138 channel->Q = strtod( channel->QString, &p ); /* Q string may be something like "notApplicable". */
139 if( *p != 0 ) { /* In that case set QIsFloat to false. */
140 channel->QIsFloat = 0;
141 channel->Q = 0.;
142 }
143 //if( ( element = xData_getOneElementByTagName( smr, channelElement, "crossSection", 1 ) ) != NULL ) {
144 if( ( element = xData_getOneElementByTagName( smr, channelElement, (char*) "crossSection", 1 ) ) != NULL ) {
145 if( ( tpia_frame_setFromElement( smr, element, 2, &channel->crossSectionFrame ) ) == 0 ) {
146 xData_addToAccessed( smr, element, 1 );
147 //if( ( pElement = xData_getOneElementByTagName( smr, element, "indexed", 1 ) ) != NULL ) {
148 if( ( pElement = xData_getOneElementByTagName( smr, element, (char*) "indexed", 1 ) ) != NULL ) {
150 &(channel->crossSectionPointwise.start), &(channel->crossSectionPointwise.end), target->energyGrid );
151 }
152 if( ( gElement = xData_getOneElementByTagName( smr, element, (char*) "grouped", 1 ) ) != NULL ) {
154 }
155 if( ( channel->crossSectionGrouped.data != NULL ) && ( ( channel->crossSectionPointwise.data != NULL ) || !pointwiseRequired ) ) {
156 if( target->contents == NULL ) { /* Only supported "crossSection" currently. */
157 if( !tpia_channel_isProduction( smr, channel ) ) {
158 //if( ( eElement = xData_getOneElementByTagName( smr, channelElement, "availableEnergy", 1 ) ) != NULL ) {
159 if( ( eElement = xData_getOneElementByTagName( smr, channelElement, (char*) "availableEnergy", 1 ) ) != NULL ) {
160 xData_addToAccessed( smr, eElement, 1 );
161 //if( ( gElement = xData_getOneElementByTagName( smr, eElement, "grouped", 1 ) ) != NULL ) {
162 if( ( gElement = xData_getOneElementByTagName( smr, eElement, (char*) "grouped", 1 ) ) != NULL ) {
164 }
165 }
166 }
167 }
168 if( smr_isOk( smr ) ) _tpia_channel_getProductData( smr, channelElement, channel );
169 }
170 }
171 }
172 }
173 return( !smr_isOk( smr ) );
174}
xData_Int start
Definition: tpia_target.h:144
double * data
Definition: tpia_target.h:145
xData_Int end
Definition: tpia_target.h:144
xData_attributionList attributes
Definition: tpia_target.h:254
tpia_1dData availableEnergyGrouped
Definition: tpia_target.h:263
tpia_1dData crossSectionGrouped
Definition: tpia_target.h:262
char * outputChannel
Definition: tpia_target.h:252
tpia_data_frame crossSectionFrame
Definition: tpia_target.h:260
xData_attributionList attributes
Definition: xData.h:186
int tpia_channel_isProduction(statusMessageReporting *, tpia_channel *channel)
#define tpia_misc_pointerToAttributeIfAllOk2(smr, element, required, attributes, name)
Definition: tpia_misc.h:42
double * tpia_misc_get2dxindex_y_data(statusMessageReporting *smr, xData_element *element, xData_Int *start, xData_Int *end, double *xValues)
Definition: tpia_misc.cc:248
int tpia_misc_get2d_xShared_yHistogram_data_Grouped(statusMessageReporting *smr, xData_element *element, tpia_1dData *group)
Definition: tpia_misc.cc:289
int xData_copyAttributionList(statusMessageReporting *smr, xData_attributionList *dest, xData_attributionList *src)
Definition: xData.cc:564

Referenced by tpia_channel_createGetFromElement().

◆ tpia_channel_getProductByIndex()

tpia_product * tpia_channel_getProductByIndex ( statusMessageReporting smr,
tpia_channel channel,
int  index 
)

Definition at line 193 of file tpia_channel.cc.

193 {
194
195 int i = 0;
196 tpia_product *p;
197
198 if( index < 0 ) return( NULL );
199 for( p = tpia_channel_getFirstProduct( channel ); ( p != NULL ) && ( i < index ); p = tpia_decayChannel_getNextProduct( p ), i++ ) ;
200 return( p );
201}
tpia_product * tpia_channel_getFirstProduct(tpia_channel *channel)
tpia_product * tpia_decayChannel_getNextProduct(tpia_product *product)

◆ tpia_channel_initialize()

int tpia_channel_initialize ( statusMessageReporting smr,
tpia_channel channel 
)

Definition at line 63 of file tpia_channel.cc.

63 {
64
65 memset( channel, 0, sizeof( tpia_channel ) );
66 return( 0 );
67}

Referenced by tpia_channel_create().

◆ tpia_channel_isProduction()

int tpia_channel_isProduction ( statusMessageReporting smr,
tpia_channel channel 
)

Definition at line 214 of file tpia_channel.cc.

214 {
215
216 return( strcmp( channel->genre, "production" ) == 0 );
217}

Referenced by tpia_channel_getFromElement().

◆ tpia_channel_numberOfProducts()

int tpia_channel_numberOfProducts ( statusMessageReporting smr,
tpia_channel channel 
)

Definition at line 206 of file tpia_channel.cc.

206 {
207
208 return( channel->decayChannel.numberOfProducts );
209}

◆ tpia_channel_release()

int tpia_channel_release ( statusMessageReporting smr,
tpia_channel channel 
)

Definition at line 92 of file tpia_channel.cc.

92 {
93
94 tpia_product *product, *nextProduct;
95
96 xData_releaseAttributionList( smr, &(channel->attributes) );
97 //channel->crossSectionPointwise.data = xData_free( smr, channel->crossSectionPointwise.data );
98 channel->crossSectionPointwise.data = (double*) xData_free( smr, channel->crossSectionPointwise.data );
99 //channel->crossSectionGrouped.data = xData_free( smr, channel->crossSectionGrouped.data );
100 channel->crossSectionGrouped.data = (double*) xData_free( smr, channel->crossSectionGrouped.data );
101 //channel->availableEnergyGrouped.data = xData_free( smr, channel->availableEnergyGrouped.data );
102 channel->availableEnergyGrouped.data = (double*) xData_free( smr, channel->availableEnergyGrouped.data );
103 for( product = channel->decayChannel.products; product != NULL; product = nextProduct ) {
104 nextProduct = product->next;
105 tpia_product_free( smr, product );
106 }
107 channel->decayChannel.numberOfProducts = 0;
108 channel->decayChannel.products = NULL;
109 return( 0 );
110}
tpia_product * products
Definition: tpia_target.h:211
tpia_product * next
Definition: tpia_target.h:232
tpia_product * tpia_product_free(statusMessageReporting *smr, tpia_product *product)
int xData_releaseAttributionList(statusMessageReporting *smr, xData_attributionList *attributes)
Definition: xData.cc:611

Referenced by tpia_channel_free().

◆ tpia_decayChannel_getFirstProduct()

tpia_product * tpia_decayChannel_getFirstProduct ( tpia_decayChannel decayChannel)

◆ tpia_decayChannel_getNextProduct()

tpia_product * tpia_decayChannel_getNextProduct ( tpia_product product)

◆ tpia_decayChannel_sampleProductsAtE()

int tpia_decayChannel_sampleProductsAtE ( statusMessageReporting smr,
tpia_decayChannel decayChannel,
tpia_decaySamplingInfo decaySamplingInfo,
int  nProductData,
tpia_productOutgoingData productData 
)

Definition at line 65 of file tpia_decayChannel.cc.

66 {
67
68 int i, n = 0, multiplicity, secondTwoBody = 0, labFrame = tpia_referenceFrame_lab;
69 tpia_product *product, *nextProduct;
70 double phi, p;
71
72 if( nProductData < decayChannel->numberOfProducts ) {
73 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1, "nProductData = %d < decayChannel->numberOfProducts = %d", nProductData,
74 decayChannel->numberOfProducts );
75 return( -1 );
76 }
77 for( i = 0, product = tpia_decayChannel_getFirstProduct( decayChannel ); product != NULL; i++, product = tpia_decayChannel_getNextProduct( product ) ) {
78 nextProduct = tpia_decayChannel_getNextProduct( product );
79 if( !secondTwoBody ) {
80 if( ( multiplicity = product->multiplicity ) == 0 ) multiplicity = tpia_product_sampleMultiplicity( smr, product, decaySamplingInfo->e_in,
81 tpia_misc_drng( decaySamplingInfo->rng, decaySamplingInfo->rngState ) );
82 while( multiplicity > 0 ) {
83 if( n >= nProductData ) break; /* This needs work. */
84 multiplicity--;
85 decaySamplingInfo->genre = product->genre;
86 decaySamplingInfo->productID = product->productID;
87 decaySamplingInfo->mu = 0;
88 decaySamplingInfo->Ep = 0;
89 productDatas[n].genre = product->genre;
90 productDatas[n].isVelocity = decaySamplingInfo->isVelocity;
91 tpia_frame_setColumns( smr, &(productDatas[n].frame), 1, &labFrame );
92 productDatas[n].productID = product->productID;
93 productDatas[n].decayChannel = &(product->decayChannel);
94 if( strcmp( product->genre, "twoBody_angular" ) == 0 ) {
95 secondTwoBody = 1;
96 productDatas[n+1].productID = nextProduct->productID;
97 productDatas[n].genre = product->genre;
98 tpia_angular_SampleMu( smr, &(product->angular), decaySamplingInfo ); /* Need to test for success. */
99 if( smr_isOk( smr ) ) {
100 phi = 2. * M_PI * tpia_misc_drng( decaySamplingInfo->rng, decaySamplingInfo->rngState );
101 productDatas[n].isVelocity = decaySamplingInfo->isVelocity;
102 productDatas[n].frame = decaySamplingInfo->frame;
103 tpia_kinetics_2BodyReaction( smr, decayChannel, decaySamplingInfo->e_in, decaySamplingInfo->mu, phi, &(productDatas[n]) );
104 } }
105 else if( strcmp( product->genre, "NBody_Legendre" ) == 0 ) {
106 tpia_Legendre_SampleEp( smr, &(product->Legendre), 1, decaySamplingInfo ); }
107 else if( strcmp( product->genre, "NBody_angular_energy" ) == 0 ) {
108 tpia_angular_SampleMu( smr, &(product->angular), decaySamplingInfo ); /* Need to test for success. */
109 tpia_angularEnergy_SampleEp( smr, &(product->angularEnergy), decaySamplingInfo ); }
110 else if( strcmp( product->genre, "NBody_uncorrelate_Legendre" ) == 0 ) {
111 tpia_angular_SampleMu( smr, &(product->angular), decaySamplingInfo ); /* Need to test for success. */
112 tpia_Legendre_SampleEp( smr, &(product->Legendre), 0, decaySamplingInfo ); }
113 else if( strcmp( product->genre, "unknown" ) == 0 ) {
114 }
115 else {
116 printf( "Unknown spectral data form product name = %s, genre = %s\n", product->productID->name, product->genre );
117 }
118 if( !smr_isOk( smr ) ) return( -1 );
119 if( secondTwoBody ) {
120 n++;
121 productDatas[n].productID = nextProduct->productID;
122 productDatas[n].genre = nextProduct->genre; }
123 else {
124 productDatas[n].kineticEnergy = decaySamplingInfo->Ep;
125 p = std::sqrt( decaySamplingInfo->Ep * ( decaySamplingInfo->Ep + 2. * product->productID->fullMass_MeV ) );
126 productDatas[n].pz_vz = p * decaySamplingInfo->mu;
127 p = std::sqrt( 1. - decaySamplingInfo->mu * decaySamplingInfo->mu ) * p;
128 phi = 2. * M_PI * tpia_misc_drng( decaySamplingInfo->rng, decaySamplingInfo->rngState );
129 productDatas[n].px_vx = p * std::sin( phi );
130 productDatas[n].py_vy = p * std::cos( phi );
131 }
132 n++;
133 }
134 }
135 }
136 return( n );
137}
#define M_PI
Definition: SbMath.h:34
int smr_setMessageError(statusMessageReporting *smr, void *userInterface, const char *file, int line, int code, const char *fmt,...)
tpia_particle * productID
Definition: tpia_target.h:155
double(* rng)(void *)
Definition: tpia_target.h:153
tpia_data_frame frame
Definition: tpia_target.h:152
char const * genre
Definition: tpia_target.h:237
tpia_particle * productID
Definition: tpia_target.h:236
tpia_product * tpia_decayChannel_getFirstProduct(tpia_decayChannel *decayChannel)
tpia_product * tpia_decayChannel_getNextProduct(tpia_product *product)
#define tpia_referenceFrame_lab
Definition: tpia_target.h:85
int tpia_kinetics_2BodyReaction(statusMessageReporting *smr, tpia_decayChannel *decayChannel, double K, double mu, double phi, tpia_productOutgoingData *outgoingData)
double tpia_misc_drng(double(*rng)(void *), void *rngState)
Definition: tpia_misc.cc:403
int tpia_frame_setColumns(statusMessageReporting *smr, tpia_data_frame *frame, int nColumns, int *values)
Definition: tpia_frame.cc:178
int tpia_Legendre_SampleEp(statusMessageReporting *smr, tpia_Legendre *Legendre, int sampleMu, tpia_decaySamplingInfo *decaySamplingInfo)
int tpia_angularEnergy_SampleEp(statusMessageReporting *smr, tpia_angularEnergy *angularEnergy, tpia_decaySamplingInfo *decaySamplingInfo)
int tpia_angular_SampleMu(statusMessageReporting *smr, tpia_angular *angular, tpia_decaySamplingInfo *decaySamplingInfo)
Definition: tpia_angular.cc:87
int tpia_product_sampleMultiplicity(statusMessageReporting *smr, tpia_product *product, double e_in, double r)

Referenced by tpia_target_heated_sampleIndexChannelProductsAtE().

◆ tpia_frame_clear()

int tpia_frame_clear ( statusMessageReporting smr,
tpia_data_frame frame 
)

Definition at line 53 of file tpia_frame.cc.

53 {
54
55 frame->frames = 0;
56 return( 0 );
57}
unsigned int frames
Definition: tpia_target.h:140

Referenced by tpia_frame_setColumns().

◆ tpia_frame_getColumn()

int tpia_frame_getColumn ( statusMessageReporting smr,
tpia_data_frame frame,
int  column 
)

Definition at line 213 of file tpia_frame.cc.

213 {
214
215 unsigned int value;
216
217 if( ( column < 0 ) || ( column >= tpia_maxNumberOfFrames ) ) {
218 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1, "bad column = %d value for getting frame (0 <= column < %d)", column, tpia_maxNumberOfFrames );
219 return( -1 ); }
220 else {
221 value = frame->frames >> ( 2 * column );
222 }
223 return( (int) ( value & 3 ) );
224}
#define tpia_maxNumberOfFrames
Definition: tpia_target.h:82

Referenced by tpia_frame_toString(), and tpia_kinetics_COMKineticEnergy2LabEnergyAndMomentum().

◆ tpia_frame_getDimensions()

int tpia_frame_getDimensions ( statusMessageReporting smr,
tpia_data_frame frame 
)

Definition at line 121 of file tpia_frame.cc.

121 {
122
123 int i, dimension = 0;
124 unsigned value = frame->frames;
125
126 for( i = 0; i < tpia_maxNumberOfFrames; i++ ) {
127 if( ( value & 3 ) == 0 ) break;
128 dimension++;
129 value = value >> 2;
130 }
131 return( dimension );
132}

Referenced by tpia_frame_toString().

◆ tpia_frame_setColumn()

int tpia_frame_setColumn ( statusMessageReporting smr,
tpia_data_frame frame,
int  column,
int  value 
)

Definition at line 190 of file tpia_frame.cc.

190 {
191
192 int i;
193
194 if( ( column < 0 ) || ( column >= tpia_maxNumberOfFrames ) ) {
195 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1, "bad column = %d value for setting frame (0 <= column < %d)", column, tpia_maxNumberOfFrames );
196 return( 1 ); }
197 else {
198 if( ( value < tpia_referenceFrame_None ) || ( value > tpia_referenceFrame_Max ) ) {
199 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1, "bad frame value = %d for column = %d", value, column );
200 return( 1 ); }
201 else {
202 i = 3 << ( 2 * column );
203 frame->frames = frame->frames & (~i);
204 value = value << ( 2 * column );
205 frame->frames = frame->frames | value;
206 }
207 }
208 return( 0 );
209}
#define tpia_referenceFrame_None
Definition: tpia_target.h:83
#define tpia_referenceFrame_Max
Definition: tpia_target.h:86

Referenced by G4GIDI_target::getElasticFinalState(), G4GIDI_target::getFinalState(), tpia_frame_setColumns(), and tpia_frame_setFromString().

◆ tpia_frame_setColumns()

int tpia_frame_setColumns ( statusMessageReporting smr,
tpia_data_frame frame,
int  nColumns,
int *  values 
)

Definition at line 178 of file tpia_frame.cc.

178 {
179
180 int i;
181
182 tpia_frame_clear( smr, frame );
183 for( i = 0; i < nColumns; i++ ) if( tpia_frame_setColumn( smr, frame, i, values[i] ) != 0 ) return( 1 );
184
185 return( 0 );
186}
int tpia_frame_clear(statusMessageReporting *, tpia_data_frame *frame)
Definition: tpia_frame.cc:53
int tpia_frame_setColumn(statusMessageReporting *smr, tpia_data_frame *frame, int column, int value)
Definition: tpia_frame.cc:190

Referenced by tpia_decayChannel_sampleProductsAtE().

◆ tpia_frame_setFromElement()

int tpia_frame_setFromElement ( statusMessageReporting smr,
xData_element element,
int  dimension,
tpia_data_frame frame 
)

Definition at line 61 of file tpia_frame.cc.

61 {
62
63 char const *value = xData_getAttributesValueInElement( element, "frame" );
64
65 if( value == NULL ) {
66 tpia_misc_setMessageError_Element( smr, NULL, element, __FILE__, __LINE__, 1, "element is missing frame attribute" );
67 return( 1 );
68 }
69 return( tpia_frame_setFromString( smr, element->fullName, value, dimension, frame ) );
70}
char * fullName
Definition: xData.h:185
int tpia_frame_setFromString(statusMessageReporting *smr, const char *forItem, const char *value, int dimension, tpia_data_frame *frame)
Definition: tpia_frame.cc:74
const char * xData_getAttributesValueInElement(xData_element *element, const char *name)
Definition: xData.cc:546

Referenced by tpia_angular_getFromElement(), tpia_angularEnergy_getFromElement(), tpia_channel_getFromElement(), tpia_Legendre_getFromElement(), and tpia_multiplicity_getFromElement().

◆ tpia_frame_setFromString()

int tpia_frame_setFromString ( statusMessageReporting smr,
const char *  forItem,
const char *  value,
int  dimension,
tpia_data_frame frame 
)

Definition at line 74 of file tpia_frame.cc.

74 {
75
76 char const *e;
77 int status = 1, i;
78
79 for( i = 0; i < tpia_maxNumberOfFrames; i++ ) tpia_frame_setColumn( smr, frame, i, tpia_referenceFrame_None );
80 if( dimension > tpia_maxNumberOfFrames ) {
81 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1, "dimension argument = %d is greater than tpia_maxNumberOfFrames = %d", dimension,
83 return( status );
84 }
85 for( i = 0, e = value; ( i < dimension ) && ( *e != 0 ); i++ ) {
86 if( strstr( e, lab_Str ) == e ) {
88 e += 3; }
89 else if( strstr( e, COM_Str ) == e ) {
91 e += 12; }
92 else {
93 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1, "bad frame '%s' for %s", value, forItem );
94 break;
95 }
96 if( *e != 0 ) {
97 if( *e != ',' ) {
98 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1, "bad separater for frame '%s' for %s", value, forItem );
99 break;
100 }
101 e++;
102 }
103 }
104 if( smr_isOk( smr ) ) {
105 if( i == dimension ) {
106 if( *e == 0 ) {
107 status = 0; }
108 else {
109 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1, "extra values for frame '%s' for %s", value, forItem );
110 } }
111 else {
112 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1, "missing values for frame '%s' for %s", value, forItem );
113 }
114 }
115 return( status );
116}
#define tpia_referenceFrame_COM
Definition: tpia_target.h:84

Referenced by tpia_angular_initialize(), tpia_angularEnergy_initialize(), tpia_frame_setFromElement(), tpia_Legendre_initialize(), and tpia_multiplicity_initialize().

◆ tpia_frame_toString()

char * tpia_frame_toString ( statusMessageReporting smr,
const char *  fromItem,
tpia_data_frame frame 
)

Definition at line 137 of file tpia_frame.cc.

137 {
138
139 int i, n = tpia_frame_getDimensions( smr, frame ), value, nStr = 0;
140 char *str = NULL, *p;
141
142 if( nlab_Str == 0 ) {
143 nlab_Str = strlen( lab_Str );
144 nCOM_Str = strlen( COM_Str );
145 }
146 for( i = 0; i < n; i++ ) {
147 value = tpia_frame_getColumn( smr, frame, i );
148 if( value == tpia_referenceFrame_COM ) {
149 nStr += nCOM_Str + 1; }
150 else if( value == tpia_referenceFrame_lab ) {
151 nStr += nlab_Str + 1; }
152 else {
153 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1, "bad frame value = %d for column = %d", value, i );
154 return( NULL );
155 }
156 }
157 if( nStr == 0 ) nStr = 1;
158 //if( ( str = xData_malloc2( smr, nStr, 1, "str" ) ) == NULL ) return( NULL );
159 if( ( str = (char*) xData_malloc2( smr, nStr, 1, "str" ) ) == NULL ) return( NULL );
160 for( i = 0, p = str - 1; i < n; i++ ) {
161 p++;
162 value = tpia_frame_getColumn( smr, frame, i );
163 if( value == tpia_referenceFrame_COM ) {
164 strcpy( p, COM_Str );
165 p += nCOM_Str; }
166 else {
167 strcpy( p, lab_Str );
168 p += nlab_Str;
169 }
170 *p = ',';
171 }
172 *p = 0;
173 return( str );
174}
int tpia_frame_getColumn(statusMessageReporting *smr, tpia_data_frame *frame, int column)
Definition: tpia_frame.cc:213
int tpia_frame_getDimensions(statusMessageReporting *, tpia_data_frame *frame)
Definition: tpia_frame.cc:121

◆ tpia_kinetics_2BodyReaction()

int tpia_kinetics_2BodyReaction ( statusMessageReporting smr,
tpia_decayChannel decayChannel,
double  K,
double  mu,
double  phi,
tpia_productOutgoingData outgoingData 
)

Definition at line 48 of file tpia_kinetics.cc.

49 {
50
51 tpia_product *pp3 = tpia_decayChannel_getFirstProduct( decayChannel ), *pp4;
52 double m1 = decayChannel->m1_fullMass_MeV, m2 = decayChannel->m2_fullMass_MeV, m3, m4, mi, mf, Kp, x, beta;
53
55 m3 = pp3->productID->fullMass_MeV;
56 m4 = pp4->productID->fullMass_MeV;
57 mi = m1 + m2;
58 mf = m3 + m4;
59 beta = std::sqrt( K * ( K + 2. * m1 ) ) / ( K + mi );
60 x = K * m2 / ( mi * mi );
61 if( x < 2e-5 ) { /* Kp is the total kinetic energy for m3 and m4 in the COM frame. */
62 Kp = mi - mf + K * m2 / mi * ( 1 - 0.5 * x * ( 1 - x ) ); }
63 else {
64 Kp = std::sqrt( mi * mi + 2 * K * m2 ) - mf;
65 }
66 if( Kp < 0 ) Kp = 0.; /* ???? There needs to be a better test here. */
67 outgoingData[0].decayChannel = &(pp3->decayChannel);
68 outgoingData[1].genre = outgoingData[0].genre;
69 outgoingData[1].productID = pp4->productID;
70 outgoingData[1].decayChannel = &(pp4->decayChannel);
71 return( tpia_kinetics_COMKineticEnergy2LabEnergyAndMomentum( smr, beta, Kp, mu, phi, m3, m4, outgoingData ) );
72}
double fullMass_MeV
Definition: tpia_target.h:130
tpia_particle * productID
Definition: tpia_target.h:165
tpia_decayChannel * decayChannel
Definition: tpia_target.h:170
tpia_decayChannel decayChannel
Definition: tpia_target.h:247
int tpia_kinetics_COMKineticEnergy2LabEnergyAndMomentum(statusMessageReporting *, double beta, double e_kinetic_com, double mu, double phi, double m3cc, double m4cc, tpia_productOutgoingData *outgoingData)

Referenced by tpia_decayChannel_sampleProductsAtE().

◆ tpia_kinetics_COMKineticEnergy2LabEnergyAndMomentum()

int tpia_kinetics_COMKineticEnergy2LabEnergyAndMomentum ( statusMessageReporting smr,
double  beta,
double  e_kinetic_com,
double  mu,
double  phi,
double  m3cc,
double  m4cc,
tpia_productOutgoingData outgoingData 
)

Definition at line 77 of file tpia_kinetics.cc.

78 {
79/*
80* beta the velocity/speedOflight of the com frame relative to the lab frame.
81* e_kinetic_com Total kinetic energy (K1 + K2) in the COM frame.
82* mu std::cos( theta ) in the COM frame.
83*/
84 double x, v_p, p, pp3, pp4, px3, py3, pz3, pz4, pz, p_perp2, E3, E4, gamma, m3cc2 = m3cc * m3cc, m4cc2 = m4cc * m4cc;
85
86 p = std::sqrt( e_kinetic_com * ( e_kinetic_com + 2. * m3cc ) * ( e_kinetic_com + 2. * m4cc ) * ( e_kinetic_com + 2. * ( m3cc + m4cc ) ) ) /
87 ( 2. * ( e_kinetic_com + m3cc + m4cc ) );
88 py3 = p * std::sqrt( 1 - mu * mu );
89 px3 = py3 * std::cos( phi );
90 py3 *= std::sin( phi );
91 pz = p * mu;
92 if( tpia_frame_getColumn( NULL, &(outgoingData[0].frame), 0 ) == tpia_referenceFrame_lab ) {
93 E3 = std::sqrt( p * p + m3cc2 );
94 E4 = std::sqrt( p * p + m4cc2 );
95 gamma = std::sqrt( 1. / ( 1. - beta * beta ) );
96 pz3 = gamma * ( pz + beta * E3 );
97 pz4 = gamma * ( -pz + beta * E4 ); }
98 else {
99 pz3 = pz;
100 pz4 = -pz;
101 }
102 outgoingData[1].isVelocity = outgoingData[0].isVelocity;
103 outgoingData[1].frame = outgoingData[0].frame;
104
105 p_perp2 = px3 * px3 + py3 * py3;
106
107 outgoingData[0].px_vx = px3;
108 outgoingData[0].py_vy = py3;
109 outgoingData[0].pz_vz = pz3;
110 pp3 = p_perp2 + pz3 * pz3;
111 x = pp3 / ( 2 * m3cc2 );
112 if( x < 1e-5 ) {
113 outgoingData[0].kineticEnergy = m3cc * x * ( 1 - 0.5 * x * ( 1 - x ) ); }
114 else {
115 outgoingData[0].kineticEnergy = std::sqrt( m3cc2 + pp3 ) - m3cc;
116 }
117 outgoingData[1].px_vx = -px3;
118 outgoingData[1].py_vy = -py3;
119 outgoingData[1].pz_vz = pz4;
120 pp4 = p_perp2 + pz4 * pz4;
121 x = pp4 / ( 2 * m4cc2 );
122 if( x < 1e-5 ) {
123 outgoingData[1].kineticEnergy = m4cc * x * ( 1 - 0.5 * x * ( 1 - x ) ); }
124 else {
125 outgoingData[1].kineticEnergy = std::sqrt( m4cc2 + pp4 ) - m4cc;
126 }
127
128 if( outgoingData[0].isVelocity ) {
129 v_p = tpia_speedOfLight_cm_sec / std::sqrt( pp3 + m3cc2 );
130 outgoingData[0].px_vx *= v_p;
131 outgoingData[0].py_vy *= v_p;
132 outgoingData[0].pz_vz *= v_p;
133
134 v_p = tpia_speedOfLight_cm_sec / std::sqrt( pp4 + m4cc2 );
135 outgoingData[1].px_vx *= v_p;
136 outgoingData[1].py_vy *= v_p;
137 outgoingData[1].pz_vz *= v_p;
138 }
139
140 return( 0 );
141}
int tpia_frame_getColumn(statusMessageReporting *smr, tpia_data_frame *frame, int column)
Definition: tpia_frame.cc:213
#define tpia_speedOfLight_cm_sec
Definition: tpia_target.h:100

Referenced by tpia_kinetics_2BodyReaction().

◆ tpia_Legendre_getFromElement()

int tpia_Legendre_getFromElement ( statusMessageReporting smr,
xData_element LegendreElement,
tpia_Legendre Legendre 
)

Definition at line 78 of file tpia_Legendre.cc.

78 {
79
80 int i, status = 0;
82
83 xData_addToAccessed( smr, LegendreElement, 1 );
84 if( ( tpia_frame_setFromElement( smr, LegendreElement, 4, &(Legendre->frame) ) ) != 0 ) return( 1 );
85 list = xData_getElementsByTagNameAndSort( smr, LegendreElement, "l", NULL, NULL );
86 if( list->n == 0 ) {
87 status = 1;
88 tpia_misc_setMessageError_Element( smr, NULL, LegendreElement, __FILE__, __LINE__, 1, "Legendre element does not contain any l elements" ); }
89 else {
90 //if( ( Legendre->binned.ls = xData_malloc2( smr, list->n * sizeof( tpia_EqualProbableBinSpectra ), 1, "ls" ) ) != NULL ) {
91 if( ( Legendre->binned.ls = (tpia_EqualProbableBinSpectra*) xData_malloc2( smr, list->n * sizeof( tpia_EqualProbableBinSpectra ), 1, "ls" ) ) != NULL ) {
92 Legendre->binned.numberOfLs = 0;
93 for( i = 0; i < list->n; i++ ) {
94 if( ( status = _tpia_Legendre_getOrder( smr, list->items[i].element, Legendre, &(Legendre->binned.ls[i]) ) ) != 0 ) break;
95 Legendre->binned.numberOfLs++;
96 }
97 }
98 }
99 xData_freeElementList( smr, list );
100 return( status );
101}
tpia_EqualProbableBinSpectra * ls
Definition: tpia_target.h:201
tpia_data_frame frame
Definition: tpia_target.h:222
tpia_LegendreBin binned
Definition: tpia_target.h:223

◆ tpia_Legendre_initialize()

int tpia_Legendre_initialize ( statusMessageReporting smr,
tpia_Legendre Legendre 
)

Definition at line 54 of file tpia_Legendre.cc.

54 {
55
56 memset( Legendre, 0, sizeof( tpia_Legendre ) );
57 if( tpia_frame_setFromString( smr, "", "", 0, &(Legendre->frame) ) ) return( 1 );
58 Legendre->binned.numberOfLs = 0;
59 Legendre->binned.ls = NULL;
60 return( 0 );
61}

Referenced by tpia_Legendre_release(), and tpia_product_initialize().

◆ tpia_Legendre_release()

int tpia_Legendre_release ( statusMessageReporting smr,
tpia_Legendre Legendre 
)

Definition at line 65 of file tpia_Legendre.cc.

65 {
66
67 int i;
68
69 for( i = 0; i < Legendre->binned.numberOfLs; i++ ) xData_free( smr, Legendre->binned.ls[i].energies );
70 //Legendre->binned.ls = xData_free( smr, Legendre->binned.ls );
71 Legendre->binned.ls = (tpia_EqualProbableBinSpectra*) xData_free( smr, Legendre->binned.ls );
72 tpia_Legendre_initialize( smr, Legendre );
73 return( 0 );
74}
int tpia_Legendre_initialize(statusMessageReporting *smr, tpia_Legendre *Legendre)

Referenced by tpia_product_release().

◆ tpia_Legendre_SampleEp()

int tpia_Legendre_SampleEp ( statusMessageReporting smr,
tpia_Legendre Legendre,
int  sampleMu,
tpia_decaySamplingInfo decaySamplingInfo 
)

Definition at line 127 of file tpia_Legendre.cc.

127 {
128
129 tpia_EqualProbableBinSpectra *binned_l0 = Legendre->binned.ls;
130 double Ep;
131
132/*
133Currently, only l = 0, equal probable binning is supported.
134Need to return frame info for Ep, mu, also.
135*/
136 if( Legendre->binned.numberOfLs > 0 ) {
137 if( sampleMu ) decaySamplingInfo->mu = 2. * tpia_misc_drng( decaySamplingInfo->rng, decaySamplingInfo->rngState ) - 1.;
138#ifndef WIN32
139 if( decaySamplingInfo->mu <= -1 ) decaySamplingInfo->mu = nextafter( -1., 0. );
140#endif
141#ifdef WIN32
142 if( decaySamplingInfo->mu <= -1 ) decaySamplingInfo->mu = _nextafter( -1., 0. );
143#endif
144
145 tpia_misc_sampleEqualProbableBin( smr, decaySamplingInfo, decaySamplingInfo->e_in, binned_l0->nBins, binned_l0, &Ep );
146 /* ??? Need to check that e_in > E_Threshold */
147 decaySamplingInfo->Ep = Ep; }
148 else {
149 return( 1 );
150 }
151
152 return( 0 );
153}

Referenced by tpia_decayChannel_sampleProductsAtE().

◆ tpia_misc_drng()

double tpia_misc_drng ( double(*)(void *)  rng,
void *  rngState 
)

Definition at line 403 of file tpia_misc.cc.

403 {
404
405 double r;
406
407 if( rng != NULL ) {
408 r = rng( rngState ); }
409 else {
410 //r = drand48( );
412
413 }
414 return( r );
415}
virtual double flat()=0
static HepRandomEngine * getTheEngine()
Definition: Random.cc:165

Referenced by G4GIDI_target::sampleChannelCrossSectionAtE(), tpia_decayChannel_sampleProductsAtE(), tpia_Legendre_SampleEp(), and tpia_misc_sampleEqualProbableBin().

◆ tpia_misc_get2d_xShared_yHistogram_data()

double * tpia_misc_get2d_xShared_yHistogram_data ( statusMessageReporting smr,
xData_element element,
xData_Int start,
xData_Int end,
xData_Int length 
)

Definition at line 268 of file tpia_misc.cc.

268 {
269
270 xData_Int i;
271 xData_element *xDataElement;
272 double *d = NULL;
273
274 xData_addToAccessed( smr, element, 1 );
275 //if( ( xDataElement = xData_getOneElementByTagName( smr, element, "xData", 1 ) ) != NULL ) {
276 if( ( xDataElement = xData_getOneElementByTagName( smr, element, (char*) "xData", 1 ) ) != NULL ) {
277 xData_addToAccessed( smr, xDataElement, 1 );
278 if( ( d = xData_2d_xShared_yHistogram_copyData( smr, xDataElement, &i ) ) != NULL ) {
279 if( start != NULL ) *start = xDataElement->xDataTypeInfo.start;
280 if( end != NULL ) *end = xDataElement->xDataTypeInfo.end;
281 if( length != NULL ) *length = xDataElement->xDataTypeInfo.length;
282 }
283 }
284 return( d );
285}
xData_Int length
Definition: xData.h:162
xData_Int end
Definition: xData.h:162
xData_Int start
Definition: xData.h:162
xDataType xDataTypeInfo
Definition: xData.h:187
double * xData_2d_xShared_yHistogram_copyData(statusMessageReporting *smr, xData_element *element, xData_Int *n)

Referenced by tpia_misc_get2d_xShared_yHistogram_data_Grouped().

◆ tpia_misc_get2d_xShared_yHistogram_data_Grouped()

int tpia_misc_get2d_xShared_yHistogram_data_Grouped ( statusMessageReporting smr,
xData_element element,
tpia_1dData group 
)

Definition at line 289 of file tpia_misc.cc.

289 {
290
291 if( ( group->data = tpia_misc_get2d_xShared_yHistogram_data( smr, element, &(group->start), &(group->end), &(group->length) ) ) == NULL ) return( 1 );
292 return( 0 );
293}
xData_Int length
Definition: tpia_target.h:144
double * tpia_misc_get2d_xShared_yHistogram_data(statusMessageReporting *smr, xData_element *element, xData_Int *start, xData_Int *end, xData_Int *length)
Definition: tpia_misc.cc:268

Referenced by tpia_channel_getFromElement(), and tpia_multiplicity_getFromElement().

◆ tpia_misc_get2dx_y_data()

double * tpia_misc_get2dx_y_data ( statusMessageReporting smr,
xData_element element,
xData_Int length 
)

Definition at line 228 of file tpia_misc.cc.

228 {
229
230 xData_element *xDataElement;
231 double *d = NULL;
232 xData_Int length_;
233
234 xData_addToAccessed( smr, element, 1 );
235 //if( ( xDataElement = xData_getOneElementByTagName( smr, element, "xData", 1 ) ) != NULL ) {
236 if( ( xDataElement = xData_getOneElementByTagName( smr, element, (char*)"xData", 1 ) ) != NULL ) {
237 xData_addToAccessed( smr, xDataElement, 1 );
238 if( xData_is_2d_xy( smr, &(xDataElement->xDataTypeInfo), 1 ) ) {
239 d = xData_2d_xy_allocateCopyData( smr, xDataElement, &length_ );
240 *length = (xData_Int) length_;
241 }
242 }
243 return( d );
244}
int xData_is_2d_xy(statusMessageReporting *smr, xDataType *xDT, int setMsg)
Definition: xData_2d_xy.cc:70
double * xData_2d_xy_allocateCopyData(statusMessageReporting *smr, xData_element *element, xData_Int *length)
Definition: xData_2d_xy.cc:84

Referenced by tpia_multiplicity_getFromElement().

◆ tpia_misc_get2dxindex_y_data()

double * tpia_misc_get2dxindex_y_data ( statusMessageReporting smr,
xData_element element,
xData_Int start,
xData_Int end,
double *  xValues 
)

Definition at line 248 of file tpia_misc.cc.

248 {
249
250 xData_element *xDataElement;
251 double *d = NULL;
252
253 xData_addToAccessed( smr, element, 1 );
254 //if( ( xDataElement = xData_getOneElementByTagName( smr, element, "xData", 1 ) ) != NULL ) {
255 if( ( xDataElement = xData_getOneElementByTagName( smr, element, (char*) "xData", 1 ) ) != NULL ) {
256 xData_addToAccessed( smr, xDataElement, 1 );
257 if( xData_is_2d_xindex_y( smr, &(xDataElement->xDataTypeInfo), 1 ) ) {
258 if( start != NULL ) *start = xDataElement->xDataTypeInfo.start;
259 if( end != NULL ) *end = xDataElement->xDataTypeInfo.end;
260 d = xData_2d_xindex_y_toFilledYs( smr, xDataElement, xValues );
261 }
262 }
263 return( d );
264}
int xData_is_2d_xindex_y(statusMessageReporting *smr, xDataType *xDT, int setMsg)
double * xData_2d_xindex_y_toFilledYs(statusMessageReporting *smr, xData_element *element, double *Xs)

Referenced by tpia_channel_getFromElement().

◆ tpia_misc_getPointwiseCrossSectionAtE()

double tpia_misc_getPointwiseCrossSectionAtE ( statusMessageReporting smr,
tpia_1dData crossSection,
double *  energyGrid,
xData_Int  index,
double  e_in 
)

Definition at line 298 of file tpia_misc.cc.

298 {
299
300 double xsec = 0.0, e1, e2;
301
302 if( ( index >= crossSection->start ) && ( index < crossSection->end ) ) {
303 e1 = energyGrid[index];
304 e2 = energyGrid[index + 1];
305 index -= crossSection->start;
306 if( e1 == e2 ) { /* Allow for future where step function may be allowed. */
307 xsec = 0.5 * ( crossSection->data[index] + crossSection->data[index + 1] ); }
308 else {
309 xsec = ( crossSection->data[index] * ( e2 - e_in ) + crossSection->data[index + 1] * ( e_in - e1 ) ) / ( e2 - e1 );
310 }
311 }
312 return( xsec );
313}

Referenced by tpia_channel_getCrossSectionAtE(), and tpia_target_heated_getTotalCrossSectionAtE().

◆ tpia_misc_NumberOfZSymbols()

int tpia_misc_NumberOfZSymbols ( void  )

Definition at line 76 of file tpia_misc.cc.

76 {
77
78 return( sizeof( ZSymbols ) / sizeof( struct ZSymbol ) );
79}

Referenced by tpia_misc_symbolToZ(), and tpia_misc_ZToSymbol().

◆ tpia_misc_pointerToAttributeIfAllOk()

char * tpia_misc_pointerToAttributeIfAllOk ( statusMessageReporting smr,
xData_element element,
const char *  path,
int  required,
xData_attributionList attributes,
const char *  name,
const char *  file,
int  line 
)

Definition at line 163 of file tpia_misc.cc.

164 {
165
166 char *value;
167
168 if( !smr_isOk( smr ) ) return( NULL );
169 if( ( value = xData_getAttributesValue( attributes, name ) ) == NULL ) {
170 if( required ) {
171 if( element != NULL ) {
172 tpia_misc_setMessageError_Element( smr, NULL, element, file, line, 1, "element does not have attribute named %s", name ); }
173 else {
174 smr_setMessageError( smr, NULL, file, line, 1, "element does not have attribute named %s for file = %d", name, path );
175 }
176 }
177 }
178 return( value );
179}
int tpia_misc_setMessageError_Element(statusMessageReporting *smr, void *userInterface, xData_element *element, const char *file, int line, int code, const char *fmt,...)
Definition: tpia_misc.cc:183
char * xData_getAttributesValue(xData_attributionList *attributes, const char *name)
Definition: xData.cc:530

◆ tpia_misc_sampleEqualProbableBin()

int tpia_misc_sampleEqualProbableBin ( statusMessageReporting smr,
tpia_decaySamplingInfo decaySamplingInfo,
double  e_in,
int  nBins,
tpia_EqualProbableBinSpectra binned,
double *  value_ 
)

Definition at line 420 of file tpia_misc.cc.

421 {
422
423 int i, j, index1, index2, method = 0;
424 double fE = 1., r, value1, value2, value3, P12, P23, value = -2.;
425
426 if( e_in <= binned->energies[0].value ) {
427 index1 = 0;
428 index2 = 0; }
429 else if( e_in >= binned->energies[binned->numberOfEs-1].value ) {
430 index1 = binned->numberOfEs - 1;
431 index2 = binned->numberOfEs - 1; }
432 else {
433 for( i = 0; i < binned->numberOfEs - 1; i++ ) {
434 if( e_in <= binned->energies[i].value ) break;
435 }
436 i--;
437 index1 = i;
438 index2 = i;
439 if( e_in != binned->energies[i].value ) {
440 index2++;
441 fE = ( e_in - binned->energies[i].value ) / ( binned->energies[i+1].value - binned->energies[i].value );
442 }
443 }
444 r = tpia_misc_drng( decaySamplingInfo->rng, decaySamplingInfo->rngState );
445 j = (int) (r * nBins);
446 if( j >= nBins ) j = nBins - 1;
447 if( j < 0 ) j = 0;
448 r = tpia_misc_drng( decaySamplingInfo->rng, decaySamplingInfo->rngState ); // Do not change r until after Point1 below.
450 method = 1;
451 if( ( ( j == 0 ) && ( r <= 0.5 ) ) || ( j == ( nBins - 1 ) && r > 0.5 ) ) method = 0;
452 }
453 if( method == 0 ) { /* Constant interpolaton. */
454 value1 = ( 1. - fE ) * binned->energies[index1].bins[j] + fE * binned->energies[index2].bins[j];
455 value2 = ( 1. - fE ) * binned->energies[index1].bins[j+1] + fE * binned->energies[index2].bins[j+1];
456 value = ( 1. - r ) * value1 + r * value2; }
457 else { /* Linear interpolation. */
458 if( r <= 0.5 ) j--; /* Point1: Above test insures that j is not 0 (nBins-1) if r <= 0.5 (> 0.5); */
459 value1 = ( 1. - fE ) * binned->energies[index1].bins[j] + fE * binned->energies[index2].bins[j];
460 value2 = ( 1. - fE ) * binned->energies[index1].bins[j+1] + fE * binned->energies[index2].bins[j+1];
461 value3 = ( 1. - fE ) * binned->energies[index1].bins[j+2] + fE * binned->energies[index2].bins[j+2];
462 P12 = 1. / ( value2 - value1 );
463 P23 = 1. / ( value3 - value2 );
464 r = tpia_misc_drng( decaySamplingInfo->rng, decaySamplingInfo->rngState );
465 if( 0.25 * ( 1.0 + 2.0 * ( value2 - value1 ) / ( value3 - value1 ) ) > r ) {
466 P23 = 2. / ( value3 - value1 );
467 value3 = value2; }
468 else {
469 P12 = 2. / ( value3 - value1 );
470 value1 = value2;
471 }
472 r = tpia_misc_drng( decaySamplingInfo->rng, decaySamplingInfo->rngState );
473 if( P23 != P12 ) r = ( -P12 + std::sqrt( P12 * P12 * ( 1. - r ) + r * P23 * P23 ) ) / ( P23 - P12 );
474 value = 0.5 * ( value1 + value2 + r * ( value3 - value1 ) );
475 }
476 *value_ = value;
477 return( 0 );
478}
tpia_samplingMethods * samplingMethods
Definition: tpia_target.h:150
const char * angular_equalProbableBinMethod
Definition: tpia_target.h:136
double tpia_misc_drng(double(*rng)(void *), void *rngState)
Definition: tpia_misc.cc:403
#define tpia_samplingMethods_isLinear(method)
Definition: tpia_target.h:121

Referenced by tpia_angular_SampleMu(), tpia_angularEnergy_SampleEp(), and tpia_Legendre_SampleEp().

◆ tpia_misc_symbolToZ()

int tpia_misc_symbolToZ ( const char *  Z)

Definition at line 92 of file tpia_misc.cc.

92 {
93
94 int i, n = tpia_misc_NumberOfZSymbols( );
95
96 for( i = 0; i < n; i++ ) {
97 //if( !strcmp( Z, ZSymbols[i].symbol ) ) return( ZSymbols[i].Z );
98 if( !strcmp( Z, ZSymbols[i].symbol.c_str() ) ) return( ZSymbols[i].Z );
99 }
100 return( -1 );
101}
int tpia_misc_NumberOfZSymbols(void)
Definition: tpia_misc.cc:76

Referenced by tpia_miscNameToZAm().

◆ tpia_misc_ZToSymbol()

const char * tpia_misc_ZToSymbol ( int  iZ)

Definition at line 83 of file tpia_misc.cc.

83 {
84
85 if( ( iZ < 0 ) || ( iZ >= tpia_misc_NumberOfZSymbols( ) ) ) return( NULL );
86 //return( ZSymbols[iZ].symbol );
87 return( ZSymbols[iZ].symbol.c_str() );
88}

Referenced by G4GIDI_Misc_Z_A_m_ToName().

◆ tpia_miscNameToZAm()

int tpia_miscNameToZAm ( statusMessageReporting smr,
const char *  name,
int *  Z,
int *  A,
int *  m 
)

Definition at line 105 of file tpia_misc.cc.

105 {
106
107 int i, n;
108 const char *p;
109 char s[1024] = "", *q, *e; /* Note 1) routine will fail when parts of a particle name can be longer than 1024. */
110
111 n = sizeof( s ) - 1;
112
113 *Z = *A = *m = 0;
114 if( !strncmp( "FissionProduct", name, 14 ) ) {
115 *Z = 99;
116 *A = 120;
117 return( 0 );
118 }
119 if( !strcmp( "gamma", name ) ) return( 0 );
120 for( p = name, q = s, i = 0; ( *p != '_' ) && ( i != n ); p++, q++, i++ ) *q = *p;
121 if( i == n ) { /* See note 1 above. */
122 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1, "Failed to find first '_' in particle name %s", name ); }
123 else {
124 *q = 0;
125 if( ( *Z = tpia_misc_symbolToZ( s ) ) < 0 ) {
126 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1, "Particle %s's symbol = '%s' not found", name, s ); }
127 else { /* Getting here implies that *p == '_'. */
128 for( p++, q = s; ( *p != '_' ) && ( *p != 0 ) && ( i != n ); p++, q++, i++ ) *q = *p;
129 if( i == n ) { /* See note 1 above. */
130 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1, "Failed to find second '_' in particle name %s", name ); }
131 else {
132 *q = 0;
133 if( strcmp( s, "natural" ) == 0 ) {
134 e = s;
135 while( *e ) e++; }
136 else {
137 *A = (int) strtol( s, &e, 10 );
138 }
139 if( *e != 0 ) {
140 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1, "Failed to convert A to integer in particle name %s", name ); }
141 else { /* Getting here implies that *p == '_' or 0. */
142 *m = 0;
143 if( *p == '_' ) {
144 p++;
145 if( *p != 'm' ) {
146 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1, "Particle name %s missing meta-stable label 'm'", name ); }
147 else {
148 p++;
149 *m = (int) strtol( p, &e, 10 );
150 if( *e != 0 ) smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1, "Failed to convert m to integer in particle name %s", name );
151 }
152 }
153 }
154 }
155 }
156 }
157
158 return( !smr_isOk( smr ) );
159}
int tpia_misc_symbolToZ(const char *Z)
Definition: tpia_misc.cc:92

Referenced by G4GIDI_Misc_channelCompound(), and tpia_particle_getInternalID().

◆ tpia_multiplicity_create()

tpia_multiplicity * tpia_multiplicity_create ( statusMessageReporting smr)

Definition at line 50 of file tpia_multiplicity.cc.

50 {
51
52 tpia_multiplicity *multiplicity;
53
54 //if( ( multiplicity = xData_malloc2( smr, sizeof( tpia_multiplicity ), 0, "multiplicity" ) ) == NULL ) return( NULL );
55 if( ( multiplicity = (tpia_multiplicity*) xData_malloc2( smr, sizeof( tpia_multiplicity ), 0, "multiplicity" ) ) == NULL ) return( NULL );
56 if( tpia_multiplicity_initialize( smr, multiplicity ) ) multiplicity = tpia_multiplicity_free( smr, multiplicity );
57 return( multiplicity );
58}
tpia_multiplicity * tpia_multiplicity_free(statusMessageReporting *smr, tpia_multiplicity *multiplicity)
int tpia_multiplicity_initialize(statusMessageReporting *smr, tpia_multiplicity *multiplicity)

Referenced by tpia_multiplicity_createGetFromElement().

◆ tpia_multiplicity_createGetFromElement()

tpia_multiplicity * tpia_multiplicity_createGetFromElement ( statusMessageReporting smr,
xData_element multiplicityElement,
int  nGroups 
)

Definition at line 92 of file tpia_multiplicity.cc.

92 {
93
94 tpia_multiplicity *multiplicity;
95
96 if( ( multiplicity = tpia_multiplicity_create( smr ) ) == NULL ) return( NULL );
97 if( tpia_multiplicity_getFromElement( smr, multiplicityElement, multiplicity, nGroups ) != 0 ) multiplicity = tpia_multiplicity_free( smr, multiplicity );
98 return( multiplicity );
99}
int tpia_multiplicity_getFromElement(statusMessageReporting *smr, xData_element *multiplicityElement, tpia_multiplicity *multiplicity, int)
tpia_multiplicity * tpia_multiplicity_create(statusMessageReporting *smr)

◆ tpia_multiplicity_free()

tpia_multiplicity * tpia_multiplicity_free ( statusMessageReporting smr,
tpia_multiplicity multiplicity 
)

Definition at line 71 of file tpia_multiplicity.cc.

71 {
72
73 tpia_multiplicity_release( smr, multiplicity );
74 xData_free( smr, multiplicity );
75 return( NULL );
76}
int tpia_multiplicity_release(statusMessageReporting *smr, tpia_multiplicity *multiplicity)

Referenced by tpia_multiplicity_create(), tpia_multiplicity_createGetFromElement(), and tpia_product_release().

◆ tpia_multiplicity_getFromElement()

int tpia_multiplicity_getFromElement ( statusMessageReporting smr,
xData_element multiplicityElement,
tpia_multiplicity multiplicity,
int  nGroups 
)

Definition at line 104 of file tpia_multiplicity.cc.

104 {
105
106 const char *timeScale;
107 int isDelayedNeutrons;
108 xData_element *data;
109
110 xData_addToAccessed( smr, multiplicityElement, 1 );
111 if( ( tpia_frame_setFromElement( smr, multiplicityElement, 2, &(multiplicity->frame) ) ) != 0 ) return( 1 );
112 if( tpia_multiplicity_getTimeScaleFromElement( smr, multiplicityElement, &timeScale, &isDelayedNeutrons, &(multiplicity->timeScale) ) ) return( 1 );
113 for( data = xData_getFirstElement( multiplicityElement ); data != NULL; data = xData_getNextElement( data ) ) {
114 if( strcmp( data->name, "grouped" ) == 0 ) {
115 if( tpia_misc_get2d_xShared_yHistogram_data_Grouped( smr, data, &(multiplicity->grouped) ) ) return( 1 ); }
116 else if( strcmp( data->name, "pointwise" ) == 0 ) {
117 if( ( multiplicity->pointwise = tpia_misc_get2dx_y_data( smr, data, &multiplicity->numberOfPointwise ) ) == NULL ) return( 1 ); }
118 else {
119 tpia_misc_setMessageError_Element( smr, NULL, multiplicityElement, __FILE__, __LINE__, 1, "unsupported multiplicity type = %s", data->name );
120 return( 1 );
121 }
122 }
123 return( 0 );
124}
tpia_data_frame frame
Definition: tpia_target.h:175
xData_Int numberOfPointwise
Definition: tpia_target.h:177
tpia_1dData grouped
Definition: tpia_target.h:178
char * name
Definition: xData.h:184
int tpia_multiplicity_getTimeScaleFromElement(statusMessageReporting *smr, xData_element *element, const char **timeScale, int *isDelayedNeutrons, double *dTimeScale)
double * tpia_misc_get2dx_y_data(statusMessageReporting *smr, xData_element *element, xData_Int *length)
Definition: tpia_misc.cc:228
xData_element * xData_getNextElement(xData_element *element)
Definition: xData.cc:478
xData_element * xData_getFirstElement(xData_element *element)
Definition: xData.cc:477

Referenced by tpia_multiplicity_createGetFromElement().

◆ tpia_multiplicity_getTimeScaleFromElement()

int tpia_multiplicity_getTimeScaleFromElement ( statusMessageReporting smr,
xData_element element,
const char **  timeScale,
int *  isDelayedNeutrons,
double *  dTimeScale 
)

Definition at line 128 of file tpia_multiplicity.cc.

129 {
130
131 const char *p;
132 char *e;
133
134 *isDelayedNeutrons = 0;
135 *dTimeScale = 0.;
136 *timeScale = xData_getAttributesValue( &(element->attributes), "timeScale" );
137 if( *timeScale != NULL ) {
138 if( strcmp( *timeScale, "prompt" ) ) {
139 if( strncmp( *timeScale, "delayed", 7 ) ) {
140 tpia_misc_setMessageError_Element( smr, NULL, element, __FILE__, __LINE__, 1, "invalid timeScale attribute = %s", *timeScale );
141 return( 1 ); }
142 else {
143 for( p = &((*timeScale)[7]); *p; p++ ) if( !isspace( *p ) ) break;
144 if( *p != '=' ) {
145 tpia_misc_setMessageError_Element( smr, NULL, element, __FILE__, __LINE__, 1, "timeScale attribute '%s' missing '='", *timeScale );
146 return( 1 );
147 }
148 p++;
149 *dTimeScale = strtod( p, &e );
150 if( *e != 0 ) {
151 tpia_misc_setMessageError_Element( smr, NULL, element, __FILE__, __LINE__, 1, "could not convert timeScale attribute '%s' to double",
152 *timeScale );
153 return( 1 );
154 }
155 *isDelayedNeutrons = 1;
156 }
157 }
158 }
159 return( 0 );
160}

Referenced by tpia_multiplicity_getFromElement().

◆ tpia_multiplicity_initialize()

int tpia_multiplicity_initialize ( statusMessageReporting smr,
tpia_multiplicity multiplicity 
)

Definition at line 62 of file tpia_multiplicity.cc.

62 {
63
64 memset( multiplicity, 0, sizeof( tpia_multiplicity ) );
65 if( tpia_frame_setFromString( smr, "", "", 0, &(multiplicity->frame) ) ) return( 1 );
66 return( 0 );
67}

Referenced by tpia_multiplicity_create(), and tpia_multiplicity_release().

◆ tpia_multiplicity_release()

int tpia_multiplicity_release ( statusMessageReporting smr,
tpia_multiplicity multiplicity 
)

Definition at line 80 of file tpia_multiplicity.cc.

80 {
81
82 //multiplicity->grouped.data = xData_free( smr, multiplicity->grouped.data );
83 multiplicity->grouped.data = (double*) xData_free( smr, multiplicity->grouped.data );
84 //multiplicity->pointwise = xData_free( smr, multiplicity->pointwise );
85 multiplicity->pointwise = (double*) xData_free( smr, multiplicity->pointwise );
86 tpia_multiplicity_initialize( smr, multiplicity );
87 return( 0 );
88}

Referenced by tpia_multiplicity_free().

◆ tpia_particle_create()

tpia_particle * tpia_particle_create ( statusMessageReporting smr)

Definition at line 51 of file tpia_particle.cc.

51 {
52
53 //tpia_particle *particle = xData_malloc2( smr, sizeof( tpia_particle ), 0, "particle" );
54 tpia_particle *particle = (tpia_particle*) xData_malloc2( smr, sizeof( tpia_particle ), 0, "particle" );
55
56 if( particle == NULL ) return( NULL );
57 tpia_particle_initialize( smr, particle );
58 return( particle );
59}
int tpia_particle_initialize(statusMessageReporting *, tpia_particle *particle)

Referenced by tpia_particle_getInternalID().

◆ tpia_particle_free()

tpia_particle * tpia_particle_free ( statusMessageReporting smr,
tpia_particle particle 
)

Definition at line 72 of file tpia_particle.cc.

72 {
73
74 int i, j;
75 tpia_particle **p;
76
77 for( i = 0, p = particleSortedList; i < numberOfParticles; i++, p++ ) {
78 if( *p == particle ) {
79 numberOfParticles--;
80 for( j = i; j < numberOfParticles; j++, p++ ) *p = p[1];
81 break;
82 }
83 }
84 if( particle == particleListEnd ) particleListEnd = particle->prior;
85 if( particle == particleList ) particleList = particle->next;
86 if( particle->prior != NULL ) particle->prior->next = particle->next;
87 if( particle->next != NULL ) particle->next->prior = particle->prior;
88 tpia_particle_release( smr, particle );
89 xData_free( smr, particle );
90 return( NULL );
91}
tpia_particle * prior
Definition: tpia_target.h:125
tpia_particle * next
Definition: tpia_target.h:126
int tpia_particle_release(statusMessageReporting *smr, tpia_particle *particle)

Referenced by tpia_particle_freeInternalList(), and tpia_particle_getInternalID().

◆ tpia_particle_freeInternalList()

int tpia_particle_freeInternalList ( statusMessageReporting smr)

Definition at line 103 of file tpia_particle.cc.

103 {
104
105 while( particleList != NULL ) tpia_particle_free( smr, particleList );
106 //particleSortedList = xData_free( smr, particleSortedList );
107 particleSortedList = (tpia_particle**) xData_free( smr, particleSortedList );
108 return( 0 );
109}
tpia_particle * tpia_particle_free(statusMessageReporting *smr, tpia_particle *particle)

◆ tpia_particle_getInternalID()

tpia_particle * tpia_particle_getInternalID ( statusMessageReporting smr,
const char *const  name 
)

Definition at line 113 of file tpia_particle.cc.

113 {
114
115 int i, iCmp, min, mid, max, Z, A, m;
116 tpia_particle *particle;
117 char *EOP;
118
119 iCmp = 0;
120 min = mid = 0;
121 max = numberOfParticles;
122 while( min != max ) {
123 mid = ( min + max ) / 2;
124 iCmp = strcmp( name, particleSortedList[mid]->name );
125 if( iCmp == 0 ) return( particleSortedList[mid] );
126 if( iCmp < 0 ) {
127 max = mid - 1;
128 if( mid == 0 ) max = 0; }
129 else {
130 min = mid + 1;
131 if( min > max ) min = max;
132 }
133 }
134 mid = min;
135 if( numberOfParticles > 0 ) {
136 iCmp = strcmp( name, particleSortedList[mid]->name );
137 if( iCmp == 0 ) return( particleSortedList[mid] );
138 if( ( iCmp < 0 ) && ( mid != 0 ) ) {
139 mid--;
140 iCmp = strcmp( name, particleSortedList[mid]->name );
141 }
142 }
143
144 if( ( particle = tpia_particle_create( smr ) ) == NULL ) return( NULL );
145 if( ( particle->spectralID = tpi_spectralID_parse( smr, name, &(EOP) ) ) == NULL ) return( tpia_particle_free( smr, particle ) );
146 particle->name = particle->spectralID->name;
147 if( tpia_miscNameToZAm( smr, particle->name, &Z, &A, &m ) != 0 ) return( tpia_particle_free( smr, particle ) );
148 particle->prior = NULL;
149 particle->next = NULL;
150 particle->Z = Z;
151 particle->A = A;
152 particle->m = m;
153 particle->mass = tpia_particleMass_AMU( smr, particle->name );
154 if( !smr_isOk( smr ) ) return( tpia_particle_free( smr, particle ) );
155 particle->fullMass_MeV = tpia_AMU2MeV * particle->mass + particle->spectralID->level;
156
157 if( sizeOfParticleSortedList < ( numberOfParticles + 1 ) ) {
158 if( sizeOfParticleSortedList == 0 ) {
159 sizeOfParticleSortedList = initialSizeOfList; }
160 else {
161 sizeOfParticleSortedList += incrementalSizeOfList;
162 }
163 //if( ( particleSortedList = xData_realloc2( smr, particleSortedList, sizeOfParticleSortedList * sizeof( tpia_particle * ),
164 if( ( particleSortedList = (tpia_particle** ) xData_realloc2( smr, particleSortedList, sizeOfParticleSortedList * sizeof( tpia_particle * ),
165 "particleSortedList" ) ) == NULL ) return( tpia_particle_free( smr, particle ) );
166 }
167
168 if( particleList == NULL ) {
169 particle->ordinal = 0;
170 particleListEnd = particleList = particle; }
171 else {
172 particle->ordinal = particleListEnd->ordinal + 1;
173 particle->prior = particleListEnd;
174 particleListEnd->next = particle;
175 particleListEnd = particle;
176 }
177
178 if( ( mid != 0 ) || ( iCmp > 0 ) ) mid++;
179 for( i = numberOfParticles; i > mid; i-- ) particleSortedList[i] = particleSortedList[i-1];
180 particleSortedList[mid] = particle;
181 numberOfParticles++;
182
183 return( particle );
184}
double level
Definition: tpi_IDs.h:68
char * name
Definition: tpi_IDs.h:63
tpi_spectralID * spectralID
Definition: tpia_target.h:132
tpi_spectralID * tpi_spectralID_parse(statusMessageReporting *smr, char const *str, char **EOP)
Definition: tpi_IDs.cc:218
double tpia_particleMass_AMU(statusMessageReporting *smr, const char *name)
Definition: tpia_mass.cc:887
tpia_particle * tpia_particle_create(statusMessageReporting *smr)
#define tpia_AMU2MeV
Definition: tpia_target.h:101
int tpia_miscNameToZAm(statusMessageReporting *smr, const char *name, int *Z, int *A, int *m)
Definition: tpia_misc.cc:105
#define xData_realloc2(smr, old, size, forItem)
Definition: xData.h:314

Referenced by tpia_product_getFromElement(), tpia_target_heated_read(), and tpia_target_read().

◆ tpia_particle_initialize()

int tpia_particle_initialize ( statusMessageReporting smr,
tpia_particle particle 
)

Definition at line 64 of file tpia_particle.cc.

64 {
65
66 memset( particle, 0, sizeof( tpia_particle ) );
67 return( 0 );
68}

Referenced by tpia_particle_create().

◆ tpia_particle_printInternalSortedList()

int tpia_particle_printInternalSortedList ( statusMessageReporting smr)

Definition at line 189 of file tpia_particle.cc.

189 {
190
191 int i;
192
193 for( i = 0; i < numberOfParticles; i++ ) printf( "%s\n", particleSortedList[i]->name );
194 return( 0 );
195}

◆ tpia_particle_release()

int tpia_particle_release ( statusMessageReporting smr,
tpia_particle particle 
)

Definition at line 95 of file tpia_particle.cc.

95 {
96
97 if( particle->spectralID != NULL ) tpi_spectralID_free( smr, particle->spectralID );
98 return( 0 );
99}
void * tpi_spectralID_free(statusMessageReporting *smr, tpi_spectralID *spectralID)
Definition: tpi_IDs.cc:191

Referenced by tpia_particle_free().

◆ tpia_product_create()

tpia_product * tpia_product_create ( statusMessageReporting smr)

Definition at line 71 of file tpia_product.cc.

71 {
72
73 tpia_product *product;
74
75 //if( ( product = xData_malloc2( smr, sizeof( tpia_product ), 0, "product" ) ) == NULL ) return( NULL );
76 if( ( product = (tpia_product*) xData_malloc2( smr, sizeof( tpia_product ), 0, "product" ) ) == NULL ) return( NULL );
77 if( tpia_product_initialize( smr, product ) ) product = tpia_product_free( smr, product );
78 return( product );
79}
int tpia_product_initialize(statusMessageReporting *smr, tpia_product *product)
Definition: tpia_product.cc:83
tpia_product * tpia_product_free(statusMessageReporting *smr, tpia_product *product)

Referenced by tpia_product_createGetFromElement().

◆ tpia_product_createGetFromElement()

tpia_product * tpia_product_createGetFromElement ( statusMessageReporting smr,
tpia_channel channel,
tpia_product parentProduct,
xData_element productElement 
)

Definition at line 93 of file tpia_product.cc.

94 {
95
96 tpia_product *product;
97
98 if( ( product = tpia_product_create( smr ) ) == NULL ) return( NULL );
99 if( tpia_product_getFromElement( smr, channel, parentProduct, productElement, product ) != 0 ) product = tpia_product_free( smr, product );
100 return( product );
101}
tpia_product * tpia_product_create(statusMessageReporting *smr)
Definition: tpia_product.cc:71
int tpia_product_getFromElement(statusMessageReporting *smr, tpia_channel *channel, tpia_product *parentProduct, xData_element *productElement, tpia_product *product)

Referenced by tpia_product_getDecayChannelFromElement().

◆ tpia_product_dataRequired()

long tpia_product_dataRequired ( statusMessageReporting smr,
tpia_product product 
)

Definition at line 359 of file tpia_product.cc.

359 {
360
361 return( product->b_dataRequired );
362}

◆ tpia_product_doesDecay()

int tpia_product_doesDecay ( statusMessageReporting smr,
tpia_product product 
)

Definition at line 387 of file tpia_product.cc.

387 {
388
389 return( product->decayChannel.products != NULL );
390}

◆ tpia_product_free()

tpia_product * tpia_product_free ( statusMessageReporting smr,
tpia_product product 
)

Definition at line 105 of file tpia_product.cc.

105 {
106
107 tpia_product_release( smr, product );
108 xData_free( smr, product );
109 return( NULL );
110}
int tpia_product_release(statusMessageReporting *smr, tpia_product *product)

Referenced by tpia_channel_release(), tpia_product_create(), tpia_product_createGetFromElement(), and tpia_product_release().

◆ tpia_product_getDecayChannelFromElement()

int tpia_product_getDecayChannelFromElement ( statusMessageReporting smr,
xData_element parentElement,
tpia_channel channel,
tpia_product parentProduct,
tpia_product **  priorProductNext 
)

Definition at line 268 of file tpia_product.cc.

269 {
270
271 xData_elementList *list;
272 tpia_product *product;
273 int i, status = 0;
274
275 list = xData_getElementsByTagName( smr, parentElement, "product" );
276 for( i = 0; i < list->n; i++ ) {
277 if( ( product = tpia_product_createGetFromElement( smr, channel, parentProduct, list->items[i].element ) ) == NULL ) {
278 status = 1;
279 break;
280 }
281 if( parentProduct == NULL ) {
284 channel->decayChannel.numberOfProducts++; }
285 else {
286 channel->decayChannel.m1_fullMass_MeV = parentProduct->productID->fullMass_MeV;
287 channel->decayChannel.m2_fullMass_MeV = 0.;
288 parentProduct->decayChannel.numberOfProducts++;
289 }
290 *priorProductNext = product;
291 priorProductNext = &(product->next);
292 }
293 xData_freeElementList( smr, list );
294 return( status );
295}
tpia_particle * targetID
Definition: tpia_target.h:272
tpia_particle * projectileID
Definition: tpia_target.h:271
tpia_product * tpia_product_createGetFromElement(statusMessageReporting *smr, tpia_channel *channel, tpia_product *parentProduct, xData_element *productElement)
Definition: tpia_product.cc:93
xData_elementList * xData_getElementsByTagName(statusMessageReporting *smr, xData_element *element, const char *tagName)
Definition: xData.cc:761

◆ tpia_product_getFirstProduct()

tpia_product * tpia_product_getFirstProduct ( tpia_product product)

Definition at line 366 of file tpia_product.cc.

366 {
367
368 return( tpia_decayChannel_getFirstProduct( &(product->decayChannel) ) );
369}

Referenced by tpia_product_getProductByIndex().

◆ tpia_product_getFromElement()

int tpia_product_getFromElement ( statusMessageReporting smr,
tpia_channel channel,
tpia_product parentProduct,
xData_element productElement,
tpia_product product 
)

Definition at line 142 of file tpia_product.cc.

143 {
144
145 char const *productGenre;
146 char *name, *multiplicity, *e;
147
148 xData_addToAccessed( smr, productElement, 1 );
149 product->channel = channel;
150 product->parentProduct = parentProduct;
151 if( xData_copyAttributionList( smr, &(product->attributes), &(productElement->attributes) ) != 0 ) return( 0 );
152 name = tpia_misc_pointerToAttributeIfAllOk2( smr, productElement, 1, &(product->attributes), "particle" );
153 if( name != NULL ) {
154 product->productID = tpia_particle_getInternalID( smr, name );
155 multiplicity = tpia_misc_pointerToAttributeIfAllOk2( smr, productElement, 1, &(product->attributes), "multiplicity" );
156 if( multiplicity != NULL ) {
157 if( strcmp( multiplicity, "energyDependent" ) && strcmp( multiplicity, "partialProduction" ) ) { /* Must be an integer. */
158 product->multiplicity = strtol( multiplicity, &e, 10 );
159 while( isspace( *e ) ) e++;
160 if( *e != 0 ) tpia_misc_setMessageError_Element( smr, NULL, productElement, __FILE__, __LINE__, 1, "bad multiplicity = %s", multiplicity );
161 }
162 }
163 }
164 if( ( productGenre = tpia_misc_pointerToAttributeIfAllOk2( smr, productElement, 1, &(product->attributes), "genre" ) ) != NULL ) {
165 if( strcmp( productGenre, tpia_productGenre_unknown ) == 0 ) {
166 product->b_dataRequired = 0;
167 product->genre = tpia_productGenre_unknown; }
168 else if( strcmp( productGenre, tpia_productGenre_twoBody_angular ) == 0 ) {
169 product->b_dataRequired = tpia_b_twoBody_angular;
171 else if( strcmp( productGenre, tpia_productGenre_twoBody_formFactor ) == 0 ) {
172 product->b_dataRequired = tpia_b_twoBody_formFactor;
174 else if( strcmp( productGenre, tpia_productGenre_NBody_Legendre ) == 0 ) {
175 product->b_dataRequired = tpia_b_NBody_Legendre;
177 else if( strcmp( productGenre, tpia_productGenre_NBody_angular_energy ) == 0 ) {
178 product->b_dataRequired = tpia_b_NBody_angular_energy;
180 else if( strcmp( productGenre, tpia_productGenre_NBody_uncorrelate_Legendre ) == 0 ) {
181 product->b_dataRequired = tpia_b_NBody_uncorrelate_Legendre;
183 else if( strcmp( productGenre, tpia_productGenre_NBody_pairProduction ) == 0 ) {
184 product->b_dataRequired = tpia_b_NBody_pairProduction;
186 else {
187 tpia_misc_setMessageError_Element( smr, NULL, productElement, __FILE__, __LINE__, 1, "unsupported product genre = %s", productGenre );
188 }
189 if( smr_isOk( smr ) ) _tpia_product_getProductOutgoingData( smr, productElement, product );
190 }
191 return( !smr_isOk( smr ) );
192}
tpia_product * parentProduct
Definition: tpia_target.h:234
xData_attributionList attributes
Definition: tpia_target.h:235
tpia_channel * channel
Definition: tpia_target.h:233
const char * tpia_productGenre_twoBody_angular
Definition: tpia_product.cc:57
const char * tpia_productGenre_NBody_uncorrelate_Legendre
Definition: tpia_product.cc:61
const char * tpia_productGenre_NBody_pairProduction
Definition: tpia_product.cc:62
const char * tpia_productGenre_twoBody_formFactor
Definition: tpia_product.cc:58
const char * tpia_productGenre_NBody_Legendre
Definition: tpia_product.cc:59
const char * tpia_productGenre_NBody_angular_energy
Definition: tpia_product.cc:60
const char * tpia_productGenre_unknown
Definition: tpia_product.cc:56
tpia_particle * tpia_particle_getInternalID(statusMessageReporting *smr, const char *const name)

Referenced by tpia_product_createGetFromElement().

◆ tpia_product_getProductByIndex()

tpia_product * tpia_product_getProductByIndex ( statusMessageReporting smr,
tpia_product product,
int  index 
)

Definition at line 374 of file tpia_product.cc.

374 {
375
376 int i = 0;
377 tpia_product *p;
378
379 if( index < 0 ) return( NULL );
380 for( p = tpia_product_getFirstProduct( product ); ( p != NULL ) && ( i < index ); p = tpia_decayChannel_getNextProduct( p ), i++ ) ;
381 return( p );
382}
tpia_product * tpia_product_getFirstProduct(tpia_product *product)

◆ tpia_product_initialize()

int tpia_product_initialize ( statusMessageReporting smr,
tpia_product product 
)

Definition at line 83 of file tpia_product.cc.

83 {
84
85 memset( product, 0, sizeof( tpia_product ) );
86 if( tpia_angular_initialize( smr, &(product->angular) ) ) return( 1 );
87 if( tpia_Legendre_initialize( smr, &(product->Legendre) ) ) return( 1 );
88 return( 0 );
89}
tpia_angular angular
Definition: tpia_target.h:244
tpia_Legendre Legendre
Definition: tpia_target.h:245
int tpia_Legendre_initialize(statusMessageReporting *smr, tpia_Legendre *Legendre)
int tpia_angular_initialize(statusMessageReporting *smr, tpia_angular *angular)
Definition: tpia_angular.cc:49

Referenced by tpia_product_create().

◆ tpia_product_isDataPresent()

int tpia_product_isDataPresent ( statusMessageReporting smr,
tpia_product product,
int  b_data 
)

Definition at line 403 of file tpia_product.cc.

403 {
404
405 return( product->b_dataPresent && b_data );
406}

◆ tpia_product_numberOfProducts()

int tpia_product_numberOfProducts ( statusMessageReporting smr,
tpia_product product 
)

Definition at line 395 of file tpia_product.cc.

395 {
396
397 return( product->decayChannel.numberOfProducts );
398}

◆ tpia_product_release()

int tpia_product_release ( statusMessageReporting smr,
tpia_product product 
)

Definition at line 114 of file tpia_product.cc.

114 {
115
116 tpia_multiplicity *multiplicity, *multiplicity_next;
117 tpia_product *decayProduct, *nextProduct;
118
119 xData_releaseAttributionList( smr, &(product->attributes) );
120 //product->depositionEnergyGrouped.data = xData_free( smr, product->depositionEnergyGrouped.data );
121 product->depositionEnergyGrouped.data = (double*) xData_free( smr, product->depositionEnergyGrouped.data );
122
123 if( product->multiplicityVsEnergy != NULL ) tpia_multiplicity_free( smr, product->multiplicityVsEnergy );
124 for( multiplicity = product->delayedNeutronMultiplicityVsEnergy; multiplicity != NULL; multiplicity = multiplicity_next ) {
125 multiplicity_next = multiplicity->next;
126 tpia_multiplicity_free( smr, multiplicity );
127 }
128 tpia_angular_release( smr, &(product->angular) );
129 tpia_Legendre_release( smr, &(product->Legendre ) );
130 tpia_angularEnergy_release( smr, &(product->angularEnergy) );
131 for( decayProduct = product->decayChannel.products; decayProduct != NULL; decayProduct = nextProduct ) {
132 nextProduct = decayProduct->next;
133 tpia_product_free( smr, decayProduct );
134 }
135 product->decayChannel.numberOfProducts = 0;
136 product->decayChannel.products = NULL;
137 return( 0 );
138}
tpia_multiplicity * next
Definition: tpia_target.h:174
tpia_multiplicity * multiplicityVsEnergy
Definition: tpia_target.h:242
tpia_1dData depositionEnergyGrouped
Definition: tpia_target.h:240
tpia_angularEnergy angularEnergy
Definition: tpia_target.h:246
tpia_multiplicity * delayedNeutronMultiplicityVsEnergy
Definition: tpia_target.h:243
int tpia_angularEnergy_release(statusMessageReporting *smr, tpia_angularEnergy *angularEnergy)
tpia_multiplicity * tpia_multiplicity_free(statusMessageReporting *smr, tpia_multiplicity *multiplicity)
int tpia_Legendre_release(statusMessageReporting *smr, tpia_Legendre *Legendre)
int tpia_angular_release(statusMessageReporting *smr, tpia_angular *angular)
Definition: tpia_angular.cc:60

Referenced by tpia_product_free().

◆ tpia_product_sampleMultiplicity()

int tpia_product_sampleMultiplicity ( statusMessageReporting smr,
tpia_product product,
double  e_in,
double  r 
)

Definition at line 411 of file tpia_product.cc.

411 {
412
413 int i, multiplicity;
414 tpia_multiplicity *multiplicityVsEnergy = product->multiplicityVsEnergy;
415 double *p = multiplicityVsEnergy->pointwise, dMult;
416
417 if( e_in <= p[0] ) {
418 dMult = p[1]; }
419 else if( e_in >= p[2 * ( multiplicityVsEnergy->numberOfPointwise - 1 )] ) {
420 dMult = p[2 * multiplicityVsEnergy->numberOfPointwise - 1]; }
421 else {
422 for( i = 0; i < multiplicityVsEnergy->numberOfPointwise - 1; i++, p += 2 ) if( e_in < p[2] ) break;
423 dMult = ( e_in - p[0] ) / ( p[2] - p[0] );
424 dMult = dMult * p[3] + ( 1. - dMult ) * p[1];
425 }
426 multiplicity = (int) dMult;
427 if( r < ( dMult - multiplicity ) ) multiplicity++;
428
429 return( multiplicity );
430}

Referenced by tpia_decayChannel_sampleProductsAtE().

◆ tpia_samplingMethods_initialize()

int tpia_samplingMethods_initialize ( statusMessageReporting smr,
tpia_samplingMethods samplingMethods 
)

Definition at line 53 of file tpia_samplingMethods.cc.

53 {
54
55 memset( samplingMethods, 0, sizeof( tpia_samplingMethods ) );
57 return( 0 );
58}
const char * tpia_samplingMethods_linear

Referenced by tpia_target_initialize().

◆ tpia_target_create()

tpia_target * tpia_target_create ( statusMessageReporting smr)

Definition at line 49 of file tpia_target.cc.

49 {
50
51 tpia_target *target;
52
53 //if( ( target = xData_malloc2( smr, sizeof( tpia_target ), 0, "target" ) ) == NULL ) return( NULL );
54 if( ( target = (tpia_target*) xData_malloc2( smr, sizeof( tpia_target ), 0, "target" ) ) == NULL ) return( NULL );
55 if( tpia_target_initialize( smr, target ) ) target = tpia_target_free( smr, target );
56 return( target );
57}
int tpia_target_initialize(statusMessageReporting *smr, tpia_target *target)
Definition: tpia_target.cc:61
tpia_target * tpia_target_free(statusMessageReporting *smr, tpia_target *target)
Definition: tpia_target.cc:108

Referenced by tpia_target_createRead().

◆ tpia_target_createRead()

tpia_target * tpia_target_createRead ( statusMessageReporting smr,
const char *  fileName 
)

Definition at line 70 of file tpia_target.cc.

70 {
71
72 tpia_target *target;
73
74 if( ( target = tpia_target_create( smr ) ) == NULL ) return( NULL );
75 //if( tpia_target_read( smr, target, fileName ) != 0 ) target = xData_free( smr, target );
76 if( tpia_target_read( smr, target, fileName ) != 0 ) target = (tpia_target*) xData_free( smr, target );
77 return( target );
78}
int tpia_target_read(statusMessageReporting *smr, tpia_target *target, const char *fileName)
Definition: tpia_target.cc:143
tpia_target * tpia_target_create(statusMessageReporting *smr)
Definition: tpia_target.cc:49

Referenced by G4GIDI_target::init(), and tpia_target_createReadFromMap().

◆ tpia_target_createReadFromMap()

tpia_target * tpia_target_createReadFromMap ( statusMessageReporting smr,
tpia_map map,
const char *  evaluation,
const char *  projectileName,
const char *  targetName 
)

Definition at line 93 of file tpia_target.cc.

94 {
95
96 char *targetPath;
97 tpia_target *target;
98
99 targetPath = tpia_map_findTarget( smr, map, evaluation, projectileName, targetName );
100 if( targetPath == NULL ) return( NULL );
101 target = tpia_target_createRead( smr, targetPath );
102 xData_free( smr, targetPath );
103 return( target );
104}
char * tpia_map_findTarget(statusMessageReporting *smr, tpia_map *map, const char *evaluation, const char *projectile, const char *targetName)
Definition: tpia_map.cc:327
tpia_target * tpia_target_createRead(statusMessageReporting *smr, const char *fileName)
Definition: tpia_target.cc:70

Referenced by tpia_depot_addTargetFromMap().

◆ tpia_target_free()

tpia_target * tpia_target_free ( statusMessageReporting smr,
tpia_target target 
)

Definition at line 108 of file tpia_target.cc.

108 {
109
110 tpia_target_release( smr, target );
111 xData_free( smr, target );
112 return( NULL );
113}
int tpia_target_release(statusMessageReporting *smr, tpia_target *target)
Definition: tpia_target.cc:117

Referenced by tpia_depot_release(), tpia_target_create(), and G4GIDI_target::~G4GIDI_target().

◆ tpia_target_getAttributesValue()

char * tpia_target_getAttributesValue ( statusMessageReporting smr,
tpia_target target,
char const name 
)

Definition at line 248 of file tpia_target.cc.

248 {
249
250 return( xData_getAttributesValue( &(target->attributes), name ) );
251}
xData_attributionList attributes
Definition: tpia_target.h:299

◆ tpia_target_getEnergyGridAtTIndex()

xData_Int tpia_target_getEnergyGridAtTIndex ( statusMessageReporting smr,
tpia_target target,
int  index,
double **  energyGrid 
)

Definition at line 331 of file tpia_target.cc.

331 {
332
333 tpia_target_heated *heated = tpia_target_getHeatedTargetAtTIndex( smr, target, index );
334
335 if( !smr_isOk( smr ) ) return( -1 );
336 return( tpia_target_heated_getEnergyGrid( smr, heated, energyGrid ) );
337}
tpia_target_heated * tpia_target_getHeatedTargetAtTIndex(statusMessageReporting *smr, tpia_target *target, int index)
Definition: tpia_target.cc:302
xData_Int tpia_target_heated_getEnergyGrid(statusMessageReporting *smr, tpia_target_heated *target, double **energyGrid)

Referenced by G4GIDI_target::getEnergyGridAtTIndex().

◆ tpia_target_getHeatedTargetAtIndex_ReadIfNeeded()

tpia_target_heated * tpia_target_getHeatedTargetAtIndex_ReadIfNeeded ( statusMessageReporting smr,
tpia_target target,
int  index 
)

Definition at line 290 of file tpia_target.cc.

290 {
291
292 if( ( index < 0 ) || ( index >= target->nHeatedTargets ) ) {
293 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1, "temperature index = %d out of range (0 <= index < %d", index, target->nHeatedTargets );
294 return( NULL );
295 }
296 if( target->heatedTargets[index].heatedTarget == NULL ) tpia_target_readHeatedTarget( smr, target, index, 0 );
297 return( target->heatedTargets[index].heatedTarget );
298}
tpia_target_heated * heatedTarget
Definition: tpia_target.h:291
tpia_target_heated_info * heatedTargets
Definition: tpia_target.h:303
int tpia_target_readHeatedTarget(statusMessageReporting *smr, tpia_target *target, int index, int checkElememtsForAccess)
Definition: tpia_target.cc:266

◆ tpia_target_getIndexChannelCrossSectionAtE()

double tpia_target_getIndexChannelCrossSectionAtE ( statusMessageReporting smr,
tpia_target target,
int  index,
double  T,
xData_Int  iEg,
double  e_in,
int  crossSectionType 
)

Definition at line 380 of file tpia_target.cc.

381 {
382
383 int i;
384 double xsec = 0., xsec1, xsec2;
385
386 for( i = 0; i < target->nReadHeatedTargets; i++ ) if( target->readHeatedTargets[i]->temperature > T ) break;
387 if( i == 0 ) {
388 xsec = tpia_target_heated_getIndexChannelCrossSectionAtE( smr, target->readHeatedTargets[0]->heatedTarget, index, iEg, e_in, crossSectionType ); }
389 else if( i == target->nReadHeatedTargets ) {
390 xsec = tpia_target_heated_getIndexChannelCrossSectionAtE( smr, target->readHeatedTargets[i-1]->heatedTarget, index, iEg, e_in, crossSectionType ); }
391 else {
392 xsec1 = tpia_target_heated_getIndexChannelCrossSectionAtE(smr, target->readHeatedTargets[i-1]->heatedTarget, index, iEg, e_in, crossSectionType);
393 xsec2 = tpia_target_heated_getIndexChannelCrossSectionAtE(smr, target->readHeatedTargets[i ]->heatedTarget, index, iEg, e_in, crossSectionType);
394 xsec = ( ( target->readHeatedTargets[i]->temperature - T ) * xsec1 + ( T - target->readHeatedTargets[i-1]->temperature ) * xsec2 ) /
395 ( target->readHeatedTargets[i]->temperature - target->readHeatedTargets[i-1]->temperature );
396 }
397
398 return( xsec );
399}
int nReadHeatedTargets
Definition: tpia_target.h:301
tpia_target_heated_info ** readHeatedTargets
Definition: tpia_target.h:304
double tpia_target_heated_getIndexChannelCrossSectionAtE(statusMessageReporting *smr, tpia_target_heated *target, int index, xData_Int iEg, double e_in, int crossSectionType)

Referenced by G4GIDI_target::sampleChannelCrossSectionAtE(), and G4GIDI_target::sumChannelCrossSectionAtE().

◆ tpia_target_getTemperatures()

int tpia_target_getTemperatures ( statusMessageReporting smr,
tpia_target target,
double *  temperatures 
)

Definition at line 256 of file tpia_target.cc.

256 {
257
258 int i;
259
260 if( temperatures != NULL ) for( i = 0; i < target->nHeatedTargets; i++ ) temperatures[i] = target->heatedTargets[i].temperature;
261 return( target->nHeatedTargets );
262}

Referenced by G4GIDI_target::getTemperatures().

◆ tpia_target_getTotalCrossSectionAtTAndE()

double tpia_target_getTotalCrossSectionAtTAndE ( statusMessageReporting smr,
tpia_target target,
double  T,
xData_Int  iEg,
double  e_in,
int  crossSectionType 
)

Definition at line 357 of file tpia_target.cc.

358 {
359
360 int i;
361 double xsec = 0., xsec1, xsec2;
362
363 for( i = 0; i < target->nReadHeatedTargets; i++ ) if( target->readHeatedTargets[i]->temperature > T ) break;
364 if( i == 0 ) {
365 xsec = tpia_target_heated_getTotalCrossSectionAtE( smr, target->readHeatedTargets[0]->heatedTarget, iEg, e_in, crossSectionType ); }
366 else if( i == target->nReadHeatedTargets ) {
367 xsec = tpia_target_heated_getTotalCrossSectionAtE( smr, target->readHeatedTargets[i-1]->heatedTarget, iEg, e_in, crossSectionType ); }
368 else {
369 xsec1 = tpia_target_heated_getTotalCrossSectionAtE( smr, target->readHeatedTargets[i-1]->heatedTarget, iEg, e_in, crossSectionType );
370 xsec2 = tpia_target_heated_getTotalCrossSectionAtE( smr, target->readHeatedTargets[i ]->heatedTarget, iEg, e_in, crossSectionType );
371 xsec = ( ( target->readHeatedTargets[i]->temperature - T ) * xsec1 + ( T - target->readHeatedTargets[i-1]->temperature ) * xsec2 ) /
372 ( target->readHeatedTargets[i]->temperature - target->readHeatedTargets[i-1]->temperature );
373 }
374
375 return( xsec );
376}
double tpia_target_heated_getTotalCrossSectionAtE(statusMessageReporting *smr, tpia_target_heated *target, xData_Int gE, double e_in, int crossSectionType)

Referenced by G4GIDI_target::getTotalCrossSectionAtE().

◆ tpia_target_getTotalCrossSectionAtTIndex()

tpia_1dData * tpia_target_getTotalCrossSectionAtTIndex ( statusMessageReporting smr,
tpia_target target,
int  index,
int  crossSectionType 
)

Definition at line 341 of file tpia_target.cc.

341 {
342
343 tpia_target_heated *heated = tpia_target_getHeatedTargetAtTIndex( smr, target, index );
344
345 if( !smr_isOk( smr ) ) return( NULL );
346 if( crossSectionType == tpia_crossSectionType_grouped ) {
347 return( &(heated->totalCrossSectionGrouped) ); }
348 else if( crossSectionType == tpia_crossSectionType_pointwise ) {
349 return( &(heated->totalCrossSectionPointwise) );
350 }
351 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1, "Invalue crossSectionType = %d", crossSectionType );
352 return( NULL );
353}
tpia_1dData totalCrossSectionPointwise
Definition: tpia_target.h:276
tpia_1dData totalCrossSectionGrouped
Definition: tpia_target.h:277

◆ tpia_target_heated_create()

tpia_target_heated * tpia_target_heated_create ( statusMessageReporting smr)

Definition at line 52 of file tpia_target_heated.cc.

52 {
53
54 tpia_target_heated *target;
55
56 //if( ( target = xData_malloc2( smr, sizeof( tpia_target_heated ), 0, "target" ) ) == NULL ) return( NULL );
57 if( ( target = (tpia_target_heated*) xData_malloc2( smr, sizeof( tpia_target_heated ), 0, "target" ) ) == NULL ) return( NULL );
58 //if( tpia_target_heated_initialize( smr, target ) ) target = xData_free( smr, target );
59 if( tpia_target_heated_initialize( smr, target ) ) target = (tpia_target_heated*) xData_free( smr, target );
60 return( target );
61}
int tpia_target_heated_initialize(statusMessageReporting *, tpia_target_heated *target)

Referenced by tpia_target_heated_createRead().

◆ tpia_target_heated_createRead()

tpia_target_heated * tpia_target_heated_createRead ( statusMessageReporting smr,
const char *  fileName,
int  checkElememtsForAccess 
)

Definition at line 74 of file tpia_target_heated.cc.

74 {
75
76 tpia_target_heated *target;
77
78 if( ( target = tpia_target_heated_create( smr ) ) == NULL ) return( NULL );
79 //if( tpia_target_heated_read( smr, target, fileName, checkElememtsForAccess ) != 0 ) target = xData_free( smr, target );
80 if( tpia_target_heated_read( smr, target, fileName, checkElememtsForAccess ) != 0 ) target = (tpia_target_heated*) xData_free( smr, target );
81 return( target );
82}
int tpia_target_heated_read(statusMessageReporting *smr, tpia_target_heated *target, const char *fileName, int checkElememtsForAccess)
tpia_target_heated * tpia_target_heated_create(statusMessageReporting *smr)

Referenced by tpia_target_readHeatedTarget().

◆ tpia_target_heated_free()

tpia_target_heated * tpia_target_heated_free ( statusMessageReporting smr,
tpia_target_heated target 
)

Definition at line 86 of file tpia_target_heated.cc.

86 {
87
88 tpia_target_heated_release( smr, target );
89 xData_free( smr, target );
90 return( NULL );
91}
int tpia_target_heated_release(statusMessageReporting *smr, tpia_target_heated *target)

Referenced by tpia_target_release().

◆ tpia_target_heated_getChannelAtIndex()

tpia_channel * tpia_target_heated_getChannelAtIndex ( tpia_target_heated target,
int  index 
)

Definition at line 263 of file tpia_target_heated.cc.

263 {
264
265 tpia_channel *channel = NULL;
266
267 if( ( index >= 0 ) && ( index < target->nChannels ) ) channel = target->channels[index];
268 return( channel );
269}
tpia_channel ** channels
Definition: tpia_target.h:281

Referenced by G4GIDI_target::init(), and tpia_target_heated_getChannelAtIndex_smr().

◆ tpia_target_heated_getChannelAtIndex_smr()

tpia_channel * tpia_target_heated_getChannelAtIndex_smr ( statusMessageReporting smr,
tpia_target_heated target,
int  index 
)

Definition at line 273 of file tpia_target_heated.cc.

273 {
274
275 tpia_channel *channel = tpia_target_heated_getChannelAtIndex( target, index );
276
277 if( channel == NULL ) {
278 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1, "bad channel index = %d for %s + %s", index,
279 target->projectileID->name, target->targetID->name );
280 }
281 return( channel );
282}
tpia_channel * tpia_target_heated_getChannelAtIndex(tpia_target_heated *target, int index)

Referenced by G4GIDI_target::getElasticFinalState(), tpia_target_heated_getIndexChannelCrossSectionAtE(), and tpia_target_heated_sampleIndexChannelProductsAtE().

◆ tpia_target_heated_getEIndex()

xData_Int tpia_target_heated_getEIndex ( tpia_target_heated target,
double  e_in 
)

Definition at line 305 of file tpia_target_heated.cc.

305 {
306
307 return( tpia_misc_binarySearch( target->energyGridLength, target->energyGrid, e_in ) );
308}
xData_Int energyGridLength
Definition: tpia_target.h:274
xData_Int tpia_misc_binarySearch(xData_Int n, double *ds, double d)
Definition: tpia_misc.cc:208

Referenced by tpia_channel_getCrossSectionAtE(), and tpia_target_heated_getTotalCrossSectionAtE().

◆ tpia_target_heated_getEnergyGrid()

xData_Int tpia_target_heated_getEnergyGrid ( statusMessageReporting smr,
tpia_target_heated target,
double **  energyGrid 
)

Definition at line 297 of file tpia_target_heated.cc.

297 {
298
299 if( energyGrid != NULL ) *energyGrid = target->energyGrid;
300 return( target->energyGridLength );
301}

Referenced by tpia_target_getEnergyGridAtTIndex().

◆ tpia_target_heated_getIndexChannelCrossSectionAtE()

double tpia_target_heated_getIndexChannelCrossSectionAtE ( statusMessageReporting smr,
tpia_target_heated target,
int  index,
xData_Int  iEg,
double  e_in,
int  crossSectionType 
)

Definition at line 329 of file tpia_target_heated.cc.

330 {
331
332 double xsec = 0.;
333 tpia_channel *channel = tpia_target_heated_getChannelAtIndex_smr( smr, target, index );
334
335 if( channel != NULL ) xsec = tpia_channel_getCrossSectionAtE( smr, channel, iEg, e_in, crossSectionType );
336 return( xsec );
337}
double tpia_channel_getCrossSectionAtE(statusMessageReporting *smr, tpia_channel *channel, xData_Int iEg, double e_in, int crossSectionType)
tpia_channel * tpia_target_heated_getChannelAtIndex_smr(statusMessageReporting *smr, tpia_target_heated *target, int index)

Referenced by tpia_target_getIndexChannelCrossSectionAtE().

◆ tpia_target_heated_getProductionChannelAtIndex()

tpia_channel * tpia_target_heated_getProductionChannelAtIndex ( tpia_target_heated target,
int  index 
)

Definition at line 286 of file tpia_target_heated.cc.

286 {
287
288 tpia_channel *channel = NULL;
289
290 if( ( index >= 0 ) && ( index < target->nProductionChannels ) ) channel = target->productionChannels[index];
291 return( channel );
292}
tpia_channel ** productionChannels
Definition: tpia_target.h:282

◆ tpia_target_heated_getTotalCrossSectionAtE()

double tpia_target_heated_getTotalCrossSectionAtE ( statusMessageReporting smr,
tpia_target_heated target,
xData_Int  gE,
double  e_in,
int  crossSectionType 
)

Definition at line 313 of file tpia_target_heated.cc.

314 {
315
316 double xsec = 0.;
317
318 if( crossSectionType == tpia_crossSectionType_grouped ) {
319 xsec = 0; }
320 else if( crossSectionType == tpia_crossSectionType_pointwise ) {
322 tpia_target_heated_getEIndex( target, e_in ), e_in );
323 }
324 return( xsec );
325}
xData_Int tpia_target_heated_getEIndex(tpia_target_heated *target, double e_in)

Referenced by tpia_target_getTotalCrossSectionAtTAndE().

◆ tpia_target_heated_initialize()

int tpia_target_heated_initialize ( statusMessageReporting smr,
tpia_target_heated target 
)

Definition at line 66 of file tpia_target_heated.cc.

66 {
67
68 memset( target, 0, sizeof( tpia_target_heated ) );
69 return( 0 );
70}

Referenced by tpia_target_heated_create(), and tpia_target_heated_read().

◆ tpia_target_heated_numberOfChannels()

int tpia_target_heated_numberOfChannels ( statusMessageReporting smr,
tpia_target_heated target 
)

Definition at line 248 of file tpia_target_heated.cc.

248 {
249
250 return( target->nChannels );
251}

Referenced by tpia_target_numberOfChannels().

◆ tpia_target_heated_numberOfProductionChannels()

int tpia_target_heated_numberOfProductionChannels ( statusMessageReporting smr,
tpia_target_heated target 
)

Definition at line 256 of file tpia_target_heated.cc.

256 {
257
258 return( target->nProductionChannels );
259}

Referenced by tpia_target_numberOfProductionChannels().

◆ tpia_target_heated_read()

int tpia_target_heated_read ( statusMessageReporting smr,
tpia_target_heated target,
const char *  fileName,
int  checkElememtsForAccess 
)

Definition at line 126 of file tpia_target_heated.cc.

126 {
127/*
128* If a target has already been read into this target, user must have called tpia_target_heated_release before calling this routine.
129* Otherwise, there will be memory leaks.
130*/
131 xData_document *doc = NULL;
132 xData_element *element, *channelElement, *channels;
133 int nChannels;
134 tpia_channel *channel;
135 char *name;
136 xData_Int i, j;
137
138 tpia_target_heated_initialize( smr, target );
139 if( ( target->path = xDataMisc_allocateCopyString2( smr, fileName, "path" ) ) == NULL ) return( 1 );
140 if( ( target->absPath = xDataMisc_getAbsPath( smr, fileName ) ) == NULL ) return( _tpia_target_heated_releaseAndReturnOne( smr, doc, target ) );
141 if( ( doc = xData_parseReadFile( smr, fileName, NULL, NULL ) ) == NULL ) return( _tpia_target_heated_releaseAndReturnOne( smr, doc, target ) );
142 element = xData_getDocumentsElement( doc );
143 xData_addToAccessed( smr, element, 1 );
144 if( xData_convertAttributeTo_xData_Int( smr, element, "nGroups", &i ) != 0 ) return( _tpia_target_heated_releaseAndReturnOne( smr, doc, target ) );
145 target->nGroups = (int) i;
146 if( strcmp( element->name, "xTargetHeated" ) != 0 ) {
147 tpia_misc_setMessageError_Element( smr, NULL, element, __FILE__, __LINE__, 1, "input file's top element must be xTargetHeated and not %s",
148 element->name ); }
149 else {
150 xData_copyAttributionList( smr, &(target->attributes), &(element->attributes) );
151 if( smr_isOk( smr ) ) target->contents = xData_getAttributesValue( &(target->attributes), "contents" );
152 if( ( name = tpia_misc_pointerToAttributeIfAllOk3( smr, target->absPath, 1, &(target->attributes), "projectile" ) ) != NULL )
153 target->projectileID = tpia_particle_getInternalID( smr, name );
154 if( ( name = tpia_misc_pointerToAttributeIfAllOk3( smr, target->absPath, 1, &(target->attributes), "target" ) ) != NULL )
155 target->targetID = tpia_particle_getInternalID( smr, name );
156 if( smr_isOk( smr ) ) _tpia_target_heated_getEnergyGridAndAllocateTotalCrossSections( smr, target, element );
157 if( smr_isOk( smr ) ) { /* Get channels. */
158 //if( ( channels = xData_getOneElementByTagName( smr, element, "channels", 1 ) ) == NULL )
159 if( ( channels = xData_getOneElementByTagName( smr, element, (char*)"channels", 1 ) ) == NULL )
160 return( _tpia_target_heated_releaseAndReturnOne( smr, doc, target ) );
161 xData_addToAccessed( smr, channels, 1 );
162 if( ( nChannels = xData_numberOfElementsByTagName( smr, channels, "channel" ) ) > 0 ) {
163 //if( ( target->channels = xData_malloc2( smr, nChannels * sizeof( tpia_channel * ), 1, "channels" ) ) == NULL )
164 if( ( target->channels = (tpia_channel**) xData_malloc2( smr, nChannels * sizeof( tpia_channel * ), 1, "channels" ) ) == NULL )
165 return( _tpia_target_heated_releaseAndReturnOne( smr, doc, target ) );
166 for( channelElement = xData_getFirstElement( channels ); channelElement != NULL; channelElement = xData_getNextElement( channelElement ) ) {
167 if( !strcmp( channelElement->name, "channel" ) ) {
168 if( ( channel = tpia_channel_createGetFromElement( smr, target, channelElement, 1 ) ) == NULL ) break;
169 target->channels[target->nChannels] = channel;
170 target->nChannels++;
171 for( i = channel->crossSectionPointwise.start, j = 0; i < channel->crossSectionPointwise.end; i++, j++ )
173 for( i = channel->crossSectionGrouped.start, j = 0; i < channel->crossSectionGrouped.end; i++, j++ )
174 target->totalCrossSectionGrouped.data[i] += channel->crossSectionGrouped.data[j];
175 }
176 }
177 }
178 }
179 if( smr_isOk( smr ) ) { /* Get production channels. */
180 //if( ( channels = xData_getOneElementByTagName( smr, element, "productionChannels", 0 ) ) == NULL ) {
181 if( ( channels = xData_getOneElementByTagName( smr, element, (char*) "productionChannels", 0 ) ) == NULL ) {
182 if( !smr_isOk( smr ) ) return( _tpia_target_heated_releaseAndReturnOne( smr, doc, target ) ); }
183 else {
184 xData_addToAccessed( smr, channels, 1 );
185 if( ( nChannels = xData_numberOfElementsByTagName( smr, channels, "channel" ) ) > 0 ) {
186 //if( ( target->productionChannels = xData_malloc2( smr, nChannels * sizeof( tpia_channel * ), 1, "channels" ) ) != NULL ) {
187 if( ( target->productionChannels = (tpia_channel**) xData_malloc2( smr, nChannels * sizeof( tpia_channel * ), 1, "channels" ) ) != NULL ) {
188 for( channelElement = xData_getFirstElement(channels); channelElement != NULL; channelElement = xData_getNextElement(channelElement) ) {
189 if( !strcmp( channelElement->name, "channel" ) ) {
190 channel = tpia_channel_createGetFromElement( smr, target, channelElement, 1 );
191 if( channel == NULL ) break;
192 target->productionChannels[target->nProductionChannels] = channel;
193 target->nProductionChannels++;
194 }
195 }
196 }
197 }
198 }
199 }
200 }
201 if( smr_isOk( smr ) && checkElememtsForAccess ) _tpia_target_heated_checkElememtsForAccess( smr, doc );
202 xData_parseFree( smr, doc );
203 if( !smr_isOk( smr ) ) tpia_target_heated_release( smr, target );
204 return( !smr_isOk( smr ) );
205}
xData_attributionList attributes
Definition: tpia_target.h:278
#define tpia_misc_pointerToAttributeIfAllOk3(smr, path, required, attributes, name)
Definition: tpia_misc.h:44
tpia_channel * tpia_channel_createGetFromElement(statusMessageReporting *smr, tpia_target_heated *target, xData_element *channelElement, int pointwiseRequired)
Definition: tpia_channel.cc:71
char * xDataMisc_getAbsPath(statusMessageReporting *smr, const char *fileName)
Definition: xDataMisc.cc:112
int xData_numberOfElementsByTagName(statusMessageReporting *smr, xData_element *element, const char *tagName)
Definition: xData.cc:750
#define xDataMisc_allocateCopyString2(smr, s, forItem)
Definition: xData.h:315
void * xData_parseFree(statusMessageReporting *smr, xData_document *xData_doc)
Definition: xData.cc:208
xData_element * xData_getDocumentsElement(xData_document *xData_doc)
Definition: xData.cc:476
xData_document * xData_parseReadFile(statusMessageReporting *smr, const char *fileName, xData_xDataTypeOk func, void *userData)
Definition: xData.cc:84

Referenced by tpia_target_heated_createRead().

◆ tpia_target_heated_release()

int tpia_target_heated_release ( statusMessageReporting smr,
tpia_target_heated target 
)

Definition at line 95 of file tpia_target_heated.cc.

95 {
96
97 int i;
98
99 //target->path = xData_free( smr, target->path );
100 target->path = (char*) xData_free( smr, target->path );
101 //target->absPath = xData_free( smr, target->absPath );
102 target->absPath = (char*) xData_free( smr, target->absPath );
103 target->energyGridLength = 0;
104 //target->energyGrid = xData_free( smr, target->energyGrid );
105 target->energyGrid = (double*) xData_free( smr, target->energyGrid );
106 //target->kerma = xData_free( smr, target->kerma );
107 target->kerma = (double*) xData_free( smr, target->kerma );
108 //target->totalCrossSectionPointwise.data = xData_free( smr, target->totalCrossSectionPointwise.data );
110 //target->totalCrossSectionGrouped.data = xData_free( smr, target->totalCrossSectionGrouped.data );
111 target->totalCrossSectionGrouped.data = (double*) xData_free( smr, target->totalCrossSectionGrouped.data );
112 xData_releaseAttributionList( smr, &(target->attributes) );
113 for( i = 0; i < target->nChannels; i++ ) tpia_channel_free( smr, target->channels[i] );
114 target->nChannels = 0;
115 //target->channels = xData_free( smr, target->channels );
116 target->channels = (tpia_channel**) xData_free( smr, target->channels );
117 for( i = 0; i < target->nProductionChannels; i++ ) tpia_channel_free( smr, target->productionChannels[i] );
118 target->nProductionChannels = 0;
119 //target->productionChannels = xData_free( smr, target->productionChannels );
120 target->productionChannels = (tpia_channel**) xData_free( smr, target->productionChannels );
121 return( 0 );
122}
tpia_channel * tpia_channel_free(statusMessageReporting *smr, tpia_channel *channel)
Definition: tpia_channel.cc:83

Referenced by tpia_target_heated_free(), and tpia_target_heated_read().

◆ tpia_target_heated_sampleIndexChannelProductsAtE()

int tpia_target_heated_sampleIndexChannelProductsAtE ( statusMessageReporting smr,
tpia_target_heated target,
int  index,
tpia_decaySamplingInfo decaySamplingInfo,
int  nProductData,
tpia_productOutgoingData productData 
)

Definition at line 341 of file tpia_target_heated.cc.

342 {
343
344 tpia_channel *channel = tpia_target_heated_getChannelAtIndex_smr( smr, target, index );
345
346 if( channel == NULL ) return( -1 );
347 return( tpia_decayChannel_sampleProductsAtE( smr, &(channel->decayChannel), decaySamplingInfo, nProductData, productDatas ) );
348}
int tpia_decayChannel_sampleProductsAtE(statusMessageReporting *smr, tpia_decayChannel *decayChannel, tpia_decaySamplingInfo *decaySamplingInfo, int nProductData, tpia_productOutgoingData *productData)

Referenced by G4GIDI_target::getFinalState(), and tpia_target_sampleIndexChannelProductsAtE().

◆ tpia_target_initialize()

int tpia_target_initialize ( statusMessageReporting smr,
tpia_target target 
)

Definition at line 61 of file tpia_target.cc.

61 {
62
63 memset( target, 0, sizeof( tpia_target ) );
65 return( 0 );
66}
tpia_samplingMethods samplingMethods
Definition: tpia_target.h:300
int tpia_samplingMethods_initialize(statusMessageReporting *smr, tpia_samplingMethods *samplingMethods)

Referenced by tpia_target_create(), tpia_target_read(), and tpia_target_release().

◆ tpia_target_numberOfChannels()

int tpia_target_numberOfChannels ( statusMessageReporting smr,
tpia_target target 
)

Definition at line 317 of file tpia_target.cc.

317 {
318
320}
tpia_target_heated * baseHeatedTarget
Definition: tpia_target.h:302
int tpia_target_heated_numberOfChannels(statusMessageReporting *smr, tpia_target_heated *target)

Referenced by G4GIDI_target::getChannelIDs(), G4GIDI_target::getNumberOfChannels(), and G4GIDI_target::init().

◆ tpia_target_numberOfProductionChannels()

int tpia_target_numberOfProductionChannels ( statusMessageReporting smr,
tpia_target target 
)

Definition at line 324 of file tpia_target.cc.

324 {
325
327}
int tpia_target_heated_numberOfProductionChannels(statusMessageReporting *smr, tpia_target_heated *target)

Referenced by G4GIDI_target::getNumberOfProductionChannels(), and G4GIDI_target::getProductionChannelIDs().

◆ tpia_target_read()

int tpia_target_read ( statusMessageReporting smr,
tpia_target target,
const char *  fileName 
)

Definition at line 143 of file tpia_target.cc.

143 {
144/*
145* If a target has already been read into this target, user must have called tpia_target_release before calling this routine.
146* Otherwise, there will be memory leaks.
147*/
148 xData_document *doc;
149 xData_element *element, *child;
150 int i, iHeated, nHeated = 0, status = 1;
151 double temperature;
152 //fix for gcc4.6 warings 110602
153 //char *pReturnValue, *name;
154 char *name;
155 char const *contents;
156
157 tpia_target_initialize( smr, target );
158 if( ( target->path = xDataMisc_allocateCopyString2( smr, fileName, "path" ) ) == NULL ) return( status );
159 if( ( target->absPath = xDataMisc_getAbsPath( smr, fileName ) ) == NULL ) return( _tpia_target_releaseAndReturnOne( smr, target ) );
160 if( ( doc = xData_parseReadFile( smr, fileName, NULL, NULL ) ) == NULL ) return( _tpia_target_releaseAndReturnOne( smr, target ) );
161 element = xData_getDocumentsElement( doc );
162 if( strcmp( element->name, "xTarget" ) != 0 ) {
163 tpia_misc_setMessageError_Element( smr, NULL, element, __FILE__, __LINE__, 1, "input file's top element must be xTarget and not %s", element->name ); }
164 else {
165 //pReturnValue = ( xData_copyAttributionList( smr, &(target->attributes), &(element->attributes) ) ) ? NULL : target->path;
166 //fix for gcc4.6 warings 110602
167 xData_copyAttributionList( smr, &(target->attributes),&(element->attributes) );
168 name = tpia_misc_pointerToAttributeIfAllOk2( smr, element, 1, &(target->attributes), "projectile" );
169 if( smr_isOk( smr ) ) target->projectileID = tpia_particle_getInternalID( smr, name );
170 if( smr_isOk( smr ) && ( name = tpia_misc_pointerToAttributeIfAllOk2( smr, element, 1, &(target->attributes), "target" ) ) != NULL ) {
171 if( smr_isOk( smr ) && ( target->targetID = tpia_particle_getInternalID( smr, name ) ) != NULL ) {
172 status = 0;
173 for( nHeated = 0, child = xData_getFirstElement( element ); child != NULL; nHeated++, child = xData_getNextElement( child ) ) {
174 if( strcmp( child->name, "target" ) != 0 ) {
175 tpia_misc_setMessageError_Element( smr, NULL, element, __FILE__, __LINE__, 1, "element can only have target sub-elements%s",
176 element->name );
177 status = 1;
178 break;
179 }
180 }
181 if( status == 0 ) {
182 //if( ( target->heatedTargets = xData_malloc2( smr, nHeated * sizeof( tpia_target_heated_info ), 1, "heatedTargets" ) ) == NULL ) {
183 if( ( target->heatedTargets = (tpia_target_heated_info*) xData_malloc2( smr, nHeated * sizeof( tpia_target_heated_info ), 1, "heatedTargets" ) ) == NULL ) {
184 status = 1; }
185 else {
186 //if( ( target->readHeatedTargets = xData_malloc2( smr, nHeated * sizeof( tpia_target_heated_info * ), 1, "heatedTargets" ) ) == NULL )
187 if( ( target->readHeatedTargets = (tpia_target_heated_info**) xData_malloc2( smr, nHeated * sizeof( tpia_target_heated_info * ), 1, "heatedTargets" ) ) == NULL )
188 status = 1;
189 }
190 for( nHeated = 0, child = xData_getFirstElement( element ); ( status == 0 ) && ( child != NULL );
191 nHeated++, child = xData_getNextElement( child ) ) {
192 if( ( i = xData_convertAttributeToDouble( smr, child, "temperature", &temperature ) ) != 0 ) {
193 if( i > 0 ) smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1, "target does not have a temperature attribute" );
194 status = 1;
195 break;
196 }
197 for( iHeated = 0; iHeated < nHeated; iHeated++ ) if( target->heatedTargets[iHeated].temperature > temperature ) break;
198 if( iHeated < nHeated ) for( i = nHeated; i >= iHeated; i-- ) target->heatedTargets[i+1] = target->heatedTargets[i];
199 target->heatedTargets[iHeated].temperature = temperature;
200 target->heatedTargets[iHeated].path = NULL;
201 target->heatedTargets[iHeated].contents = NULL;
202 target->heatedTargets[iHeated].heatedTarget = NULL;
203 if( ( contents = xData_getAttributesValueInElement( child, "contents" ) ) != NULL ) {
204 if( ( target->heatedTargets[iHeated].contents = xDataMisc_allocateCopyString2( smr, contents, "contents" ) ) == NULL ) {
205 status = 1;
206 break;
207 }
208 }
209 if( ( contents = xData_getAttributesValueInElement( child, "file" ) ) == NULL ) {
210 status = 1;
211 break;
212 }
213 //if((target->heatedTargets[iHeated].path = xData_malloc2(smr, strlen( target->absPath ) + strlen( contents ) + 2, 0, "path")) == NULL) {
214 if((target->heatedTargets[iHeated].path = (char*) xData_malloc2(smr, strlen( target->absPath ) + strlen( contents ) + 2, 0, "path")) == NULL) {
215 status = 1;
216 break;
217 }
218 strcpy( target->heatedTargets[iHeated].path, target->absPath );
219 *strrchr( target->heatedTargets[iHeated].path, '/' ) = 0;
220 strcat( target->heatedTargets[iHeated].path, "/" );
221 strcat( target->heatedTargets[iHeated].path, contents );
222 target->nHeatedTargets++;
223 }
224 }
225 }
226 }
227 }
228 xData_parseFree( smr, doc );
229 if( status == 0 ) {
230 for( i = 0; i < nHeated; i++ ) target->heatedTargets[i].ordinal = i;
231 for( i = 0; i < nHeated; i++ ) if( target->heatedTargets[i].contents == NULL ) break;
232 if( i == nHeated ) i = 0; /* All heated targets are crossSection only. */
233 if( tpia_target_readHeatedTarget( smr, target, i, 0 ) == 0 ) {
234 target->baseHeatedTarget = target->heatedTargets[i].heatedTarget; }
235 else {
236 tpia_target_release( NULL, target );
237 status = 1;
238 } }
239 else {
240 tpia_target_release( smr, target );
241 }
242 return( status );
243}
tpia_particle * projectileID
Definition: tpia_target.h:297
char * absPath
Definition: tpia_target.h:296
tpia_particle * targetID
Definition: tpia_target.h:298

Referenced by tpia_target_createRead(), and tpia_target_readFromMap().

◆ tpia_target_readFromMap()

int tpia_target_readFromMap ( statusMessageReporting smr,
tpia_target target,
tpia_map map,
const char *  evaluation,
const char *  projectileName,
const char *  targetName 
)

Definition at line 82 of file tpia_target.cc.

83 {
84
85 char *targetPath;
86
87 if( ( targetPath = tpia_map_findTarget( smr, map, evaluation, projectileName, targetName ) ) == NULL ) return( 1 );
88 return( tpia_target_read( smr, target, targetPath ) );
89}

◆ tpia_target_readHeatedTarget()

int tpia_target_readHeatedTarget ( statusMessageReporting smr,
tpia_target target,
int  index,
int  checkElememtsForAccess 
)

Definition at line 266 of file tpia_target.cc.

266 {
267
268 int i;
269
270 if( ( index < 0 ) || ( index >= target->nHeatedTargets ) ) {
271 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1, "temperature index = %d out of range (0 <= index < %d", index, target->nHeatedTargets );
272 return( -1 );
273 }
274 if( target->heatedTargets[index].heatedTarget != NULL ) return( 1 );
275 target->heatedTargets[index].heatedTarget = tpia_target_heated_createRead( smr, target->heatedTargets[index].path, checkElememtsForAccess );
276 if( target->heatedTargets[index].heatedTarget != NULL ) {
277 target->heatedTargets[index].heatedTarget->ordinal = target->heatedTargets[index].ordinal;
278 for( i = target->nReadHeatedTargets; i > 0; i-- ) {
279 if( target->readHeatedTargets[i-1]->temperature < target->heatedTargets[index].temperature ) break;
280 target->readHeatedTargets[i] = target->readHeatedTargets[i-1];
281 }
282 target->readHeatedTargets[i] = &(target->heatedTargets[i]);
283 target->nReadHeatedTargets++;
284 }
285 return( ( target->heatedTargets[index].heatedTarget == NULL ? -1 : 0 ) );
286}
tpia_target_heated * tpia_target_heated_createRead(statusMessageReporting *smr, const char *fileName, int checkElememtsForAccess)

Referenced by G4GIDI_target::readTemperature(), tpia_target_getHeatedTargetAtIndex_ReadIfNeeded(), and tpia_target_read().

◆ tpia_target_release()

int tpia_target_release ( statusMessageReporting smr,
tpia_target target 
)

Definition at line 117 of file tpia_target.cc.

117 {
118
119 int i;
120
121 //target->path = xData_free( smr, target->path );
122 target->path = (char*) xData_free( smr, target->path );
123 //target->absPath = xData_free( smr, target->absPath );
124 target->absPath = (char*) xData_free( smr, target->absPath );
125 xData_releaseAttributionList( smr, &(target->attributes) );
126 for( i = 0; i < target->nHeatedTargets; i++ ) {
127 //target->heatedTargets[i].path = xData_free( smr, target->heatedTargets[i].path );
128 target->heatedTargets[i].path = (char*) xData_free( smr, target->heatedTargets[i].path );
129 //target->heatedTargets[i].contents = xData_free( smr, target->heatedTargets[i].contents );
130 target->heatedTargets[i].contents = (char*) xData_free( smr, target->heatedTargets[i].contents );
131 if( target->heatedTargets[i].heatedTarget != NULL ) tpia_target_heated_free( smr, target->heatedTargets[i].heatedTarget );
132 }
133 //target->heatedTargets = xData_free( smr, target->heatedTargets );
135 //target->readHeatedTargets = xData_free( smr, target->readHeatedTargets );
137 tpia_target_initialize( smr, target );
138 return( 0 );
139}
tpia_target_heated * tpia_target_heated_free(statusMessageReporting *smr, tpia_target_heated *target)

Referenced by tpia_target_free(), and tpia_target_read().

◆ tpia_target_sampleIndexChannelProductsAtE()

int tpia_target_sampleIndexChannelProductsAtE ( statusMessageReporting smr,
tpia_target target,
int  index,
double  T,
tpia_decaySamplingInfo decaySamplingInfo,
int  nProductData,
tpia_productOutgoingData productData 
)

Definition at line 404 of file tpia_target.cc.

405 {
406
407 return( tpia_target_heated_sampleIndexChannelProductsAtE( smr, target->baseHeatedTarget, index, decaySamplingInfo,
408 nProductData, productData ) );
409}
int tpia_target_heated_sampleIndexChannelProductsAtE(statusMessageReporting *smr, tpia_target_heated *target, int index, tpia_decaySamplingInfo *decaySamplingInfo, int nProductData, tpia_productOutgoingData *productData)

Variable Documentation

◆ tpia_productGenre_NBody_angular_energy

DLL_LEND const char * tpia_productGenre_NBody_angular_energy

Definition at line 104 of file tpia_target.h.

Referenced by tpia_product_getFromElement().

◆ tpia_productGenre_NBody_Legendre

DLL_LEND const char * tpia_productGenre_NBody_Legendre

Definition at line 104 of file tpia_target.h.

Referenced by tpia_product_getFromElement().

◆ tpia_productGenre_NBody_pairProduction

DLL_LEND const char * tpia_productGenre_NBody_pairProduction

Definition at line 105 of file tpia_target.h.

Referenced by tpia_product_getFromElement().

◆ tpia_productGenre_NBody_uncorrelate_Legendre

DLL_LEND const char * tpia_productGenre_NBody_uncorrelate_Legendre

Definition at line 104 of file tpia_target.h.

Referenced by tpia_product_getFromElement().

◆ tpia_productGenre_twoBody_angular

DLL_LEND const char * tpia_productGenre_twoBody_angular

Definition at line 103 of file tpia_target.h.

Referenced by tpia_product_getFromElement().

◆ tpia_productGenre_twoBody_formFactor

DLL_LEND const char * tpia_productGenre_twoBody_formFactor

Definition at line 103 of file tpia_target.h.

Referenced by tpia_product_getFromElement().

◆ tpia_productGenre_unknown

DLL_LEND const char* tpia_productGenre_unknown
extern

Definition at line 56 of file tpia_product.cc.

Referenced by tpia_product_getFromElement().

◆ tpia_samplingMethods_constant

DLL_LEND const char* tpia_samplingMethods_constant
extern

Definition at line 45 of file tpia_samplingMethods.cc.

◆ tpia_samplingMethods_linear

DLL_LEND const char * tpia_samplingMethods_linear

Definition at line 107 of file tpia_target.h.

Referenced by tpia_samplingMethods_initialize().