ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MCGIDI.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file MCGIDI.h
1 /*
2 # <<BEGIN-copyright>>
3 # <<END-copyright>>
4 */
5 #ifndef MCGIDI_h_included
6 #define MCGIDI_h_included
7 
8 #define MCGIDI_VERSION_MAJOR 1
9 #define MCGIDI_VERSION_MINOR 0
10 #define MCGIDI_VERSION_PATCHLEVEL 0
11 
12 #ifdef WIN32
13 #define M_PI 3.141592653589793238463
14 #endif
15 
16 #include <GIDI_settings.hh>
17 #include <map>
18 #include <vector>
19 
20 #include <statusMessageReporting.h>
21 #include <ptwXY.h>
22 #include <xDataTOM.h>
23 
24 #include "MCGIDI_mass.h"
25 #include "MCGIDI_map.h"
26 
27 /* Disable Effective C++ warnings in GIDI code. */
28 #if __INTEL_COMPILER > 1399
29 #pragma warning( disable:2021 )
30 #pragma warning( disable:593 )
31 #pragma warning( disable:111 )
32 #elif __INTEL_COMPILER > 1199
33 #pragma warning( disable:2304 )
34 #endif
35 
36 #if defined __cplusplus
37  extern "C" {
38  namespace GIDI {
39 #endif
40 
42 typedef struct MCGIDI_POP_s MCGIDI_POP;
43 typedef struct MCGIDI_POPs_s MCGIDI_POPs;
47 typedef struct MCGIDI_target_heated_sorted_s MCGIDI_target_heated_sorted;
65 
71 
72 #if defined __cplusplus
73  }
74  }
75 #endif
76 
80 };
81 
83 
84  private:
89  double mTemperature;
92 
93  public:
94  MCGIDI_quantitiesLookupModes( int projectilesPOPID );
96 
97  inline double getProjectileEnergy( void ) const { return( mProjectileEnergy ); }
98  void setProjectileEnergy( double e_in ) { mProjectileEnergy = e_in; }
99 
100  inline int getGroupIndex( void ) const { return( mGroupIndex ); }
101  int setGroupIndex( GIDI_settings const &settings, bool encloseOutOfRange );
102 
103  inline double getTemperature( void ) const { return( mTemperature ); }
104  void setTemperature( double temperature ) { mTemperature = temperature; }
105 
106  enum MCGIDI_quantityLookupMode getMode( std::string const &quantity ) const;
108  std::vector<std::string> getListOfLookupQuanities( ) const;
109  void setMode( std::string const &quantity, enum MCGIDI_quantityLookupMode mode );
111  void setModeAll( enum MCGIDI_quantityLookupMode mode );
112 };
113 
115 
117  int PoPID;
119 };
120 
122 
123  public:
126 };
127 
129 
130  private: // This is user input.
133  double (*mRng)( void * );
134  void *mRngState;
135  std::vector<struct MCGIDI_samplingMultiplicityBias_s> mSamplingMultiplicityBiases;
136 
137  public: // Temporary variables used in MCGIDI sampling routines.
140  double mMu;
141  double mEp;
142 
143  public:
144  MCGIDI_samplingSettings( enum GIDI::xDataTOM_frame frame, bool wantVelocities, double (*rng)( void * ), void *rngState );
146 
147  inline double getProductMultiplicityBias( int PoPID ) const {
148  for( int i1 = 0; i1 < (int) mSamplingMultiplicityBiases.size( ); ++i1 ) {
149  if( PoPID == mSamplingMultiplicityBiases[i1].PoPID ) return( mSamplingMultiplicityBiases[i1].multiplicityFactor );
150  }
151  return( 1. ); }
152  int setProductMultiplicityBias( GIDI::statusMessageReporting *smr, int PoPID, double fractor );
153 };
154 
155 #if defined __cplusplus
156  extern "C" {
157  namespace GIDI {
158 #endif
159 
166 #if defined __cplusplus
167  }
168  }
169 #endif
170 
171 typedef std::map<int, enum GIDI::MCGIDI_transportability> transportabilitiesMap;
172 
173 #if defined __cplusplus
174  extern "C" {
175  namespace GIDI {
176 #endif
177 
178 #define MCGIDI_crossSectionType_grouped 1
179 #define MCGIDI_crossSectionType_pointwise 2
180 
181 #define MCGIDI_nullReaction -10001
182 
183 #define MCGIDI_speedOfLight_cm_sec 2.99792458e10
184 #define MCGIDI_AMU2MeV 931.494028
185 
187  MCGIDI_reactionType_unknown_e, /* This should never happen. */
188  MCGIDI_reactionType_null_e, /* Only occurs when sampling with from grouped cross sections and the projectile is below threshold. */
189  MCGIDI_reactionType_elastic_e, /* A nuclear elastic reaction. */
190  MCGIDI_reactionType_scattering_e, /* A nuclear reaction where the projectile and target are products as well as gammas,
191  excluding reactions that are MCGIDI_reactionType_elastic_e and
192  MCGIDI_reactionType_nuclearLevelTransition_e. */
193  MCGIDI_reactionType_nuclearIsomerTransmutation_e, /* A nuclear that changes N or Z and is not one of the others.*/
194  MCGIDI_reactionType_nuclearLevelTransition_e, /* Reaction in which the residual is the same isotope as the target but in a
195  different nuclear level. Mainly for meta-stables. */
196  MCGIDI_reactionType_capture_e, /* A nuclear capture reaction. */
197  MCGIDI_reactionType_fission_e, /* A nuclear fission reaction. */
200 };
201 
204 
207 
211 
213 
217 
220 
221 #define MCGIDI_particleLevel_continuum -1
222 #define MCGIDI_particleLevel_sum -2
223 
226  double probability;
227 };
228 
229 struct MCGIDI_POP_s {
232  char *name;
233  int globalPoPsIndex; /* Index of particle in the PoPs library if particle can be return to packages using */
234  int Z, A, level, m; /* this library. Otherwise, -1. */
235  double mass_MeV;
236  double level_MeV;
239 };
240 
242  int numberOfPOPs, size, increment;
243  MCGIDI_POP *first, *last, **sorted;
244 };
245 
249  int ordinal;
250  int Z, A, m;
251  double mass_MeV;
252  char *name;
253 };
254 
256  enum xDataTOM_frame frame; /* The frame the product data are in. */
257  int isVelocity; /* See struct MCGIDI_sampledProductsData_s for meaning. This is user input. */
258  double (*rng)( void * ); /* User supplied rng. */
259  void *rngState; /* User supplied rng state. */
260  MCGIDI_POP *pop; /* pop for the sampled product. */
261  double mu; /* mu = cos( theta ) for the sampled product. Frame is given by frame member. */
262  double Ep; /* Energy of the product. Frame is given by frame member. */
263 };
264 
270 };
271 
276 };
277 
279  int isVelocity; /* If true, px_vx, py_vy and pz_vz are velocities otherwise momenta. */
282  double px_vx;
283  double py_vy;
284  double pz_vz;
287  double birthTimeSec; /* Some products, like delayed fission neutrons, are to appear (be born) later. */
288 };
289 
295 };
296 
299  double *Xs;
300  double *pdf;
301  double *cdf;
302 };
303 
307  double *Ws;
309 };
310 
314  int iW, iX1, iX2;
315  double x, w, frac;
316 };
317 
323  double projectileMass_MeV, targetMass_MeV, productMass_MeV, residualMass_MeV;
324 };
325 
329 };
330 
333  MCGIDI_energyWeightedFunctional weightedFunctional[4]; /* ??????????? Hardwired for no good reason. Will handle up to a (z,4n) reaction. */
334 };
335 
338  double mass, massFactor, e_inCOMFactor, Q_MeV;
339 };
340 
348  double U;
349  ptwXYPoints *theta, *Watt_a, *Watt_b;
354 };
355 
359  MCGIDI_pdfsOfXGivenW *pdfOfMuGivenEAndEp; /* The number of MCGIDI_pdfsOfXGivenW allocated is given by pdfOfEpGivenE.numberOfWs. */
360 };
361 
365  MCGIDI_pdfsOfXGivenW *pdfOfEpGivenEAndMu; /* The number of MCGIDI_pdfsOfXGivenW allocated is given by pdfOfMuGivenE.numberOfWs. */
366 };
367 
369  double *rs;
370  double *as;
371 };
372 
375  double energyToMeVFactor, massFactor, Sa, Sb, Ma, mb; /* Needed if a(E,E') is caluclated from the formula. */
376  MCGIDI_pdfsOfXGivenW dists; /* Sa currently not used. */
378 };
379 
383  MCGIDI_angular *angular; /* All distribution forms must have a frame member. */
388 };
389 
392  MCGIDI_reaction *reaction; /* This is only used for output channels. */
393  MCGIDI_product *parent; /* This is only used for decay channels. */
394  int QIsFloat;
395  double Q;
398 };
399 
402  char *label;
404  int multiplicity; /* If 0, the multiplicity is either 'energyDependent' or 'partialProduction'. */
413 };
414 
417  int ENDF_MT, ENDL_C, ENDL_S;
419  char const *outputChannelStr;
420  xDataTOM_attributionList attributes; /* Do not free, owned by attributes. */
421  int domainValuesPresent; /* True if cross section data defined so EMin and EMax are value. */
422  int thresholdGroupIndex; /* For grouped data, the group index where threshold starts. */
423  double thresholdGroupDomain; /* This is groupEnergy[thresholdGroupIndex+1] - EMin. */
424  double thresholdGroupedDeltaCrossSection; /* The adjusted group cross section in group thresholdGroupIndex. */
425  double EMin, EMax, finalQ; /* BRB, EMin is used as threshold. However, some reactions, especially charged particle */
426  ptwXYPoints *crossSection; /* have effective thresholds much higher than EMin, may need to handle these differently??????? */
429  MCGIDI_productsInfo productsInfo; /* See MCGIDI_reaction_ParseDetermineReactionProducts for description. */
430  transportabilitiesMap *transportabilities;
431 };
432 
434  int ordinal;
435  char *path; /* Partial path of input file. */
436  char *absPath; /* Full absolute path of input file. */
441  char *contents;
443  double EMin, EMax;
449  transportabilitiesMap *transportabilities;
450 };
451 
453  int ordinal;
454  double temperature;
455  char *path; /* Full path of input file. */
456  char *contents;
458 };
459 
461  char *path; /* Full path of input file. */
462  char *absPath; /* Full absolute path of input file. */
466  int nHeatedTargets, nReadHeatedTargets;
467  MCGIDI_target_heated *baseHeatedTarget; /* The lowest temperature whose contents is "all" data, (e.g, not just "crossSection"). */
468  MCGIDI_target_heated_info *heatedTargets; /* List of heated targets in order by temperature. */
469  MCGIDI_target_heated_info **readHeatedTargets; /* List of "read in" heated targets in order by temperature. */
470 };
471 
472 char const *MCGIDI_version( void );
473 int MCGIDI_versionMajor( void );
474 int MCGIDI_versionMinor( void );
475 int MCGIDI_versionPatchLevel( void );
476 
477 /*
478 * Routines in MCGIDI_target.c
479 */
482 MCGIDI_target *MCGIDI_target_newRead( statusMessageReporting *smr, const char *fileName );
484  int projectile_PoPID, int target_PoPID );
485 int MCGIDI_target_readFromMap( statusMessageReporting *smr, MCGIDI_target *target, MCGIDI_map *map, const char *evaluation, const char *projectileName,
486  const char *targetName );
488  int projectile_PoPID, int target_PoPID );
489 MCGIDI_target *MCGIDI_target_newReadFromMap( statusMessageReporting *smr, MCGIDI_map *map, const char *evaluation, const char *projectileName,
490  const char *targetName );
493 int MCGIDI_target_read( statusMessageReporting *smr, MCGIDI_target *target, const char *fileName );
499 
505 
506 transportabilitiesMap const *MCGIDI_target_getUniqueProducts( statusMessageReporting *smr, MCGIDI_target *target );
508 
509 int MCGIDI_target_getDomain( statusMessageReporting *smr, MCGIDI_target *target, double *EMin, double *EMax );
511  bool sampling );
513  bool sampling );
515  double (*userrng)( void * ), void *rngState );
517  MCGIDI_quantitiesLookupModes &modes, MCGIDI_decaySamplingInfo *decaySamplingInfo, MCGIDI_sampledProductsDatas *productDatas );
519  MCGIDI_quantitiesLookupModes &modes, MCGIDI_decaySamplingInfo *decaySamplingInfo, MCGIDI_sampledProductsDatas *productData );
521 
522 /*
523 * Routines in MCGIDI_target_heated.c
524 */
530 int MCGIDI_target_heated_read( statusMessageReporting *smr, MCGIDI_target_heated *target, const char *fileName );
535 #if 0
536 MCGIDI_reaction *MCGIDI_target_heated_getProductionReactionAtIndex( MCGIDI_target_heated *target, int index );
537 #endif
542 int MCGIDI_target_heated_getEnergyGrid( statusMessageReporting *smr, MCGIDI_target_heated *target, double **energyGrid );
544  bool sampling );
546  MCGIDI_quantitiesLookupModes &modes, bool sampling );
548  MCGIDI_quantitiesLookupModes &modes, MCGIDI_decaySamplingInfo *decaySamplingInfo, MCGIDI_sampledProductsDatas *productData );
550 int MCGIDI_target_heated_getReactionsDomain( statusMessageReporting *smr, MCGIDI_target_heated *target, int index, double *EMin, double *EMax );
553 
554 transportabilitiesMap const *MCGIDI_target_heated_getUniqueProducts( statusMessageReporting *smr, MCGIDI_target_heated *target );
556 
557 /*
558 * Routines in MCGIDI_reaction.c
559 */
565  MCGIDI_POPs *pops, MCGIDI_reaction *reaction );
570 int MCGIDI_reaction_getDomain( statusMessageReporting *smr, MCGIDI_reaction *reaction, double *EMin, double *EMax );
571 int MCGIDI_reaction_fixDomains( statusMessageReporting *smr, MCGIDI_reaction *reaction, double EMin, double EMax, nfu_status *status );
577  GIDI_settings_particle const *projectileSettings, double temperature_MeV, ptwXPoints *totalGroupedCrossSection );
578 
581 int MCGIDI_productsInfo_getPoPsIndexAtIndex( MCGIDI_productsInfo *productsInfo, int index );
585 
586 /*
587 * Routines in MCGIDI_pop.c
588 */
590 int MCGIDI_POPs_initial( statusMessageReporting *smr, MCGIDI_POPs *pops, int size );
591 void *MCGIDI_POPs_free( MCGIDI_POPs *pops );
592 int MCGIDI_POPs_release( MCGIDI_POPs *pops );
593 MCGIDI_POP *MCGIDI_POPs_addParticleIfNeeded( statusMessageReporting *smr, MCGIDI_POPs *pops, char const *name, double mass_MeV,
594  double level_MeV, MCGIDI_POP *parent, int globalParticle );
595 int MCGIDI_POPs_findParticleIndex( MCGIDI_POPs *pops, char const *name );
596 MCGIDI_POP *MCGIDI_POPs_findParticle( MCGIDI_POPs *pops, char const *name );
597 void MCGIDI_POPs_writeSortedList( MCGIDI_POPs *pops, FILE *f );
599 
600 MCGIDI_POP *MCGIDI_POP_new( statusMessageReporting *smr, char const *name, double mass_MeV, double level_MeV, MCGIDI_POP *parent );
603 double MCGIDI_POP_getMass_MeV( MCGIDI_POP *pop );
604 
605 /*
606 * Routines in MCGIDI_particle.c
607 */
615 
616 /*
617 * Routines in MCGIDI_outputChannel.c
618 */
624  MCGIDI_reaction *reaction, MCGIDI_product *parent );
627 int MCGIDI_outputChannel_getDomain( statusMessageReporting *smr, MCGIDI_outputChannel *outputChannel, double *EMin, double *EMax );
631 double MCGIDI_outputChannel_getQ_MeV( statusMessageReporting *smr, MCGIDI_outputChannel *outputChannel, double e_in );
632 double MCGIDI_outputChannel_getFinalQ( statusMessageReporting *smr, MCGIDI_outputChannel *outputChannel, double e_in );
634  MCGIDI_decaySamplingInfo *decaySamplingInfo, MCGIDI_sampledProductsDatas *productDatas, double *masses );
635 
636 /*
637 * Routines in MCGIDI_product.c
638 */
644  MCGIDI_POPs *pops, MCGIDI_product *product, int *delayedNeutronIndex );
645 int MCGIDI_product_getDomain( statusMessageReporting *smr, MCGIDI_product *product, double *EMin, double *EMax );
646 int MCGIDI_product_setTwoBodyMasses( statusMessageReporting *smr, MCGIDI_product *product, double projectileMass_MeV, double targetMass_MeV,
647  double productMass_MeV, double residualMass_MeV );
652 int MCGIDI_product_sampleMultiplicity( statusMessageReporting *smr, MCGIDI_product *product, double e_in, double r );
654  MCGIDI_decaySamplingInfo *decaySamplingInfo );
655 
656 int MCGIDI_sampledProducts_initialize( statusMessageReporting *smr, MCGIDI_sampledProductsDatas *sampledProductsDatas, int incrementSize );
660  MCGIDI_sampledProductsData *sampledProductsData );
663 
664 /*
665 * Routines in MCGIDI_distribution.c
666 */
672 
673 /*
674 * Routines in MCGIDI_angular.c
675 */
680 int MCGIDI_angular_setTwoBodyMasses( statusMessageReporting *smr, MCGIDI_angular *angular, double projectileMass_MeV, double targetMass_MeV,
681  double productMass_MeV, double residualMass_MeV );
684  MCGIDI_decaySamplingInfo *decaySamplingInfo );
685 
686 /*
687 * Routines in MCGIDI_energy.c
688 */
694  enum MCGIDI_energyType energyType, double gammaEnergy_MeV );
696  MCGIDI_decaySamplingInfo *decaySamplingInfo );
697 
698 /*
699 * Routines in MCGIDI_energyAngular.c
700 */
707  MCGIDI_decaySamplingInfo *decaySamplingInfo );
708 
709 /*
710 * Routines in MCGIDI_angularEnergy.c
711 */
718  MCGIDI_decaySamplingInfo *decaySamplingInfo );
719 
720 /*
721 * Routines in MCGIDI_KalbachMann.c
722 */
729  MCGIDI_decaySamplingInfo *decaySamplingInfo );
730 
731 /*
732 * Routines in MCGIDI_uncorrelated.c
733 */
735  enum MCGIDI_energyType energyType, double gammaEnergy_MeV );
737  MCGIDI_decaySamplingInfo *decaySamplingInfo );
738 
739 /*
740 * Routines in MCGIDI_LLNLAngular_angularEnergy.c
741 */
743 
744 /*
745 * Routines in MCGIDI_kinetics.c
746 */
747 int MCGIDI_kinetics_2BodyReaction( statusMessageReporting *smr, MCGIDI_angular *angular, double K, double mu, double phi,
748  MCGIDI_sampledProductsData *outgoingData );
749 int MCGIDI_kinetics_COMKineticEnergy2LabEnergyAndMomentum( statusMessageReporting *smr, double beta, double e_kinetic_com, double mu, double phi,
750  double m3cc, double m4cc, MCGIDI_sampledProductsData *outgoingData );
751 int MCGIDI_kinetics_COM2Lab( statusMessageReporting *smr, MCGIDI_quantitiesLookupModes &modes, MCGIDI_decaySamplingInfo *decaySamplingInfo, double masses[3] );
752 
753 /*
754 * Routines in MCGIDI_sampling.c
755 */
762  MCGIDI_quantitiesLookupModes &modes, MCGIDI_decaySamplingInfo *decaySamplingInfo );
763 int MCGIDI_sampling_interpolationValues( statusMessageReporting *smr, ptwXY_interpolation interpolation, double *ws, double y1, double y2, double *y );
764 double MCGIDI_sampling_ptwXY_getValueAtX( ptwXYPoints *ptwXY, double x1 );
765 
766 /*
767 * Routines in MCGIDI_misc.c
768 */
769 int MCGIDI_misc_NumberOfZSymbols( void );
770 const char *MCGIDI_misc_ZToSymbol( int iZ );
771 int MCGIDI_misc_symbolToZ( const char *Z );
772 int MCGIDI_miscNameToZAm( statusMessageReporting *smr, const char *name, int *Z, int *A, int *m, int *level );
773 xDataTOM_Int MCGIDI_misc_binarySearch( xDataTOM_Int n, double *ds, double d );
774 int MCGIDI_misc_PQUStringToDouble( statusMessageReporting *smr, char const *str, char const *unit, double conversion, double *value );
775 int MCGIDI_misc_PQUStringToDoubleInUnitOf( statusMessageReporting *smr, char const *str, char const *toUnit, double *value );
776 void MCGIDI_misc_updateTransportabilitiesMap( transportabilitiesMap *transportabilities, int PoPID, enum MCGIDI_transportability transportability );
777 void MCGIDI_misc_updateTransportabilitiesMap2( transportabilitiesMap *transportabilities, int PoPID, int transportable );
778 
779 #if defined __cplusplus
780  }
781  }
782 #endif
783 
784 #endif /* End of MCGIDI_h_included. */