Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
MCGIDI_target_heated.cc
Go to the documentation of this file.
1/*
2# <<BEGIN-copyright>>
3# <<END-copyright>>
4*/
5
6#include <map>
7#include <string.h>
8#include <cmath>
9
10#include <xDataTOM.h>
11#include "MCGIDI.h"
12#include "MCGIDI_misc.h"
13#include "MCGIDI_private.h"
14
15#if defined __cplusplus
16namespace GIDI {
17using namespace GIDI;
18#endif
19
20static int MCGIDI_target_heated_parsePOPs( statusMessageReporting *smr, MCGIDI_target_heated *target, xDataTOM_element *element,
21 xDataTOM_element *particleAliases );
22static int MCGIDI_target_heated_parseParticle( statusMessageReporting *smr, MCGIDI_target_heated *target, xDataTOM_element *element,
23 xDataTOM_element *particleAliases );
24static int MCGIDI_target_heated_parseParticleLevel( statusMessageReporting *smr, MCGIDI_target_heated *target, xDataTOM_element *element, MCGIDI_POP *parent,
25 double mass_MeV, xDataTOM_element *particleAliases );
26static int MCGIDI_target_heated_parseParticleGammas( statusMessageReporting *smr, MCGIDI_target_heated *target, xDataTOM_element *element, char const *name );
27static int MCGIDI_target_heated_parseReaction( statusMessageReporting *smr, xDataTOM_element *child, MCGIDI_target_heated *target,
28 MCGIDI_POPs *pops, MCGIDI_reaction *reaction );
29/*
30************************************************************
31*/
33
35
36 if( ( target = (MCGIDI_target_heated *) smr_malloc2( smr, sizeof( MCGIDI_target_heated ), 0, "target" ) ) == NULL ) return( NULL );
37 if( MCGIDI_target_heated_initialize( smr, target ) ) target = (MCGIDI_target_heated *) smr_freeMemory( (void **) &target );
38 return( target );
39}
40/*
41************************************************************
42*/
44
45 memset( target, 0, sizeof( MCGIDI_target_heated ) );
46 MCGIDI_POPs_initial( smr, &(target->pops), 100 );
48 return( 0 );
49}
50/*
51************************************************************
52*/
54
56
57 if( ( target = MCGIDI_target_heated_new( smr ) ) == NULL ) return( NULL );
58 if( MCGIDI_target_heated_read( smr, target, fileName ) != 0 ) target = (MCGIDI_target_heated *) smr_freeMemory( (void **) &target );
59 return( target );
60}
61/*
62************************************************************
63*/
65
66 MCGIDI_target_heated_release( smr, target );
67 smr_freeMemory( (void **) &target );
68 return( NULL );
69}
70/*
71************************************************************
72*/
74
75 int ir;
76
77 ptwXY_free( target->crossSection );
80 for( ir = 0; ir < target->numberOfReactions; ir++ ) MCGIDI_reaction_release( NULL, &(target->reactions[ir]) );
81 smr_freeMemory( (void **) &(target->reactions) );
82 MCGIDI_POPs_release( &(target->pops) );
83 smr_freeMemory( (void **) &(target->path) );
84 smr_freeMemory( (void **) &(target->absPath) );
85 xDataTOMAL_release( &(target->attributes) );
86 delete target->transportabilities;
87 return( 0 );
88}
89/*
90************************************************************
91*/
92int MCGIDI_target_heated_read( statusMessageReporting *smr, MCGIDI_target_heated *target, const char *fileName ) {
93/*
94* If a target has already been read into this target, user must have called MCGIDI_target_heated_release before calling this routine.
95* Otherwise, there will be memory leaks.
96*/
97 int n, ir;
98 xDataTOM_TOM *doc = NULL;
99 xDataTOM_element *element, *child, *particles, *particleAliases;
100 char const *name, *version, *temperatureStr;
101 char *e1;
102 MCGIDI_reaction *reaction;
103 double crossSectionInit[4] = { 0., 0., 0., 0., };
104 nfu_status status;
105 ptwXYPoints *crossSection;
106int subtag1_Notice = 0;
107
108 if( ( target->path = smr_allocateCopyString2( smr, fileName, "path" ) ) == NULL ) goto err;
109 if( ( target->absPath = xDataTOMMisc_getAbsPath( smr, fileName ) ) == NULL ) goto err;
110 if( ( doc = xDataTOM_importFile( smr, fileName ) ) == NULL ) goto err;
111 element = xDataTOM_getDocumentsElement( doc );
112 if( ( version = xDataTOM_getAttributesValueInElement( element, "version" ) ) == NULL ) {
113 smr_setReportError2( smr, smr_unknownID, 1, "version attribute missing from element '%s'", element->name );
114 goto err; }
115 else {
116 if( strcmp( version, "GND 1.3" ) != 0 ) {
117 smr_setReportError2( smr, smr_unknownID, 1, "Unsupported version '%s' for element %s", version, element->name );
118 goto err;
119 }
120 }
121 if( strcmp( element->name, "reactionSuite" ) != 0 ) {
122 smr_setReportError2( smr, smr_unknownID, 1, "input file's top element must be reactionSuite and not %s", element->name );
123 goto err; }
124 else {
125 xDataTOMAL_copyAttributionList( smr, &(target->attributes), &(element->attributes) );
126 particleAliases = xDataTOME_getOneElementByName( smr, element, "aliases", 0 );
127 if( ( particles = xDataTOME_getOneElementByName( smr, element, "particles", 1 ) ) == NULL ) goto err;
128 if( MCGIDI_target_heated_parsePOPs( smr, target, particles, particleAliases ) != 0 ) goto err;
129
130 if( ( temperatureStr = MCGIDI_misc_pointerToTOMAttributeIfAllOk3( smr, target->absPath, 1, &(target->attributes), "temperature" ) ) == NULL ) goto err;
131 target->temperature_MeV = strtod( temperatureStr, &e1 );
132 while( isspace( *e1 ) ) ++e1; // Loop checking, 11.06.2015, T. Koi
133 target->temperature_MeV *= MCGIDI_misc_getUnitConversionFactor( smr, e1, "MeV/k" );
134 if( !smr_isOk( smr ) ) goto err;
135
136 if( ( name = MCGIDI_misc_pointerToTOMAttributeIfAllOk3( smr, target->absPath, 1, &(target->attributes), "projectile" ) ) != NULL )
137 target->projectilePOP = MCGIDI_POPs_findParticle( &(target->pops), name );
138 if( !smr_isOk( smr ) ) goto err;
139
140 if( ( name = MCGIDI_misc_pointerToTOMAttributeIfAllOk3( smr, target->absPath, 1, &(target->attributes), "target" ) ) != NULL )
141 if( !smr_isOk( smr ) ) goto err;
142 target->targetPOP = MCGIDI_POPs_findParticle( &(target->pops), name );
143
144 n = xDataTOM_numberOfElementsByName( smr, element, "reaction" );
145 if( n == 0 ) {
146 smr_setReportError2( smr, smr_unknownID, 1, "target does not have any reactions: file = '%s'", fileName );
147 goto err;
148 }
149 if( ( target->reactions = (MCGIDI_reaction *) smr_malloc2( smr, n * sizeof( MCGIDI_reaction ), 1, "target->reactions" ) ) == NULL ) goto err;
150
151 for( ir = 0, child = xDataTOME_getFirstElement( element ); child != NULL; child = xDataTOME_getNextElement( child ) ) {
152 if( strcmp( child->name, "particles" ) == 0 ) continue;
153 if( strcmp( child->name, "styles" ) == 0 ) continue;
154 if( strcmp( child->name, "documentations" ) == 0 ) continue;
155 if( strcmp( child->name, "resonances" ) == 0 ) continue;
156 if( strcmp( child->name, "summedReaction" ) == 0 ) continue;
157 if( strcmp( child->name, "fissionComponent" ) == 0 ) continue;
158 if( strcmp( child->name, "reaction" ) == 0 ) {
159 double EMin, EMax;
160
161 reaction = &(target->reactions[ir]);
162 if( MCGIDI_target_heated_parseReaction( smr, child, target, &(target->pops), reaction ) ) goto err;
163 if( MCGIDI_reaction_getDomain( smr, reaction, &EMin, &EMax ) ) goto err;
164 if( ir == 0 ) { target->EMin = EMin; target->EMax = EMax; }
165 if( EMin < target->EMin ) target->EMin = EMin;
166 if( EMax > target->EMax ) target->EMax = EMax;
167 for( transportabilitiesMap::const_iterator iter = reaction->transportabilities->begin( );
168 iter != reaction->transportabilities->end( ); ++iter ) {
169 MCGIDI_misc_updateTransportabilitiesMap( target->transportabilities, iter->first, iter->second );
170 }
171 ir++; }
172 else if( strcmp( child->name, "production" ) == 0 ) {
173 continue; }
174 else if( strcmp( child->name, "aliases" ) == 0 ) {
175 continue; }
176 else if( strcmp( child->name, "partialGammaProduction" ) == 0 ) {
177 if( subtag1_Notice == 0 ) printf( "Unsupported reactionSuite sub-tag = '%s'\n", child->name );
178 subtag1_Notice++; }
179 else {
180 printf( "Unsupported reactionSuite sub-tag = '%s'\n", child->name );
181 }
182 }
183 crossSectionInit[0] = target->EMin;
184 crossSectionInit[2] = target->EMax;
185 if( ( target->crossSection = ptwXY_create( ptwXY_interpolationLinLin, NULL, 2., 1e-3, 2, 10, 2, crossSectionInit, &status, 0 ) ) == NULL ) {
186 smr_setReportError2( smr, smr_unknownID, 1, "ptwXY_create err = %d: %s\n", status, nfu_statusMessage( status ) );
187 goto err;
188 }
189 for( ir = 0; ir < target->numberOfReactions; ir++ ) {
190 reaction = &(target->reactions[ir]);
191 if( MCGIDI_reaction_fixDomains( smr, reaction, target->EMin, target->EMax, &status ) ) {
192 smr_setReportError2( smr, smr_unknownID, 1, "ptwXY_add_ptwXY err = %d: %s\n", status, nfu_statusMessage( status ) );
193 goto err;
194 }
195 if( ( crossSection = ptwXY_add_ptwXY( target->crossSection, reaction->crossSection, &status ) ) == NULL ) {
196 smr_setReportError2( smr, smr_unknownID, 1, "ptwXY_add_ptwXY err = %d: %s\n", status, nfu_statusMessage( status ) );
197 goto err;
198 }
199 target->crossSection = ptwXY_free( target->crossSection );
200 target->crossSection = crossSection;
201 }
202 }
203 xDataTOM_freeTOM( smr, &doc );
204 return( 0 );
205
206err:
207 smr_setReportError2( smr, smr_unknownID, 1, "Sub-error while reading file '%s'", fileName );
208 if( doc != NULL ) xDataTOM_freeTOM( smr, &doc );
209 MCGIDI_target_heated_release( smr, target );
210 return( 1 );
211}
212/*
213************************************************************
214*/
215static int MCGIDI_target_heated_parsePOPs( statusMessageReporting *smr, MCGIDI_target_heated *target, xDataTOM_element *element,
216 xDataTOM_element *particleAliases ) {
217
218 xDataTOM_element *child;
219
220 for( child = xDataTOME_getFirstElement( element ); child != NULL; child = xDataTOME_getNextElement( child ) ) {
221 if( strcmp( child->name, "particle" ) ) {
222 smr_setReportError2( smr, smr_unknownID, 1, "invalid element '%s' in %s", child->name, element->name );
223 goto err;
224 }
225 if( MCGIDI_target_heated_parseParticle( smr, target, child, particleAliases ) ) goto err;
226 }
227 return( 0 );
228
229err:
230 return( 1 );
231}
232/*
233************************************************************
234*/
235static int MCGIDI_target_heated_parseParticle( statusMessageReporting *smr, MCGIDI_target_heated *target, xDataTOM_element *element,
236 xDataTOM_element *particleAliases ) {
237/*
238 This routine, MCGIDI_target_heated_parseParticleLevel, MCGIDI_target_heated_parseParticleGammas handle the parsing of a
239 particle which can have one of the following three forms:
240
2411)
242 <particle name="Sc47" genre="nucleus" mass="46.9524440292728 amu"/>
2432)
244 <particle name="Sc46" genre="nucleus" mass="45.9551770270807 amu">
245 <level name="Sc46_e0" label="0" energy="0 eV"/>
246 <level name="Sc46_e1" label="1" energy="142500 eV"/></particle>
2473)
248 <particle name="S36" genre="nucleus" mass="35.9669735654569 amu">
249 <level name="S36_e0" label="0" energy="0 eV" spin="0"/>
250 <level name="S36_e1" label="1" energy="3.291e6 eV">
251 <gamma finalLevel="S36_e0" probability="1.0"/></level>
252 <level name="S36_e2" label="2" energy="3.346e6 eV">
253 <gamma finalLevel="S36_e0" probability="1.0"/></level>
254 <level name="S36_e3" label="3" energy="4191990 eV">
255 <gamma finalLevel="S36_e1" probability="1.0"/></level>
256 <level name="S36_e4" label="4" energy="4522990 eV">
257 <gamma finalLevel="S36_e1" probability="0.248"/>
258 <gamma finalLevel="S36_e0" probability="0.752"/></level>
259 <level name="S36_e5" label="5" energy="4574990 eV">
260 <gamma finalLevel="S36_e1" probability="1.0"/></level>
261 <level name="S36_c" label="c" energy="u:4999990 eV"/></particle>
262*/
263 int globalParticle = 1;
264 char const *name = NULL, *mass = NULL; /* Do not free name or mass, do not own them. */
265 double mass_MeV;
266 xDataTOM_element *child;
267 MCGIDI_POP *pop;
268
269 if( ( name = xDataTOM_getAttributesValueInElement( element, "name" ) ) == NULL ) {
270 smr_setReportError2p( smr, smr_unknownID, 1, "particle missing name attribute" );
271 goto err;
272 }
273 if( ( mass = xDataTOM_getAttributesValueInElement( element, "mass" ) ) == NULL ) {
274 smr_setReportError2( smr, smr_unknownID, 1, "particle '%s' missing mass attribute", name );
275 goto err;
276 }
277 if( MCGIDI_misc_PQUStringToDouble( smr, mass, "amu", MCGIDI_AMU2MeV, &mass_MeV ) ) goto err;
278 if( ( pop = MCGIDI_POPs_addParticleIfNeeded( smr, &(target->pops), name, mass_MeV, 0., NULL, globalParticle ) ) == NULL ) goto err;
279
280 for( child = xDataTOME_getFirstElement( element ); child != NULL; child = xDataTOME_getNextElement( child ) ) {
281 if( strcmp( child->name, "level" ) ) {
282 smr_setReportError2( smr, smr_unknownID, 1, "invalid element '%s' in %s", child->name, element->name );
283 goto err;
284 }
285 if( MCGIDI_target_heated_parseParticleLevel( smr, target, child, pop, mass_MeV, particleAliases ) ) goto err;
286 }
287
288 return( 0 );
289
290err:
291 return( 1 );
292}
293/*
294************************************************************
295*/
296static int MCGIDI_target_heated_parseParticleLevel( statusMessageReporting *smr, MCGIDI_target_heated *target, xDataTOM_element *element, MCGIDI_POP *parent,
297 double mass_MeV, xDataTOM_element *particleAliases ) {
298
299 int globalParticle = 0;
300 char const *name, *level, *aliasValue; /* Do not free any of these as they are owned by called routine. */
301 double level_MeV = 0.;
302 xDataTOM_element *alias;
303
304 if( ( name = xDataTOM_getAttributesValueInElement( element, "name" ) ) == NULL ) {
305 smr_setReportError2p( smr, smr_unknownID, 1, "particle missing name attribute" );
306 goto err;
307 }
308 if( ( level = xDataTOM_getAttributesValueInElement( element, "energy" ) ) == NULL ) {
309 smr_setReportError2( smr, smr_unknownID, 1, "particle '%s' level missing energy attribute", name );
310 goto err;
311 }
312 /* Special case for 'c' labels. Correct mass is only needed for two-body. */
313 if( level[0] != 'u' ) if( MCGIDI_misc_PQUStringToDoubleInUnitOf( smr, level, "MeV", &level_MeV ) ) goto err;
314 for( alias = xDataTOME_getFirstElement( particleAliases ); alias != NULL; alias = xDataTOME_getNextElement( alias ) ) {
315 if( ( aliasValue = xDataTOM_getAttributesValueInElement( alias, "value" ) ) == NULL ) {
316 smr_setReportError2p( smr, smr_unknownID, 1, "particle missing name attribute" );
317 goto err;
318 }
319 if( strcmp( aliasValue, name ) == 0 ) globalParticle = 1;
320 }
321 if( MCGIDI_POPs_addParticleIfNeeded( smr, &(target->pops), name, mass_MeV + level_MeV, level_MeV, parent, globalParticle ) == NULL ) goto err;
322
323 return( MCGIDI_target_heated_parseParticleGammas( smr, target, element, name ) );
324
325err:
326 return( 1 );
327}
328/*
329************************************************************
330*/
331static int MCGIDI_target_heated_parseParticleGammas( statusMessageReporting *smr, MCGIDI_target_heated *target, xDataTOM_element *element, char const *name ) {
332
333 int gammaCounts = 0;
334 MCGIDI_POP *pop = MCGIDI_POPs_findParticle( &(target->pops), name );
335 xDataTOM_element *child;
336 MCGIDI_GammaBranching *gammas = NULL;
337 char const *finalLevelString;
338 double probability;
339
340 for( child = xDataTOME_getFirstElement( element ); child != NULL; child = xDataTOME_getNextElement( child ) ) {
341 if( strcmp( child->name, "gamma" ) ) {
342 smr_setReportError2( smr, smr_unknownID, 1, "invalid element '%s' in %s", child->name, element->name );
343 goto err;
344 }
345 gammaCounts++;
346 }
347 if( gammaCounts > 0 ) {
348 if( ( gammas = (MCGIDI_GammaBranching *) smr_malloc2( smr, gammaCounts * sizeof( MCGIDI_GammaBranching), 0, "gammas" ) ) == NULL ) goto err;
349 for( child = xDataTOME_getFirstElement( element ); child != NULL; child = xDataTOME_getNextElement( child ) ) {
350 if( ( finalLevelString = xDataTOM_getAttributesValueInElement( child, "finalLevel" ) ) == NULL ) {
351 smr_setReportError2p( smr, smr_unknownID, 1, "gamma missing 'finalLevel'" );
352 goto err;
353 }
354 if( xDataTOME_convertAttributeToDouble( smr, child, "probability", &probability ) != 0 ) {
355 smr_setReportError2p( smr, smr_unknownID, 1, "gamma missing 'probability' attribute" );
356 goto err;
357 }
358 }
359 }
360 pop->numberOfGammaBranchs = gammaCounts;
361 pop->gammas = gammas;
362
363 return( 0 );
364
365err:
366 if( gammas != NULL ) smr_freeMemory( (void **) &gammas );
367 return( 1 );
368}
369/*
370************************************************************
371*/
372static int MCGIDI_target_heated_parseReaction( statusMessageReporting *smr, xDataTOM_element *element, MCGIDI_target_heated *target,
373 MCGIDI_POPs *pops, MCGIDI_reaction *reaction ) {
374
375 if( MCGIDI_reaction_parseFromTOM( smr, element, target, pops, reaction ) ) goto err;
376 target->numberOfReactions++;
377
378 return( 0 );
379
380err:
381 smr_setReportError2( smr, smr_unknownID, 1, "%s\n", xDataTOM_getAttributesValueInElement( element, "outputChannel" ) );
382 return( 1 );
383}
384/*
385************************************************************
386*/
391/*
392************************************************************
393*/
398/*
399************************************************************
400*/
402
403 if( ( index >= 0 ) && ( index < target->numberOfReactions ) ) return( &(target->reactions[index]) );
404 return( NULL );
405}
406/*
407************************************************************
408*/
410
411 MCGIDI_reaction *reaction = MCGIDI_target_heated_getReactionAtIndex( target, index );
412
413 if( reaction == NULL ) {
414 smr_setReportError2( smr, smr_unknownID, 1, "bad reaction index = %d for %s + %s", index, target->projectilePOP->name, target->targetPOP->name );
415 }
416 return( reaction );
417}
418#if 0
419/*
420************************************************************
421*/
422MCGIDI_channel *MCGIDI_target_heated_getProductionReactionAtIndex( MCGIDI_target_heated *target, int index ) {
423
424 MCGIDI_channel *channel = NULL;
425
426 if( ( index >= 0 ) && ( index < target->nProductionReactions ) ) channel = target->productionReactions[index];
427 return( channel );
428}
429#endif
430/*
431************************************************************
432*/
437/*
438************************************************************
439*/
444/*
445************************************************************
446*/
451/*
452************************************************************
453*/
458/*
459************************************************************
460*/
462 MCGIDI_quantitiesLookupModes &modes, bool sampling ) {
463
464 double xsec;
465
467 double e_in = modes.getProjectileEnergy( );
468
469 if( e_in < target->EMin ) e_in = target->EMin;
470 if( e_in > target->EMax ) e_in = target->EMax;
471 ptwXY_getValueAtX( target->crossSection, e_in, &xsec ); }
473 int index = modes.getGroupIndex( );
474 double *xSecP;
475
476 if( sampling ) {
477 xSecP = ptwX_getPointAtIndex( target->crossSectionGroupedForSampling, index ); }
478 else {
479 xSecP = ptwX_getPointAtIndex( target->crossSectionGrouped, index );
480 }
481
482 if( xSecP != NULL ) {
483 xsec = *xSecP; }
484 else {
485 xsec = 0.;
486 smr_setReportError2( smr, smr_unknownID, 1, "Invalid cross section group index %d", index, (int) ptwX_length( target->crossSectionGrouped ) );
487 } }
488 else {
489 xsec = 0.;
490 }
491 return( xsec );
492}
493/*
494************************************************************
495*/
497 MCGIDI_quantitiesLookupModes &modes, bool sampling ) {
498
499 double xsec = 0.;
500 MCGIDI_reaction *reaction = MCGIDI_target_heated_getReactionAtIndex_smr( smr, target, index );
501
502 if( reaction != NULL ) xsec = MCGIDI_reaction_getCrossSectionAtE( smr, reaction, modes, sampling );
503 return( xsec );
504}
505/*
506************************************************************
507*/
509 MCGIDI_quantitiesLookupModes &modes, MCGIDI_decaySamplingInfo *decaySamplingInfo, MCGIDI_sampledProductsDatas *productDatas ) {
510
511 MCGIDI_reaction *reaction = MCGIDI_target_heated_getReactionAtIndex_smr( smr, target, index );
512
513 productDatas->numberOfProducts = 0;
514 if( reaction == NULL ) return( -1 );
515 return( MCGIDI_outputChannel_sampleProductsAtE( smr, &(reaction->outputChannel), modes, decaySamplingInfo, productDatas, NULL ) );
516}
517/*
518************************************************************
519*/
521
522 MCGIDI_reaction *reaction = MCGIDI_target_heated_getReactionAtIndex( target, index );
523
524 if( reaction == NULL ) return( -1 );
525 return( reaction->EMin );
526}
527/*
528************************************************************
529*/
530int MCGIDI_target_heated_getReactionsDomain( statusMessageReporting * /*smr*/, MCGIDI_target_heated *target, int index, double *EMin, double *EMax ) {
531
532 MCGIDI_reaction *reaction = MCGIDI_target_heated_getReactionAtIndex( target, index );
533
534 if( reaction == NULL ) return( -1 );
535 *EMin = reaction->EMin;
536 *EMax = reaction->EMax;
537 return( 0 );
538}
539/*
540************************************************************
541*/
544
545 MCGIDI_reaction *reaction = MCGIDI_target_heated_getReactionAtIndex_smr( smr, target, index );
546
547 if( reaction == NULL ) return( 0. );
548 return( MCGIDI_reaction_getFinalQ( smr, reaction, modes ) );
549}
550/*
551************************************************************
552*/
553std::map<int, enum MCGIDI_transportability> const *MCGIDI_target_heated_getUniqueProducts( statusMessageReporting * /*smr*/, MCGIDI_target_heated *target ) {
554
555 return( target->transportabilities );
556}
557/*
558************************************************************
559*/
561
562 int ir, projectilePoPID = target->projectilePOP->globalPoPsIndex;
563 ptwXPoints *totalGroupedCrossSection = NULL;
564 GIDI_settings_particle const *projectileSettings = settings.getParticle( projectilePoPID );
565 nfu_status status_nf;
566
567 if( projectileSettings == NULL ) {
568 smr_setReportError2( smr, smr_unknownID, 1, "Settings missing for projectile %s", target->projectilePOP->name );
569 return( 1 );
570 }
573 if( projectileSettings->isEnergyMode_grouped( ) ) {
574 int64_t numberOfGroups = projectileSettings->getNumberOfGroups( );
575
576 if( ( totalGroupedCrossSection = ptwX_createLine( numberOfGroups, numberOfGroups, 0, 0, &status_nf ) ) == NULL ) {
577 smr_setReportError2( smr, smr_unknownID, 1, "totalGroupedCrossSection allocation failed: status_nf = %d, '%s'",
578 status_nf, nfu_statusMessage( status_nf ) );
579 goto err;
580 }
581 }
582
583 for( ir = 0; ir < target->numberOfReactions; ++ir ) {
584 if( MCGIDI_reaction_recast( smr, &(target->reactions[ir]), settings, projectileSettings, target->temperature_MeV, totalGroupedCrossSection ) != 0 ) goto err;
585 }
586 if( projectileSettings->isEnergyMode_grouped( ) ) {
587 if( ( target->crossSectionGroupedForSampling = ptwX_clone( totalGroupedCrossSection, &status_nf ) ) == NULL ) {
588 smr_setReportError2( smr, smr_unknownID, 1, "totalGroupedCrossSection allocation failed: status_nf = %d, '%s'",
589 status_nf, nfu_statusMessage( status_nf ) );
590 goto err;
591 }
592 for( ir = 0; ir < target->numberOfReactions; ++ir ) {
593 int index = target->reactions[ir].thresholdGroupIndex;
594
595 if( index > -1 ) {
596 double xSec = target->reactions[ir].thresholdGroupedDeltaCrossSection +
598
600 }
601 }
602 }
603 target->crossSectionGrouped = totalGroupedCrossSection;
604 totalGroupedCrossSection = NULL;
605
606 return( 0 );
607
608err:
609 ptwX_free( totalGroupedCrossSection );
611 return( 1 );
612}
613
614#if defined __cplusplus
615}
616#endif
MCGIDI_reaction * MCGIDI_target_heated_getReactionAtIndex(MCGIDI_target_heated *target, int index)
int MCGIDI_target_heated_numberOfReactions(statusMessageReporting *smr, MCGIDI_target_heated *target)
int MCGIDI_target_heated_initialize(statusMessageReporting *smr, MCGIDI_target_heated *target)
MCGIDI_reaction * MCGIDI_target_heated_getReactionAtIndex_smr(statusMessageReporting *smr, MCGIDI_target_heated *target, int index)
MCGIDI_POP * MCGIDI_POPs_addParticleIfNeeded(statusMessageReporting *smr, MCGIDI_POPs *pops, char const *name, double mass_MeV, double level_MeV, MCGIDI_POP *parent, int globalParticle)
Definition MCGIDI_pop.cc:67
double MCGIDI_target_heated_getIndexReactionFinalQ(statusMessageReporting *smr, MCGIDI_target_heated *target, int index, MCGIDI_quantitiesLookupModes &modes)
std::map< int, enum GIDI::MCGIDI_transportability > transportabilitiesMap
Definition MCGIDI.h:167
MCGIDI_POP * MCGIDI_target_heated_getPOPForProjectile(statusMessageReporting *smr, MCGIDI_target_heated *target)
int MCGIDI_target_heated_getReactionsDomain(statusMessageReporting *smr, MCGIDI_target_heated *target, int index, double *EMin, double *EMax)
MCGIDI_POP * MCGIDI_POPs_findParticle(MCGIDI_POPs *pops, char const *name)
MCGIDI_POP * MCGIDI_target_heated_getPOPForTarget(statusMessageReporting *smr, MCGIDI_target_heated *target)
int MCGIDI_misc_PQUStringToDouble(statusMessageReporting *smr, char const *str, char const *unit, double conversion, double *value)
int MCGIDI_target_heated_recast(statusMessageReporting *smr, MCGIDI_target_heated *target, GIDI_settings &settings)
double MCGIDI_target_heated_getIndexReactionCrossSectionAtE(statusMessageReporting *smr, MCGIDI_target_heated *target, int index, MCGIDI_quantitiesLookupModes &modes, bool sampling)
int MCGIDI_reaction_recast(statusMessageReporting *smr, MCGIDI_reaction *reaction, GIDI_settings &settings, GIDI_settings_particle const *projectileSettings, double temperature_MeV, ptwXPoints *totalGroupedCrossSection)
double MCGIDI_target_heated_getTotalCrossSectionAtE(statusMessageReporting *smr, MCGIDI_target_heated *target, MCGIDI_quantitiesLookupModes &modes, bool sampling)
int MCGIDI_target_heated_sampleIndexReactionProductsAtE(statusMessageReporting *smr, MCGIDI_target_heated *target, int index, MCGIDI_quantitiesLookupModes &modes, MCGIDI_decaySamplingInfo *decaySamplingInfo, MCGIDI_sampledProductsDatas *productData)
MCGIDI_target_heated * MCGIDI_target_heated_free(statusMessageReporting *smr, MCGIDI_target_heated *target)
void MCGIDI_misc_updateTransportabilitiesMap(transportabilitiesMap *transportabilities, int PoPID, enum MCGIDI_transportability transportability)
int MCGIDI_target_heated_release(statusMessageReporting *smr, MCGIDI_target_heated *target)
double MCGIDI_target_heated_getReactionsThreshold(statusMessageReporting *smr, MCGIDI_target_heated *target, int index)
@ MCGIDI_quantityLookupMode_pointwise
Definition MCGIDI.h:74
@ MCGIDI_quantityLookupMode_grouped
Definition MCGIDI.h:75
int MCGIDI_POPs_initial(statusMessageReporting *smr, MCGIDI_POPs *pops, int size)
Definition MCGIDI_pop.cc:30
int MCGIDI_reaction_fixDomains(statusMessageReporting *smr, MCGIDI_reaction *reaction, double EMin, double EMax, nfu_status *status)
#define MCGIDI_AMU2MeV
Definition MCGIDI.h:180
int MCGIDI_misc_PQUStringToDoubleInUnitOf(statusMessageReporting *smr, char const *str, char const *toUnit, double *value)
double MCGIDI_target_heated_getTargetMass_MeV(statusMessageReporting *smr, MCGIDI_target_heated *target)
int MCGIDI_reaction_getDomain(statusMessageReporting *smr, MCGIDI_reaction *reaction, double *EMin, double *EMax)
int MCGIDI_reaction_parseFromTOM(statusMessageReporting *smr, xDataTOM_element *element, MCGIDI_target_heated *target, MCGIDI_POPs *pops, MCGIDI_reaction *reaction)
int MCGIDI_target_heated_numberOfProductionReactions(statusMessageReporting *smr, MCGIDI_target_heated *target)
int MCGIDI_outputChannel_sampleProductsAtE(statusMessageReporting *smr, MCGIDI_outputChannel *outputChannel, MCGIDI_quantitiesLookupModes &modes, MCGIDI_decaySamplingInfo *decaySamplingInfo, MCGIDI_sampledProductsDatas *productDatas, double *masses)
transportabilitiesMap const * MCGIDI_target_heated_getUniqueProducts(statusMessageReporting *smr, MCGIDI_target_heated *target)
double MCGIDI_reaction_getFinalQ(statusMessageReporting *smr, MCGIDI_reaction *reaction, MCGIDI_quantitiesLookupModes &modes)
int MCGIDI_POPs_release(MCGIDI_POPs *pops)
Definition MCGIDI_pop.cc:51
double MCGIDI_POP_getMass_MeV(MCGIDI_POP *pop)
double MCGIDI_reaction_getCrossSectionAtE(statusMessageReporting *smr, MCGIDI_reaction *reaction, MCGIDI_quantitiesLookupModes &modes, bool sampling)
MCGIDI_target_heated * MCGIDI_target_heated_new(statusMessageReporting *smr)
double MCGIDI_target_heated_getProjectileMass_MeV(statusMessageReporting *smr, MCGIDI_target_heated *target)
MCGIDI_target_heated * MCGIDI_target_heated_newRead(statusMessageReporting *smr, const char *fileName)
int MCGIDI_reaction_release(statusMessageReporting *smr, MCGIDI_reaction *reaction)
int MCGIDI_target_heated_read(statusMessageReporting *smr, MCGIDI_target_heated *target, const char *fileName)
#define MCGIDI_misc_pointerToTOMAttributeIfAllOk3(smr, path, required, attributes, name)
Definition MCGIDI_misc.h:28
double MCGIDI_misc_getUnitConversionFactor(statusMessageReporting *smr, char const *fromUnit, char const *toUnit)
bool isEnergyMode_grouped(void) const
int getNumberOfGroups(void) const
GIDI_settings_particle const * getParticle(int PoPId) const
int getGroupIndex(void) const
Definition MCGIDI.h:96
enum MCGIDI_quantityLookupMode getCrossSectionMode(void) const
Definition MCGIDI.h:103
double getProjectileEnergy(void) const
Definition MCGIDI.h:93
const char * name(G4int ptype)
enum nfu_status_e nfu_status
const char * nfu_statusMessage(nfu_status status)
nfu_status ptwXY_getValueAtX(ptwXYPoints *ptwXY, double x, double *y)
@ ptwXY_interpolationLinLin
Definition ptwXY.h:35
ptwXYPoints * ptwXY_create(ptwXY_interpolation interpolation, ptwXY_interpolationOtherInfo const *interpolationOtherInfo, double biSectionMax, double accuracy, int64_t primarySize, int64_t secondarySize, int64_t length, double const *xy, nfu_status *status, int userFlag)
ptwXYPoints * ptwXY_free(ptwXYPoints *ptwXY)
ptwXYPoints * ptwXY_add_ptwXY(ptwXYPoints *ptwXY1, ptwXYPoints *ptwXY2, nfu_status *status)
double * ptwX_getPointAtIndex(ptwXPoints *ptwX, int64_t index)
Definition ptwX_core.cc:206
ptwXPoints * ptwX_createLine(int64_t size, int64_t length, double slope, double offset, nfu_status *status)
Definition ptwX_core.cc:62
double ptwX_getPointAtIndex_Unsafely(ptwXPoints *ptwX, int64_t index)
Definition ptwX_core.cc:215
ptwXPoints * ptwX_clone(ptwXPoints *ptwX, nfu_status *status)
Definition ptwX_core.cc:88
nfu_status ptwX_setPointAtIndex(ptwXPoints *ptwX, int64_t index, double x)
Definition ptwX_core.cc:222
ptwXPoints * ptwX_free(ptwXPoints *ptwX)
Definition ptwX_core.cc:158
int64_t ptwX_length(ptwXPoints *ptwX)
Definition ptwX_core.cc:166
#define smr_setReportError2(smr, libraryID, code, fmt,...)
#define smr_setReportError2p(smr, libraryID, code, fmt)
#define smr_allocateCopyString2(smr, s, forItem)
void * smr_freeMemory(void **p)
int smr_isOk(statusMessageReporting *smr)
#define smr_malloc2(smr, size, zero, forItem)
#define smr_unknownID
char * name
Definition MCGIDI.h:228
MCGIDI_GammaBranching * gammas
Definition MCGIDI.h:234
int globalPoPsIndex
Definition MCGIDI.h:229
int numberOfGammaBranchs
Definition MCGIDI.h:233
transportabilitiesMap * transportabilities
Definition MCGIDI.h:426
int thresholdGroupIndex
Definition MCGIDI.h:418
double thresholdGroupedDeltaCrossSection
Definition MCGIDI.h:420
MCGIDI_outputChannel outputChannel
Definition MCGIDI.h:424
ptwXYPoints * crossSection
Definition MCGIDI.h:422
MCGIDI_POP * projectilePOP
Definition MCGIDI.h:434
MCGIDI_POPs pops
Definition MCGIDI.h:433
ptwXYPoints * crossSection
Definition MCGIDI.h:440
xDataTOM_attributionList attributes
Definition MCGIDI.h:436
ptwXPoints * crossSectionGrouped
Definition MCGIDI.h:441
ptwXPoints * crossSectionGroupedForSampling
Definition MCGIDI.h:442
MCGIDI_reaction * reactions
Definition MCGIDI.h:444
transportabilitiesMap * transportabilities
Definition MCGIDI.h:445
MCGIDI_POP * targetPOP
Definition MCGIDI.h:435
xDataTOM_attributionList attributes
Definition xDataTOM.h:184
int xDataTOM_numberOfElementsByName(statusMessageReporting *smr, xDataTOM_element *element, char const *name)
Definition xDataTOM.cc:268
xDataTOM_element * xDataTOME_getOneElementByName(statusMessageReporting *smr, xDataTOM_element *element, char const *name, int required)
Definition xDataTOM.cc:246
xDataTOM_TOM * xDataTOM_importFile(statusMessageReporting *smr, const char *fileName)
Definition xDataTOM.cc:44
void * xDataTOM_freeTOM(statusMessageReporting *smr, xDataTOM_TOM **TOM)
Definition xDataTOM.cc:78
xDataTOM_element * xDataTOME_getNextElement(xDataTOM_element *element)
Definition xDataTOM.cc:238
char const * xDataTOM_getAttributesValueInElement(xDataTOM_element *element, char const *name)
Definition xDataTOM.cc:286
xDataTOM_element * xDataTOM_getDocumentsElement(xDataTOM_TOM *TOM)
Definition xDataTOM.cc:223
xDataTOM_element * xDataTOME_getFirstElement(xDataTOM_element *element)
Definition xDataTOM.cc:230
int xDataTOME_convertAttributeToDouble(statusMessageReporting *smr, xDataTOM_element *element, char const *name, double *d)
Definition xDataTOM.cc:307
int xDataTOMAL_copyAttributionList(statusMessageReporting *smr, xDataTOM_attributionList *desc, xDataTOM_attributionList *src)
Definition xDataTOM.cc:415
void xDataTOMAL_release(xDataTOM_attributionList *attributes)
Definition xDataTOM.cc:361
char * xDataTOMMisc_getAbsPath(statusMessageReporting *smr, const char *fileName)