Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
tpia_angular.cc File Reference
#include <string.h>
#include "tpia_target.h"
#include "tpia_misc.h"

Go to the source code of this file.

Functions

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)
 

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().