Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/hadronic/models/lend/src/MCGIDI_outputChannel.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/hadronic/models/lend/src/MCGIDI_outputChannel.cc (Version 11.3.0) and /processes/hadronic/models/lend/src/MCGIDI_outputChannel.cc (Version 10.3.p1)


  1 /*                                                  1 /*
  2 # <<BEGIN-copyright>>                               2 # <<BEGIN-copyright>>
  3 # <<END-copyright>>                                 3 # <<END-copyright>>
  4 */                                                  4 */
  5 #include <string.h>                                 5 #include <string.h>
  6 #define _USE_MATH_DEFINES                      << 
  7 #include <cmath>                                    6 #include <cmath>
  8                                                     7 
  9 #include "MCGIDI.h"                                 8 #include "MCGIDI.h"
 10 #include "MCGIDI_misc.h"                            9 #include "MCGIDI_misc.h"
 11                                                    10 
 12 #if defined __cplusplus                            11 #if defined __cplusplus
 13 #include "G4Log.hh"                                12 #include "G4Log.hh"
 14 namespace GIDI {                                   13 namespace GIDI {
 15 using namespace GIDI;                              14 using namespace GIDI;
 16 #endif                                             15 #endif
 17                                                    16 
 18 /*                                                 17 /*
 19 **********************************************     18 ************************************************************
 20 */                                                 19 */
 21 MCGIDI_outputChannel *MCGIDI_outputChannel_new     20 MCGIDI_outputChannel *MCGIDI_outputChannel_new( statusMessageReporting *smr ) {
 22                                                    21 
 23     MCGIDI_outputChannel *outputChannel;           22     MCGIDI_outputChannel *outputChannel;
 24                                                    23 
 25     if( ( outputChannel = (MCGIDI_outputChanne     24     if( ( outputChannel = (MCGIDI_outputChannel *) smr_malloc2( smr, sizeof( MCGIDI_outputChannel ), 0, "outputChannel" ) ) == NULL ) return( NULL );
 26     if( MCGIDI_outputChannel_initialize( smr,      25     if( MCGIDI_outputChannel_initialize( smr, outputChannel ) ) outputChannel = MCGIDI_outputChannel_free( smr, outputChannel );
 27     return( outputChannel );                       26     return( outputChannel );
 28 }                                                  27 }
 29 /*                                                 28 /*
 30 **********************************************     29 ************************************************************
 31 */                                                 30 */
 32 int MCGIDI_outputChannel_initialize( statusMes     31 int MCGIDI_outputChannel_initialize( statusMessageReporting * /*smr*/, MCGIDI_outputChannel *outputChannel ) {
 33                                                    32 
 34     memset( outputChannel, 0, sizeof( MCGIDI_o     33     memset( outputChannel, 0, sizeof( MCGIDI_outputChannel ) );
 35     return( 0 );                                   34     return( 0 );
 36 }                                                  35 }
 37 /*                                                 36 /*
 38 **********************************************     37 ************************************************************
 39 */                                                 38 */
 40 MCGIDI_outputChannel *MCGIDI_outputChannel_fre     39 MCGIDI_outputChannel *MCGIDI_outputChannel_free( statusMessageReporting *smr, MCGIDI_outputChannel *outputChannel ) {
 41                                                    40 
 42     MCGIDI_outputChannel_release( smr, outputC     41     MCGIDI_outputChannel_release( smr, outputChannel );
 43     smr_freeMemory( (void **) &outputChannel )     42     smr_freeMemory( (void **) &outputChannel );
 44     return( NULL );                                43     return( NULL );
 45 }                                                  44 }
 46 /*                                                 45 /*
 47 **********************************************     46 ************************************************************
 48 */                                                 47 */
 49 int MCGIDI_outputChannel_release( statusMessag     48 int MCGIDI_outputChannel_release( statusMessageReporting *smr, MCGIDI_outputChannel *outputChannel ) {
 50                                                    49 
 51     int i;                                         50     int i;
 52                                                    51 
 53     for( i = 0; i < outputChannel->numberOfPro     52     for( i = 0; i < outputChannel->numberOfProducts; i++ ) MCGIDI_product_release( smr, &(outputChannel->products[i]) );
 54     smr_freeMemory( (void **) &(outputChannel-     53     smr_freeMemory( (void **) &(outputChannel->products) );
 55     MCGIDI_outputChannel_initialize( smr, outp     54     MCGIDI_outputChannel_initialize( smr, outputChannel );
 56                                                    55 
 57     return( 0 );                                   56     return( 0 );
 58 }                                                  57 }
 59 /*                                                 58 /*
 60 **********************************************     59 ************************************************************
 61 */                                                 60 */
 62 int MCGIDI_outputChannel_parseFromTOM( statusM     61 int MCGIDI_outputChannel_parseFromTOM( statusMessageReporting *smr, xDataTOM_element *element, MCGIDI_POPs *pops, MCGIDI_outputChannel *outputChannel,
 63         MCGIDI_reaction *reaction, MCGIDI_prod     62         MCGIDI_reaction *reaction, MCGIDI_product *parent ) {
 64                                                    63 
 65     int n{0}, delayedNeutronIndex{0};          <<  64     int n, delayedNeutronIndex = 0;
 66     char const *genre{""}, *Q{""};             <<  65     char const *genre, *Q;
 67     xDataTOM_element *child{nullptr};          <<  66     xDataTOM_element *child;
 68                                                    67 
 69     MCGIDI_outputChannel_initialize( smr, outp     68     MCGIDI_outputChannel_initialize( smr, outputChannel );
 70                                                    69 
 71     outputChannel->reaction = reaction;            70     outputChannel->reaction = reaction;
 72     outputChannel->parent = parent;                71     outputChannel->parent = parent;
 73     if( ( genre = xDataTOM_getAttributesValueI     72     if( ( genre = xDataTOM_getAttributesValueInElement( element, "genre" ) ) == NULL ) goto err;
 74     if( ( parent != NULL ) && ( strcmp( genre,     73     if( ( parent != NULL ) && ( strcmp( genre, "NBody" ) ) ) {
 75         smr_setReportError2( smr, smr_unknownI     74         smr_setReportError2( smr, smr_unknownID, 1, "decay channel's genre can only be 'uncorreclated' (a.k.a. 'NBody') and not '%s'", genre );
 76         goto err;                                  75         goto err;
 77     }                                              76     }
 78     if( strcmp( genre, "twoBody" ) == 0 ) {        77     if( strcmp( genre, "twoBody" ) == 0 ) {
 79         outputChannel->genre = MCGIDI_channelG     78         outputChannel->genre = MCGIDI_channelGenre_twoBody_e; }
 80     else if( strcmp( genre, "NBody" ) == 0 ) {     79     else if( strcmp( genre, "NBody" ) == 0 ) {
 81         outputChannel->genre = MCGIDI_channelG     80         outputChannel->genre = MCGIDI_channelGenre_uncorrelated_e; }
 82     else if( strcmp( genre, "sumOfRemainingOut     81     else if( strcmp( genre, "sumOfRemainingOutputChannels" ) == 0 ) {
 83         outputChannel->genre = MCGIDI_channelG     82         outputChannel->genre = MCGIDI_channelGenre_sumOfRemaining_e; }
 84     else {                                         83     else {
 85         smr_setReportError2( smr, smr_unknownI     84         smr_setReportError2( smr, smr_unknownID, 1, "unsupported genre = '%s'", genre );
 86         goto err;                                  85         goto err;
 87     }                                              86     }
 88     if( ( Q = xDataTOM_getAttributesValueInEle     87     if( ( Q = xDataTOM_getAttributesValueInElement( element, "Q" ) ) == NULL ) goto err;
 89     outputChannel->QIsFloat = !MCGIDI_misc_PQU     88     outputChannel->QIsFloat = !MCGIDI_misc_PQUStringToDoubleInUnitOf( smr, Q, "MeV", &(outputChannel->Q) );
 90                                                    89 
 91     if( ( n = xDataTOM_numberOfElementsByName(     90     if( ( n = xDataTOM_numberOfElementsByName( smr, element, "product" ) ) == 0 ) {
 92         smr_setReportError2p( smr, smr_unknown     91         smr_setReportError2p( smr, smr_unknownID, 1, "outputChannel does not have any products" );
 93         goto err;                                  92         goto err;
 94     }                                              93     }
 95     if( ( outputChannel->products = (MCGIDI_pr     94     if( ( outputChannel->products = (MCGIDI_product *) smr_malloc2( smr, n * sizeof( MCGIDI_product ), 0, "outputChannel->products" ) ) == NULL ) goto err;
 96                                                    95 
 97     for( child = xDataTOME_getFirstElement( el     96     for( child = xDataTOME_getFirstElement( element ); child != NULL; child = xDataTOME_getNextElement( child ) ) {
 98         if( strcmp( child->name, "product" ) =     97         if( strcmp( child->name, "product" ) == 0 ) {
 99             if( MCGIDI_product_parseFromTOM( s     98             if( MCGIDI_product_parseFromTOM( smr, child, outputChannel, pops, &(outputChannel->products[outputChannel->numberOfProducts]),
100                 &delayedNeutronIndex ) ) goto      99                 &delayedNeutronIndex ) ) goto err;
101             outputChannel->numberOfProducts++;    100             outputChannel->numberOfProducts++; }
102         else if( strcmp( child->name, "fission    101         else if( strcmp( child->name, "fissionEnergyReleased" ) == 0 ) {     /* ????????? Need to support. */
103             continue; }                           102             continue; }
104         else {                                    103         else {
105             printf( "outputChannel child not c    104             printf( "outputChannel child not currently supported = %s\n", child->name );
106         }                                         105         }
107     }                                             106     }
108     if( outputChannel->genre == MCGIDI_channel    107     if( outputChannel->genre == MCGIDI_channelGenre_twoBody_e ) {
109         double projectileMass_MeV, targetMass_    108         double projectileMass_MeV, targetMass_MeV, productMass_MeV, residualMass_MeV;
110                                                   109 
111         projectileMass_MeV = MCGIDI_reaction_g    110         projectileMass_MeV = MCGIDI_reaction_getProjectileMass_MeV( smr, reaction );
112         targetMass_MeV = MCGIDI_reaction_getTa    111         targetMass_MeV = MCGIDI_reaction_getTargetMass_MeV( smr, reaction );
113         productMass_MeV = MCGIDI_product_getMa    112         productMass_MeV = MCGIDI_product_getMass_MeV( smr, &(outputChannel->products[0]) );
114         residualMass_MeV = MCGIDI_product_getM    113         residualMass_MeV = MCGIDI_product_getMass_MeV( smr, &(outputChannel->products[1]) );
115                                                << 
116         //TK 17-11-10 for v1.3                 << 
117         //A temporary fix for emission of gamm << 
118         //                  capture            << 
119         if ( reaction->ENDF_MT == 102 && produ << 
120            //include/PoPs_data.h:#define e_Mas << 
121            residualMass_MeV += 5.4857990943e-4 << 
122         }                                      << 
123                                                << 
124         MCGIDI_product_setTwoBodyMasses( smr,     114         MCGIDI_product_setTwoBodyMasses( smr, &(outputChannel->products[0]), projectileMass_MeV, targetMass_MeV, productMass_MeV, residualMass_MeV );
125     }                                             115     }
126                                                   116 
127     return( 0 );                                  117     return( 0 );
128                                                   118 
129 err:                                              119 err:
130     MCGIDI_outputChannel_release( smr, outputC    120     MCGIDI_outputChannel_release( smr, outputChannel );
131     return( 1 );                                  121     return( 1 );
132 }                                                 122 }
133 /*                                                123 /*
134 **********************************************    124 ************************************************************
135 */                                                125 */
136 int MCGIDI_outputChannel_numberOfProducts( MCG    126 int MCGIDI_outputChannel_numberOfProducts( MCGIDI_outputChannel *outputChannel ) {
137                                                   127 
138     return( outputChannel->numberOfProducts );    128     return( outputChannel->numberOfProducts );
139 }                                                 129 }
140 /*                                                130 /*
141 **********************************************    131 ************************************************************
142 */                                                132 */
143 MCGIDI_product *MCGIDI_outputChannel_getProduc    133 MCGIDI_product *MCGIDI_outputChannel_getProductAtIndex( statusMessageReporting *smr, MCGIDI_outputChannel *outputChannel, int i ) {
144                                                   134 
145     if( ( i < 0 ) || ( i >= outputChannel->num    135     if( ( i < 0 ) || ( i >= outputChannel->numberOfProducts ) ) {
146         smr_setReportError2( smr, smr_unknownI    136         smr_setReportError2( smr, smr_unknownID, 1, "bad product index = %d: outputChannel as only %d products", i, outputChannel->numberOfProducts );
147         return( NULL );                           137         return( NULL );
148     }                                             138     }
149     return( &(outputChannel->products[i]) );      139     return( &(outputChannel->products[i]) );
150 }                                                 140 }
151 /*                                                141 /*
152 **********************************************    142 ************************************************************
153 */                                                143 */
154 int MCGIDI_outputChannel_getDomain( statusMess    144 int MCGIDI_outputChannel_getDomain( statusMessageReporting *smr, MCGIDI_outputChannel *outputChannel, double *EMin, double *EMax ) {
155                                                   145 
156     if( outputChannel->reaction != NULL ) retu    146     if( outputChannel->reaction != NULL ) return( MCGIDI_reaction_getDomain( smr, outputChannel->reaction, EMin, EMax ) );
157     return( MCGIDI_product_getDomain( smr, out    147     return( MCGIDI_product_getDomain( smr, outputChannel->parent, EMin, EMax ) );
158 }                                                 148 }
159 /*                                                149 /*
160 **********************************************    150 ************************************************************
161 */                                                151 */
162 MCGIDI_target_heated *MCGIDI_outputChannel_get    152 MCGIDI_target_heated *MCGIDI_outputChannel_getTargetHeated( statusMessageReporting *smr, MCGIDI_outputChannel *outputChannel ) {
163                                                   153 
164     if( outputChannel->reaction != NULL ) retu    154     if( outputChannel->reaction != NULL ) return( MCGIDI_reaction_getTargetHeated( smr, outputChannel->reaction ) );
165     return( MCGIDI_product_getTargetHeated( sm    155     return( MCGIDI_product_getTargetHeated( smr, outputChannel->parent ) );
166 }                                                 156 }
167 /*                                                157 /*
168 **********************************************    158 ************************************************************
169 */                                                159 */
170 double MCGIDI_outputChannel_getProjectileMass_    160 double MCGIDI_outputChannel_getProjectileMass_MeV( statusMessageReporting *smr, MCGIDI_outputChannel *outputChannel ) {
171                                                   161 
172     if( outputChannel->reaction != NULL ) retu    162     if( outputChannel->reaction != NULL ) return( MCGIDI_reaction_getProjectileMass_MeV( smr, outputChannel->reaction ) );
173     return( MCGIDI_product_getProjectileMass_M    163     return( MCGIDI_product_getProjectileMass_MeV( smr, outputChannel->parent ) );
174 }                                                 164 }
175 /*                                                165 /*
176 **********************************************    166 ************************************************************
177 */                                                167 */
178 double MCGIDI_outputChannel_getTargetMass_MeV(    168 double MCGIDI_outputChannel_getTargetMass_MeV( statusMessageReporting *smr, MCGIDI_outputChannel *outputChannel ) {
179                                                   169 
180     if( outputChannel->reaction != NULL ) retu    170     if( outputChannel->reaction != NULL ) return( MCGIDI_reaction_getTargetMass_MeV( smr, outputChannel->reaction ) );
181     return( MCGIDI_product_getTargetMass_MeV(     171     return( MCGIDI_product_getTargetMass_MeV( smr, outputChannel->parent ) );
182 }                                                 172 }
183 /*                                                173 /*
184 **********************************************    174 ************************************************************
185 */                                                175 */
186 double MCGIDI_outputChannel_getQ_MeV( statusMe    176 double MCGIDI_outputChannel_getQ_MeV( statusMessageReporting * /*smr*/, MCGIDI_outputChannel *outputChannel, double /*e_in*/ ) {
187                                                   177 
188     return( outputChannel->Q );                   178     return( outputChannel->Q );
189 }                                                 179 }
190 /*                                                180 /*
191 **********************************************    181 ************************************************************
192 */                                                182 */
193 double MCGIDI_outputChannel_getFinalQ( statusM    183 double MCGIDI_outputChannel_getFinalQ( statusMessageReporting *smr, MCGIDI_outputChannel *outputChannel, double e_in ) {
194                                                   184 
195     int iProduct;                                 185     int iProduct;
196     double Q = outputChannel->Q;                  186     double Q = outputChannel->Q;
197     MCGIDI_product *product;                      187     MCGIDI_product *product;
198                                                   188 
199     for( iProduct = 0; iProduct < outputChanne    189     for( iProduct = 0; iProduct < outputChannel->numberOfProducts; iProduct++ ) {
200         product = &(outputChannel->products[iP    190         product = &(outputChannel->products[iProduct]);
201         if( product->decayChannel.genre != MCG    191         if( product->decayChannel.genre != MCGIDI_channelGenre_undefined_e ) Q += MCGIDI_outputChannel_getFinalQ( smr, &(product->decayChannel), e_in );
202         if( !smr_isOk( smr ) ) break;             192         if( !smr_isOk( smr ) ) break;
203     }                                             193     }
204     return( Q );                                  194     return( Q );
205 }                                                 195 }
206 /*                                                196 /*
207 **********************************************    197 ************************************************************
208 */                                                198 */
209 int MCGIDI_outputChannel_sampleProductsAtE(sta << 199 int MCGIDI_outputChannel_sampleProductsAtE( statusMessageReporting *smr, MCGIDI_outputChannel *outputChannel, MCGIDI_quantitiesLookupModes &modes,
210                                            MCG << 200         MCGIDI_decaySamplingInfo *decaySamplingInfo, MCGIDI_sampledProductsDatas *productDatas, double *masses_ ) {
211                                            MCG << 
212                                            MCG << 
213                                            MCG << 
214                                            dou << 
215 {                                              << 
216   int i1;                                      << 
217   int multiplicity(0);                         << 
218   int secondTwoBody = 0, isDecayChannel = ( ou << 
219   double e_in = modes.getProjectileEnergy( );  << 
220   MCGIDI_product *product;                     << 
221   double phi, p, masses[3];                    << 
222   MCGIDI_distribution *distribution;           << 
223   MCGIDI_sampledProductsData productData[2];   << 
224                                                << 
225   if (isDecayChannel) {                        << 
226     masses[0] = masses_[0];              /* Mo << 
227     masses[1] = masses_[1];                    << 
228   } else {                                     << 
229     masses[0] = MCGIDI_reaction_getProjectileM << 
230     masses[1] = MCGIDI_reaction_getTargetMass_ << 
231   }                                            << 
232                                                << 
233   // Loop over all possible final state partic << 
234   // List of these particles (products) was re << 
235   // Note: all particles satifying the samplin << 
236   // final state, regardless of charge, energy << 
237                                                << 
238   for (i1 = 0; i1 < outputChannel->numberOfPro << 
239     product = &(outputChannel->products[i1]);  << 
240     if (product->decayChannel.genre != MCGIDI_ << 
241       if( MCGIDI_outputChannel_sampleProductsA << 
242                                                << 
243                                                << 
244     } else {                                   << 
245       distribution = &(product->distribution); << 
246       if( distribution->type == MCGIDI_distrib << 
247                                                << 
248       if (!secondTwoBody) {                    << 
249         // Sample multiplicity of final state  << 
250         // The multiplicity stored in GIDI is  << 
251         // compared to a random number to deci << 
252         if ((multiplicity = product->multiplic << 
253                                MCGIDI_product_ << 
254                                   decaySamplin << 
255         while (multiplicity > 0) {             << 
256                                                << 
257           multiplicity--;                      << 
258           decaySamplingInfo->pop = product->po << 
259           decaySamplingInfo->mu = 0;           << 
260           decaySamplingInfo->Ep = 0;           << 
261           productData[0].isVelocity = decaySam << 
262           productData[0].pop = product->pop;   << 
263           productData[0].delayedNeutronIndex = << 
264           productData[0].delayedNeutronRate =  << 
265           productData[0].birthTimeSec = 0;     << 
266           if (product->delayedNeutronRate > 0) << 
267             productData[0].birthTimeSec =      << 
268                  -G4Log( decaySamplingInfo->rn << 
269           }                                    << 
270                                                << 
271           switch( outputChannel->genre ) {     << 
272                                                << 
273           case MCGIDI_channelGenre_twoBody_e : << 
274             secondTwoBody = 1;                 << 
275             MCGIDI_angular_sampleMu( smr, dist << 
276             if (smr_isOk(smr) ) {              << 
277               phi = 2. * M_PI * decaySamplingI << 
278               MCGIDI_kinetics_2BodyReaction( s << 
279               if (!smr_isOk(smr) ) return( -1  << 
280               productData[1].pop = product[1]. << 
281               productData[1].delayedNeutronInd << 
282               productData[1].delayedNeutronRat << 
283               productData[1].birthTimeSec = 0; << 
284               MCGIDI_sampledProducts_addProduc << 
285               if( !smr_isOk( smr ) ) return( - << 
286               MCGIDI_sampledProducts_addProduc << 
287               if( !smr_isOk( smr ) ) return( - << 
288             }                                  << 
289             break;                             << 
290                                                   201 
291           case MCGIDI_channelGenre_uncorrelate << 202     int i1, multiplicity, secondTwoBody = 0, isDecayChannel = ( outputChannel->reaction == NULL );
292                                                << 203     double e_in = modes.getProjectileEnergy( );
293           case MCGIDI_channelGenre_sumOfRemain << 204     MCGIDI_product *product;
294             // Get mass of final state particl << 205     double phi, p, masses[3];
295             // masses[0] and masses[1] are inc << 206     MCGIDI_distribution *distribution;
296             masses[2] = MCGIDI_product_getMass << 207     MCGIDI_sampledProductsData productData[2];
297             switch( distribution->type ) {     << 208 
298             case MCGIDI_distributionType_uncor << 209     if( isDecayChannel ) {
299               MCGIDI_uncorrelated_sampleDistri << 210         masses[0] = masses_[0];              /* More work may be needed here. */
300               break;                           << 211         masses[1] = masses_[1]; }
301             case MCGIDI_distributionType_energ << 212     else {
302               MCGIDI_energyAngular_sampleDistr << 213         masses[0] = MCGIDI_reaction_getProjectileMass_MeV( smr, outputChannel->reaction );
303               break;                           << 214         masses[1] = MCGIDI_reaction_getTargetMass_MeV( smr, outputChannel->reaction );
304             case MCGIDI_distributionType_Kalba << 215     }
305               MCGIDI_KalbachMann_sampleEp( smr << 
306               break;                           << 
307             case MCGIDI_distributionType_angul << 
308               MCGIDI_angularEnergy_sampleDistr << 
309               break;                           << 
310             default :                          << 
311               printf( "Unknown spectral data f << 
312               break;                           << 
313             }                                  << 
314             break;                             << 
315                                                   216 
316           case MCGIDI_channelGenre_undefined_e << 217     for( i1 = 0; i1 < outputChannel->numberOfProducts; i1++ ) {
317             printf( "Channel is undefined\n" ) << 218         product = &(outputChannel->products[i1]);
318             break;                             << 219         if( product->decayChannel.genre != MCGIDI_channelGenre_undefined_e ) {
319                                                << 220             if( MCGIDI_outputChannel_sampleProductsAtE( smr, &(product->decayChannel), modes, decaySamplingInfo, productDatas, masses ) < 0 ) return( -1 ); }
320           case MCGIDI_channelGenre_twoBodyDeca << 221         else {
321             printf( "Channel is twoBodyDecay\n << 222             distribution = &(product->distribution);
322             break;                             << 223             if( distribution->type == MCGIDI_distributionType_none_e ) continue;
323                                                << 224             if( !secondTwoBody ) {
324           case MCGIDI_channelGenre_uncorrelate << 225                 if( ( multiplicity = product->multiplicity ) == 0 ) multiplicity = MCGIDI_product_sampleMultiplicity( smr, product, e_in,
325             printf( "Channel is uncorrelatedDe << 226                     decaySamplingInfo->rng( decaySamplingInfo->rngState ) );
326             break;                             << 227                 while( multiplicity > 0 ) { 
327                                                << 228 
328           default :                            << 229                     multiplicity--;
329             printf( "Unsupported channel genre << 230                     decaySamplingInfo->pop = product->pop;
330             break;                             << 231                     decaySamplingInfo->mu = 0;
331           }                                    << 232                     decaySamplingInfo->Ep = 0;
332                                                << 233                     productData[0].isVelocity = decaySamplingInfo->isVelocity;
333           if (!smr_isOk(smr) ) return( -1 );   << 234                     productData[0].pop = product->pop;
334           if (!secondTwoBody) {                << 235                     productData[0].delayedNeutronIndex = product->delayedNeutronIndex;
335             if (decaySamplingInfo->frame == xD << 236                     productData[0].delayedNeutronRate = product->delayedNeutronRate;
336               if (MCGIDI_kinetics_COM2Lab( smr << 237                     productData[0].birthTimeSec = 0;
                                                   >> 238                     if( product->delayedNeutronRate > 0 ) {
                                                   >> 239                         productData[0].birthTimeSec = -G4Log( decaySamplingInfo->rng( decaySamplingInfo->rngState ) ) / product->delayedNeutronRate;
                                                   >> 240                     }
                                                   >> 241 
                                                   >> 242                     switch( outputChannel->genre ) {
                                                   >> 243                     case MCGIDI_channelGenre_twoBody_e :
                                                   >> 244                         secondTwoBody = 1;
                                                   >> 245                         MCGIDI_angular_sampleMu( smr, distribution->angular, modes, decaySamplingInfo );
                                                   >> 246                         if( smr_isOk( smr ) ) {
                                                   >> 247                             phi = 2. * M_PI * decaySamplingInfo->rng( decaySamplingInfo->rngState );
                                                   >> 248                             MCGIDI_kinetics_2BodyReaction( smr, distribution->angular, e_in, decaySamplingInfo->mu, phi, productData );
                                                   >> 249                             if( !smr_isOk( smr ) ) return( -1 );
                                                   >> 250                             productData[1].pop = product[1].pop;
                                                   >> 251                             productData[1].delayedNeutronIndex = product[1].delayedNeutronIndex;
                                                   >> 252                             productData[1].delayedNeutronRate = product->delayedNeutronRate;
                                                   >> 253                             productData[1].birthTimeSec = 0;
                                                   >> 254                             MCGIDI_sampledProducts_addProduct( smr, productDatas, productData );
                                                   >> 255                             if( !smr_isOk( smr ) ) return( -1 );
                                                   >> 256                             MCGIDI_sampledProducts_addProduct( smr, productDatas, &(productData[1]) );
                                                   >> 257                             if( !smr_isOk( smr ) ) return( -1 );
                                                   >> 258                         }
                                                   >> 259                         break;
                                                   >> 260                     case MCGIDI_channelGenre_uncorrelated_e :
                                                   >> 261                     case MCGIDI_channelGenre_sumOfRemaining_e :
                                                   >> 262                         masses[2] = MCGIDI_product_getMass_MeV( smr, product );
                                                   >> 263                         switch( distribution->type ) {
                                                   >> 264                         case MCGIDI_distributionType_uncorrelated_e :
                                                   >> 265                             MCGIDI_uncorrelated_sampleDistribution( smr, distribution, modes, decaySamplingInfo );
                                                   >> 266                             break;
                                                   >> 267                         case MCGIDI_distributionType_energyAngular_e :
                                                   >> 268                             MCGIDI_energyAngular_sampleDistribution( smr, distribution, modes, decaySamplingInfo );
                                                   >> 269                             break;
                                                   >> 270                         case MCGIDI_distributionType_KalbachMann_e :
                                                   >> 271                             MCGIDI_KalbachMann_sampleEp( smr, distribution->KalbachMann, modes, decaySamplingInfo );
                                                   >> 272                             break;
                                                   >> 273                         case MCGIDI_distributionType_angularEnergy_e :
                                                   >> 274                             MCGIDI_angularEnergy_sampleDistribution( smr, distribution->angularEnergy, modes, decaySamplingInfo );
                                                   >> 275                             break;
                                                   >> 276                         default :
                                                   >> 277                             printf( "Unknown spectral data form product name = %s, channel genre = %d\n", product->pop->name, outputChannel->genre );
                                                   >> 278                             break;
                                                   >> 279                         }
                                                   >> 280                         break;
                                                   >> 281                     case MCGIDI_channelGenre_undefined_e :
                                                   >> 282                         printf( "Channel is undefined\n" );
                                                   >> 283                     case MCGIDI_channelGenre_twoBodyDecay_e :
                                                   >> 284                         printf( "Channel is twoBodyDecay\n" );
                                                   >> 285                     case MCGIDI_channelGenre_uncorrelatedDecay_e :
                                                   >> 286                         printf( "Channel is uncorrelatedDecay\n" );
                                                   >> 287                     default :
                                                   >> 288                         printf( "Unsupported channel genre = %d\n", outputChannel->genre );
                                                   >> 289                     }
                                                   >> 290                     if( !smr_isOk( smr ) ) return( -1 );
                                                   >> 291                     if( !secondTwoBody ) {
                                                   >> 292                         if( decaySamplingInfo->frame == xDataTOM_frame_centerOfMass ) {
                                                   >> 293                             if( MCGIDI_kinetics_COM2Lab( smr, modes, decaySamplingInfo, masses ) != 0 ) return( -1 );
                                                   >> 294                         }
                                                   >> 295                         productData[0].kineticEnergy = decaySamplingInfo->Ep;
                                                   >> 296                         p = std::sqrt( decaySamplingInfo->Ep * ( decaySamplingInfo->Ep + 2. * product->pop->mass_MeV ) );
                                                   >> 297                         if( productData[0].isVelocity ) p *= MCGIDI_speedOfLight_cm_sec / std::sqrt( p * p + product->pop->mass_MeV * product->pop->mass_MeV );
                                                   >> 298                         productData[0].pz_vz = p * decaySamplingInfo->mu;
                                                   >> 299                         p = std::sqrt( 1. - decaySamplingInfo->mu * decaySamplingInfo->mu ) * p;
                                                   >> 300                         phi = 2. * M_PI * decaySamplingInfo->rng( decaySamplingInfo->rngState );
                                                   >> 301                         productData[0].px_vx = p * std::sin( phi );
                                                   >> 302                         productData[0].py_vy = p * std::cos( phi );
                                                   >> 303                         MCGIDI_sampledProducts_addProduct( smr, productDatas, productData );
                                                   >> 304                         if( !smr_isOk( smr ) ) return( -1 );
                                                   >> 305                     }
                                                   >> 306                 } // Loop checking, 11.06.2015, T. Koi
337             }                                     307             }
338                                                << 308         }
339             // Assign kinematics to final stat << 309     }
340             productData[0].kineticEnergy = dec << 310     return( productDatas->numberOfProducts );
341             p = std::sqrt( decaySamplingInfo-> << 
342             if (productData[0].isVelocity) p * << 
343             productData[0].pz_vz = p * decaySa << 
344             p = std::sqrt( 1. - decaySamplingI << 
345             phi = 2. * M_PI * decaySamplingInf << 
346             productData[0].px_vx = p * std::si << 
347             productData[0].py_vy = p * std::co << 
348             MCGIDI_sampledProducts_addProduct( << 
349             if (!smr_isOk(smr) ) return( -1 ); << 
350           }                                    << 
351         } // while multiplicity                << 
352                                                << 
353       }  // if !secondTwoBody                  << 
354     }  // if decay channel genre               << 
355                                                << 
356   }  // loop over possible final state product << 
357   return( productDatas->numberOfProducts );    << 
358                                                << 
359 }                                                 311 }
360                                                   312 
361 #if defined __cplusplus                           313 #if defined __cplusplus
362 }                                                 314 }
363 #endif                                            315 #endif
364                                                   316 
365                                                   317