Ignore:
Timestamp:
Jun 18, 2010, 11:42:07 AM (15 years ago)
Author:
garnier
Message:

update geant4-09-04-beta-cand-01 interfaces-V09-03-09 vis-V09-03-08

Location:
trunk/source/processes/hadronic/models/cascade
Files:
95 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/processes/hadronic/models/cascade/History

    r1228 r1315  
     1$Id: History,v 1.90 2010/06/08 06:34:43 stesting Exp $
    12-------------------------------------------------------------------
    23
     
    1415     * Please list in reverse chronological order (last date on top)
    1516     ---------------------------------------------------------------
     17
     1808 June 2010 Gunter Folger  (hadr-casc-V09-03-42)
     19-  trivial fix for compiler warning on gcc43 on empty body in for(...) in 
     20    cascade/include/G4CascadeInterpolator.icc:67
     21
     2201 June 2010 Michael Kelsey (hadr-casc-V09-03-41)
     23-------------------------------------------------
     24- paraMaker.cc:  Fix vector initialization for Windows crash.
     25
     2626 May 2010 Dennis Wright (hadr-casc-V09-03-40)
     27-----------------------------------------------
     28- G4NucleiModel: remove conversion to fm, and conversion of cross
     29  sections to fm**2
     30
     3121 May 2010 Michael Kelsey (hadr-casc-V09-03-39)
     32------------------------------------------------
     33Final tag for inclusion in GEANT 4.9.4-beta.  Will be validated internal and
     34included in global Hadronics tag.
     35
     36- G4CascadeSampler.icc:  Activate time-saving checks on single bins.
     37- G4ElementaryParticleCollider.cc:  Remove special case for nucleon elastic
     38  scattering.
     39
     4021 May 2010 Michael Kelsey (kelsey-20100521c)
     41---------------------------------------------
     42- G4CascadeInterface, G4PreCompoundCascadeInterface, G4InuclEvaporation:
     43  Simplify code: fetch G4DynamicParticle out of outgoing G4InuclParticles,
     44  rather than creating new ones.  Remove all of the *Collider data members
     45  (instantiated within G4InuclCollider).  Move final state rotations to
     46  G4CollisionOutput.
     47
     48- G4InuclParticle:  Provide accessor to return G4DynamicParticle.
     49
     50- G4CollisionOutput:  Add function to apply LorentzRotation to both lists;
     51  used by G4CascadeInterface.
     52
     53- G4ElementaryParticleCollider:  Avoid memory churn with G4LorentzVector
     54  temporaries.
     55
     5621 May 2010 Michael Kelsey (kelsey-20100521b)
     57---------------------------------------------
     58- G4VCascadeCollider:  New base class for all Colliders.  Carries
     59  verboseLevel data member and set-function.  ::collide() is pure virtual.
     60  Additional protected member functions will be defined to include all code
     61  shared across multiple Colliders.
     62
     63- Migrate all of the "Collider" factories to use new base class, removing
     64  common member functions, and replace passed-in sibling colliders with
     65  local data members (pointers for now).  Since none of these classes have
     66  persistent (state preserving) data members, the cost of more than one
     67  instantiation is minimal.
     68
     69        G4BigBanger
     70        G4ElementaryParticleCollider
     71        G4EquilibriumEvaporator
     72        G4EvaporationInuclCollider
     73        G4Fissioner
     74        G4IntraNucleiCascader
     75        G4InuclCollider
     76        G4NonEquilibriumEvaporator
     77        G4PreCompoundInuclCollider
     78
     79- G4CascadeInterface.cc, G4InuclEvaporation.cc,
     80  G4PreCompoundCascadeInterface.cc:  Remove siblings from constructors for
     81  the Colliders.
     82
     83- G4InteractionCase.hh:  Eliminate unnecessary copying of std::pair<>'s, use
     84  initializers in ctors, add clear() function to reset to 0-0-0.  Move
     85  evaluation of bullet vs. target to new set() function, replacing separate
     86  bulletTargetSetter() in the colliders.  Add boolean accessors to avoid
     87  hard-coding inter_case values.  Change code numbers so nucleus collisions
     88  are negative, and positive codes refer to the "is" or "rtype" numbers.
     89
     90- G4ElementaryParticleCollider.cc:  Use G4InteractionCase to compute "is",
     91  instead of hardwiring the meaning.
     92
     93- G4Collider.hh:  Remove empty and never-used file.
     94
     95- G4EvaporationInuclCollider.cc:  Eliminate unnecessary creation of
     96  duplicate G4InuclNuclei: pass input through to G4EquilibriumEvaporator.
     97
     98- G4LorentzConvertor:  Add interfaces to pass G4InuclParticles directly.
     99
     10021 May 2010 Michael Kelsey (kelsey-20100521a)
     101---------------------------------------------
     102Replace hand-coded interpolation of arrays with use of G4CascadeInterpolator.
     103In all cases, local arrays are replaced with static const, and the
     104interpolator object itself is declared static, to reduce memory churn.
     105
     106        G4NucleiModel::totalCrossSection()
     107        G4EquilibriumEvaporator::getQF()
     108        G4InuclSpecialFunctions::paraMaker[Truncated]() (in paraMaker.cc)
     109
     110- G4CascadSpecialFunctions:  Remove. totalCrossSection() redundant with
     111  G4NucleiModel.  Move absorptionCrossSection() to G4NucleiModel.
     112
     113- G4CascadeInterpolator.icc:  Bug fix to catch special case of exact upper
     114  bin edge (occurs when !doExtrapolation).  If index == last + 0., just
     115  return upper edge value, without calculation.
     116
     117- G4NucleiModel.cc:  Use G4Cascade{Pi*}Channel and G4Cascade{NN,NP,PP}Channel
     118  classes to get total cross-sections for pi-N and N-N scattering.  Arrays
     119  for kaon and hyperon scattering should be migrated as well, once binning
     120  is resolved.  Move absorptionCrossSection() here from SpecialFunctions.
     121
     12220 May 2010 Michael Kelsey (kelsey-20100521)
     123--------------------------------------------
     124- G4CascadeInterpolator.icc:  Two bug fixes involving values at array edges.
     125
     12619 May 2010 Michael Kelsey, Dennis Wright
     127-----------------------------------------
     128- G4BertiniData.hh,.cc:  Remove unused and unnecessary class.
     129- G4NucleiModel.cc: convert nuclear radii to fm and cross sections to
     130    fm**2.  Use six-zone model for A > 99, and make alpha a 1-zone
     131    nucleus.
     132- G4CascadSpecialFunctions: convert pion absorption cross sections from
     133    mb to fm**2, correct spelling of method absorptionCrossSection
     134
     13517 May 2010 Michael Kelsey (hadr-casc-V09-03-38)
     136------------------------------------------------
     137- paraMaker.cc (G4InuclSpecialFunctions::paraMaker[Truncated]):  Upper edge
     138  of interpolation array not properly handled.  Should be "if (Z >= 70.0)".
     139  This affects G4NonEquilibriumEvaporator output.
     140
     14117 May 2010 Michael Kelsey (hadr-casc-V09-03-37)
     142------------------------------------------------
     143Bug fixes for compiler warnings (not seen on MacOSX, even with g++ -Wall)
     144
     145- G4CascadeData.hh: Dummy arrays needed double-braces for initialization.
     146
     147- G4CascadeInterpolator.icc: Extraneous decimal point in "for (i=0.;".
     148
     149- G4CascadeKzeroBarNChannel.cc:  Left three "old" arrays in place during
     150  conversion.
     151
     15214 May 2010 Michael Kelsey (hadr-casc-V09-03-36)
     153------------------------------------------------
     154Remove obsolete files following reorganization of two-body scattering
     155lookup tables.
     156
     157        G4CascadeElasticInterface.hh,.cc
     158        G4ElasticCascadeInterface.hh,.cc
     159        G4FinalStateSampler.hh,.cc
     160        G4NucleonSampler.hh,.cc
     161        G4PionSampler.hh,.cc
     162
     163- G4CascadeChannel.hh,.cc:  All functionality removed, replaced with
     164  namespace containing only getQnums and CheckQnums validation functions.
     165
     16614 May 2010 Michael Kelsey (hadr-casc-V09-03-35)
     167------------------------------------------------
     168Replace independent parallel samplers with templated base class and single
     169implementation.  This completes the reorganization of the channel tables.
     170
     171- G4CascadeSampler:  Redefine as templated base, taking binning array as
     172  constructor argument.  Move implementation file from .cc to .icc.
     173  NOTE:  G4CascadeSampler.cc is removed, since not consistent with new .hh.
     174
     175- G4PionNucSampler:  Subclass of G4CascadeSampler<30>, replaces
     176  G4FinalStateSampler, using bins array from there.
     177
     178- G4KaonNucSampler:  Sublcass of G4CascadeSampler<31>, replaces previous
     179  G4CascadeSampler, using bins array from there.
     180
     181- G4Cascade*Channel.hh:  Change all typedefs to pass appropriate of two new
     182  samplers in template.
     183
     184- G4ElementaryParticleCollider.cc: Replace long "if (is==)"-cascades with
     185  switch blocks.  Move all getOutgoing calls (for pions and nucleons) into
     186  one function, and call it from outside multiplicity checks.  Use
     187  G4CascadeInterpolator for angular distributions.  Set modelID=3 in all
     188  G4InuclParticle constructions.
     189
     19014 May 2010 Michael Kelsey (hadr-casc-V09-03-34)
     191------------------------------------------------
     192Extract lookup tables from G4PionSampler and G4NucleonSampler into
     193individual "classes" defined and initialized with G4CascadeData.
     194
     195- G4CascadePi{Plus,Minus,Zero}{P,N}Channel.hh: Six new typedefs defined as
     196  with the existing G4CascadeXXXChannel, to replace G4PionSampler.
     197
     198- G4CascadeT33piNChannel.cc: Lookup tables for both PiPlusP and PiMinusN,
     199  implemented as with existing G4CascadeXXXChannel, from G4PionSampler.cc.
     200
     201- G4CascadeT31piNChannel.cc: Lookup tables for both PiMinusP and PiPlusN,
     202  implemented as with existing G4CascadeXXXChannel, from G4PionSampler.cc
     203
     204- G4CascadeT11pizNChannel.cc: Lookup tables for both PiZeroP and PiZeroN,
     205  implemented as with existing G4CascadeXXXChannel, from G4PionSampler.cc
     206
     207- G4Cascade{PP,NP,NN}Channel.hh: Three new typedefs defined as with the
     208  existing G4CascadeXXXChannel, to replace G4NucleonSampler.
     209
     210- G4CascadeT1NNChannel.cc: Lookup tables for both p-p and n-n scattering,
     211  implemented as with existing G4CascadeXXXChannel, from G4NucleonSampler.cc
     212
     213- G4CascadeT0npChannel.cc: Lookup tables for p-n scattering, implemented as
     214  with existing G4CascadeXXXChannel, from G4NucleonSampler.cc
     215
     216- G4CascadeFunctions.hh, .icc: Pass std::vector as non-const argument to
     217  getOutgoingParticleTypes() instead of returning internal buffer.
     218
     219- G4CascadeSampler.cc, G4FinalStateSampler.cc:  Add some checks in
     220  findFinalStateIndex, fillSigmaBuffer, and sampleFlat(), such that
     221  single-entry ranges don't go through the analysis, just return index 0.
     222
     223- G4ElementaryParticleCollider.cc: Follow change to getOutgoingParticleTypes()
     224  in generateStrangeChannelPartTypes().  Replace all uses of G4PionSampler
     225  and G4NucleonSampler with new channel "classes".
     226
     22714 May 2010 Michael Kelsey (hadr-casc-V09-03-33)
     228------------------------------------------------
     229Continue consolidation of two-body collision lookup tables.  Unify
     230interfaces between pion/nucleon and kaon/hyperon samplers.
     231
     232- G4CascadeData: Many changes to support use as data class for both
     233  kaon/hyperon and pion/nucleon tables (migration will be next tag):
     234
     235  1) Add new first argument to template with number of bins in energy
     236     interpolation.  This replaces the (temporary) use of
     237     G4CascadeSampler::energyBins within the class definition.
     238
     239  2) Add two additional template arguments, N8 and N9, with default values
     240     of zero.  These will be used by the pion/nucleon tables, but not by the
     241     existing kaon/hyperon tables.
     242
     243  3) Define additional arrays for 8- and 9-body final states, using
     244     conditional dimensioning (e.g., if N8==0, use [1]).  Define second
     245     9-body constructor to accept and initialize the new arrays.
     246
     247  4) Eliminate static intialization of index[], moving it into
     248     initialize().  Template specialization can't be used with data!
     249
     250  5) Add separate "sum" (summed N-body cross-sections) and "tot" arrays
     251     (measured inclusive xsec).  Latter is a const-ref, initialized to "sum"
     252     if not provided as ctor argument, with two new ctors as needed.
     253
     254  6) Add accessor to return maximum multiplicity (NM+1).
     255
     256- G4CascadeFunctions.hh:  Add second template argument to specify which
     257  "final state sampler" is the base class.  Use both T::data.tot and
     258  T::data.sum in GetMultiplicity(), to support sum/tot comparisons in
     259  pion/nucleon channels.  Extend GetOutputParticleTypes() to support up to
     260  multiplicity 9.
     261
     262- G4CascadeFunctions.icc:  Implementations of template class functions.
     263
     264- G4CascadeXXXChannel.hh: Add "31," as initial template argument for Data.
     265  Add G4CascadeSampler as second template argument in G4CascadeXXXChannel
     266  typedef.
     267
     268
     26914 May 2010 Michael Kelsey (hadr-casc-V09-03-32)
     270------------------------------------------------
     271Continue revisions to two-body collision lookup tables.  Make the kaon and
     272hyperon channels compatible with the pion/nucleon samplers, before the next
     273stage of unifying the structure.
     274
     275- G4CascadeSampler: NEW class, parallel to G4FinalStateSampler but with a
     276  different energy binning.  Used as base class to G4CascadeFunctions<T>,
     277  from which the cross-section and other arrays are passed.  Implement
     278  findMultiplicity (cf. G4CascadeFunctions::getMultiplicity) to return the
     279  true value, not the array index.
     280
     281  This class replaces functionality of G4CascadeChannel, which is redundant.
     282
     283- G4CascadeChannel: Remove all interpolation code, leaving only getQnums().
     284
     285- G4CascadeFunctions:  Inherit from G4CascadeSampler for interpolations,
     286  except for final-state extraction (where FS type arrays are dealt with
     287  locally, not passed).  Public static functions rely on private instantiated
     288  version of class to do work, so that G4CascadeSampler gets instantiated.
     289
     290- G4CascadeData: Remove final template argument (total number of indices),
     291  as redundant with simple sum of multplicity indices.  Use template args to
     292  dimension data member arrays (const references), and to statically
     293  initialize the start-stop index table.  Make large cross-sections table
     294  G4double, not G4float.  Define ctor to pass in array refs for initialization.
     295  Reduce index array to single dimension (start=index[i], stop=index[i+1]).
     296
     297- G4CascadeXXXChannel:  All of the initial-state channel "classes"
     298  (typedef names) modified to follow G4CascadeData rewrite.  In .cc file,
     299  the explicit lookup tables are static, and passed by const-ref to
     300  G4CascadeData.  The "initializer" struct is dropped; with the static
     301  "data" object initialized by ctor here.
     302
     303- G4ElementaryParticleCollider.cc:  In ::generateMultiplicity(), eliminate
     304  extra "+2" and "-2" applied to local "mul" variables.  With change above,
     305  all functions return return true multiplicity, not array index.
     306
     307- G4FinalStateSampler:  Add findFinalStateIndex() function, to make
     308  interface match G4CascadeSampler exactly.  Reduce index array to single
     309  dimension.
     310
     311- G4PionSampler.cc, G4NucleonSampler.cc:  Use new findFinalStateIndex()
     312  function in GetFSPartTypesXXX() functions.  Reduce index array to single
     313  dimension (start=index[i], stop=index[i+1]).
     314
     31514 May 2010 Michael Kelsey (hadr-casc-V09-03-31)
     316------------------------------------------------
     317Begin revisions to two-body collision lookup tables.  This will be a major
     318reorganization, splitting the G4PionSampler and G4NucleonSampler into
     319separate little "classes" (typedefs) for each initial state, in the same way
     320that the kaon and hyperon states are done now.  The underlying templated and
     321base classes will be unified across all of the channels.
     322
     323- G4CascadeInterpolator: NEW class to encapsulate interpolation procedure.
     324  Uses C-style arrays passed by dimensioned reference, to allow compile-time
     325  array bounds checking.  Template argument is array dimension, and array of
     326  energy bins is saved by ctor.  User array to be interpolated is passed as
     327  function argument.  Last value interpolated, along with result, is saved,
     328  to allow fast multiple interpolations.
     329
     330  This class is substantially more lightweight than G4PhysicsVector.
     331
     332- G4FinalStateSampler: Replace manual interpolation with G4CascadeInterpolator.
     333  Remove redundant sampleFlat(...) function with argument.  Rename member
     334  functions in anticipation of merging with G4CascadeFunctions.
     335
     336- G4PionSampler.cc, G4NucleonSampler.cc: Follow use of G4CascadeInterpolator
     337  above, and drop local caching of interpolation results.  Reduce offset
     338  list for cross-sections to one dimension (start=index[i], stop=index[i+1]).
     339
     34011 May 2010 Michael Kelsey (hadr-casc-V09-03-30)
     341------------------------------------------------
     342Bug fixes in the two-body scattering code.
     343
     344- G4PionSampler.cc, G4NucleonSampler.cc:  Fix long-standing bug with offset
     345  indices computed for cross-section tables.  XXXindex[m][0] (start) and
     346  XXXindex[m][1] (stop) are computed in initChannels() as [start,stop]
     347  inclusive range (i.e., "for (i=start; i<=stop; i++)"), but used with
     348  G4FinalStateSampler::fillSigmaBuffer (and its predecessor code) as
     349  [start,stop) exclusive range (i.e., normal C style "for (i=start; i<stop;
     350  i++)").  This is fixed by properly setting XXXindex[m-1][1] =
     351  XXXindex[m][0], and using the ranges consistently in initChannels().
     352
     353- G4ElementaryParticleCollider.cc:  In the six pion-nucleon scatters, the
     354  two-body final state is incorrectly tested for charge-exchange.  All the
     355  if statements check whether "particle_kinds[0]" is the initial nucleon,
     356  but the outgoing baryon actually appears in particle_kinds[1].  Replace
     357  the individual tests with the use of "finaltype", moved out of the
     358  strangeness if-block.
     359
     36006 May 2010 Michael Kelsey (hadr-casc-V09-03-29, hadr-casc-V09-03-23-01)
     361------------------------------------------------------------------------
     362- G4Diproton.cc, G4Dineutron.cc, G4UnboundPN.cc:  After creating instance
     363  of these "internal" particles, remove the pointer from G4ParticleTable.
     364  This avoids an issue with the FTFP de-excitation code, which occasionally
     365  picks up the diproton and puts it onto a final-state particle list.
     366
     367These three changes, and nothing else, are "backported" on top of -23 for
     368continued validation tests.
     369 
     37030 Apr 2010 Dennis Wright (hadr-casc-V09-03-28)
     371-----------------------------------------------
     372- G4ElementaryParticleCollider:
     373    improved pi-nucleon two-body angular distributions, and made
     374    sampling of CM angle faster.  As a result, the methods
     375    getElasticCase and adjustIntervalForElastic were made redundant
     376    and removed.  Also removed array containing old angular distribution
     377    parameters.
     378   
     379    Now use nucleon-nucleon angular distributions for hyperon-nucleon
     380    scattering, and pi-nucleon dsitributions for kaon-nucleon scattering
     381    (until specific kaon distributions are added).
     382 
     38329 Apr 2010 Michael Kelsey (hadr-casc-V09-03-27)
     384------------------------------------------------
     385- G4InuclPartcleNames.hh:  Long name "gamma" conflicts with math function.
     386  Change back to "photon".
     387
     388- G4InuclElementaryParticle.cc, G4InuclEvaporation.cc,
     389  G4NonEquilibriumEvaporator.cc, G4NucleiModel.cc, G4NucleonSampler.cc,
     390  G4PionSampler.cc, G4PreCompoundCascadeInterface.cc,
     391  G4PreCompoundInuclCollider.cc:  Replace "gamma" with "photon".
     392
     393- G4InuclElementaryParticle.hh:  Change "photon()" to "isPhoton()" to avoid
     394  conflicts with names enum.  Use names enum internally as well.
     395
     396- G4ElementaryParticleCollider.cc, G4InuclCollider.cc,
     397  G4PreCompoundInuclCollider.cc:  Change "photon()" to "isPhoton()".
     398
     39928 Apr 2010 Michael Kelsey (hadr-casc-V09-03-26)
     400------------------------------------------------
     401All changes below within "cascade/" subdirectory:
     402
     403- G4InuclParticleNames.hh:  Define enums for particle type codes, using both
     404  "long" and "short" names copied from existing duplicated enums.  One
     405  change is that "kp" and "km" are replaced by "kpl" and "kmi" respectively,
     406  since "km" conflicts with GEANT4 "kilometers" unit.  Deploy in classes:
     407
     408        include/G4FinalStateSampler.hh
     409        src/G4CascadeElasticInterface.cc
     410        src/G4CascadeInterface.cc
     411        src/G4ElasticCascadeInterface.cc
     412        src/G4ElementaryParticleCollider.cc
     413        src/G4InuclElementaryParticle.cc
     414        src/G4InuclEvaporation.cc
     415        src/G4NucleonSampler.cc
     416        src/G4PionSampler.cc
     417        src/G4PreCompoundCascadeInterface.cc
     418
     419- G4InuclElementaryParticle.cc:  Add Omega- and antinucleon partcles to lists.
     420  No code uses these (yet).
     421
     42224 April 2010 Michael Kelsey (hadr-casc-V09-03-25)
     423--------------------------------------------------
     424Remove redundant classes, G4Ibertini and G4BertiniRegionModel.
     425
     42621 April 2010 Michael Kelsey (hadr-casc-V09-03-24)
     427--------------------------------------------------
     428- G4NucleiModel.hh,cc:  Eliminate last remaining hardwired baryon masses.
     429
     43018 April 2010 Michael Kelsey (hadr-casc-V09-03-23)
     431--------------------------------------------------
     432Final revisions to access std::vector<particle> via const-references:
     433
     434        G4CascadeInterface.cc
     435        G4EquilibriumEvaporator.cc
     436        G4IBertini.cc
     437        G4InuclCollier.cc
     438        G4NucleiModel.cc
     439        G4PreCompoundCascadeInterface.cc
     440
     441- G4CollisionOutput:  Add new function to boost output lists to lab frame.
     442
     44314 April 2010 Michael Kelsey (hadr-casc-V09-03-22)
     444--------------------------------------------------
     445- G4CascadeInterface.cc, G4IBertini.cc, G4PreCompoundCascadeInterface.cc:
     446  In ::ApplyYourself(), do the check on K0L/K0S _before_ passing G4PartDefn
     447  to G4InuclElemPart::type().  This avoids unnecessary warning message.
     448
     44914 April 2010 Michael Kelsey (temporary: kelsey-memClean3)
     450----------------------------------------------------------
     451All changes below within "cascade/" subdirectory:
     452
     453- G4FinalStateSampler: Replace "sigma" argument for sampling with data
     454  member, add functions to fill sigma buffer by passing in array references.
     455  Provide typedef for interpolator, and function to apply interpolation.
     456
     457- G4PionSampler, G4NucleonSampler:  Follow changes to base class,
     458  eliminating much of the copy-and-paste code blocks via function calls.
     459  Replace G4float arrays with G4double, to support passing into functions.
     460
     46113 April 2010 Michael Kelsey (hadr-casc-V09-03-21)
     462--------------------------------------------------
     463All changes below within "cascade/" subdirectory:
     464
     465- G4InuclSpecialFunctions.hh, paraMaker.cc, paraMakerTruncated.cc:  Drop
     466  return-by-value from paraMaker() and paraMakerTruncated().  Add second
     467  argument with non-const reference to output buffer for return.
     468
     469- G4EquilibriumEvaporator.cc:  Follow changes above to paraMaker(), use
     470  references to address parms.first and parms.second, instead of copying.
     471
     472- G4NonEquilibriumEvaporator.cc:  Follow changes above to
     473  paraMakerTruncaed(), use references to address parms.first and
     474  parms.second, instead of copying.
     475
     476- G4Dineutron, G4Diproton, G4UnboundPN:  Inherit from G4VShortLivedParticle,
     477  per Kurashige.  Thought it would eliminate G4ElectronOccupancy churn, but
     478  did not.
     479
     48012 April 2010 Michael Kelsey (hadr-casc-V09-03-20)
     481--------------------------------------------------
     482All changes below within "cascade/" subdirectory:
     483
     484- G4NucleiModel: Move function implementations from .hh to .cc.  Replace
     485  manual sorting (inefficient O(N^2)) with std::sort() and simple
     486  "less-than" function for std::pair<> "partners".
     487
     488- G4CollisionOutput: Move function implementations from .hh to .cc.  Use
     489  std::vevtor<>::insert() to add vectors together.
     490
     491- Replace return-by-value G4CollisionOutput with non-const reference buffer
     492  passed into xxx::collide(), in the following classes:
     493        G4BigBanger
     494        G4CascadeElasticInterface
     495        G4CascadeInterface
     496        G4ElasticCascadeInterface
     497        G4ElementaryParticleCollider
     498        G4EquilibriumEvaporator
     499        G4EvaporationInuclCollider
     500        G4Fissioner
     501        G4IBertini
     502        G4IntraNucleiCascader
     503        G4InuclCollider
     504        G4InuclEvaporation
     505        G4NonEquilibriumEvaporator
     506        G4NucleiModel
     507        G4PreCompoundCascadeInterface
     508        G4PreCompoundInuclCollider
     509
     510  Note that some places where internal G4CollisionOutput buffers are being
     511  used (and their contents appended to the global output) have not been
     512  cleaned up yet.  These will require some rearrangement of the algorithms,
     513  or/and elimination of debugging output.
     514
     51509 April 2010 Michael Kelsey (hadr-casc-V09-03-16-01)
     516-----------------------------------------------------
     517This modification is included in a pseudo-patch of hadr-casc-V09-03-16,
     518without brining in any of the -17 through -19 modifications.
     519
     520- G4LorentzVector.cc:  Protect two instances of sqrt() against tiny negative
     521  arguments (due to tiny-tiny subtractions).
     522
     52309 April 2010 Michael Kelsey (hadr-casc-V09-03-19)
     524--------------------------------------------------
     525All changes below within "cascade/" subdirectory:
     526
     527- G4InuclParticle, G4InuclElementaryParticle, G4InuclNuclei:  Eliminate
     528  unused G4String ctor argument, introduced in hadr-casc-V09-03-01.  Causes
     529  a lot of pointless memory churn.
     530
     531- G4BigBanger.cc:  Fix type conversion warning I introduced by mistake.
     532
     53308 April 2010 Michael Kelsey (hadr-casc-V09-03-18)
     534--------------------------------------------------
     535All changes below within "cascade/" subdirectory:
     536
     537- G4PionSampler, G4NucleonSampler: For all ::GetFSPartTypes*() functions,
     538  eliminate return-by-value std::vector<>, and pass in non-const reference
     539  for filling in situ.  Buffer is cleared.
     540
     541- G4ElementaryParticleCollider.cc:  Follow changes above for Sampler calls.
     542
     54307 April 2010 Michael Kelsey (hadr-casc-V09-03-17)
     544--------------------------------------------------
     545All changes below within "cascade/" subdirectory:
     546
     547Replace return-by-value std::vector<> with either const-ref returns, or
     548with use of an internal buffer which can be reused, to reduce memory
     549churn due to copying, allocation, and resizing.
     550
     551- G4BigBanger:  Create data buffer for lists of secondaries and momenta.
     552  Fill buffers in ::generateBangInSCM() and ::generateMomentumModules(),
     553  which are now non-const.  Reference buffers in ::collide().
     554
     555- G4CascadeFunctions::getOutgoingParticleTypes():  Make "kinds" a static
     556  variable (buffer), and return it by const-ref.
     557
     558- G4ElementaryParticleCollider:  Eliminate return-by-value std::vector<>
     559  on the functions listed below, by creating data buffers for particles,
     560  momenta, and particle types.  The functions become non-const and void:
     561  ::generateSCMfinalState(), ::generateMomModules()
     562  ::generateStrangeChannelPartTypes(), ::generateSCMpionAbsorption()
     563
     564  Also, in ::generateStrangeChannelPartTypes(), use a switch statement
     565  instead of the long cascade of if-else-else.
     566
     567- G4NucleiModel: Several member functions have different modifications:
     568
     569  ::initializeCascad(bullet,target) -- Replace return value with a passed-in
     570        (non-const reference) buffer to be filled.  The calling code can
     571        pass in a data member, local variable, or whatever.
     572
     573  ::generateParticleFate() -- Replace local "thePartners" variable with data
     574        member, filled below.  Move "outgouing_cparticles" to data member
     575        (fix the spelling!), and return by const-ref.
     576
     577  ::generateInteractionPartners() -- Eliminate return value; fill data
     578        member instead, to be used by ::generateParticleFate().
     579
     580- G4IntraNucleiCascader.cc:  Follow changes to initializeCascad() above.
     581
     582- G4NucleonSampler, G4PionSampler: ** DON'T KNOW WHAT TO DO HERE **
     583
     584- G4WatcherGun:  Return const-ref to list of watchers, instead of copy.
     585
     586Replace all uses of std::vector<>::resize(0) with ::clear().  The former
     587causes deallocation/reallocation/resizing cycles, while clear() just removes
     588content, preserving the allocated buffer.
     589
     590        include/G4CollisionOutput.hh
     591        src/G4ElementaryParticleCollider.cc
     592        src/G4NucleiModel.cc
     593        src/G4WatcherGun.cc
     594
     59507 April 2010 Dennis Wright (hadr-casc-V09-03-16)
     596-------------------------------------------------
     597- fix negative energy bug in G4BigBanger, and switch to using
     598  G4NucleiProperties::GetBindingEnergy
     599
     60007 April 2010 Michael Kelsey (hadr-casc-V09-03-15)
     601--------------------------------------------------
     602All changes below within "cascade/" subdirectory:
     603
     6041) Systematically replace pass-by-value function arguments with const-refs.
     605This is the first step in reducing unnecessary memory churn, to be followed
     606by replacing return-by-value std::vector<> with non-const argument buffers.
     607
     608        include/G4CascadeChannel.hh
     609        include/G4FinalStateSampler.hh
     610        include/G4InuclEvaporation.hh
     611        include/G4NuclWatcher.hh
     612        src/G4CascadeChannel.cc
     613        src/G4FinalStateSampler.cc
     614        src/G4InuclEvaporation.cc
     615        src/G4NuclWatcher.cc
     616
     6172) Fix constness on some operator== and operator!= definitions.
     618
     619        include/G4CascadeElasticInterface.hh
     620        include/G4CascadeInterface.hh
     621        include/G4ElasticCascadeInterface.hh
     622        include/G4IBertini.hh
     623        include/G4PreCompoundCascadeInterface.hh
     624
     62507 Apr 2010 Michael Kelsey (hadr-casc-V09-03-14)
     626------------------------------------------------
     627- G4Dineutron.hh, G4Diproton.hh, G4UnboundPN.hh: 
     628  Reset static "theInstance" pointer to zero in (now virtual) destructor.
     629
     630- G4Dineutron.cc, G4Diproton.cc, G4UnboundPN.cc:
     631  Implement constructor to do the G4Ions initialization, rather than in
     632  ::Definition().  Drop use of G4ParticleTable; just monitor static pointer.
     633  Set "ShortLived" flag in G4Ions initialization, to avoid interactions with
     634  ProcessManager.
     635
     636- G4InuclNuclei.cc:  In ::makeNuclearFragment(), set "ShortLived" flag for
     637  G4Ions, to avoid interactions with ProcessManager.
     638
     63926 Mar 2010 Dennis Wright (hadr-casc-V09-03-13)
     640-----------------------------------------------
     641- G4EquilibriumEvaporator.cc: remove line #include "G4types.hh"
     642  (file doesn't exist)
     643
     64420 Mar 2010 Michael Kelsey (hadr-casc-V09-03-12)
     645------------------------------------------------
     646All changes below within "cascade/" subdirectory:
     647
     648- G4EquilibriumEvaporator.cc:  Move subtraction of Q1[i] outside new
     649  GetBindingEnergy() call.
     650
     651- G4InuclNuclei.cc::makeNuclearFragment():  Add message warning users about
     652  non-physical creation.  Use new GetBindingEnergy() function here as well
     653  (V09-03-05 didn't have this function, so wasn't included in migration).
     654
     65519 Mar 2010 Michael Kelsey (hadr-casc-V09-03-11)
     656------------------------------------------------
     657All changes below within "cascade/" subdirectory:
     658
     659- G4InuclSpecialFunctions:  Two new functions:
     660
     661::generateWithRandomAngles() to encapsulate random-direction generation.
     662  This function and existing generateWithFixedTheta() take optional mass
     663  argument to produce proper four-vector.
     664
     665  Replace duplicated random angle code with new function above, and use new
     666  optional mass argument where available:
     667
     668        G4BigBanger.cc
     669        G4ElementaryParticleCollider.cc
     670        G4EquilibriumEvaporator.cc
     671        G4Fissioner.cc
     672        G4NonEquilibriumEvaporator.cc
     673        G4NucleiModel.cc
     674
     675::G4cbrt():  Define cube-root in terms of log and exp, rather than pow().
     676  Note that "cbrt()" can't be used, as it conflicts with <math.h> on Linux.
     677
     678  Eliminate unnecessary uses of std::pow() with fixed arguments.  For
     679  example, "pow(x,3)" -> "x*x*x", "pow(x,1/3)" -> G4cbrt(x):
     680
     681        G4BertiniRegionModel.cc
     682        G4EquilibriumEvaporator.cc
     683        G4EvaporationInuclCollider.cc
     684        G4Fissioner.cc
     685        G4IntraNucleiCascader.cc
     686        G4InuclCollider.cc
     687        G4NonEquilibriumEvaporator.cc
     688        G4NucleiModel.cc
     689        G4PreCompoundInuclCollider.cc
     690        G4RegionModel.cc
     691        bindingEnergyAsymptotic.cc
     692        bindingEnergyKummel.cc
     693
     694  WARNING!  In G4IntraNucleiCascader.cc, the Coulomb barrier was calculated
     695  using "std::pow(A, 0.333)", rather than the "exact" 1./3.  This leads to
     696  per-mil differences in the value, and occasional differences in wheter an
     697  outgoing particle tunnels through.  The new code is exact to double
     698  precision, and therefore fixes a bug.
     699
     700- Move "using" directive from all .hh files to corresponding .cc, along with
     701  some unnecessary #includes:
     702
     703        G4BigBanger.hh, .cc
     704        G4ElementaryParticleCollider.hh, .cc
     705        G4EquilibriumEvaporator.hh, .cc
     706        G4EvaporationInuclCollider.hh, .cc
     707        G4Fissioner.hh, .cc
     708        G4IntraNucleiCascader.hh, .cc
     709        G4InuclCollider.hh
     710        G4InuclNuclei.hh
     711        G4NonEquilibriumEvaporator.hh, .cc
     712        G4NucleiModel.hh, .cc
     713        G4PreCompoundInuclCollider.hh, .cc
     714
     715- G4NuclWatcher.hh and .cc (new):  Move implementation code from .hh to .cc.
     716
     71718 March 2010 Michael Kelsey (hadr-casc-V09-03-10)
     718--------------------------------------------------
     719All changes below within "cascade/" subdirectory:
     720
     721Missed one bug in repairs below, found when testing 4 GeV pi -> Pb.
     722
     723- G4Fissioner.cc:  Replace incorrect G4LorentzVector ctor arguments
     724  (G4ThreeVector,m) with call to G4LV::setVectM().
     725
     72617 March 2010 Dennis Wright (hadr-casc-V09-03-09)
     727-------------------------------------------------
     728Fix warning in G4InuclNuclei.cc: G4Ions:G4Ions was being called with
     729a double (a) in its 13th argument, when an integer is required.  Use
     730G4lrint to convert.
     731
     73216 March 2010 Michael Kelsey (hadr-casc-V09-03-08)
     733--------------------------------------------------
     734All changes below within "cascade/" subdirectory:
     735
     736Fix bugs introduced during migration from G4CascadeMomentum to
     737G4LorentzVector (see hadr-casc-V09-03-03).  With these bug fixes, 2000
     738events generated with "ppi4GeV" test executable are equivalent to production
     739output (GEANT 4.9.3), allowing for differences in hardwired nucleon masses.
     740When compared with hadr-casc-V09-03-02 (which uses G4ParticleDefinition for
     741all the particle masses) the 2000-event results are identical within
     742floating point precision.
     743
     744- G4BigBanger.cc:  Line 72, fix unit conversion bug, GeV/MeV vs. MeV/GeV.
     745  Replace incorrectly introduced cross-product with original vector
     746  manipulation, written with G4LorentzVector accessors.
     747
     748- G4CollisionOutput::selectPairToTune(): Test on "i3>0" not appropriate with
     749  G4LorentzVector indexing.  Replace with failure-test on "i3<0".  Also
     750  simplify final if-cascade for readability.
     751
     752- G4EquilibriumEvaporator.cc:  Replace incorrect G4LorentzVector ctor
     753  arguments (px,py,pz,m) with call to G4LV::setVectM().
     754
     755- G4IntraNuclearCascader.cc:  Replace leftover momentum_out[0] with .e().
     756
     757- G4InuclNuclei.cc,hh:  Add new function ::makeNuclearFragment(a,z,exc),
     758  which "manually" construct a G4Ions object for cases where A/Z is not a
     759  valid stable or unstable nucleus.  These unphysical objects are passed
     760  back from G4IntraNuclearCascader.cc and immediately passed to G4BigBanger
     761  for conversion to nucleons.  A future change should move this action into
     762  G4INCascader and eliminate the need for unphysical nuclei.
     763
     764- G4LorentzConvertor::toTheTargetRestFrame():  Remove local declaration of
     765  scm_momentum, restoring access to data member with that name.
     766
     767- G4NucleiModel::generateQuasiDeutron(): Undo consolidation of dmom with
     768  local variables for each of the nucleon momenta.  Stack corruption led to
     769  differences in unbound p-n state relative to pp and nn states.
     770
     771Minor updates:  Changed all the "verboseLevel()" initializers to (0), via a
     772shell script.  This allows making the code uniformly verbose or quiet.
     773
     774        include/G4NucleiModel.hh
     775        src/G4Analyser.cc
     776        src/G4CollisionOutput.cc
     777        src/G4ElementaryParticleCollider.cc
     778        src/G4FissionStore.cc
     779        src/G4Fissioner.cc
     780        src/G4IntraNucleiCascader.cc
     781        src/G4NonEquilibriumEvaporator.cc
     782        src/G4NucleiModel.cc
     783        src/G4WatcherGun.cc
     784
     78516 March 2010 Michael Kelsey (hadr-casc-V09-03-DO-NOT-USE)
     786--------------------------------------------------
     787All changes below within "cascade/" subdirectory:
     788
     789Restore version hadr-casc-V09-03-05 to HEAD of CVS in order to apply bug
     790fixes and re-deploy migration from G4CascadeMomentum to G4LorentzVector.
     791This reversion is tagged as a checkpoint only, and should not be used for
     792testing or running (since it restores the known bugs in V09-03-03).
     793
     794The update to G4InteractionCase.hh by Gabriele Cosmo in hadr-casc-V09-03-07
     795is not touched by this reversion!
     796
     797The following CVS commands were used to perform the reversion:
     798
     799        cvs update -j1.13 -j1.12 cascade/include/G4CascadParticle.hh
     800        cvs update -j1.4 -j1.3 cascade/include/G4CascadeMomentum.hh
     801        cvs update -j1.15 -j1.14 cascade/include/G4CollisionOutput.hh
     802        cvs update -j1.23 -j1.22 cascade/include/G4ElementaryParticleCollider.hh
     803        cvs update -j1.9 -j1.8 cascade/include/G4InuclCollider.hh
     804        cvs update -j1.19 -j1.18 cascade/include/G4InuclElementaryParticle.hh
     805        cvs update -j1.12 -j1.11 cascade/include/G4InuclNuclei.hh
     806        cvs update -j1.16 -j1.15 cascade/include/G4InuclParticle.hh
     807        cvs update -j1.13 -j1.12 cascade/include/G4InuclSpecialFunctions.hh
     808        cvs update -j1.13 -j1.12 cascade/include/G4LorentzConvertor.hh
     809        cvs update -j1.4 -j1.3 cascade/include/G4ParticleLargerBeta.hh
     810        cvs update -j1.9 -j1.8 cascade/include/G4ParticleLargerEkin.hh
     811        cvs update -j1.20 -j1.19 cascade/src/G4BigBanger.cc
     812        cvs update -j1.13 -j1.12 cascade/src/G4CascadParticle.cc
     813        cvs update -j1.6 -j1.5 cascade/src/G4CascadeElasticInterface.cc
     814        cvs update -j1.68 -j1.67 cascade/src/G4CascadeInterface.cc
     815        cvs update -j1.18 -j1.17 cascade/src/G4CollisionOutput.cc
     816        cvs update -j1.7 -j1.6 cascade/src/G4ElasticCascadeInterface.cc
     817        cvs update -j1.6 -j1.5 cascade/src/G4EvaporationInuclCollider.cc
     818        cvs update -j1.5 -j1.4 cascade/src/G4IBertini.cc
     819        cvs update -j1.3 -j1.2 cascade/src/G4InuclElementaryParticle.cc
     820        cvs update -j1.10 -j1.9 cascade/src/G4InuclEvaporation.cc
     821        cvs update -j1.3 -j1.2 cascade/src/G4InuclNuclei.cc
     822        cvs update -j1.4 -j1.3 cascade/src/G4InuclParticle.cc
     823        cvs update -j1.17 -j1.16 cascade/src/G4InuclSpecialFunctions.cc
     824        cvs update -j1.19 -j1.18 cascade/src/G4LorentzConvertor.cc
     825        cvs update -j1.5 -j1.4 cascade/src/G4PreCompoundCascadeInterface.cc
     826        cvs update -j1.4 -j1.3 cascade/src/G4PreCompoundInuclCollider.cc
     827
     828Intermediate versions below had bindingEnergy changes from -05 re-applied
     829
     830        cvs update -j1.23 -j1.21 cascade/src/G4EquilibriumEvaporator.cc
     831        cvs update -j1.22 -j1.20 cascade/src/G4Fissioner.cc
     832        cvs update -j1.29 -j1.27 cascade/src/G4IntraNucleiCascader.cc
     833        cvs update -j1.24 -j1.22 cascade/src/G4InuclCollider.cc
     834        cvs update -j1.23 -j1.21 cascade/src/G4NonEquilibriumEvaporator.cc
     835        cvs update -j1.38 -j1.36 cascade/src/G4NucleiModel.cc
     836
     837G4ElementaryParticleCollider::particleSCMmomentumFor2to2:  Restore new
     838parametrization of elastic scattering added by D.Write in hadr-casc-V09-03-06
     839
     840        cvs update -j1.47 -j1.45 cascade/src/G4ElementaryParticleCollider.cc
     841        + editing
     842
     84305 Mar 2010 Gabriele Cosmo (hadr-casc-V09-03-07)
     844------------------------------------------------
     845- Reinstated fix in G4InteractionCase.hh for initialisation in constructor to
     846  allow for porting on C++0x Standard.
     847
     84807 Feb 2010 Dennis Wright (hadr-casc-V09-03-06)
     849-----------------------------------------------
     850- back out changes from tags V09-03-00 to V00-03-05 by restoring HEAD
     851  to V09-02-11, and keeping the di-nucleon classes
     852- replace Bertini method bindingEnergy() with
     853  G4NucleiProperties::GetBindingEnergy() in classes
     854  G4IntraNuclearCascader, G4InuclCollider, G4NucleiModel, G4EquilibriumModel,
     855  G4NonEquilibriumModel, G4Fissioner.  Note that G4Fissioner still uses the
     856  Bertini method bindingEnergyAsymptotic.
     857
     858- G4ElementaryParticleCollider::particleSCMmomentumFor2to2
     859  replace original (incorrect) pp, pn, nn 2-body to 2-body scattering angular
     860  distributions with a new parameterization of elastic scattering data using
     861  the sum of two exponentials
     862
     86302 Feb 2010 Dennis Wright (hadr-casc-V09-03-05)
     864-----------------------------------------------
     865- replace all uses of bindingEnergy (local Bertini method) with the
     866  Geant4 standard G4NucleiProperties::GetBindingEnergy(A,Z)
     867  files modified:
     868    G4IntraNucleiCascader.cc
     869    G4InuclCollider.cc
     870    G4NucleiModel.cc
     871    G4EquilibriumEvaporator.cc
     872    G4NonEquilibriumEvaporator.cc
     873    G4Fissioner.cc
     874- note that G4Fissioner still uses Bertini method bindingEnergyAsymptotic
     875 
     87628 Jan 2010 Dennis Wright (hadr-casc-V09-03-04)
     877-----------------------------------------------
     878- fix unused variable warnings in G4InuclParticle.hh, .cc and
     879  G4NonEquilibriumEvaporator.cc
     880
     88126 Jan 2010 Michael Kelsey (hadr-casc-V09-03-03)
     882------------------------------------------------
     883All changes below within "cascade/" subdirectory:
     884
     885- G4ParticleLargerBeta.hh:  Fix to use of CVS "Name" tag; no code changes.
     886
     887- G4CascadParticle: Replace the position std::vector<> with G4ThreeVector.
     888
     889- G4NucleiModel: Replace all std::vector<> coordinates with G4ThreeVector,
     890  and use vector math for computations.
     891
     892Remove all use of G4CascadeMomentum (a simple container with a C-style
     893four-element array) with G4LorentzVector.  This is a fairly invasive change,
     894since G4CascMom was used for all of the three- and four-vector operations
     895throughout the Bertini code:
     896
     897        include/G4CascadParticle.hh
     898        include/G4CollisionOutput.hh
     899        include/G4ElementaryParticleCollider.hh
     900        include/G4InuclCollider.hh
     901        include/G4InuclElementaryParticle.hh
     902        include/G4InuclNuclei.hh
     903        include/G4InuclParticle.hh
     904        include/G4InuclSpecialFunctions.hh
     905        include/G4LorentzConvertor.hh
     906
     907        src/G4BigBanger.cc
     908        src/G4CascadParticle.cc
     909        src/G4CascadeElasticInterface.cc
     910        src/G4CascadeInterface.cc
     911        src/G4CollisionOutput.cc
     912        src/G4ElasticCascadeInterface.cc
     913        src/G4ElementaryParticleCollider.cc
     914        src/G4EquilibriumEvaporator.cc
     915        src/G4EvaporationInuclCollider.cc
     916        src/G4Fissioner.cc
     917        src/G4IBertini.cc
     918        src/G4IntraNucleiCascader.cc
     919        src/G4InuclCollider.cc
     920        src/G4InuclElementaryParticle.cc
     921        src/G4InuclEvaporation.cc
     922        src/G4InuclNuclei.cc
     923        src/G4InuclParticle.cc
     924        src/G4InuclSpecialFunctions.cc
     925        src/G4LorentzConvertor.cc
     926        src/G4NonEquilibriumEvaporator.cc
     927        src/G4NucleiModel.cc
     928        src/G4PreCompoundCascadeInterface.cc
     929        src/G4PreCompoundInuclCollider.cc
     930
     931The new code is not yet entirely "correct," since Bertini also does a lot of
     932operations by way of three-momentum, imposing masses (and hence energy
     933conservation) separately, after the fact.
     934
     93520 Jan 2010 Gabriele Cosmo
     936--------------------------
     937- G4InteractionCase.hh:  Minor fix in initialisation in constructor to
     938  allow for porting on C++0x Standard.
     939
     94020 Jan 2010 Michael Kelsey (hadr-casc-V09-03-02)
     941------------------------------------------------
     942- G4LorentzConvertor.hh:  Fix scm_momentum data member to be G4ThreeVector
     943  (as used in previous versions) rather than G4LorentzVector.
     944
     945NOTE:  I have *retagged* cascade/include/G4LorentzConverter.hh and this
     946       History file, rather than creating a new tag, since these are private
     947       development only, not public releases.
     948
     94912 Jan 2010 Michael Kelsey (hadr-casc-V09-03-02)
     950------------------------------------------------
     951All changes below within "cascade/" subdirectory:
     952
     953- G4CascadeMomentum: Replace use of static G4LV variables within functions
     954  with mutable data member of object; this does introduce more memory
     955  thrashing, but the plan is to get rid of the whole thing anyway.  Improve
     956  implicit casting and add assignment from G4LV.
     957
     958- G4LorentzConverter:  Change function signatures to accept G4LV as input,
     959  using implicit cast to convert existing G4CascadeMomentum argument
     960  passing.  Use G4LV internally throughout, again using implicit cast to
     961  return G4CascMom values.  This substantially increases (temporarily!)
     962  memory thrashing.  Simplify ::rotate() functions to use G4LV and
     963  G4ThreeVec operations rather than array index gymnastics.  Move some
     964  function implementations out of .hh file into .cc.
     965
     966- G4ParticleLargerEkin.hh: Fix use of CVS "Name" tag.  No code changes.
     967
     96812 Jan 2010 Michael Kelsey (hadr-casc-V09-03-01)
     969------------------------------------------------
     970All changes below within "cascade/" subdirectory:
     971
     972- G4ParticleLargerBeta, G4ParticleLargerEkin: Add additional operator()
     973  which takes pointers (for future mods to reduce ctor/dtor cycling), and
     974  fix ordering bug in beta sorting.  Add debugging printout togged with
     975  preprocessor flag.
     976
     977- G4InuclParticle, G4InuclNuclei, G4InuclElementaryParticle:  Rewrite to
     978  carry G4DynamicParticle data member, and to instantiate particle
     979  properties via G4ParticleDefinition subclasses.  This is first stage in
     980  eventually eliminating the G4InuclParticle stuff entirely in favor of
     981  direct use of G4DynamicParticle for internal propagation.
     982
     983These changes have been testing using debugging output on the production
     984(4.9.3) code compared to the above changes.  |diff| shows mostly identical
     985results, with occasional ~1e-5 floating point differences.
     986
     98708 Jan 2010 Michael Kelsey (hadr-casc-V09-03-00)
     988------------------------------------------------
     989All changes below within "cascade/" subdirectory:
     990
     991- G4BertiniNuclearModel:  REMOVE this class from the HEAD, and hopefully all
     992  future tags.  It is redundant with the G4NuclearModel class, and is not
     993  used anywhere in the G4 distribtion; the latter is referenced in both
     994  regular G4 code and in examples.
     995
     996- G4Diproton, G4Dineutron, G4UnboundPN:  New G4ParticleDefinition
     997  subclasses, which implement the Bertini-specific dibaryon states.  These
     998  are not used anywhere as yet, but will be used in future modifications to
     999  the G4InuclParticle subclasses.
     1000
     1001- G4CascadeMomentum:  Add interface to create from and cast to
     1002  G4LorentzVector.  Will be used (in future) by G4InuclParticle modifications,
     1003  and provides a transition to eliminating this class entirely.
    161004
    1710051 Dec 2009 Dennis Wright (hadr-casc-V09-02-11)
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4BigBanger.hh

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4BigBanger.hh,v 1.13 2010/05/21 17:56:34 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100315  M. Kelsey -- Remove "using" directive and unnecessary #includes.
     29// 20100407  M. Kelsey -- Replace std::vector<> returns with data members.
     30// 20100413  M. Kelsey -- Pass G4CollisionOutput by ref to ::collide()
     31// 20100517  M. Kelsey -- Inherit from common base class
     32// 20100519  M. Kelsey -- Get rid of proton and neutron masses as arguments!
     33
    2634#ifndef G4BIG_BANGER_HH
    2735#define G4BIG_BANGER_HH
    2836
    29 #include "G4Collider.hh"
     37#include "G4VCascadeCollider.hh"
    3038#include "G4InuclElementaryParticle.hh"
    31 #include "G4InuclSpecialFunctions.hh"
     39#include <vector>
     40
     41class G4CollisionOutput;
    3242
    3343
    34 using namespace G4InuclSpecialFunctions;
     44class G4BigBanger : public G4VCascadeCollider {
     45public:
     46  G4BigBanger();
     47  virtual ~G4BigBanger() {};
    3548
    36 class G4BigBanger {
    37 
    38 public:
    39 
    40   G4BigBanger();
    41 
    42   G4CollisionOutput collide(G4InuclParticle* bullet,
    43                             G4InuclParticle* target);
     49  void collide(G4InuclParticle* bullet, G4InuclParticle* target,
     50               G4CollisionOutput& output);
    4451
    4552private:
     53  void generateBangInSCM(G4double etot, G4double a, G4double z);
    4654
    47 G4int verboseLevel;
    48   std::vector<G4InuclElementaryParticle> generateBangInSCM(G4double etot,
    49                                                       G4double a,
    50                                                       G4double z,
    51                                                       G4double mp,
    52                                                       G4double mn) const;
    53 
    54   std::vector<G4double> generateMomentumModules(G4double etot,
    55                                            G4double a,
    56                                            G4double z,
    57                                            G4double mp,
    58                                            G4double mn) const;
     55  void generateMomentumModules(G4double etot, G4double a, G4double z);
    5956
    6057  G4double xProbability(G4double x,
     
    6764                     G4double promax) const;
    6865
     66  // Buffers for big-bang results
     67  std::vector<G4InuclElementaryParticle> particles;
     68  std::vector<G4double> momModules;
    6969};       
    7070
    71 #endif // G4BIG_BANGER_HH
     71#endif /* G4BIG_BANGER_HH */
    7272
    7373
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4CascadParticle.hh

    r1196 r1315  
     1#ifndef G4CASCAD_PARTICLE_HH
     2#define G4CASCAD_PARTICLE_HH
    13//
    24// ********************************************************************
     
    2325// * acceptance of all terms of the Geant4 Software license.          *
    2426// ********************************************************************
     27// $Id: G4CascadParticle.hh,v 1.14 2010/03/16 22:10:26 mkelsey Exp $
     28// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2529//
    26 #ifndef G4CASCAD_PARTICLE_HH
    27 #define G4CASCAD_PARTICLE_HH
     30// 20100112  M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
     31// 20100126  M. Kelsey -- Replace vector<G4Double> position with G4ThreeVector,
     32//              move ::print() to .cc file, fix uninitialized data members
    2833
    2934#include "G4InuclElementaryParticle.hh"
     35#include "G4LorentzVector.hh"
     36#include "G4ThreeVector.hh"
     37
    3038
    3139class G4CascadParticle {
    3240
    3341public:
    34 
     42  // NOTE:  Default constructor does not make a functional object!
    3543  G4CascadParticle();
    3644
    3745  G4CascadParticle(const G4InuclElementaryParticle& particle,
    38                    const std::vector<G4double>& pos,
     46                   const G4ThreeVector& pos,
    3947                   G4int izone,
    4048                   G4double cpath,
    4149                   G4int gen)
     50    : verboseLevel(0), theParticle(particle), position(pos),
     51      current_zone(izone), current_path(cpath), movingIn(true),
     52      reflectionCounter(0), reflected(false), generation(gen) {}
    4253
    43     : theParticle(particle),
    44     position(pos),
    45     current_zone(izone),
    46     current_path(cpath) {
    47     current_path = cpath;
    48     movingIn = true;
    49     reflectionCounter = 0;
    50     generation = gen;
    51   };
     54  void updateParticleMomentum(const G4LorentzVector& mom) {
     55    theParticle.setMomentum(mom);
     56  }
    5257
    53   void updateParticleMomentum(const G4CascadeMomentum& mom) {
    54     theParticle.setMomentum(mom);
    55   };
    56 
    57   void updatePosition(const std::vector<G4double>& pos) {
     58  void updatePosition(const G4ThreeVector& pos) {
    5859    position = pos;
    59   };
     60  }
    6061
    6162  void incrementReflectionCounter() {
    6263    reflectionCounter++;
    6364    reflected = true;
    64   };
     65  }
    6566
    6667  void resetReflection() {
    6768    reflected = false;
    68   };
     69  }
    6970
    7071  void incrementCurrentPath(G4double npath) {
    7172    current_path += npath;
    72   };
     73  }
    7374
    7475  void updateZone(G4int izone) {
    7576    current_zone = izone;
    76   };
     77  }
    7778
    7879  G4bool movingInsideNuclei() const {
    7980    return movingIn;
    80   };
     81  }
    8182
    8283  G4double getPathToTheNextZone(G4double rz_in,
    8384                                G4double rz_out);
    8485
    85   const G4CascadeMomentum& getMomentum() const {
     86  G4LorentzVector getMomentum() const {         // Can't return ref; temporary
    8687    return theParticle.getMomentum();
    87   };
     88  }
    8889
    89   G4InuclElementaryParticle getParticle() const {
     90  const G4InuclElementaryParticle& getParticle() const {
    9091    return theParticle;
    91   };
     92  }
    9293
    93   const std::vector<G4double>& getPosition() const {
     94  G4InuclElementaryParticle& getParticle() {
     95    return theParticle;
     96  }
     97
     98  const G4ThreeVector& getPosition() const {
    9499    return position;
    95   };
     100  }
    96101
    97102  G4int getCurrentZone() const {
    98103    return current_zone;
    99   };
     104  }
    100105
    101106  G4int getNumberOfReflections() const {
    102107    return reflectionCounter;
    103   };
     108  }
    104109
    105110  G4bool young(G4double young_path_cut,
    106111               G4double cpath) const {
    107    
    108     if(current_path < 1000.0) {
    109       return cpath < young_path_cut;
    110     }
    111     else {
    112       return false;
    113     };   
    114     // return current_path + cpath < young_path_cut;
    115   };
     112    return ((current_path < 1000.) && (cpath < young_path_cut));
     113  }
    116114
    117115  G4bool reflectedNow() const {
    118116    return reflected;
    119   };
     117  }
    120118
    121119  void propagateAlongThePath(G4double path);
    122120
    123   void print() const {
    124     theParticle.printParticle();
    125     G4cout << " zone " << current_zone << " current_path " << current_path
    126            << " reflectionCounter " << reflectionCounter << G4endl
    127            << " x " << position[0] << " y " << position[1]
    128            << " z " << position[2] << G4endl;
    129   };
     121  void print() const;
    130122
    131123  G4int getGeneration() {
     
    134126   
    135127private:
    136 
    137128  G4int verboseLevel;
    138129  G4InuclElementaryParticle theParticle;
    139   std::vector<G4double> position;
     130  G4ThreeVector position;
    140131  G4int current_zone;
    141132  G4double current_path;
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4CascadeChannel.hh

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4CascadeChannel.hh,v 1.6 2010/05/15 04:25:17 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100514  M. Kelsey -- All functionality removed except quantum-number
     29//              validation functions.
     30
    2631#ifndef G4_CASCADE_CHANNEL_HH
    2732#define G4_CASCADE_CHANNEL_HH
    2833
    2934#include "globals.hh"
     35#include "G4FastVector.hh"
     36#include "G4ReactionProduct.hh"
    3037#include <vector>
    3138
    32 class G4CascadeChannel {
     39namespace G4CascadeChannel {
     40  std::vector<G4int> getQnums(G4int type);
    3341
    34 public:
    35 
    36   static std::pair<G4int, G4double> interpolateEnergy(G4double ke);
    37   static G4int sampleFlat(std::vector<G4double> const& sigma);
    38   static std::vector<G4int> getQnums(G4int type);
    39 
    40 private:
    41   G4CascadeChannel(); // not implemented
    42 
    43   static const double energyScale[31];
    44 };       
     42  void CheckQnums(const G4FastVector<G4ReactionProduct,256> &vec,
     43                  G4int &vecLen,
     44                  G4ReactionProduct &currentParticle,
     45                  G4ReactionProduct &targetParticle,
     46                  G4double Q, G4double B, G4double S);
     47}
    4548
    4649#endif
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4CascadeData.hh

    r967 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4CascadeData.hh,v 1.5 2010/05/16 05:18:36 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100507  M. Kelsey -- Use template arguments to dimension const-refs
     29//              to arrays,for use in passing to functions as dimensioned.
     30//              Add two additional optional(!) template args for piN/NN.
     31//              Add new data member "sum" to separate summed xsec values
     32//              from measured inclusive (tot) cross-sections.  Add two
     33//              ctors to pass inclusive xsec array as input (for piN/NN).
     34
    2635#ifndef G4_CASCADE_DATA_HH
    2736#define G4_CASCADE_DATA_HH
    2837
    2938#include "globals.hh"
     39#include "G4CascadeSampler.hh"          /* To get number of energy bins */
    3040
    31 template <int n2, int n3, int n4, int n5, int n6, int n7, int nxs>
     41template <int NE,int N2,int N3,int N4,int N5,int N6,int N7,int N8=0,int N9=0>
    3242struct G4CascadeData
    3343{
    34   G4double *  tot;
     44  // NOTE: Need access to N2 by value to initialize index array
     45  enum { N02=N2, N23=N2+N3, N24=N23+N4, N25=N24+N5, N26=N25+N6, N27=N26+N7,
     46         N28=N27+N8, N29=N28+N9 };
    3547
    36   typedef G4double multiplicities_t[31];
    37   multiplicities_t * multiplicities;
     48  enum { N8D=N8?N8:1, N9D=N9?N9:1 };    // SPECIAL: Can't dimension arrays [0]
    3849
    39   typedef G4int index_t[2];
    40   index_t const * index;
     50  enum { NM=N9?8:N8?7:6, NXS=N29 };     // Multiplicity and cross-section bins
    4151
    42   typedef G4int x2bfs_t[2];
    43   x2bfs_t const * x2bfs;
     52  G4int index[NM+1];                    // Start and stop indices to xsec's
     53  G4double multiplicities[NM][NE];      // Multiplicity distributions
    4454
    45   typedef G4int x3bfs_t[3];
    46   x3bfs_t const * x3bfs;
     55  const G4int (&x2bfs)[N2][2];          // Initialized from file-scope inputs
     56  const G4int (&x3bfs)[N3][3];
     57  const G4int (&x4bfs)[N4][4];
     58  const G4int (&x5bfs)[N5][5];
     59  const G4int (&x6bfs)[N6][6];
     60  const G4int (&x7bfs)[N7][7];
     61  const G4int (&x8bfs)[N8D][8];         // These may not be used if mult==7
     62  const G4int (&x9bfs)[N9D][9];
     63  const G4double (&crossSections)[NXS][NE];
    4764
    48   typedef G4int x4bfs_t[4];
    49   x4bfs_t const * x4bfs;
     65  G4double sum[NE];                     // Summed cross-sections, computed
     66  const G4double (&tot)[NE];            // Inclusive cross-sections (from input)
    5067
    51   typedef G4int x5bfs_t[5];
    52   x5bfs_t const * x5bfs;
     68  static const G4int empty8bfs[1][8];   // For multiplicity==7 case
     69  static const G4int empty9bfs[1][9];
    5370
    54   typedef G4int x6bfs_t[6];
    55   x6bfs_t const * x6bfs;
     71  G4int maxMultiplicity() const { return NM+1; }  // Used by G4CascadeFunctions
    5672
    57   typedef G4int x7bfs_t[7];
    58   x7bfs_t const * x7bfs;
     73  // Constructor for kaon/hyperon channels, with multiplicity <= 7
     74  G4CascadeData(const G4int (&the2bfs)[N2][2], const G4int (&the3bfs)[N3][3],
     75                const G4int (&the4bfs)[N4][4], const G4int (&the5bfs)[N5][5],
     76                const G4int (&the6bfs)[N6][6], const G4int (&the7bfs)[N7][7],
     77                const G4double (&xsec)[NXS][NE])
     78    : x2bfs(the2bfs), x3bfs(the3bfs), x4bfs(the4bfs), x5bfs(the5bfs),
     79      x6bfs(the6bfs), x7bfs(the7bfs), x8bfs(empty8bfs), x9bfs(empty9bfs),
     80      crossSections(xsec), tot(sum) { initialize(); }
    5981
    60   typedef G4float crossSections_t[31];
    61   crossSections_t const * crossSections;
     82  // Constructor for kaon/hyperon channels, with multiplicity <= 7 and inclusive
     83  G4CascadeData(const G4int (&the2bfs)[N2][2], const G4int (&the3bfs)[N3][3],
     84                const G4int (&the4bfs)[N4][4], const G4int (&the5bfs)[N5][5],
     85                const G4int (&the6bfs)[N6][6], const G4int (&the7bfs)[N7][7],
     86                const G4double (&xsec)[NXS][NE], const G4double (&theTot)[NE])
     87    : x2bfs(the2bfs), x3bfs(the3bfs), x4bfs(the4bfs), x5bfs(the5bfs),
     88      x6bfs(the6bfs), x7bfs(the7bfs), x8bfs(empty8bfs), x9bfs(empty9bfs),
     89      crossSections(xsec), tot(theTot) { initialize(); }
    6290
    63   void initialize();
     91  // Constructor for pion/nuleon channels, with multiplicity > 7
     92  G4CascadeData(const G4int (&the2bfs)[N2][2], const G4int (&the3bfs)[N3][3],
     93                const G4int (&the4bfs)[N4][4], const G4int (&the5bfs)[N5][5],
     94                const G4int (&the6bfs)[N6][6], const G4int (&the7bfs)[N7][7],
     95                const G4int (&the8bfs)[N8D][8], const G4int (&the9bfs)[N9D][9],
     96                const G4double (&xsec)[NXS][NE])
     97    : x2bfs(the2bfs), x3bfs(the3bfs), x4bfs(the4bfs), x5bfs(the5bfs),
     98      x6bfs(the6bfs), x7bfs(the7bfs), x8bfs(the8bfs), x9bfs(the9bfs),
     99      crossSections(xsec), tot(sum) { initialize(); }
    64100
    65 //   G4double tot[31];
    66 //   G4double multiplicities[6][31];
    67 
    68 //   G4int index[6][2];
    69 //   G4int x2bfs[n2][2];
    70 //   G4int x3bfs[n3][3];
    71 //   G4int x4bfs[n4][4];
    72 //   G4int x5bfs[n5][5];
    73 //   G4int x6bfs[n6][6];
    74 //   G4int x7bfs[n7][7];
    75 
    76 //   G4float crossSections[nxs][31];
     101  // Constructor for pion/nuleon channels, with multiplicity > 7 and inclusive
     102  G4CascadeData(const G4int (&the2bfs)[N2][2], const G4int (&the3bfs)[N3][3],
     103                const G4int (&the4bfs)[N4][4], const G4int (&the5bfs)[N5][5],
     104                const G4int (&the6bfs)[N6][6], const G4int (&the7bfs)[N7][7],
     105                const G4int (&the8bfs)[N8D][8], const G4int (&the9bfs)[N9D][9],
     106                const G4double (&xsec)[NXS][NE], const G4double (&theTot)[NE])
     107    : x2bfs(the2bfs), x3bfs(the3bfs), x4bfs(the4bfs), x5bfs(the5bfs),
     108      x6bfs(the6bfs), x7bfs(the7bfs), x8bfs(the8bfs), x9bfs(the9bfs),
     109      crossSections(xsec), tot(theTot) { initialize(); }
     110  void initialize();                    // Fill summed arrays from input
    77111};
    78112
    79 template <int n2, int n3, int n4, int n5, int n6, int n7, int nxs>
    80 inline
    81 void
    82 G4CascadeData<n2, n3, n4, n5, n6, n7, nxs>::initialize()
    83 {
     113template <int NE,int N2,int N3,int N4,int N5,int N6,int N7,int N8,int N9> inline
     114void G4CascadeData<NE,N2,N3,N4,N5,N6,N7,N8,N9>::initialize() {
     115  // Initialize index offsets for cross-section array (can't do globally)
     116  index[0] = 0;   index[1] = N02; index[2] = N23; index[3] = N24;
     117  index[4] = N25; index[5] = N26; index[6] = N27;
     118  if (NM>6) index[7]=N28;
     119  if (NM>7) index[8]=N29;
     120
    84121  // Initialize multiplicity array
    85  
    86   for (G4int m = 0; m < 6; m++) {
    87     G4int start = index[m][0];
    88     G4int stop = index[m][1];
    89     for (G4int k = 0; k < 31; k++) {
     122  for (G4int m = 0; m < NM; m++) {
     123    G4int start = index[m];
     124    G4int stop = index[m+1];
     125    for (G4int k = 0; k < NE; k++) {
    90126      multiplicities[m][k] = 0.0;
    91127      for (G4int i = start; i < stop; i++) {
     
    96132 
    97133  // Initialize total cross section array
    98  
    99   for (G4int k = 0; k < 31; k++) {
    100     tot[k] = 0.0;
    101     for (G4int m = 0; m < 6; m++) {
    102       tot[k] += multiplicities[m][k];
     134  for (G4int k = 0; k < NE; k++) {
     135    sum[k] = 0.0;
     136    for (G4int m = 0; m < NM; m++) {
     137      sum[k] += multiplicities[m][k];
    103138    }
    104139  }
    105140}
    106141
     142// Dummy arrays for use when optional template arguments are skipped
     143template <int NE,int N2,int N3,int N4,int N5,int N6,int N7,int N8,int N9>
     144const G4int G4CascadeData<NE,N2,N3,N4,N5,N6,N7,N8,N9>::empty8bfs[1][8] = {{0}};
     145
     146template <int NE,int N2,int N3,int N4,int N5,int N6,int N7,int N8,int N9>
     147const G4int G4CascadeData<NE,N2,N3,N4,N5,N6,N7,N8,N9>::empty9bfs[1][9] = {{0}};
     148
    107149#endif
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4CascadeFunctions.hh

    r967 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4CascadeFunctions.hh,v 1.5 2010/05/14 21:05:03 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100407  M. Kelsey -- Return particle types std::vector<> by const ref,
     29//              using a static variable in the function as a buffer.
     30// 20100505  M. Kelsey -- Use new interpolator class, drop std::pair<>, move
     31//              sampleFlat(...) from G4CascadeChannel, move functionality
     32//              to new base class, to allow data-member buffers.  Move
     33//              function definitions to .icc file (needed with templating).
     34// 20100510  M. Kelsey -- Use both summed and inclusive cross-sections for
     35//              multiplicity, as done in G4{Pion,Nucleon}Sampler.  Support
     36//              up to 9-body final states.  Add second argument specifying
     37//              which Sampler is used.  Move implementations to .icc file.
     38// 20100511  M. Kelsey -- Pass "kinds" buffer as input to getOutputPartTypes
     39
    2640#ifndef G4_CASCADE_FUNCTIONS_HH
    2741#define G4_CASCADE_FUNCTIONS_HH
    2842
     43#include "globals.hh"
     44#include "Randomize.hh"
    2945#include <vector>
    30 #include "globals.hh"
    31 #include "G4CascadeChannel.hh"
    3246
    33 template <class T>
    34 class G4CascadeFunctions
    35 {
     47
     48template <class DATA, class SAMP>
     49class G4CascadeFunctions : public SAMP {
    3650public:
    37   static G4double getCrossSection(double ke);
     51  static G4double getCrossSection(double ke) {
     52    return instance.findCrossSection(ke, DATA::data.tot);
     53  }
     54
     55  static G4double getCrossSectionSum(double ke) {
     56    return instance.findCrossSection(ke, DATA::data.sum);
     57  }
     58
    3859  static G4int getMultiplicity(G4double ke);
    39   static std::vector<G4int> getOutgoingParticleTypes(G4int mult, G4double ke);
     60
     61  static void
     62  getOutgoingParticleTypes(std::vector<G4int>& kinds, G4int mult, G4double ke);
     63
     64private:
     65  G4CascadeFunctions() : SAMP() {}
     66  static const G4CascadeFunctions<DATA,SAMP> instance;
    4067};
    4168
    42 template <class T>
    43 inline
    44 G4double
    45 G4CascadeFunctions<T>::getCrossSection(double ke)
    46 {
    47   std::pair<G4int, G4double> epair = G4CascadeChannel::interpolateEnergy(ke);
    48   G4int k = epair.first;
    49   G4double fraction = epair.second;
    50   return T::data.tot[k] + fraction*(T::data.tot[k+1] - T::data.tot[k]);
    51 }
     69#include "G4CascadeFunctions.icc"
    5270
    53 template <class T>
    54 inline
    55 G4int
    56 G4CascadeFunctions<T>::getMultiplicity(G4double ke)
    57 {
    58   G4double multint(0.0);
    59   std::vector<G4double> sigma;
    60 
    61   std::pair<G4int, G4double> epair = G4CascadeChannel::interpolateEnergy(ke);
    62   G4int k = epair.first;
    63   G4double fraction = epair.second;
    64 
    65   for (G4int m = 0; m < 6; ++m)
    66     {
    67       multint = T::data.multiplicities[m][k]
    68         + fraction * (T::data.multiplicities[m][k+1] - T::data.multiplicities[m][k]);
    69       sigma.push_back(multint);
    70     }
    71  
    72   return G4CascadeChannel::sampleFlat(sigma);
    73 }
    74 
    75 template <class T>
    76 inline
    77 std::vector<G4int>
    78 G4CascadeFunctions<T>::getOutgoingParticleTypes(G4int mult, G4double ke)
    79 {
    80   G4int i;
    81   G4double sigint(0.);
    82   std::vector<G4double> sigma;
    83  
    84   std::pair<G4int, G4double> epair = G4CascadeChannel::interpolateEnergy(ke);
    85   G4int k = epair.first;
    86   G4double fraction = epair.second;
    87 
    88   G4int start = T::data.index[mult-2][0];
    89   G4int stop = T::data.index[mult-2][1];
    90  
    91   for (i = start; i < stop; i++) {
    92     sigint = T::data.crossSections[i][k]
    93       + fraction*(T::data.crossSections[i][k+1] - T::data.crossSections[i][k]);
    94     sigma.push_back(sigint);
    95   }
    96  
    97   G4int channel = G4CascadeChannel::sampleFlat(sigma);
    98 
    99   std::vector<G4int> kinds;
    100 
    101   if (mult == 2) {
    102     for(i = 0; i < mult; i++) kinds.push_back(T::data.x2bfs[channel][i]);
    103   } else if (mult == 3) {
    104     for(i = 0; i < mult; i++) kinds.push_back(T::data.x3bfs[channel][i]);
    105   } else if (mult == 4) {
    106     for(i = 0; i < mult; i++) kinds.push_back(T::data.x4bfs[channel][i]);
    107   } else if (mult == 5) {
    108     for(i = 0; i < mult; i++) kinds.push_back(T::data.x5bfs[channel][i]);
    109   } else if (mult == 6) {
    110     for(i = 0; i < mult; i++) kinds.push_back(T::data.x6bfs[channel][i]);
    111   } else if (mult == 7) {
    112     for(i = 0; i < mult; i++) kinds.push_back(T::data.x7bfs[channel][i]);
    113   } else {
    114     G4cout << " Illegal multiplicity " << G4endl;
    115   }
    116 
    117   return kinds;
    118 }
    119 
    120 
    121 #endif
     71#endif  /* G4_CASCADE_FUNCTIONS_HH */
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4CascadeInterface.hh

    r1196 r1315  
    2424// ********************************************************************
    2525//
    26 // $Id: G4CascadeInterface.hh,v 1.14 2009/09/24 20:48:02 dennis Exp $
     26// $Id: G4CascadeInterface.hh,v 1.16 2010/05/21 18:07:30 mkelsey Exp $
    2727// Defines an interface to Bertini (BERT) cascade
    2828// based on INUCL  intra-nuclear transport.models
    2929// with bullet hadron energy ~< 10 GeV
     30//
     31// 20100405  M. Kelsey -- Fix constness of op== and op!=
     32// 20100519  M. Kelsey -- Remove Collider data members
    3033
    3134#ifndef G4CASCADEINTERFACE_H
    3235#define G4CASCADEINTERFACE_H 1
    3336
     37#include "G4VIntraNuclearTransportModel.hh"
     38#include "G4FragmentVector.hh"
     39#include "G4KineticTrackVector.hh"
    3440#include "G4Nucleon.hh"
    3541#include "G4Nucleus.hh"
    36 #include "G4VIntraNuclearTransportModel.hh"
    37 #include "G4KineticTrackVector.hh"
    38 #include "G4FragmentVector.hh"
    3942#include "G4ParticleChange.hh"
     43#include "G4ReactionProduct.hh"
    4044#include "G4ReactionProductVector.hh"
    41 #include "G4ReactionProduct.hh"
    42 
    43 #include "G4ElementaryParticleCollider.hh"
    44 #include "G4NonEquilibriumEvaporator.hh"
    45 #include "G4EquilibriumEvaporator.hh"
    46 #include "G4Fissioner.hh"
    47 #include "G4BigBanger.hh"
    48 #include "G4IntraNucleiCascader.hh"
    4945
    5046
     
    5652  virtual ~G4CascadeInterface();
    5753
    58   G4ReactionProductVector* Propagate(G4KineticTrackVector* theSecondaries, G4V3DNucleus* theNucleus);
    59 
    60   G4HadFinalState* ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& theNucleus);
     54  G4ReactionProductVector* Propagate(G4KineticTrackVector* theSecondaries,
     55                                     G4V3DNucleus* theNucleus);
     56 
     57  G4HadFinalState* ApplyYourself(const G4HadProjectile& aTrack,
     58                                 G4Nucleus& theNucleus);
    6159
    6260private:
    63   G4int operator==(G4CascadeInterface& right) {
     61  G4int operator==(const G4CascadeInterface& right) const {
    6462    return (this == &right);
    6563  }
    6664
    67   G4int operator!=(G4CascadeInterface& right) {
     65  G4int operator!=(const G4CascadeInterface& right) const {
    6866    return (this != &right);
    6967  }
     
    7270
    7371private:
    74 
    75   G4ElementaryParticleCollider colep;
    76   G4NonEquilibriumEvaporator noneq;
    77   G4EquilibriumEvaporator eqil;
    78   G4Fissioner fiss;
    79   G4BigBanger bigb;
    80   G4IntraNucleiCascader inc;
    81 
    8272  G4HadFinalState theResult; 
    83 
    8473};
    8574
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4CascadeKminusNChannel.hh

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4CascadeKminusNChannel.hh,v 1.6 2010/05/15 00:55:01 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100507  M. Kelsey -- Remove redundant total-bins template argument
     29// 20100510  M. Kelsey -- Add initial "31" template arg.  Add G4CascSampler
     30//              to template for channel typedef
     31// 20100514  M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
     32
    2633#ifndef G4_CASCADE_KMINUSN_CHANNEL_HH
    2734#define G4_CASCADE_KMINUSN_CHANNEL_HH
    2835
    29 
    3036#include "G4CascadeData.hh"
    3137#include "G4CascadeFunctions.hh"
     38#include "G4KaonHypSampler.hh"
    3239
    3340struct G4CascadeKminusNChannelData {
    34   typedef G4CascadeData<5,15,28,42,20,11,121> data_t;
     41  typedef G4CascadeData<31,5,15,28,42,20,11> data_t;
    3542  static data_t data;
    3643};
    3744
    38 typedef G4CascadeFunctions<G4CascadeKminusNChannelData> G4CascadeKminusNChannel;
    39 
     45typedef G4CascadeFunctions<G4CascadeKminusNChannelData,G4KaonHypSampler> G4CascadeKminusNChannel;
    4046
    4147#endif
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4CascadeKminusPChannel.hh

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4CascadeKminusPChannel.hh,v 1.6 2010/05/15 00:55:01 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100507  M. Kelsey -- Remove redundant total-bins template argument
     29// 20100510  M. Kelsey -- Add initial "31" template arg.  Add G4CascSampler
     30//              to template for channel typedef
     31// 20100514  M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
     32
    2633#ifndef G4_CASCADE_KMINUSP_CHANNEL_HH
    2734#define G4_CASCADE_KMINUSP_CHANNEL_HH
     
    2936#include "G4CascadeData.hh"
    3037#include "G4CascadeFunctions.hh"
     38#include "G4KaonHypSampler.hh"
    3139
    3240struct  G4CascadeKminusPChannelData {
    33   typedef G4CascadeData<8,20,34,48,22,16,148> data_t;
     41  typedef G4CascadeData<31,8,20,34,48,22,16> data_t;
    3442  static data_t data;
    3543};
    3644
    37 typedef G4CascadeFunctions<G4CascadeKminusPChannelData> G4CascadeKminusPChannel;
     45typedef G4CascadeFunctions<G4CascadeKminusPChannelData,G4KaonHypSampler> G4CascadeKminusPChannel;
    3846
    3947#endif
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4CascadeKplusNChannel.hh

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4CascadeKplusNChannel.hh,v 1.6 2010/05/15 00:55:01 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100507  M. Kelsey -- Remove redundant total-bins template argument
     29// 20100510  M. Kelsey -- Add initial "31" template arg.  Add G4CascSampler
     30//              to template for channel typedef
     31// 20100514  M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
     32
    2633#ifndef G4_CASCADE_KPLUSN_CHANNEL_HH
    2734#define G4_CASCADE_KPLUSN_CHANNEL_HH
     
    2936#include "G4CascadeData.hh"
    3037#include "G4CascadeFunctions.hh"
     38#include "G4KaonHypSampler.hh"
    3139
    3240struct G4CascadeKplusNChannelData {
    33   typedef G4CascadeData<2,5,13,22,32,41,115> data_t;
     41  typedef G4CascadeData<31,2,5,13,22,32,41> data_t;
    3442  static data_t data;
    3543};
    3644
    37 typedef G4CascadeFunctions<G4CascadeKplusNChannelData> G4CascadeKplusNChannel;
     45typedef G4CascadeFunctions<G4CascadeKplusNChannelData,G4KaonHypSampler> G4CascadeKplusNChannel;
    3846
    3947#endif
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4CascadeKplusPChannel.hh

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4CascadeKplusPChannel.hh,v 1.6 2010/05/15 00:55:01 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100507  M. Kelsey -- Remove redundant total-bins template argument
     29// 20100510  M. Kelsey -- Add initial "31" template arg.  Add G4CascSampler
     30//              to template for channel typedef
     31// 20100514  M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
     32
    2633#ifndef G4_CASCADE_KPLUSP_CHANNEL_HH
    2734#define G4_CASCADE_KPLUSP_CHANNEL_HH
     
    2936#include "G4CascadeData.hh"
    3037#include "G4CascadeFunctions.hh"
    31 
     38#include "G4KaonHypSampler.hh"
    3239
    3340struct G4CascadeKplusPChannelData {
    34   typedef G4CascadeData<1,4,10,19,28,38,100> data_t;
     41  typedef G4CascadeData<31,1,4,10,19,28,38> data_t;
    3542  static data_t data;
    3643};
    3744
    38 typedef G4CascadeFunctions<G4CascadeKplusPChannelData> G4CascadeKplusPChannel;
     45typedef G4CascadeFunctions<G4CascadeKplusPChannelData,G4KaonHypSampler> G4CascadeKplusPChannel;
    3946
    4047#endif
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4CascadeKzeroBarNChannel.hh

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4CascadeKzeroBarNChannel.hh,v 1.6 2010/05/15 00:55:01 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100507  M. Kelsey -- Remove redundant total-bins template argument
     29// 20100510  M. Kelsey -- Add initial "31" template arg.  Add G4CascSampler
     30//              to template for channel typedef
     31// 20100514  M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
     32
    2633#ifndef G4_CASCADE_KZEROBARN_CHANNEL_HH
    2734#define G4_CASCADE_KZEROBARN_CHANNEL_HH
     
    2936#include "G4CascadeData.hh"
    3037#include "G4CascadeFunctions.hh"
     38#include "G4KaonHypSampler.hh"
    3139
    3240struct G4CascadeKzeroBarNChannelData {
    33   typedef G4CascadeData<8,20,34,48,22,16,148> data_t;
     41  typedef G4CascadeData<31,8,20,34,48,22,16> data_t;
    3442  static data_t data;
    3543};
    3644
    37 typedef G4CascadeFunctions<G4CascadeKzeroBarNChannelData> G4CascadeKzeroBarNChannel;
     45typedef G4CascadeFunctions<G4CascadeKzeroBarNChannelData,G4KaonHypSampler> G4CascadeKzeroBarNChannel;
    3846
    3947#endif
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4CascadeKzeroBarPChannel.hh

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4CascadeKzeroBarPChannel.hh,v 1.6 2010/05/15 00:55:01 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100507  M. Kelsey -- Remove redundant total-bins template argument
     29// 20100510  M. Kelsey -- Add initial "31" template arg.  Add G4CascSampler
     30//              to template for channel typedef
     31// 20100514  M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
     32
    2633#ifndef G4_CASCADE_KZEROBARP_CHANNEL_HH
    2734#define G4_CASCADE_KZEROBARP_CHANNEL_HH
     
    2936#include "G4CascadeData.hh"
    3037#include "G4CascadeFunctions.hh"
    31 
    32 
     38#include "G4KaonHypSampler.hh"
    3339
    3440struct G4CascadeKzeroBarPChannelData {
    35   typedef G4CascadeData<5,15,28,42,20,11,121> data_t;
     41  typedef G4CascadeData<31,5,15,28,42,20,11> data_t;
    3642  static data_t data;
    3743};
    3844
    39 typedef G4CascadeFunctions<G4CascadeKzeroBarPChannelData> G4CascadeKzeroBarPChannel;
     45typedef G4CascadeFunctions<G4CascadeKzeroBarPChannelData,G4KaonHypSampler> G4CascadeKzeroBarPChannel;
    4046
    4147#endif
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4CascadeKzeroNChannel.hh

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4CascadeKzeroNChannel.hh,v 1.6 2010/05/15 00:55:01 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100507  M. Kelsey -- Remove redundant total-bins template argument
     29// 20100510  M. Kelsey -- Add initial "31" template arg.  Add G4CascSampler
     30//              to template for channel typedef
     31// 20100514  M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
     32
    2633#ifndef G4_CASCADE_KZERON_CHANNEL_HH
    2734#define G4_CASCADE_KZERON_CHANNEL_HH
     
    2936#include "G4CascadeData.hh"
    3037#include "G4CascadeFunctions.hh"
    31 
     38#include "G4KaonHypSampler.hh"
    3239
    3340struct G4CascadeKzeroNChannelData {
    34   typedef G4CascadeData<1,4,10,19,28,38,100> data_t;
     41  typedef G4CascadeData<31,1,4,10,19,28,38> data_t;
    3542  static data_t data;
    3643};
    3744
    38 typedef G4CascadeFunctions<G4CascadeKzeroNChannelData> G4CascadeKzeroNChannel;
     45typedef G4CascadeFunctions<G4CascadeKzeroNChannelData,G4KaonHypSampler> G4CascadeKzeroNChannel;
    3946
    4047#endif
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4CascadeKzeroPChannel.hh

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4CascadeKzeroPChannel.hh,v 1.6 2010/05/15 00:55:01 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100507  M. Kelsey -- Remove redundant total-bins template argument
     29// 20100510  M. Kelsey -- Add initial "31" template arg.  Add G4CascSampler
     30//              to template for channel typedef
     31// 20100514  M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
     32
    2633#ifndef G4_CASCADE_KZEROP_CHANNEL_HH
    2734#define G4_CASCADE_KZEROP_CHANNEL_HH
     
    2936#include "G4CascadeData.hh"
    3037#include "G4CascadeFunctions.hh"
     38#include "G4KaonHypSampler.hh"
    3139
    3240struct G4CascadeKzeroPChannelData {
    33   typedef G4CascadeData<2,5,13,22,32,41,115> data_t;
     41  typedef G4CascadeData<31,2,5,13,22,32,41> data_t;
    3442  static data_t data;
    3543};
    3644
    37 typedef G4CascadeFunctions<G4CascadeKzeroPChannelData> G4CascadeKzeroPChannel;
     45typedef G4CascadeFunctions<G4CascadeKzeroPChannelData,G4KaonHypSampler> G4CascadeKzeroPChannel;
    3846
    3947#endif
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4CascadeLambdaNChannel.hh

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4CascadeLambdaNChannel.hh,v 1.6 2010/05/15 00:55:01 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100507  M. Kelsey -- Remove redundant total-bins template argument
     29// 20100510  M. Kelsey -- Add initial "31" template arg.  Add G4CascSampler
     30//              to template for channel typedef
     31// 20100514  M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
     32
    2633#ifndef G4_CASCADE_LAMBDAN_CHANNEL_HH
    2734#define G4_CASCADE_LAMBDAN_CHANNEL_HH
     
    2936#include "G4CascadeData.hh"
    3037#include "G4CascadeFunctions.hh"
    31 
     38#include "G4KaonHypSampler.hh"
    3239
    3340struct G4CascadeLambdaNChannelData {
    34   typedef G4CascadeData<3,12,33,59,30,20,157> data_t;
     41  typedef G4CascadeData<31,3,12,33,59,30,20> data_t;
    3542  static data_t data;
    3643};
    3744
    38 typedef G4CascadeFunctions<G4CascadeLambdaNChannelData> G4CascadeLambdaNChannel;
     45typedef G4CascadeFunctions<G4CascadeLambdaNChannelData,G4KaonHypSampler> G4CascadeLambdaNChannel;
    3946
    4047#endif
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4CascadeLambdaPChannel.hh

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4CascadeLambdaPChannel.hh,v 1.6 2010/05/15 00:55:01 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100507  M. Kelsey -- Remove redundant total-bins template argument
     29// 20100510  M. Kelsey -- Add initial "31" template arg.  Add G4CascSampler
     30//              to template for channel typedef
     31// 20100514  M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
     32
    2633#ifndef G4_CASCADE_LAMBDAP_CHANNEL_HH
    2734#define G4_CASCADE_LAMBDAP_CHANNEL_HH
     
    2936#include "G4CascadeData.hh"
    3037#include "G4CascadeFunctions.hh"
     38#include "G4KaonHypSampler.hh"
    3139
    3240struct G4CascadeLambdaPChannelData {
    33   typedef G4CascadeData<3,12,33,59,30,20,157> data_t;
     41  typedef G4CascadeData<31,3,12,33,59,30,20> data_t;
    3442  static data_t data;
    3543};
    3644
    37 typedef G4CascadeFunctions<G4CascadeLambdaPChannelData> G4CascadeLambdaPChannel;
     45typedef G4CascadeFunctions<G4CascadeLambdaPChannelData,G4KaonHypSampler> G4CascadeLambdaPChannel;
    3846
    3947#endif
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4CascadeMomentum.hh

    r1228 r1315  
    2424// ********************************************************************
    2525//
    26 // $Id: G4CascadeMomentum.hh,v 1.1 2008/09/22 10:06:32 gcosmo Exp $
    27 // GEANT4 tag $Name: geant4-09-03 $
    28 //
     26// $Id: G4CascadeMomentum.hh,v 1.5 2010/03/16 22:10:26 mkelsey Exp $
     27// GEANT4 tag $Name: geant4-09-04-beta-cand-01 $
    2928//
    3029// Class G4CascadeMomentum
     
    3534// std::vector<double> in the cascade mode code, which causes
    3635// problems for performance due to excess memory allocations.
    37 
     36//
     37// NOTE:  The Bertini code does not pass legitimate four-vectors when
     38//        creating new particles; the new getLV() function takes an
     39//        optional mass argument (in Bertini units [GeV]) so that a
     40//        valid G4LorentzVector can be returned.
     41//
    3842// Author: Peter Elmer, Princeton University                  7-Aug-2008
     43// Update: Michael Kelsey, SLAC (support G4LorentzVector)     8-Jan-2010
    3944// --------------------------------------------------------------------
    4045#ifndef G4CASCADE_MOMENTUM_HH
     
    4449
    4550#include "G4Types.hh"
     51#include "G4LorentzVector.hh"
     52#include "G4ThreeVector.hh"
    4653
    4754class G4CascadeMomentum
    4855{
    4956  public:
    50 
    5157    G4CascadeMomentum() {for (int i=0; i<4; ++i) data_[i]=0.0;}
    5258
    53     G4double& operator[](int i)
    54     {
     59    // WARNING!  This metric is (t,x,y,z), DIFFERENT FROM HepLV!
     60    G4CascadeMomentum(const G4LorentzVector& lv) {
     61      setLV(lv);
     62    }
     63
     64    G4double& operator[](int i) {
    5565      assert(i>=0 && i<4);
    5666      return data_[i];
    5767    }
    58     const G4double& operator[](int i) const
    59     {
     68    const G4double& operator[](int i) const {
    6069      assert(i>=0 && i<4);
    6170      return data_[i];
    6271    }
    6372
     73    operator const G4LorentzVector&() const {
     74      return getLV();                   // Casting can't do mass repairs
     75    }
     76
     77    const G4LorentzVector& getLV(G4double mass=-1.) const {
     78      if (mass>=0.) lv.setVectM(get3V(),mass);          // Force input mass!
     79      else lv.set(data_[1],data_[2],data_[3],data_[0]);
     80     
     81      return lv;
     82    }
     83
     84    G4ThreeVector get3V() const {
     85      return getLV().vect();
     86    }
     87
     88    void setLV(const G4LorentzVector& lv) {
     89      data_[0] = lv.t();                // NOTE DIFFERENT METRIC CONVENTION!
     90      data_[1] = lv.x();
     91      data_[2] = lv.y();
     92      data_[3] = lv.z();
     93    }
     94
     95    G4CascadeMomentum& operator=(const G4LorentzVector& lv) {
     96      setLV(lv);
     97      return *this;
     98    }
     99
    64100  private:
     101    G4double data_[4];
     102    mutable G4LorentzVector lv;         // Buffer for conversion operations
     103};
    65104
    66     G4double data_[4];
    67 };
    68105#endif
    69106
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4CascadeSigmaMinusNChannel.hh

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4CascadeSigmaMinusNChannel.hh,v 1.6 2010/05/15 00:55:01 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100507  M. Kelsey -- Remove redundant total-bins template argument
     29// 20100510  M. Kelsey -- Add initial "31" template arg.  Add G4CascSampler
     30//              to template for channel typedef
     31// 20100514  M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
     32
    2633#ifndef G4_CASCADE_SIGMAMINUSN_CHANNEL_HH
    2734#define G4_CASCADE_SIGMAMINUSN_CHANNEL_HH
     
    2936#include "G4CascadeData.hh"
    3037#include "G4CascadeFunctions.hh"
    31 
     38#include "G4KaonHypSampler.hh"
    3239
    3340struct G4CascadeSigmaMinusNChannelData {
    34   typedef G4CascadeData<1,6,20,42,25,17,111> data_t;
     41  typedef G4CascadeData<31,1,6,20,42,25,17> data_t;
    3542  static data_t data;
    3643};
    3744
    38 typedef G4CascadeFunctions<G4CascadeSigmaMinusNChannelData> G4CascadeSigmaMinusNChannel;
     45typedef G4CascadeFunctions<G4CascadeSigmaMinusNChannelData,G4KaonHypSampler> G4CascadeSigmaMinusNChannel;
    3946
    4047#endif
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4CascadeSigmaMinusPChannel.hh

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4CascadeSigmaMinusPChannel.hh,v 1.6 2010/05/15 00:55:01 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100507  M. Kelsey -- Remove redundant total-bins template argument
     29// 20100510  M. Kelsey -- Add initial "31" template arg.  Add G4CascSampler
     30//              to template for channel typedef
     31// 20100514  M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
     32
    2633#ifndef G4_CASCADE_SIGMAMINUSP_CHANNEL_HH
    2734#define G4_CASCADE_SIGMAMINUSP_CHANNEL_HH
     
    2936#include "G4CascadeData.hh"
    3037#include "G4CascadeFunctions.hh"
    31 
     38#include "G4KaonHypSampler.hh"
    3239
    3340struct G4CascadeSigmaMinusPChannelData {
    34   typedef G4CascadeData<3,12,33,59,30,20,157> data_t;
     41  typedef G4CascadeData<31,3,12,33,59,30,20> data_t;
    3542  static data_t data;
    3643};
    3744
    38 typedef G4CascadeFunctions<G4CascadeSigmaMinusPChannelData> G4CascadeSigmaMinusPChannel;
     45typedef G4CascadeFunctions<G4CascadeSigmaMinusPChannelData,G4KaonHypSampler> G4CascadeSigmaMinusPChannel;
    3946
    4047#endif
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4CascadeSigmaPlusNChannel.hh

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4CascadeSigmaPlusNChannel.hh,v 1.6 2010/05/15 00:55:01 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100507  M. Kelsey -- Remove redundant total-bins template argument
     29// 20100510  M. Kelsey -- Add initial "31" template arg.  Add G4CascSampler
     30//              to template for channel typedef
     31// 20100514  M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
     32
    2633#ifndef G4_CASCADE_SIGMAPLUSN_CHANNEL_HH
    2734#define G4_CASCADE_SIGMAPLUSN_CHANNEL_HH
     
    2936#include "G4CascadeData.hh"
    3037#include "G4CascadeFunctions.hh"
    31 
     38#include "G4KaonHypSampler.hh"
    3239
    3340struct G4CascadeSigmaPlusNChannelData {
    34   typedef G4CascadeData<3,12,33,59,30,20,157> data_t;
     41  typedef G4CascadeData<31,3,12,33,59,30,20> data_t;
    3542  static data_t data;
    3643};
    3744
    38 typedef G4CascadeFunctions<G4CascadeSigmaPlusNChannelData> G4CascadeSigmaPlusNChannel;
     45typedef G4CascadeFunctions<G4CascadeSigmaPlusNChannelData,G4KaonHypSampler> G4CascadeSigmaPlusNChannel;
    3946
    4047#endif
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4CascadeSigmaPlusPChannel.hh

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4CascadeSigmaPlusPChannel.hh,v 1.6 2010/05/15 00:55:01 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100507  M. Kelsey -- Remove redundant total-bins template argument
     29// 20100510  M. Kelsey -- Add initial "31" template arg.  Add G4CascSampler
     30//              to template for channel typedef
     31// 20100514  M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
     32
    2633#ifndef G4_CASCADE_SIGMAPLUSP_CHANNEL_HH
    2734#define G4_CASCADE_SIGMAPLUSP_CHANNEL_HH
     
    2936#include "G4CascadeData.hh"
    3037#include "G4CascadeFunctions.hh"
    31 
     38#include "G4KaonHypSampler.hh"
    3239
    3340struct G4CascadeSigmaPlusPChannelData {
    34   typedef G4CascadeData<1,6,20,42,25,17,111> data_t;
     41  typedef G4CascadeData<31,1,6,20,42,25,17> data_t;
    3542  static data_t data;
    3643};
    3744
    38 typedef G4CascadeFunctions<G4CascadeSigmaPlusPChannelData> G4CascadeSigmaPlusPChannel;
     45typedef G4CascadeFunctions<G4CascadeSigmaPlusPChannelData,G4KaonHypSampler> G4CascadeSigmaPlusPChannel;
    3946
    4047#endif
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4CascadeSigmaZeroNChannel.hh

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4CascadeSigmaZeroNChannel.hh,v 1.6 2010/05/15 00:55:01 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100507  M. Kelsey -- Remove redundant total-bins template argument
     29// 20100510  M. Kelsey -- Add initial "31" template arg.  Add G4CascSampler
     30//              to template for channel typedef
     31// 20100514  M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
     32
    2633#ifndef G4_CASCADE_SIGMAZERON_CHANNEL_HH
    2734#define G4_CASCADE_SIGMAZERON_CHANNEL_HH
     
    2936#include "G4CascadeData.hh"
    3037#include "G4CascadeFunctions.hh"
    31 
     38#include "G4KaonHypSampler.hh"
    3239
    3340struct G4CascadeSigmaZeroNChannelData {
    34   typedef G4CascadeData<3,12,33,59,30,20,157> data_t;
     41  typedef G4CascadeData<31,3,12,33,59,30,20> data_t;
    3542  static data_t data;
    3643};
    3744
    38 typedef G4CascadeFunctions<G4CascadeSigmaZeroNChannelData> G4CascadeSigmaZeroNChannel;
     45typedef G4CascadeFunctions<G4CascadeSigmaZeroNChannelData,G4KaonHypSampler> G4CascadeSigmaZeroNChannel;
    3946
    4047#endif
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4CascadeSigmaZeroPChannel.hh

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4CascadeSigmaZeroPChannel.hh,v 1.6 2010/05/15 00:55:01 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100507  M. Kelsey -- Remove redundant total-bins template argument
     29// 20100510  M. Kelsey -- Add initial "31" template arg.  Add G4CascSampler
     30//              to template for channel typedef
     31// 20100514  M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
     32
    2633#ifndef G4_CASCADE_SIGMAZEROP_CHANNEL_HH
    2734#define G4_CASCADE_SIGMAZEROP_CHANNEL_HH
     
    2936#include "G4CascadeData.hh"
    3037#include "G4CascadeFunctions.hh"
     38#include "G4KaonHypSampler.hh"
    3139
    3240struct G4CascadeSigmaZeroPChannelData {
    33   typedef G4CascadeData<3,12,33,59,30,20,157> data_t;
     41  typedef G4CascadeData<31,3,12,33,59,30,20> data_t;
    3442  static data_t data;
    3543};
    3644
    37 typedef G4CascadeFunctions<G4CascadeSigmaZeroPChannelData> G4CascadeSigmaZeroPChannel;
     45typedef G4CascadeFunctions<G4CascadeSigmaZeroPChannelData,G4KaonHypSampler> G4CascadeSigmaZeroPChannel;
    3846
    3947#endif
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4CascadeXiMinusNChannel.hh

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4CascadeXiMinusNChannel.hh,v 1.6 2010/05/15 00:55:01 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100507  M. Kelsey -- Remove redundant total-bins template argument
     29// 20100510  M. Kelsey -- Add initial "31" template arg.  Add G4CascSampler
     30//              to template for channel typedef
     31// 20100514  M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
     32
    2633#ifndef G4_CASCADE_XIMINUSN_CHANNEL_HH
    2734#define G4_CASCADE_XIMINUSN_CHANNEL_HH
     
    2936#include "G4CascadeData.hh"
    3037#include "G4CascadeFunctions.hh"
     38#include "G4KaonHypSampler.hh"
    3139
    3240struct G4CascadeXiMinusNChannelData {
    33   typedef G4CascadeData<3,18,53,2,2,2,80> data_t;
     41  typedef G4CascadeData<31,3,18,53,2,2,2> data_t;
    3442  static data_t data;
    3543};
    3644
    37 typedef G4CascadeFunctions<G4CascadeXiMinusNChannelData> G4CascadeXiMinusNChannel;
     45typedef G4CascadeFunctions<G4CascadeXiMinusNChannelData,G4KaonHypSampler> G4CascadeXiMinusNChannel;
    3846
    3947#endif
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4CascadeXiMinusPChannel.hh

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4CascadeXiMinusPChannel.hh,v 1.6 2010/05/15 00:55:01 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100507  M. Kelsey -- Remove redundant total-bins template argument
     29// 20100510  M. Kelsey -- Add initial "31" template arg.  Add G4CascSampler
     30//              to template for channel typedef
     31// 20100514  M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
     32
    2633#ifndef G4_CASCADE_XIMINUSP_CHANNEL_HH
    2734#define G4_CASCADE_XIMINUSP_CHANNEL_HH
     
    2936#include "G4CascadeData.hh"
    3037#include "G4CascadeFunctions.hh"
     38#include "G4KaonHypSampler.hh"
    3139
    3240struct G4CascadeXiMinusPChannelData {
    33   typedef G4CascadeData<6,24,4,4,4,4,46> data_t;
     41  typedef G4CascadeData<31,6,24,4,4,4,4> data_t;
    3442  static data_t data;
    3543};
    3644
    37 typedef G4CascadeFunctions<G4CascadeXiMinusPChannelData> G4CascadeXiMinusPChannel;
     45typedef G4CascadeFunctions<G4CascadeXiMinusPChannelData,G4KaonHypSampler> G4CascadeXiMinusPChannel;
    3846
    3947#endif
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4CascadeXiZeroNChannel.hh

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4CascadeXiZeroNChannel.hh,v 1.6 2010/05/15 00:55:01 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100507  M. Kelsey -- Remove redundant total-bins template argument
     29// 20100510  M. Kelsey -- Add initial "31" template arg.  Add G4CascSampler
     30//              to template for channel typedef
     31// 20100514  M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
     32
    2633#ifndef G4_CASCADE_XIZERON_CHANNEL_HH
    2734#define G4_CASCADE_XIZERON_CHANNEL_HH
     
    2936#include "G4CascadeData.hh"
    3037#include "G4CascadeFunctions.hh"
     38#include "G4KaonHypSampler.hh"
    3139
    3240
    3341struct G4CascadeXiZeroNChannelData {
    34   typedef G4CascadeData<6,24,4,4,4,4,46> data_t;
     42  typedef G4CascadeData<31,6,24,4,4,4,4> data_t;
    3543  static data_t data;
    3644};
    3745
    38 typedef G4CascadeFunctions<G4CascadeXiZeroNChannelData> G4CascadeXiZeroNChannel;
     46typedef G4CascadeFunctions<G4CascadeXiZeroNChannelData,G4KaonHypSampler> G4CascadeXiZeroNChannel;
    3947
    4048#endif
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4CascadeXiZeroPChannel.hh

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4CascadeXiZeroPChannel.hh,v 1.6 2010/05/15 00:55:01 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100507  M. Kelsey -- Remove redundant total-bins template argument
     29// 20100510  M. Kelsey -- Add initial "31" template arg.  Add G4CascSampler
     30//              to template for channel typedef
     31// 20100514  M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
     32
    2633#ifndef G4_CASCADE_XIZEROP_CHANNEL_HH
    2734#define G4_CASCADE_XIZEROP_CHANNEL_HH
     
    2936#include "G4CascadeData.hh"
    3037#include "G4CascadeFunctions.hh"
     38#include "G4KaonHypSampler.hh"
     39
    3140
    3241struct G4CascadeXiZeroPChannelData {
    33   typedef G4CascadeData<3,18,53,2,2,2,80> data_t;
     42  typedef G4CascadeData<31,3,18,53,2,2,2> data_t;
    3443  static data_t data;
    3544};
    3645
    37 typedef G4CascadeFunctions<G4CascadeXiZeroPChannelData> G4CascadeXiZeroPChannel;
     46typedef G4CascadeFunctions<G4CascadeXiZeroPChannelData,G4KaonHypSampler> G4CascadeXiZeroPChannel;
    3847
    3948#endif
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4CollisionOutput.hh

    r1196 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4CollisionOutput.hh,v 1.20 2010/05/21 18:07:30 mkelsey Exp $
     26// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100114  M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
     29// 20100407  M. Kelsey -- Replace ::resize(0) with ::clear()
     30// 20100409  M. Kelsey -- Move function code to .cc files, not inlinable
     31// 20100418  M. Kelsey -- Add function to boost output lists to lab frame
     32// 20100520  M. Kelsey -- Add function to rotate Z axis, from G4Casc.Interface
     33
    2634#ifndef G4COLLISION_OUTPUT_HH
    2735#define G4COLLISION_OUTPUT_HH
    2836
    29 #include <iostream>
    30 
    3137#include "G4InuclElementaryParticle.hh"
    3238#include "G4InuclNuclei.hh"
    33 
     39#include "G4LorentzRotation.hh"
    3440#include <algorithm>
    3541#include <vector>
     42
     43class G4LorentzConvertor;
    3644
    3745class G4CollisionOutput {
     
    4351  G4CollisionOutput& operator=(const G4CollisionOutput& right);
    4452
    45   void reset() {
    46     nucleiFragments.resize(0);
    47     outgoingParticles.resize(0);
    48  
    49   };
     53  void reset();
    5054
    5155  void addOutgoingParticle(const G4InuclElementaryParticle& particle) {
    5256    outgoingParticles.push_back(particle);
    53   };
     57  }
    5458
    55   void addOutgoingParticles(const std::vector<G4InuclElementaryParticle>& particles) {
    56     for(G4int i = 0; i < G4int(particles.size()); i++)
    57       outgoingParticles.push_back(particles[i]);
    58   };
     59  void addOutgoingParticles(const std::vector<G4InuclElementaryParticle>& particles);
    5960
    6061  void addTargetFragment(const G4InuclNuclei& nuclei) {
     
    6263  };
    6364
    64   void addTargetFragments(const std::vector<G4InuclNuclei>& nuclea) {
    65     for(G4int i = 0; i < G4int(nuclea.size()); i++)
    66       nucleiFragments.push_back(nuclea[i]);
    67   };
     65  void addTargetFragments(const std::vector<G4InuclNuclei>& nuclea);
    6866
    6967  const std::vector<G4InuclElementaryParticle>& getOutgoingParticles() const {
     
    7977  };
    8078
    81   G4CascadeMomentum getTotalOutputMomentum() const {
    82     G4CascadeMomentum tot_mom;
    83     double eex_r = 0.0;
    84     G4int i(0);
    85     for(i = 0; i < G4int(outgoingParticles.size()); i++) {
    86       const G4CascadeMomentum& mom = outgoingParticles[i].getMomentum();
    87       for(G4int j = 0; j < 4; j++) tot_mom[j] += mom[j];
    88     };
    89     for(i = 0; i < G4int(nucleiFragments.size()); i++) {
    90       const G4CascadeMomentum& mom = nucleiFragments[i].getMomentum();
    91       for(G4int j = 0; j < 4; j++) tot_mom[j] += mom[j];
    92       eex_r += 0.001 * nucleiFragments[i].getExitationEnergy();
    93     };
    94     tot_mom[0] += eex_r;
    95     return tot_mom;
    96   };
     79  G4LorentzVector getTotalOutputMomentum() const;
    9780
    98   void printCollisionOutput() const {
    99     G4cout << " Output: " << G4endl 
    100            << " Outgoing Particles: " << outgoingParticles.size() << G4endl;
    101     G4int i(0);
    102     for(i = 0; i < G4int(outgoingParticles.size()); i++) {
    103       outgoingParticles[i].printParticle();
    104     };
    105     G4cout << " Nuclei fragments: " << nucleiFragments.size() << G4endl;     
    106     for(i = 0; i < G4int(nucleiFragments.size()); i++) {
    107       nucleiFragments[i].printParticle();
    108     };
    109   };
     81  void printCollisionOutput() const;
     82
     83  void boostToLabFrame(const G4LorentzConvertor& convertor);
     84
     85  void rotateEvent(const G4LorentzRotation& rotate);
    11086
    11187  void trivialise(G4InuclParticle* bullet,
    112                   G4InuclParticle* target) {
    113     if(G4InuclNuclei* nuclei_target = dynamic_cast<G4InuclNuclei*>(target)) {     
    114       nucleiFragments.push_back(*nuclei_target);
    115     }
    116     else {
    117       G4InuclElementaryParticle* particle =
    118         dynamic_cast<G4InuclElementaryParticle*>(target);
    119       outgoingParticles.push_back(*particle);
    120     };
    121     if(G4InuclNuclei* nuclei_bullet = dynamic_cast<G4InuclNuclei*>(bullet)) {     
    122       nucleiFragments.push_back(*nuclei_bullet);
    123     }
    124     else {
    125       G4InuclElementaryParticle* particle =
    126         dynamic_cast<G4InuclElementaryParticle*>(bullet);
    127       outgoingParticles.push_back(*particle);
    128     };
    129   };
     88                  G4InuclParticle* target);
    13089
    13190  void setOnShell(G4InuclParticle* bullet,
    13291                  G4InuclParticle* target);
    13392
    134   void setRemainingExitationEnergy() {
    135     eex_rest = 0.0;
    136     for(G4int i = 0; i < G4int(nucleiFragments.size()); i++)
    137       eex_rest += 0.001 * nucleiFragments[i].getExitationEnergy();
    138   };
     93  void setRemainingExitationEnergy();
    13994
    14095  double getRemainingExitationEnergy() const {
     
    147102
    148103private:
    149 
    150 G4int verboseLevel;
     104  G4int verboseLevel;
    151105  std::vector<G4InuclElementaryParticle> outgoingParticles;
    152 
    153106  std::vector<G4InuclNuclei> nucleiFragments;
    154 
    155107  G4double eex_rest;
    156108
    157   std::pair<std::pair<G4int, G4int>, G4int> selectPairToTune(G4double de) const;
     109  std::pair<std::pair<G4int,G4int>, G4int> selectPairToTune(G4double de) const;
    158110
    159111  G4bool on_shell;
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4ElementaryParticleCollider.hh

    r1196 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4ElementaryParticleCollider.hh,v 1.31 2010/05/21 17:56:34 mkelsey Exp $
     26// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100114  M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
     29// 20100315  M. Kelsey -- Remove "using" directive and unnecessary #includes.
     30// 20100407  M. Kelsey -- Eliminate return-by-value std::vector<> by creating
     31//              three data buffers for particles, momenta, and particle types.
     32//              The following functions now return void and are non-const:
     33//                ::generateSCMfinalState()
     34//                ::generateMomModules() (also remove input vector)
     35//                ::generateStrangeChannelPartTypes()
     36//                ::generateSCMpionAbsorption()
     37// 20100413  M. Kelsey -- Pass G4CollisionOutput by ref to ::collide(); merge
     38//              public vs. private ::collide() functions.
     39// 20100511  M. Kelsey -- Remove G4PionSampler and G4NucleonSampler.  Expand
     40//              particle-types selector to all modes, not just strangeness.
     41// 20100517  M. Kelsey -- Inherit from common base class, make arrays static
     42
    2643#ifndef G4ELEMENTARY_PARTICLE_COLLIDER_HH
    2744#define G4ELEMENTARY_PARTICLE_COLLIDER_HH
    2845
    29 #include "G4Collider.hh"
     46#include "G4VCascadeCollider.hh"
    3047#include "G4InuclElementaryParticle.hh"
    31 #include "G4InuclSpecialFunctions.hh"
    32 #include "G4CascadSpecialFunctions.hh"
    33 #include "G4LorentzConvertor.hh"
    34 #include "G4NucleonSampler.hh"
    35 #include "G4PionSampler.hh"
     48#include "G4LorentzVector.hh"
     49#include <vector>
    3650
    37  
    38 using namespace G4InuclSpecialFunctions;
    39 using namespace G4CascadSpecialFunctions;
     51class G4LorentzConvertor;
     52class G4CollisionOutput;
    4053
    4154
    42 class G4ElementaryParticleCollider {
    43 
     55class G4ElementaryParticleCollider : public G4VCascadeCollider {
    4456public:
    45 
    4657  G4ElementaryParticleCollider();
    47 
    48   G4CollisionOutput collide(G4InuclParticle* bullet,
    49                             G4InuclParticle* target);
     58  virtual ~G4ElementaryParticleCollider() {};
     59 
     60  void collide(G4InuclParticle* bullet, G4InuclParticle* target,
     61               G4CollisionOutput& output);
    5062
    5163private:
    52 
    53   G4int verboseLevel;
    54 
    5564  void initializeArrays();
    5665
    5766  G4int generateMultiplicity(G4int is, G4double ekin) const;
    5867
    59   void collide(G4InuclElementaryParticle* bullet,
    60                G4InuclElementaryParticle* target,
    61                G4CollisionOutput& output);
     68  void generateOutgoingPartTypes(G4int is, G4int mult, G4double ekin);
    6269
    63      
    64   std::vector<G4InuclElementaryParticle>
    65   generateSCMfinalState(G4double ekin, G4double etot_scm, G4double pscm,             
    66                         G4InuclElementaryParticle* particle1,
    67                         G4InuclElementaryParticle* particle2,
    68                         G4LorentzConvertor* toSCM) const;
     70  void generateSCMfinalState(G4double ekin, G4double etot_scm, G4double pscm,
     71                             G4InuclElementaryParticle* particle1,
     72                             G4InuclElementaryParticle* particle2,
     73                             G4LorentzConvertor* toSCM);
     74
     75  void generateSCMpionAbsorption(G4double etot_scm,
     76                                 G4InuclElementaryParticle* particle1,
     77                                 G4InuclElementaryParticle* particle2);
     78
     79  void generateMomModules(G4int mult, G4int is, G4double ekin,
     80                          G4double etot_cm);
     81
     82  // Samples the CM momentum for elastic and charge exchange scattering
     83  //
     84  G4LorentzVector
     85  sampleCMmomentumFor2to2(G4int is, G4int kw, G4double ekin,
     86                          G4double pscm) const;
    6987
    7088
    71   std::vector<G4double>
    72   generateMomModules(const std::vector<G4int>& kinds, G4int mult,
    73                      G4int is, G4double ekin, G4double etot_cm) const;
     89  // Samples cos(theta) in the CM for elastic and charge exchange scattering
     90  //
     91  G4double sampleCMcosFor2to2(G4double pscm, G4double pFrac,
     92                              G4double pA, G4double pC, G4double pCos) const;
    7493
    7594
    76   G4CascadeMomentum
    77   particleSCMmomentumFor2to2(G4int is, G4int kw, G4double ekin,
    78                              G4double pscm) const;
    79 
    80 
    81   G4int getElasticCase(G4int is, G4int kw, G4double ekin) const;
    82 
    83 
    84   std::vector<G4int>
    85   generateStrangeChannelPartTypes(G4int is, G4int mult,
    86                                   G4double ekin) const;
    87 
    88 
    89   G4double
    90   getMomModuleFor2toMany(G4int is, G4int mult, G4int knd,
    91                          G4double ekin) const;
     95  G4double getMomModuleFor2toMany(G4int is, G4int mult, G4int knd,
     96                                  G4double ekin) const;
    9297
    9398
    9499  G4bool satisfyTriangle(const std::vector<G4double>& modules) const;
    95100       
    96   G4CascadeMomentum
     101  G4LorentzVector
    97102  particleSCMmomentumFor2to3(G4int is, G4int knd, G4double ekin,
    98103                             G4double pmod) const;
    99104
    100 
    101   std::pair<G4double, G4double>
    102   adjustIntervalForElastic(G4double ekin, G4double ak, G4double ae,
    103                            G4int k, G4int l, const std::vector<G4double>& ssv,
    104                            G4double st) const;
    105  
    106   std::vector<G4InuclElementaryParticle>
    107   generateSCMpionAbsorption(G4double etot_scm,
    108                             G4InuclElementaryParticle* particle1,
    109                             G4InuclElementaryParticle* particle2) const;
    110 
    111   G4NucleonSampler nucSampler;
    112   G4PionSampler piSampler;
     105  // Internal buffers for lists of secondaries
     106  std::vector<G4InuclElementaryParticle> particles;
     107  std::vector<G4double> modules;
     108  std::vector<G4int> particle_kinds;
    113109
    114110  // Parameter arrays
    115 
    116   G4double rmn[14][10][2];   
    117   G4double ang[4][4][13];
    118   G4double abn[4][4][4];
    119 
     111  static const G4double rmn[14][10][2];   
     112  static const G4double abn[4][4][4];
    120113};
    121114
    122 #endif // G4ELEMENTARY_PARTICLE_COLLIDER_HH
     115#endif  /* G4ELEMENTARY_PARTICLE_COLLIDER_HH */
    123116
    124117
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4EquilibriumEvaporator.hh

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4EquilibriumEvaporator.hh,v 1.11 2010/05/21 17:56:34 mkelsey Exp $
     26// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100413  M. Kelsey -- Pass G4CollisionOutput by ref to ::collide()
     29// 20100517  M. Kelsey -- Inherit from common base class, make other colliders
     30//              simple data members.  Rename timeToBigBang() to override
     31//              base explosion().
     32
    2633#ifndef G4EQUILIBRIUM_EVAPORATOR_HH
    2734#define G4EQUILIBRIUM_EVAPORATOR_HH
    2835
    29 #include "G4Collider.hh"
    30 #include "G4Fissioner.hh"
    31 #include "G4BigBanger.hh"
    32 #include "G4InuclSpecialFunctions.hh"
     36#include "G4VCascadeCollider.hh"
    3337
    34 using namespace G4InuclSpecialFunctions;
     38class G4CollisionOutput;
     39class G4Fissioner;
     40class G4BigBanger;
     41class G4InuclParticle;
    3542
    36 class G4EquilibriumEvaporator {
     43class G4EquilibriumEvaporator : public G4VCascadeCollider {
     44public:
     45  G4EquilibriumEvaporator();
     46  virtual ~G4EquilibriumEvaporator();
    3747
    38 public:
    39 
    40   G4EquilibriumEvaporator();
    41 
    42   void setFissioner(G4Fissioner* fissioner) {
    43     theFissioner = fissioner;
    44   };
    45 
    46   void setBigBanger(G4BigBanger* banger) {
    47     theBigBanger = banger;
    48   };
    49 
    50   G4CollisionOutput collide(G4InuclParticle* bullet,
    51                             G4InuclParticle* target);
     48  void collide(G4InuclParticle* bullet, G4InuclParticle* target,
     49               G4CollisionOutput& output);
    5250
    5351private:
    54 G4int verboseLevel;
     52  // Replace base class verision
     53  virtual G4bool explosion(G4InuclNuclei*) const { return false; }
     54  virtual G4bool explosion(G4double a,
     55                           G4double z,
     56                           G4double e) const;
     57
     58  G4bool goodRemnant(G4double a,
     59                     G4double z) const;
     60
    5561  G4double getE0(G4double A) const;
    5662
    5763  G4double getPARLEVDEN(G4double A,
    5864                        G4double Z) const;
    59 
    60   G4bool timeToBigBang(G4double a,
    61                        G4double z,
    62                        G4double e) const;
    63 
    64   G4bool goodRemnant(G4double a,
    65                      G4double z) const;
    6665
    6766  G4double getQF(G4double x,
     
    7877  G4Fissioner* theFissioner;
    7978  G4BigBanger* theBigBanger;
    80 
    8179};       
    8280
    83 #endif // G4EQUILIBRIUM_EVAPORATOR_HH
     81#endif /* G4EQUILIBRIUM_EVAPORATOR_HH */
    8482
    8583
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4EvaporationInuclCollider.hh

    r962 r1315  
    2424// ********************************************************************
    2525//
    26 // $Id: G4EvaporationInuclCollider.hh,v 1.2 2008/06/29 23:56:03 dennis Exp $
     26// $Id: G4EvaporationInuclCollider.hh,v 1.5 2010/05/21 17:56:34 mkelsey Exp $
     27// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
     28//
     29// 20100315  M. Kelsey -- Remove "using" directive and unnecessary #includes.
     30// 20100413  M. Kelsey -- Pass G4CollisionOutput by ref to ::collide()
     31// 20100517  M. Kelsey -- Inherit from common base class, make other colliders
     32//              simple data members
     33
    2734#ifndef G4EVAPORATIONINUCL_COLLIDER_HH
    2835#define G4EVAPORATIONINUCL_COLLIDER_HH
    2936 
    30 #include "G4Collider.hh"
     37#include "G4VCascadeCollider.hh"
    3138
    32 #include "G4EquilibriumEvaporator.hh"
    33 #include "G4Fissioner.hh"
    34 #include "G4BigBanger.hh"
     39class G4InuclParticle;
     40class G4CollisionOutput;
     41class G4EquilibriumEvaporator;
     42class G4BigBanger;
    3543
    36 #include "G4ElementaryParticleCollider.hh"
    37 #include "G4InteractionCase.hh"
    38 #include "G4InuclNuclei.hh"
    39 #include "G4InuclSpecialFunctions.hh"
    40 #include "G4Analyser.hh"
    41 
    42 using namespace G4InuclSpecialFunctions;
    43 
    44 class G4EvaporationInuclCollider {
    45 
     44class G4EvaporationInuclCollider : public G4VCascadeCollider {
    4645public:
    47 
    4846  G4EvaporationInuclCollider();
    4947
    50   G4EvaporationInuclCollider(G4EquilibriumEvaporator* eqevaporator, G4Fissioner* fissioner, G4BigBanger* bigbanger) {
    51 
    52     setEquilibriumEvaporator(eqevaporator, fissioner, bigbanger);
    53   };
    54 
    55   void setEquilibriumEvaporator(G4EquilibriumEvaporator* eqevaporator, G4Fissioner* fissioner, G4BigBanger* bigbanger) {
    56     theEquilibriumEvaporator = eqevaporator;
    57     theEquilibriumEvaporator->setFissioner(fissioner);   
    58     theEquilibriumEvaporator->setBigBanger(bigbanger);   
    59   };
    60 
    61   void setBigBanger(G4BigBanger* bigbanger) {
    62 
    63     theBigBanger = bigbanger;   
    64   };
    65  
    66   G4CollisionOutput collide(G4InuclParticle* bullet, G4InuclParticle* target);
     48  void collide(G4InuclParticle* bullet, G4InuclParticle* target,
     49               G4CollisionOutput& output);
    6750 
    6851private:
    69 
    70   G4int verboseLevel;
    71 
    72   G4bool inelasticInteractionPossible(G4InuclParticle* bullet,
    73                                       G4InuclParticle* target,
    74                                       G4double ekin) const;
    75 
    76   G4InteractionCase bulletTargetSetter(G4InuclParticle* bullet,
    77                                        G4InuclParticle* target) const;
    78 
    79   G4bool explosion(G4InuclNuclei* target) const;
    80        
    8152  G4EquilibriumEvaporator* theEquilibriumEvaporator;
    82   G4BigBanger* theBigBanger;
    83 
    8453};       
    8554
    86 #endif // G4EVAPORATIONINUCL_COLLIDER_HH
     55#endif /* G4EVAPORATIONINUCL_COLLIDER_HH */
    8756
    8857
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4Fissioner.hh

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4Fissioner.hh,v 1.12 2010/05/21 17:56:34 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100315  M. Kelsey -- Remove "using" directive and unnecessary #includes.
     29// 20100413  M. Kelsey -- Pass G4CollisionOutput by ref to ::collide()
     30// 20100517  M. Kelsey -- Inherit from common base class
     31
    2632#ifndef G4FISSIONER_HH
    2733#define G4FISSIONER_HH
    2834
    29 #include "G4Collider.hh"
    30 #include "G4InuclSpecialFunctions.hh"
     35#include "G4VCascadeCollider.hh"
     36#include <vector>
    3137
    32 using namespace G4InuclSpecialFunctions;
     38class G4CollisionOutput;
     39class G4InuclParticle;
    3340
    34 class G4Fissioner {
    3541
     42class G4Fissioner : public G4VCascadeCollider {
    3643public:
     44  G4Fissioner();
     45  virtual ~G4Fissioner() {}
    3746
    38   G4Fissioner();
    39 
    40   G4CollisionOutput collide(G4InuclParticle* bullet,
    41                             G4InuclParticle* target);
     47  void collide(G4InuclParticle* bullet, G4InuclParticle* target,
     48               G4CollisionOutput& output);
    4249
    4350private:
    44 G4int verboseLevel;
    4551  G4double getC2(G4double A1,
    4652                 G4double A2,
     
    6672                             std::vector<G4double>& BET1,
    6773                             G4double& R12) const;
    68 
    6974};       
    7075
    71 #endif // G4FISSIONER_HH
     76#endif /* G4FISSIONER_HH */
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4InteractionCase.hh

    r819 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4InteractionCase.hh,v 1.11 2010/05/21 17:56:34 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100518  M. Kelsey -- Why use std::pair<> at all?  Never exported; just
     29//              store pointers.  Add clear() function.  Move code from
     30//              Colliders' "bulletTargetSetter()" to set().
     31
    2632#ifndef G4INTERACTION_CASE_HH
    2733#define G4INTERACTION_CASE_HH
    2834
    29 //#ifndef G4INUCL_PARTICLE_HH
    30 #include "G4InuclParticle.hh"
    31 //#endif
     35#include "globals.hh"
    3236
    33 #include <algorithm>
     37class G4InuclParticle;
     38
    3439
    3540class G4InteractionCase {
     41public:
     42  G4InteractionCase() : bullet(0), target(0), inter_case(0) {}
    3643
    37 public:
     44  G4InteractionCase(G4InuclParticle* part1, G4InuclParticle* part2) {
     45    set(part1, part2);
     46  }
    3847
    39   G4InteractionCase() {
    40     bultag = std::pair<G4InuclParticle*, G4InuclParticle*>(0, 0);
     48  void set(G4InuclParticle* part1, G4InuclParticle* part2);
     49
     50  void clear() {
     51    bullet = target = 0;
    4152    inter_case = 0;
    42   };
     53  }
    4354
    44   G4InteractionCase(G4InuclParticle* part1,
    45                     G4InuclParticle* part2,
    46                     G4int ic) {
    47     setBulletTarget(part1, part2);
    48     setInterCase(ic);
    49   };
     55  G4InuclParticle* getBullet() const { return bullet; }
     56  G4InuclParticle* getTarget() const { return target; }
    5057
    51   void setBulletTarget(G4InuclParticle* part1,
    52                        G4InuclParticle* part2) {
    53     bultag = std::pair<G4InuclParticle*, G4InuclParticle*>(part1, part2);
    54   };
     58  G4bool valid() const      { return inter_case != 0; }
    5559
    56   void setInterCase(G4int ic) {
    57     inter_case = ic;
    58   };
     60  G4bool twoNuclei() const  { return inter_case == -2; }
     61  G4bool hadNucleus() const { return inter_case == -1; }
     62  G4int  hadrons() const    { return inter_case; }      // "rtype" or "is" code
    5963
    60   G4InuclParticle* getBullet() const {
    61     return bultag.first;
    62   };
    63 
    64   G4InuclParticle* getTarget() const {
    65     return bultag.second;
    66   };
    67 
    68   G4int getInterCase() const {
    69     return inter_case;
    70   };
     64  // For compatibility with G4IntraNucleiCascader code
     65  G4int  code() const { return ((inter_case<0) ? -inter_case : 0); }
    7166
    7267private:
    73 
    74   std::pair<G4InuclParticle*, G4InuclParticle*> bultag;
     68  G4InuclParticle* bullet;
     69  G4InuclParticle* target;
    7570
    7671  G4int inter_case;
    77 
    7872};
    7973
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4IntraNucleiCascader.hh

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4IntraNucleiCascader.hh,v 1.10 2010/05/21 17:56:34 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100315  M. Kelsey -- Remove "using" directory and unnecessary #includes.
     29// 20100413  M. Kelsey -- Pass G4CollisionOutput by ref to ::collide()
     30// 20100517  M. Kelsey -- Inherit from common base class, make other colliders
     31//              simple data members
     32
    2633#ifndef G4INTRA_NUCLEI_CASCADER_HH
    2734#define G4INTRA_NUCLEI_CASCADER_HH
    2835
    29 #include "G4Collider.hh"
    30 #include "G4ElementaryParticleCollider.hh"
    31 #include "G4InuclSpecialFunctions.hh"
    32 #include "G4CascadSpecialFunctions.hh"
    33 #include "G4InuclElementaryParticle.hh"
     36#include "G4VCascadeCollider.hh"
    3437
    35 using namespace G4InuclSpecialFunctions;
    36 using namespace G4CascadSpecialFunctions;
     38class G4CollisionOutput;
     39class G4ElementaryParticleCollider;
     40class G4InuclParticle;
    3741
    38 class G4IntraNucleiCascader {
    3942
     43class G4IntraNucleiCascader : public G4VCascadeCollider {
    4044public:
     45  G4IntraNucleiCascader();
     46  virtual ~G4IntraNucleiCascader();
    4147
    42   G4IntraNucleiCascader();
     48  void collide(G4InuclParticle* bullet, G4InuclParticle* target,
     49               G4CollisionOutput& output);
    4350
    44   void setElementaryParticleCollider(G4ElementaryParticleCollider* ecollider) {
    45     theElementaryParticleCollider = ecollider;   
    46   };
    47  
    48   G4CollisionOutput collide(G4InuclParticle* bullet,
    49                             G4InuclParticle* target);
    50 
     51  // FIXME:  This should come from (or be determined by) G4InteractionCase
    5152  void setInteractionCase(G4int intcase) {
    5253    inter_case = intcase;
     
    5455
    5556private:
    56 G4int verboseLevel;
    5757  G4ElementaryParticleCollider* theElementaryParticleCollider;
    5858
     59  // FIXME:  This should come from (or be determined by) G4InteractionCase
    5960  G4int inter_case;
    6061
    6162  G4bool goodCase(G4double a, G4double z, G4double eexs, G4double ein) const;
    62 
    6363};       
    6464
    65 #endif // G4INTRA_NUCLEI_CASCADER_HH
     65#endif /* G4INTRA_NUCLEI_CASCADER_HH */
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4InuclCollider.hh

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4InuclCollider.hh,v 1.13 2010/05/21 17:56:34 mkelsey Exp $
     26// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100413  M. Kelsey -- Pass G4CollisionOutput by ref to ::collide()
     29// 20100517  M. Kelsey -- Inherit from common base class, make other colliders
     30//              simple data members
     31
    2632#ifndef G4INUCL_COLLIDER_HH
    2733#define G4INUCL_COLLIDER_HH
    28  
    29 #include "G4Collider.hh"
    30 #include "G4IntraNucleiCascader.hh"
    31 #include "G4NonEquilibriumEvaporator.hh"
    32 #include "G4EquilibriumEvaporator.hh"
    33 #include "G4Fissioner.hh"
    34 #include "G4BigBanger.hh"
    35 #include "G4ElementaryParticleCollider.hh"
    36 #include "G4InteractionCase.hh"
    37 #include "G4InuclNuclei.hh"
    38 #include "G4InuclSpecialFunctions.hh"
    39 #include "G4Analyser.hh"
    4034
    41 using namespace G4InuclSpecialFunctions;
     35#include "G4VCascadeCollider.hh"
    4236
    43 class G4InuclCollider {
     37class G4BigBanger;
     38class G4CollisionOutput;
     39class G4ElementaryParticleCollider;
     40class G4EquilibriumEvaporator;
     41class G4IntraNucleiCascader;
     42class G4InuclParticle;
     43class G4NonEquilibriumEvaporator;
     44
     45
     46class G4InuclCollider : public G4VCascadeCollider {
    4447
    4548public:
    4649
    4750  G4InuclCollider();
     51  virtual ~G4InuclCollider();
    4852
    49   G4InuclCollider(G4ElementaryParticleCollider* ecollider,
    50                   G4IntraNucleiCascader* incascader,
    51                   G4NonEquilibriumEvaporator* noeqevaporator,
    52                   G4EquilibriumEvaporator* eqevaporator,
    53                   G4Fissioner* fissioner,
    54                   G4BigBanger* bigbanger) {
    55 
    56     setElementaryParticleCollider(ecollider);
    57     setIntraNucleiCascader(incascader,ecollider);
    58     setNonEquilibriumEvaporator(noeqevaporator);
    59     setEquilibriumEvaporator(eqevaporator, fissioner, bigbanger);
    60     setBigBanger(bigbanger);
    61 
    62   };
    63 
    64   void setElementaryParticleCollider(G4ElementaryParticleCollider* ecollider) {
    65 
    66     theElementaryParticleCollider = ecollider;   
    67   };
    68 
    69   void setIntraNucleiCascader(G4IntraNucleiCascader* incascader,
    70                               G4ElementaryParticleCollider* ecollider) {
    71 
    72     theIntraNucleiCascader = incascader;
    73     theIntraNucleiCascader->setElementaryParticleCollider(ecollider);
    74   };
    75 
    76   void setNonEquilibriumEvaporator(G4NonEquilibriumEvaporator* noeqevaporator) {
    77 
    78     theNonEquilibriumEvaporator = noeqevaporator;   
    79   };
    80 
    81   void setEquilibriumEvaporator(G4EquilibriumEvaporator* eqevaporator,
    82                                 G4Fissioner* fissioner,
    83                                 G4BigBanger* bigbanger) {
    84 
    85     theEquilibriumEvaporator = eqevaporator;
    86     theEquilibriumEvaporator->setFissioner(fissioner);   
    87     theEquilibriumEvaporator->setBigBanger(bigbanger);   
    88   };
    89 
    90   void setBigBanger(G4BigBanger* bigbanger) {
    91 
    92     theBigBanger = bigbanger;   
    93   };
    94  
    95   G4CollisionOutput collide(G4InuclParticle* bullet,
    96                             G4InuclParticle* target);
     53  void collide(G4InuclParticle* bullet, G4InuclParticle* target,
     54               G4CollisionOutput& output);
    9755
    9856private:
    99 
    100   G4int verboseLevel;
    101 
    102   G4bool inelasticInteractionPossible(G4InuclParticle* bullet,
    103                                       G4InuclParticle* target,
    104                                       G4double ekin) const;
    105 
    106   G4InteractionCase bulletTargetSetter(G4InuclParticle* bullet,
    107                                        G4InuclParticle* target) const;
    108 
    109   G4bool explosion(G4InuclNuclei* target) const;
    110        
    11157  G4ElementaryParticleCollider* theElementaryParticleCollider;
    11258  G4IntraNucleiCascader* theIntraNucleiCascader;
     
    11460  G4EquilibriumEvaporator* theEquilibriumEvaporator;
    11561  G4BigBanger* theBigBanger;
    116 
    11762};       
    11863
    119 #endif // G4INUCL_COLLIDER_HH
     64#endif /* G4INUCL_COLLIDER_HH */
    12065
    12166
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4InuclElementaryParticle.hh

    r1196 r1315  
     1#ifndef G4INUCL_ELEMENTARY_PARTICLE_HH
     2#define G4INUCL_ELEMENTARY_PARTICLE_HH
    13//
    24// ********************************************************************
     
    2325// * acceptance of all terms of the Geant4 Software license.          *
    2426// ********************************************************************
     27// $Id: G4InuclElementaryParticle.hh,v 1.22 2010/04/29 19:39:55 mkelsey Exp $
     28// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2529//
    26 #ifndef G4INUCL_ELEMENTARY_PARTICLE_HH
    27 #define G4INUCL_ELEMENTARY_PARTICLE_HH
     30// 20100114  M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
     31// 20100409  M. Kelsey -- Drop unused string argument from ctors.
     32// 20100429  M. Kelsey -- Change "photon()" to "isPhoton()", use enum names
    2833
    29 
     34#include "G4InuclParticle.hh"
     35#include "G4InuclParticleNames.hh"
    3036#include "globals.hh"
    3137
    32 #ifndef G4INUCL_PARTICLE_HH
    33 #include "G4InuclParticle.hh"
    34 #endif
     38class G4ParticleDefinition;
    3539
    3640class G4InuclElementaryParticle : public G4InuclParticle {
     41public:
     42  G4InuclElementaryParticle()
     43    : G4InuclParticle(), generation(0) {}
    3744
    38 //                     known particle types:
    39 //      1 - proton          11 - k+         111 - quasideuteron PP
    40 //      2 - neutron         13 - k-         112 - quasideuteron PN
    41 //      3 - pi+             15 - k0         122 - quasideuteron NN
    42 //      5 - pi-             17 - k0bar
    43 //      7 - pi 0            21 - lambda
    44 //     10 - photon          23 - sigma+
    45 //                          25 - sigma0
    46 //                          27 - sigma-
    47 //                          29 - xi0
    48 //                          31 - xi-
    49  
    50 public:
     45  explicit G4InuclElementaryParticle(G4int type)
     46    : G4InuclParticle(makeDefinition(type)), generation(0) {}
    5147
    52   G4InuclElementaryParticle() {
    53     particleType = 0;     // DHW: added to keep 4.3 compiler happy
    54     particleMass = 0.;    //            "              "
    55     valid_particle = false;
    56     generation = 0;
    57   };
     48  G4InuclElementaryParticle(const G4LorentzVector& mom,
     49                            G4int type, G4int model=0)
     50    : G4InuclParticle(makeDefinition(type), mom), generation(0) {
     51    setModel(model);
     52  }
    5853
    59   G4InuclElementaryParticle(G4int type)
    60     : particleType(type) {
     54  G4InuclElementaryParticle(G4double ekin, G4int type)
     55    : G4InuclParticle(makeDefinition(type), ekin), generation(0) {}
    6156
    62     particleMass = getParticleMass(type);
    63     valid_particle = false;
    64   };
     57  // Copy and assignment constructors for use with std::vector<>
     58  G4InuclElementaryParticle(const G4InuclElementaryParticle& right)
     59    : G4InuclParticle(right), generation(right.generation) {}
    6560
    66   G4InuclElementaryParticle(const G4CascadeMomentum& mom,
    67                             G4int type)
    68     : G4InuclParticle(mom),
    69       particleType(type) {
     61  G4InuclElementaryParticle& operator=(const G4InuclElementaryParticle& right);
    7062
    71     particleMass = getParticleMass(type);
    72     momentum[0] = std::sqrt(momentum[1] * momentum[1] + momentum[2] * momentum[2] +
    73                        momentum[3] * momentum[3] + particleMass * particleMass);
    74     valid_particle = true;
    75   };
     63  void setType(G4int ityp);
     64  G4int type() const { return type(getDefinition()); }
    7665
    77  
    78   G4InuclElementaryParticle(const G4CascadeMomentum& mom,
    79                             G4int type, G4int model)
    80     : G4InuclParticle(mom),
    81       particleType(type) {
     66  static G4int type(const G4ParticleDefinition* pd);
    8267
    83     G4InuclParticle::setModel(model);
     68  G4bool isPhoton() const { return (type() == G4InuclParticleNames::photon); }
    8469
    85     particleMass = getParticleMass(type);
    86     momentum[0] = std::sqrt(momentum[1] * momentum[1] + momentum[2] * momentum[2] +
    87                        momentum[3] * momentum[3] + particleMass * particleMass);
    88     valid_particle = true;
    89   };
     70  G4bool pion() const { return (type()==G4InuclParticleNames::pionPlus ||
     71                                type()==G4InuclParticleNames::pionMinus ||
     72                                type()==G4InuclParticleNames::pionZero); }
    9073
    91   G4InuclElementaryParticle(G4double ekin,
    92                             G4int type)
    93     : particleType(type) {
     74  G4bool nucleon() const { return (type()==G4InuclParticleNames::proton ||
     75                                   type()==G4InuclParticleNames::neutron); }
    9476
    95     particleMass = getParticleMass(type);
    96     momentum[0] = ekin + particleMass;
    97     momentum[3] = std::sqrt(momentum[0] * momentum[0] - particleMass * particleMass);
    98     momentum[1] = momentum[2] = 0.0;
    99     valid_particle = true;
    100   };
     77  G4int baryon() const {                // Can use as a bool (!=0 ==> true)
     78    return getDefinition()->GetBaryonNumber();
     79  }
    10180
    102   void setType(G4int ityp) {
     81  G4bool quasi_deutron() const { return (type() > 100); }
    10382
    104     particleType = ityp;
    105     particleMass = getParticleMass(ityp);
    106   };
    107 
    108   void setMomentum(const G4CascadeMomentum& mom) {
    109 
    110     momentum = mom;
    111     momentum[0] = std::sqrt(momentum[1] * momentum[1] + momentum[2] * momentum[2] +
    112                        momentum[3] * momentum[3] + particleMass * particleMass);
    113     valid_particle = true;
    114   };
    115 
    116   G4int type() const {
    117 
    118     return particleType;
    119   };
    120 
    121   G4bool photon() const {
    122 
    123     return particleType == 10;
    124   };
    125 
    126   G4bool nucleon() const {
    127     return particleType <= 2;
    128   };
    129 
    130   G4bool baryon() const {
    131     return (particleType == 1  ||
    132             particleType == 2  ||
    133             particleType == 21 ||
    134             particleType == 23 ||
    135             particleType == 25 ||
    136             particleType == 27 ||
    137             particleType == 29 ||
    138             particleType == 31 );
    139   };
    140 
    141   G4bool pion() const {
    142 
    143     return particleType == 3 || particleType == 5 || particleType == 7;
    144   };
    145 
    146   G4bool quasi_deutron() const {
    147 
    148     return particleType > 100;
    149   };
    150 
    151   G4double getMass() const {
    152 
    153     return particleMass;
    154   };
    155 
    156   G4double getParticleMass() const {
    157 
    158     G4double mass;
    159 
    160     switch(particleType) {
    161     case 1: // proton
    162       mass = 0.93827;
    163       break;
    164     case 2: // neutron
    165       mass = 0.93957;
    166       break;
    167     case 3: // pi+
    168       mass = 0.13957;
    169       break;
    170     case 5: // pi-
    171       mass = 0.13957;
    172       break;
    173     case 7: // pi0
    174       mass = 0.13498;
    175       break;
    176     case 10: // photon
    177       mass = 0.0;
    178       break;
    179     case 11: // k+
    180       mass = 0.49368;
    181       break;
    182     case 13: // k-
    183       mass = 0.49368;
    184       break;
    185     case 15: // k0
    186       mass = 0.49767;
    187       break;
    188     case 17: // k0bar
    189       mass = 0.49767;
    190       break;
    191     case 21: // lambda
    192       mass = 1.1157;
    193       break;
    194     case 23: // sigma+
    195       mass = 1.1894;
    196       break;
    197     case 25: // sigma0
    198       mass = 1.1926;
    199       break;
    200     case 27: // sigma-
    201       mass = 1.1974;
    202       break;
    203     case 29: // xi0
    204       mass = 1.3148;
    205       break;
    206     case 31: // xi-
    207       mass = 1.3213;
    208       break;
    209     case 111: // PP
    210       mass = 0.93827 + 0.93827;
    211       break;
    212     case 112: // PN
    213       mass = 0.93827 + 0.93957;
    214       break;
    215     case 122: // NN
    216       mass = 0.93957 + 0.93957;
    217       break;
    218     default:
    219       G4cout << " uups, unknown particle type " << particleType << G4endl;
    220       mass = 0.;
    221     };
    222        
    223     return mass;
    224   };
    225 
    226   G4double getCharge() const {
    227 
    228     G4double charge;
    229 
    230     switch(particleType) {
    231     case 1: // proton
    232       charge = 1.0;
    233       break;
    234     case 2: // neutron
    235       charge = 0.0;
    236       break;
    237     case 3: // pi+
    238       charge = 1.0;
    239       break;
    240     case 5: // pi-
    241       charge = -1.0;
    242       break;
    243     case 7: // pi0
    244       charge = 0.0;
    245       break;
    246     case 10: // photon
    247       charge = 0.0;
    248       break;
    249     case 11: // k+
    250       charge = 1.0;
    251       break;
    252     case 13: // k-
    253       charge = -1.0;
    254       break;
    255     case 15: // k0
    256       charge = 0.0;
    257       break;
    258     case 17: // k0bar
    259       charge = 0.0;
    260       break;
    261     case 21: // lambda
    262       charge = 0.0;
    263       break;
    264     case 23: // sigma+
    265       charge = 1.0;
    266       break;
    267     case 25: // sigma0
    268       charge = 0.0;
    269       break;
    270     case 27: // sigma-
    271       charge = -1.0;
    272       break;
    273     case 29: // xi0
    274       charge = 0.0;
    275       break;
    276     case 31: // xi-
    277       charge = -1.0;
    278       break;
    279     case 111: // PP
    280       charge = 2.0;
    281       break;
    282     case 112: // PN
    283       charge = 1.0;
    284       break;
    285     case 122: // NN
    286       charge = 0.0;
    287       break;
    288     default:
    289       G4cout << " uups, unknown particle type " << particleType << G4endl;
    290       charge = 0.0;
    291     };
    292        
    293     return charge;
    294   };
    295 
    296 
    297   G4double getStrangeness(G4int type) const {
    298 
    299     G4double strangeness;
    300 
    301     switch(type) {
    302     case 1: // proton
    303       strangeness = 0.0;
    304       break;
    305     case 2: // neutron
    306       strangeness = 0.0;
    307       break;
    308     case 3: // pi+
    309       strangeness = 0.0;
    310       break;
    311     case 5: // pi-
    312       strangeness = 0.0;
    313       break;
    314     case 7: // pi0
    315       strangeness = 0.0;
    316       break;
    317     case 10: // photon
    318       strangeness = 0.0;
    319       break;
    320     case 11: // k+
    321       strangeness = 1.0;
    322       break;
    323     case 13: // k-
    324       strangeness = -1.0;
    325       break;
    326     case 15: // k0
    327       strangeness = 1.0;
    328       break;
    329     case 17: // k0bar
    330       strangeness = -1.0;
    331       break;
    332     case 21: // lambda
    333       strangeness = -1.0;
    334       break;
    335     case 23: // sigma+
    336       strangeness = -1.0;
    337       break;
    338     case 25: // sigma0
    339       strangeness = -1.0;
    340       break;
    341     case 27: // sigma-
    342       strangeness = -1.0;
    343       break;
    344     case 29: // xi0
    345       strangeness = -2.0;
    346       break;
    347     case 31: // xi-
    348       strangeness = -2.0;
    349       break;
    350     case 111: // PP
    351       strangeness = 0.0;
    352       break;
    353     case 112: // PN
    354       strangeness = 0.0;
    355       break;
    356     case 122: // NN
    357       strangeness = 0.0;
    358       break;
    359     default:
    360       G4cout << " unknown particle type " << type << G4endl;
    361       strangeness = 0.0;
    362     };
    363        
    364     return strangeness;
    365   };
    366 
    367 
    368   G4double getParticleMass(G4int type) const {
    369 
    370     G4double mass;
    371 
    372     switch(type) {
    373     case 1: // proton
    374       mass = 0.93827;
    375       break;
    376     case 2: // neutron
    377       mass = 0.93957;
    378       break;
    379     case 3: // pi+
    380       mass = 0.13957;
    381       break;
    382     case 5: // pi-
    383       mass = 0.13957;
    384       break;
    385     case 7: // pi0
    386       mass = 0.13498;
    387       break;
    388     case 10: // photon
    389       mass = 0.0;
    390       break;
    391     case 11: // k+
    392       mass = 0.49368;
    393       break;
    394     case 13: // k-
    395       mass = 0.49368;
    396       break;
    397     case 15: // k0
    398       mass = 0.49767;
    399       break;
    400     case 17: // k0bar
    401       mass = 0.49767;
    402       break;
    403     case 21: // lambda
    404       mass = 1.1157;
    405       break;
    406     case 23: // sigma+
    407       mass = 1.1894;
    408       break;
    409     case 25: // sigma0
    410       mass = 1.1926;
    411       break;
    412     case 27: // sigma-
    413       mass = 1.1974;
    414       break;
    415     case 29: // xi0
    416       mass = 1.3148;
    417       break;
    418     case 31: // xi-
    419       mass = 1.3213;
    420       break;
    421     case 111: // PP
    422       mass = 0.93827 + 0.93827;
    423       break;
    424     case 112: // PN
    425       mass = 0.93827 + 0.93957;
    426       break;
    427     case 122: // NN
    428       mass = 0.93957 + 0.93957;
    429       break;
    430     default:
    431       G4cout << " uups, unknown particle type " << type << G4endl;
    432       mass = 0.0;
    433     };
    434        
    435     return mass;
    436   };
    437 
    438   G4double getKineticEnergy() const {
    439 
    440     return momentum[0] - particleMass;
    441   };
    442 
    443   G4double getEnergy() const {
    444 
    445     return momentum[0];
    446   };
    447 
    448   G4bool valid() const {
    449 
    450     return valid_particle;
    451   };
     83  G4bool valid() const { return type()>0; }
    45284
    45385  virtual void printParticle() const {
    454 
    45586    G4InuclParticle::printParticle();
    456 
    457     G4cout << " Particle: type " << particleType << " mass " << particleMass <<
    458       " ekin " << getKineticEnergy() << G4endl;
    459   };
    460 
    461   void setGeneration(G4int gen) {
    462     generation = gen;
     87    G4cout << " Particle: type " << type() << " mass " << getMass()
     88           << " ekin " << getKineticEnergy() << G4endl;
    46389  }
    46490
    465   G4int getGeneration() {
    466     return generation;
    467   }
     91  void setGeneration(G4int gen) { generation = gen; }
     92  G4int getGeneration() const { return generation; }
     93
     94  static G4double getStrangeness(G4int type);
     95  static G4double getParticleMass(G4int type);
     96
     97protected:
     98  // Convert internal type code to standard GEANT4 pointer
     99  static G4ParticleDefinition* makeDefinition(G4int ityp);
    468100
    469101private:
    470 
    471   G4int particleType;
    472 
    473   G4double particleMass;
    474 
    475   G4bool valid_particle;
    476 
    477102  G4int generation;
    478 
    479103};       
    480104
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4InuclEvaporation.hh

    r819 r1315  
    2424// ********************************************************************
    2525//
    26 // $Id: G4InuclEvaporation.hh,v 1.5 2007/05/24 23:27:01 miheikki Exp $
     26// $Id: G4InuclEvaporation.hh,v 1.8 2010/05/21 18:07:30 mkelsey Exp $
    2727// Defines an interface to evaporation models of Bertini cascase (BERT)
    2828// based on INUCL code.
    2929//
     30// 20100405  M. Kelsey -- Pass const-ref std::vector<>
     31// 20100517  M. Kelsey -- MakeG4EvaporationInuclCollider a data member.
     32// 20100520  M. Kelsey -- Clean up interface
     33
    3034#ifndef G4INUCLEVAPORATION_h
    3135#define G4INUCLEVAPORATION_h 1
     
    3539#include "G4Fragment.hh"
    3640
    37 //#define DEBUG
     41class G4EvaporationInuclCollider;
     42
    3843
    3944class G4InuclEvaporation : public G4VEvaporation {
     
    4954  G4bool operator!=(const G4InuclEvaporation &right) const;
    5055
    51   void fillResult( std::vector< G4DynamicParticle * > secondaryParticleVector,
    52                    G4FragmentVector * aResult );
    5356public:
    54 
    5557  G4FragmentVector * BreakItUp(const G4Fragment &theNucleus);
    56        
     58     
    5759  void setVerboseLevel( const G4int verbose );
    5860
    5961private:
    6062  G4int verboseLevel;
    61 
    62 #ifdef DEBUG
    63 
    64 #endif
    65 
     63  G4EvaporationInuclCollider* evaporator;
    6664};
    6765
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4InuclNuclei.hh

    r962 r1315  
     1#ifndef G4INUCL_NUCLEI_HH
     2#define G4INUCL_NUCLEI_HH
    13//
    24// ********************************************************************
     
    2325// * acceptance of all terms of the Geant4 Software license.          *
    2426// ********************************************************************
     27// $Id: G4InuclNuclei.hh,v 1.16 2010/04/09 19:33:11 mkelsey Exp $
     28// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2529//
    26 #ifndef G4INUCL_NUCLEI_HH
    27 #define G4INUCL_NUCLEI_HH
     30// 20100112  Michael Kelsey -- Replace G4CascadeMomentum with G4LorentzVector
     31// 20100301  M. Kelsey -- Add function to create unphysical nuclei for use
     32//           as temporary final-state fragments.
     33// 20100319  M. Kelsey -- Remove "using" directory and unnecessary #includes.
     34// 20100409  M. Kelsey -- Drop unused string argument from ctors.
    2835
    29 #ifndef G4INUCL_PARTICLE_HH
    3036#include "G4InuclParticle.hh"
    31 #endif
    3237#include "G4ExitonConfiguration.hh"
    33 #include "G4InuclSpecialFunctions.hh"
    3438
    35 using namespace G4InuclSpecialFunctions;
     39class G4ParticleDefinition;
    3640
    3741class G4InuclNuclei : public G4InuclParticle {
     42public:
     43  G4InuclNuclei() : G4InuclParticle() {}
    3844
    39 public:
     45  G4InuclNuclei(G4double a, G4double z)
     46    : G4InuclParticle(makeDefinition(a,z)),
     47      exitationEnergy(0.0) {}
    4048
    41   G4InuclNuclei() {};
     49  G4InuclNuclei(const G4LorentzVector& mom, G4double a, G4double z)
     50    : G4InuclParticle(makeDefinition(a,z), mom),
     51      exitationEnergy(0.0) {}
    4252
    43   G4InuclNuclei(G4double a,
    44                 G4double z)
    45     : A(a),
    46       Z(z) {
     53  G4InuclNuclei(G4double ekin, G4double a, G4double z)
     54    : G4InuclParticle(makeDefinition(a,z), ekin),
     55      exitationEnergy(0.0) {}
    4756
    48     setNucleiMass();
    49     exitationEnergy = 0.0;
    50   };
     57  virtual ~G4InuclNuclei() {}
    5158
    52   G4InuclNuclei(const G4CascadeMomentum& mom,
    53                 G4double a,
    54                 G4double z)
    55     : G4InuclParticle(mom),
    56       A(a),
    57       Z(z) {
     59  // Copy and assignment constructors for use with std::vector<>
     60  G4InuclNuclei(const G4InuclNuclei& right)
     61    : G4InuclParticle(right), exitationEnergy(right.exitationEnergy),
     62      theExitonConfiguration(right.theExitonConfiguration) {}
    5863
    59     setNucleiMass(); 
    60     exitationEnergy = 0.0;
    61   };
     64  G4InuclNuclei& operator=(const G4InuclNuclei& right);
    6265
    63   G4InuclNuclei(G4double ekin,
    64                 G4double a,
    65                 G4double z)
    66     : A(a),
    67     Z(z) {
    68 
    69     setNucleiMass();
    70     G4CascadeMomentum mom;
    71     mom[0] = ekin + nucleiMass;
    72     mom[3] = std::sqrt(mom[0] * mom[0] - nucleiMass * nucleiMass);
    73     G4InuclParticle::setMomentum(mom);
    74     exitationEnergy = 0.0;
    75   };
    76        
    77   void setA(G4double a) {
    78 
    79     A = a;
    80   };
    81 
    82   void setZ(G4double z) {
    83 
    84     Z = z;
    85   };
    86 
    87   void setExitationEnergy(G4double e) {
    88 
    89     exitationEnergy = e;
    90   };
    91 
    92   void setEnergy() {
    93 
    94     momentum[0] = std::sqrt(momentum[1] * momentum[1] + momentum[2] * momentum[2] +
    95                        momentum[3] * momentum[3] + nucleiMass * nucleiMass); 
    96   };
    97 
    98   void setNucleiMass() {
    99 
    100     nucleiMass = 0.93827 * Z + 0.93957 * (A - Z) - 0.001 * bindingEnergy(A, Z);
    101   };
     66  void setExitationEnergy(G4double e) { exitationEnergy = e; }
    10267
    10368  void setExitonConfiguration(const G4ExitonConfiguration& config) {
     69    theExitonConfiguration = config;
     70  }
    10471
    105     theExitonConfiguration = config;
    106   };
     72  G4double getA() const { return getDefinition()->GetAtomicMass(); }
    10773
    108   G4double getA() const {
     74  G4double getZ() const { return getDefinition()->GetAtomicNumber(); }
    10975
    110     return A;
    111   };
    112 
    113   G4double getZ() const {
    114 
    115     return Z;
    116   };
    117 
    118   G4double getExitationEnergy() const {
    119 
    120     return exitationEnergy;
    121   };
     76  G4double getExitationEnergy() const { return exitationEnergy; }
    12277
    12378  G4double getExitationEnergyInGeV() const {
     79    return 0.001 * exitationEnergy;
     80  }
    12481
    125     return 0.001 * exitationEnergy;
    126   };
     82  const G4ExitonConfiguration& getExitonConfiguration() const {
     83    return theExitonConfiguration;
     84  }
    12785
    128   G4ExitonConfiguration getExitonConfiguration() const {
    129 
    130     return theExitonConfiguration;
    131   };
    132 
    133   G4double getMass() const {
    134 
    135     return nucleiMass;
    136   };
    137 
    138   G4double getKineticEnergy() const {
    139 
    140     return momentum[0] - nucleiMass;
    141   };
    142 
    143   G4double getNucleiMass(G4double a,
    144                          G4double z) const {
    145 
    146     return 0.93827 * z + 0.93957 * (a - z) - 0.001 * bindingEnergy(a, z);
    147   };
     86  static G4double getNucleiMass(G4double a, G4double z);
    14887
    14988  virtual void printParticle() const {
     89    G4cout << " A " << getA() << " Z " << getZ() << " mass "
     90           << getMass() << " Eex (MeV) " << exitationEnergy << G4endl;
     91    G4InuclParticle::printParticle();
     92  }
    15093
    151     G4cout << " A " << A << " Z " << Z << " mass " << nucleiMass <<
    152       " Eex (MeV) " << exitationEnergy << G4endl;
     94protected:
     95  // Convert nuclear configuration to standard GEANT4 pointer
     96  static G4ParticleDefinition*
     97  makeDefinition(G4double a, G4double z, G4double exc=0.);
    15398
    154     G4cout << " Px " << momentum[1] << " Py " << momentum[2] << " Pz " << 
    155         momentum[3] <<  " E " << momentum[0] << G4endl;
    156   };
     99  static G4ParticleDefinition*
     100  makeNuclearFragment(G4double a, G4double z, G4double exc=0.);
    157101
    158102private:
    159 
    160   G4double A;
    161   G4double Z;
    162103  G4double exitationEnergy;
    163   G4double nucleiMass;
    164104  G4ExitonConfiguration theExitonConfiguration;
    165 
    166105};       
    167106
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4InuclParticle.hh

    r962 r1315  
     1#ifndef G4INUCL_PARTICLE_HH
     2#define G4INUCL_PARTICLE_HH
    13//
    24// ********************************************************************
     
    2325// * acceptance of all terms of the Geant4 Software license.          *
    2426// ********************************************************************
     27// $Id: G4InuclParticle.hh,v 1.19 2010/05/21 18:07:30 mkelsey Exp $
     28// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2529//
    26 #ifndef G4INUCL_PARTICLE_HH
    27 #define G4INUCL_PARTICLE_HH
     30// 20100112  M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
     31// 20100409  M. Kelsey -- Drop unused string argument from ctors.
     32// 20100519  M. Kelsey -- Add public access to G4DynamicParticle content
    2833
    29 #ifndef GLOB
     34#include "G4DynamicParticle.hh"
     35#include "G4LorentzVector.hh"
    3036#include "globals.hh"
    31 #endif
    3237
    33 #include <iostream>
    34 #include <vector>
    35 #include "G4CascadeMomentum.hh"
    36 
    37 // Notice: no cc-file for G4InuclParticle
    3838
    3939class G4InuclParticle {
     40public:
     41  G4InuclParticle() : modelId(0) {}
    4042
    41 public:
    42   G4InuclParticle() {
    43     setModel(0); // default model
    44   };
     43  explicit G4InuclParticle(const G4LorentzVector& mom) : modelId(0) {
     44    pDP.Set4Momentum(mom*GeV/MeV);              // From Bertini to G4 units
     45  }
    4546
    46   virtual ~G4InuclParticle() { };
    47  
    48   G4InuclParticle(const G4CascadeMomentum& mom) {
    49     setMomentum(mom);
    50     setModel(0);
    51   };
     47  virtual ~G4InuclParticle() {}
    5248
    53   void setMomentum(const G4CascadeMomentum& mom) {
    54     momentum = mom;
    55   };
     49  // Copy and assignment constructors for use with std::vector<>
     50  G4InuclParticle(const G4InuclParticle& right)
     51    : pDP(right.pDP), modelId(right.modelId) {}
    5652
     53  G4InuclParticle& operator=(const G4InuclParticle& right);
    5754
    58   const G4CascadeMomentum& getMomentum() const {
    59     return momentum;
    60   };
     55  // This is no longer required, as setMomentum() handles mass adjustment
     56  void setEnergy() { ; }
    6157
    62   G4double getMomModule() const {
    63     return std::sqrt(momentum[1] * momentum[1] +
    64                      momentum[2] * momentum[2] +
    65                      momentum[3] * momentum[3]);
    66   };
    67    
    68   virtual void printParticle() const {
    69     G4cout << " px " << momentum[1] << " py " << momentum[2] <<
    70       " pz " << momentum[3] <<
    71       " pmod " << std::sqrt(momentum[1] * momentum[1] +
    72                             momentum[2] * momentum[2] +
    73                             momentum[3] * momentum[3])
    74            << " E " << momentum[0]
    75            << " creator model " << modelId << G4endl;
    76   };
     58  // These are call-throughs to G4DynamicParticle
     59  void setMomentum(const G4LorentzVector& mom);
    7760
    78   void setModel(G4int model) {
    79     modelId = model;
    80   };
     61  void setMass(G4double mass) { pDP.SetMass(mass*GeV/MeV); }
    8162
    82   G4int getModel() {
    83     return modelId;
    84   };
     63  G4double getMass() const {
     64    return pDP.GetMass()*MeV/GeV;               // From G4 to Bertini units
     65  }
     66
     67  G4double getCharge() const {
     68    return pDP.GetCharge();
     69  }
     70
     71  G4double getKineticEnergy() const {
     72    return pDP.GetKineticEnergy()*MeV/GeV;      // From G4 to Bertini units
     73  }
     74
     75  G4double getEnergy() const {
     76    return pDP.GetTotalEnergy()*MeV/GeV;        // From G4 to Bertini units
     77  }
     78
     79  G4double getMomModule() const {
     80    return pDP.GetTotalMomentum()*MeV/GeV;      // From G4 to Bertini units
     81  }
     82
     83  G4LorentzVector getMomentum() const {
     84    return pDP.Get4Momentum()*MeV/GeV;          // From G4 to Bertini units
     85  }
     86
     87  virtual void printParticle() const;
     88
     89  void setModel(G4int model) { modelId = model; }
     90
     91  G4int getModel() const { return modelId; }
     92
     93  G4ParticleDefinition* getDefinition() const {
     94    return pDP.GetDefinition();
     95  }
     96
     97  const G4DynamicParticle& getDynamicParticle() const {
     98    return pDP;
     99  }
    85100
    86101protected:
    87   G4CascadeMomentum momentum;
     102  //  Special constructors for subclasses to set particle type correctly
     103  explicit G4InuclParticle(G4ParticleDefinition* pd) : modelId(0) {
     104    setDefinition(pd);
     105  }
     106
     107  // FIXME: Bertini code doesn't pass valid 4-vectors, so force mass value
     108  //        from supplied PartDefn, with required unit conversions
     109  G4InuclParticle(G4ParticleDefinition* pd, const G4LorentzVector& mom);
     110
     111  // NOTE:  Momentum forced along Z direction
     112  G4InuclParticle(G4ParticleDefinition* pd, G4double ekin)
     113    : pDP(pd,G4ThreeVector(0.,0.,1.),ekin*GeV/MeV), modelId(0) {}
     114
     115  void setDefinition(G4ParticleDefinition* pd) { pDP.SetDefinition(pd); }
    88116
    89117private:
    90   G4int modelId; // used to indicate model that created instance of G4InuclParticle
     118  G4DynamicParticle pDP;                // Carries all the kinematics and info
    91119
     120  G4int modelId;
     121  // used to indicate model that created instance of G4InuclParticle
    92122  // 0 default
    93123  // 1 bullet
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4InuclSpecialFunctions.hh

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4InuclSpecialFunctions.hh,v 1.16 2010/04/13 05:30:10 mkelsey Exp $
     26// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100114  M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
     29// 20100319  M. Kelsey -- Add optional mass argument to generateWithFixedTheta;
     30//              define new generateWithRandomAngles, encapsulating code; define
     31//              cbrt() cube-root function (in math.h, but not in <math>!)
     32// 20100412  M. Kelsey -- Modify paraMaker[Truncated] to take buffer as argument
     33
    2634#ifndef G4INUCL_SPECIAL_FUNC_HH
    2735#define G4INUCL_SPECIAL_FUNC_HH
    2836
    2937#include "globals.hh"
    30 #include <cmath>
    3138#include <algorithm>
    3239#include <vector>
    33 #include "G4CascadeMomentum.hh"
     40#include "G4LorentzVector.hh"
    3441
    3542namespace G4InuclSpecialFunctions {
     
    5158                       G4int ntype);
    5259 
    53   std::pair<std::vector<G4double>, std::vector<G4double> > paraMaker(G4double Z);
     60  void paraMaker(G4double Z, std::pair<std::vector<G4double>, std::vector<G4double> >& parms);
    5461
    55   std::pair<G4double, G4double> paraMakerTruncated(G4double Z);
     62  void paraMakerTruncated(G4double Z, std::pair<G4double, G4double>& parms);
    5663
    5764  G4double getAL(G4double A);
     
    6067
    6168  G4double csPN(G4double e);
     69
     70  G4double G4cbrt(G4double x);  // Can't use "cbrt" name, clashes with <math.h>
    6271
    6372  G4double inuclRndm();
     
    7180  G4double nucleiLevelDensity(G4double a);
    7281
    73   G4CascadeMomentum generateWithFixedTheta(G4double ct,
    74                                           G4double p);
     82  // Optional mass argument will be used to fill G4LorentzVector correctly
     83  G4LorentzVector generateWithFixedTheta(G4double ct, G4double p,
     84                                         G4double m=0.);
     85
     86  G4LorentzVector generateWithRandomAngles(G4double p, G4double m=0.);
    7587}
     88
     89
    7690#endif
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4LorentzConvertor.hh

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4LorentzConvertor.hh,v 1.15 2010/05/21 17:56:34 mkelsey Exp $
     26// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100108  Michael Kelsey -- Use G4LorentzVector internally
     29// 20100120  M. Kelsey -- BUG FIX:  scm_momentum should be G4ThreeVector
     30// 20100126  M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
     31// 20100519  M. Kelsey -- Add interfaces to pass G4InuclParticles directly
     32
    2633#ifndef G4LORENTZ_CONVERTOR_HH
    2734#define G4LORENTZ_CONVERTOR_HH
    2835
    29 #ifndef GLOB
    3036#include "globals.hh"
    31 #endif
     37#include "G4LorentzVector.hh"
     38#include "G4ThreeVector.hh"
    3239
    33 #include <vector>
    34 #include "G4CascadeMomentum.hh"
     40class G4InuclParticle;
    3541
    3642class G4LorentzConvertor {
     
    4046  G4LorentzConvertor();
    4147
    42   G4LorentzConvertor(const G4CascadeMomentum& bmom,
    43                      G4double bmass,
    44                      const G4CascadeMomentum& tmom,
    45                      G4double tmass) {
    46 
     48  G4LorentzConvertor(const G4LorentzVector& bmom, G4double bmass,
     49                     const G4LorentzVector& tmom, G4double tmass) {
    4750    setBullet(bmom, bmass);
    4851    setTarget(tmom, tmass);
    49     degenerated = false; 
    50   };
     52  }
    5153
    52   void setBullet(const G4CascadeMomentum& bmom,
    53                  G4double bmass) {
     54  G4LorentzConvertor(const G4InuclParticle* bullet,
     55                     const G4InuclParticle* target) {
     56    setBullet(bullet);
     57    setTarget(target);
     58  }
    5459
    55     bullet_mom = bmom;
    56     bullet_mass = bmass;
    57     //  G4cout << " bullet: e " << bmom[0] << " mass " << bmass << G4endl;
     60  void setVerbose(G4int vb=0) { verboseLevel = vb; }
     61
     62  void setBullet(const G4InuclParticle* bullet);
     63  void setTarget(const G4InuclParticle* target);
     64
     65  void setBullet(const G4InuclParticle& bullet) { setBullet(&bullet); }
     66  void setTarget(const G4InuclParticle& target) { setTarget(&target); }
     67
     68  // Use correct four-vectors as input
     69  void setBullet(const G4LorentzVector& bmom) { bullet_mom = bmom; }
     70  void setTarget(const G4LorentzVector& bmom) { target_mom = bmom; }
     71
     72  // NOTE:  These functions "repair" input 4-vectors using specified mass
     73  void setBullet(const G4LorentzVector& bmom, G4double bmass) {
     74    bullet_mom.setVectM(bmom.vect(), bmass);
     75
     76    //  G4cout << " bullet: e " << bullet_mom.e() << " mass "
     77    //         << bullet_mom.m() << G4endl;
    5878  };
    5979
    60   void setTarget(const G4CascadeMomentum& tmom,
    61                  G4double tmass) {
     80  void setTarget(const G4LorentzVector& tmom, G4double tmass) {
     81    target_mom.setVectM(tmom.vect(), tmass);
    6282
    63     target_mom = tmom;
    64     target_mass = tmass;
    65     //  G4cout << " target: e " << tmom[0] << " mass " << tmass << G4endl;
     83    //  G4cout << " target: e " << target_mom.e() << " mass "
     84    //         << target_mom.m() << G4endl;
    6685  };
    6786
    6887  void toTheCenterOfMass();
    69  
    7088  void toTheTargetRestFrame();
    7189
    72   G4CascadeMomentum backToTheLab(const G4CascadeMomentum& mom) const;
     90  G4LorentzVector backToTheLab(const G4LorentzVector& mom) const;
    7391
    74   G4double getKinEnergyInTheTRS() const {
     92  // Four-vectors of bullet and target in last chosen reference frame
     93  const G4LorentzVector& getBullet() const { return bullet_mom; }
     94  const G4LorentzVector& getTarget() const { return target_mom; }
     95 
     96  G4double getKinEnergyInTheTRS() const;
     97  G4double getTotalSCMEnergy() const { return ecm_tot; }
     98  G4double getSCMMomentum() const { return scm_momentum.rho(); }
     99  G4double getTRSMomentum() const;
    75100
    76     G4double pv = bullet_mom[1] * target_mom[1] +
    77       bullet_mom[2] * target_mom[2] +
    78       bullet_mom[3] * target_mom[3]; 
    79     G4double ekin_trf = (target_mom[0] *
    80                          bullet_mom[0] - pv) / target_mass - bullet_mass;
    81     return ekin_trf;
    82   };
     101  G4LorentzVector rotate(const G4LorentzVector& mom) const;
    83102
    84   G4double getTotalSCMEnergy() const {
    85 
    86     return ecm_tot;
    87   };
    88 
    89   G4double getSCMMomentum() const {
    90 
    91     return pscm;
    92   };
    93 
    94   G4double getTRSMomentum() const {
    95 
    96     return plab;
    97   };
    98  
    99   G4CascadeMomentum rotate(const G4CascadeMomentum& mom) const;
    100 
    101   G4CascadeMomentum rotate(const G4CascadeMomentum& mom1,
    102                             const G4CascadeMomentum& mom) const;
     103  G4LorentzVector rotate(const G4LorentzVector& mom1,
     104                         const G4LorentzVector& mom) const;
    103105
    104106  G4bool reflectionNeeded() const;
    105107
    106   G4bool trivial() const {
    107     return degenerated;
    108   };
     108  G4bool trivial() const { return degenerated; }
    109109
    110110private:
    111 G4int verboseLevel;
    112   G4CascadeMomentum bullet_mom;
    113   G4double bullet_mass;
     111  static const G4double small;
    114112
    115   G4CascadeMomentum target_mom;
    116   G4double target_mass;
     113  G4int verboseLevel;
     114  G4LorentzVector bullet_mom;
     115  G4LorentzVector target_mom;
    117116
    118   std::vector<G4double> velocity;
     117  G4LorentzVector scm_momentum;         // CM momentum relative to target/bullet
    119118
    120   G4CascadeMomentum scm_momentum;
    121 
     119  // Buffer variables for doing ::rotate() calculations
     120  G4ThreeVector velocity;
     121  G4double gamma;
     122  G4double v2;
    122123  G4double ecm_tot;
    123 
    124   G4double pscm;
    125 
    126   G4double plab;
    127 
    128   G4double gamma;
    129 
    130   G4double v2;
    131 
    132124  G4double ga;
    133 
    134125  G4double gb;
    135 
    136126  G4double gbpp;
    137 
    138127  G4double gapp;
    139 
    140128  G4bool degenerated;
    141129};       
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4NonEquilibriumEvaporator.hh

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4NonEquilibriumEvaporator.hh,v 1.10 2010/05/21 17:56:34 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100315  M. Kelsey -- Remove "using" directive and unnecessary #includes.
     29// 20100413  M. Kelsey -- Pass G4CollisionOutput by ref to ::collide()
     30// 20100517  M. Kelsey -- Inherit from common base class
     31
    2632#ifndef G4NON_EQUILIBRIUM_EVAPORATOR_HH
    2733#define G4NON_EQUILIBRIUM_EVAPORATOR_HH
    2834
    29 #include "G4Collider.hh"
    30 #include "G4InuclSpecialFunctions.hh"
     35#include "G4VCascadeCollider.hh"
    3136
    32 using namespace G4InuclSpecialFunctions;
     37class G4CollisionOutput;
     38class G4InuclParticle;
    3339
    34 class G4NonEquilibriumEvaporator {
     40class G4NonEquilibriumEvaporator : public G4VCascadeCollider {
     41public:
     42  G4NonEquilibriumEvaporator();
     43  virtual ~G4NonEquilibriumEvaporator() {}
    3544
    36 public:
    37 
    38   G4NonEquilibriumEvaporator();
    39 
    40   G4CollisionOutput collide(G4InuclParticle* bullet,
    41                                     G4InuclParticle* target);
     45  void collide(G4InuclParticle* bullet, G4InuclParticle* target,
     46               G4CollisionOutput& output);
    4247
    4348private:
    44 G4int verboseLevel;
    4549  G4double getMatrixElement(G4double A) const;
    46 
    4750  G4double getE0(G4double A) const;
    48 
    4951  G4double getParLev(G4double A, G4double Z) const;
    50 
    5152};
    5253
    53 #endif // G4NON_EQUILIBRIUM_EVAPORATOR_HH
     54#endif /* G4NON_EQUILIBRIUM_EVAPORATOR_HH */
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4NuclWatcher.hh

    r819 r1315  
     1#ifndef G4NUCL_WATCHER_HH
     2#define G4NUCL_WATCHER_HH
    13//
    24// ********************************************************************
     
    2325// * acceptance of all terms of the Geant4 Software license.          *
    2426// ********************************************************************
     27// $Id: G4NuclWatcher.hh,v 1.13 2010/04/07 18:23:15 mkelsey Exp $
     28// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2529//
    26 #ifndef G4NUCL_WATCHER_HH
    27 #define G4NUCL_WATCHER_HH
     30// 20100202  M. Kelsey -- Move most code into .cc file
     31// 20100405  M. Kelsey -- Pass const-ref std::vector<>
    2832
    29 #ifndef GLOB
    30 #include "globals.hh"
    31 #endif
     33#include "G4Types.hh"
    3234
    3335#include <algorithm>
     
    3638
    3739class G4NuclWatcher {
     40public:
     41  G4NuclWatcher(G4double z,
     42                const std::vector<G4double>& expa,
     43                const std::vector<G4double>& expcs,
     44                const std::vector<G4double>& experr,
     45                G4bool check,
     46                G4bool nucl);
    3847
    39 public:
     48  ~G4NuclWatcher() {}
    4049
    41   G4NuclWatcher(G4double z,
    42                 std::vector<G4double> expa,
    43                 std::vector<G4double> expcs,
    44                 std::vector<G4double> experr,
    45                 G4bool check,
    46                 G4bool nucl)
    47     : nuclz(z),
    48       checkable(check),
    49       nucleable(nucl)  {
     50  void watch(G4double a, G4double z);
     51  void setInuclCs(G4double csec, G4int nev);
    5052
    51     exper_as = expa;
    52     exper_cs = expcs;
    53     exper_err = experr;
    54   };
     53  G4double getChsq() const { return izotop_chsq; }
     54  G4bool to_check() const { return checkable; }
     55  G4bool look_forNuclei() const { return nucleable; }
     56  G4double getLhood() const { return aver_lhood; }
     57  G4double getNmatched() const { return aver_matched; }
    5558
    56   void watch(G4double a,
    57              G4double z) {
    58 
    59     const G4double small = 0.001;
    60 
    61     if(std::fabs(z - nuclz) < small) {
    62       G4bool here = false;
    63       G4int  simulatedAsSize = simulated_as.size();
    64       for(G4int i = 0; i < simulatedAsSize; i++) {
    65 
    66         if(std::fabs(simulated_as[i] - a) < small) {
    67           simulated_cs[i] += 1.0;
    68           here = true;
    69           break;
    70         };
    71       };
    72       if(!here) {
    73         simulated_as.push_back(a);
    74         simulated_cs.push_back(1.0);
    75       };
    76     };
    77   };
    78 
    79   void setInuclCs(G4double csec,
    80                   G4int nev) {
    81     G4int  simulatedAsSize = simulated_as.size();
    82     for(G4int i = 0; i < simulatedAsSize ; i++) {
    83       double err = std::sqrt(simulated_cs[i]) / simulated_cs[i];
    84 
    85       simulated_prob.push_back(simulated_cs[i] / nev);
    86       simulated_cs[i] *= csec / nev;
    87       simulated_errors.push_back(simulated_cs[i] * err);   
    88     };
    89   };
    90 
    91   G4double getChsq() const {
    92 
    93     return izotop_chsq;
    94   };
     59  std::pair<G4double, G4double> getExpCs() const;
     60  std::pair<G4double, G4double> getInuclCs() const;
    9561
    9662  std::pair<G4double, G4double> getAverageRatio() const {
     63    return std::pair<G4double, G4double>(average_ratio, aver_rat_err);
     64  }
    9765
    98     return std::pair<G4double, G4double>(average_ratio, aver_rat_err);
    99   };
    100 
    101   std::pair<G4double, G4double> getExpCs() const {
    102 
    103     G4double cs = 0.0;
    104     G4double err = 0.0;
    105 
    106     G4int experAsSize = exper_as.size();
    107     for(G4int iz = 0; iz < experAsSize; iz++) {
    108       cs += exper_cs[iz];
    109       err += exper_err[iz];
    110     };
    111 
    112     return std::pair<G4double, G4double>(cs, err);
    113   };
    114 
    115   G4bool to_check() const {
    116 
    117     return checkable;
    118   };
    119 
    120   G4bool look_forNuclei() const {
    121 
    122     return nucleable;
    123   };
    124 
    125   std::pair<G4double, G4double> getInuclCs() const {
    126 
    127     G4double cs = 0.0;
    128     G4double err = 0.0;
    129     G4int  simulatedAsSize = simulated_as.size();
    130     for(G4int iz = 0; iz < simulatedAsSize; iz++) {
    131       cs += simulated_cs[iz];
    132       err += simulated_errors[iz];
    133     };
    134 
    135     return std::pair<G4double, G4double>(cs, err);
    136   };
    137 
    138   void print() {
    139 
    140     const G4double small = 0.001;
    141 
    142     G4cout << G4endl << " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "
    143            << G4endl;
    144     G4cout << " **** izotop Z **** " << nuclz << G4endl;
    145 
    146     izotop_chsq = 0.0;
    147     average_ratio = 0.0;
    148     aver_rat_err = 0.0;
    149     G4double exp_cs = 0.0;
    150     G4double exp_cs_err = 0.0;
    151     G4double inucl_cs = 0.0;
    152     G4double inucl_cs_err = 0.0;
    153     std::vector<G4bool> not_used(simulated_cs.size(), true);
    154     G4int nmatched = exper_as.size();
    155     G4int nused = simulated_cs.size();
    156     G4double lhood = 0.0;
    157     G4int experAsSize = exper_as.size();
    158     for(G4int iz = 0; iz < experAsSize; iz++) {
    159       G4double a = exper_as[iz];
    160 
    161       exp_cs += exper_cs[iz];
    162       exp_cs_err += exper_err[iz];
    163 
    164       G4bool found = false;
    165     G4int  simulatedAsSize = simulated_as.size();
    166       for(G4int i = 0; i < simulatedAsSize; i++) {
    167 
    168         if(std::fabs(simulated_as[i] - a) < small) {
    169           G4double rat = simulated_cs[i] / exper_cs[iz];
    170 
    171           lhood += std::log10(rat) * std::log10(rat);
    172 
    173           G4double rat_err = std::sqrt(simulated_errors[i] * simulated_errors[i] +
    174                                   exper_err[iz] * exper_err[iz] * rat * rat) / exper_cs[iz];
    175           average_ratio += rat;
    176           aver_rat_err += rat_err;
    177 
    178           G4cout << " A " << a << " exp.cs " << exper_cs[iz] << " err " <<
    179             exper_err[iz] << G4endl <<
    180             " sim. cs " << simulated_cs[i] << " err " << simulated_errors[i] << G4endl
    181                  << " ratio " << rat << " err " << rat_err << G4endl;
    182           G4cout << " simulated production rate " << simulated_prob[i] << G4endl;         
    183 
    184           not_used[i] = false;
    185           izotop_chsq += (rat - 1.0) * (rat - 1.0) / rat_err / rat_err;
    186           found = true;
    187           nused--;
    188           break;
    189         };
    190       };
    191       if(!found) {
    192         G4cout << " not found exper.: A " << a << " exp.cs " << exper_cs[iz]
    193                << " err " << exper_err[iz] << G4endl;
    194       }
    195       else {
    196         nmatched--;
    197       };
    198     };
    199 
    200     G4cout << " not found in simulations " << nmatched << G4endl;
    201     G4cout << " not found in exper: " << nused << G4endl;
    202     G4int  simulatedAsSize = simulated_as.size();
    203     for(G4int i = 0; i < simulatedAsSize; i++) {
    204       inucl_cs += simulated_cs[i];
    205       inucl_cs_err += simulated_errors[i];
    206 
    207       if(not_used[i])
    208         G4cout << " extra simul.: A " << simulated_as[i] <<
    209           " sim. cs " << simulated_cs[i] << " err " << simulated_errors[i] << G4endl;
    210       G4cout << " simulated production rate " << simulated_prob[i] << G4endl;     
    211     };
    212     G4int matched = exper_as.size() - nmatched;
    213 
    214     if(matched > 0) {
    215       aver_lhood = lhood;
    216       aver_matched = matched;   
    217       lhood = std::pow(10.0, std::sqrt(lhood / matched));
    218 
    219       G4cout << " matched " << matched << " CHSQ " << std::sqrt(izotop_chsq) / matched
    220              << G4endl
    221              << " raw chsq " << izotop_chsq << G4endl
    222              << " average ratio " << average_ratio / matched
    223              << " err " << aver_rat_err / matched << G4endl
    224              << " lhood " << lhood << G4endl;
    225     }
    226     else {
    227       izotop_chsq = 0.0;
    228       aver_lhood = 0.0;   
    229     };
    230    
    231     G4cout << " exper. cs " << exp_cs << " err " << exp_cs_err << G4endl
    232            << " inucl. cs " << inucl_cs << " err " << inucl_cs_err << G4endl;
    233     G4cout <<  " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ " << G4endl;
    234   };
    235 
    236   G4double getLhood() const {
    237 
    238     return aver_lhood;
    239   };
    240 
    241   G4double getNmatched() const {
    242 
    243     return aver_matched;
    244   };
     66  void print();
    24567
    24668private:
    247 
    24869  G4double nuclz;
    249 
    25070  G4double izotop_chsq;
    251 
    25271  G4double average_ratio;
    253 
    25472  G4double aver_rat_err;
    255 
    25673  G4double aver_lhood;
    257 
    25874  G4double aver_matched;
    259 
    26075  std::vector<G4double> exper_as;
    261 
    26276  std::vector<G4double> exper_cs;
    263 
    26477  std::vector<G4double> exper_err;
    265 
    26678  std::vector<G4double> simulated_as;
    267 
    26879  std::vector<G4double> simulated_cs;
    269 
    27080  std::vector<G4double> simulated_errors;
    271 
    27281  std::vector<G4double> simulated_prob;
    273 
    27482  G4bool checkable;
    275 
    27683  G4bool nucleable;
    277 
    278 };       
     84};
    27985
    28086#endif // G4NUCL_WATCHER_HH
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4NucleiModel.hh

    r1196 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4NucleiModel.hh,v 1.25 2010/05/21 17:44:38 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100319  M. Kelsey -- Remove "using" directory and unnecessary #includes,
     29//              move ctor to .cc file
     30// 20100407  M. Kelsey -- Create "partners thePartners" data member to act
     31//              as buffer between ::generateInteractionPartners() and
     32//              ::generateParticleFate(), and make "outgoing_cparticles" a
     33//              data member returned from the latter by const-ref.  Replace
     34//              return-by-value of initializeCascad() with an input buffer.
     35// 20100409  M. Kelsey -- Add function to sort list of partnerts by pathlen,
     36//              move non-inlinable code to .cc.
     37// 20100421  M. Kelsey -- Move getFermiKinetic() to .cc, no hardwired masses.
     38// 20100517  M. Kelsey -- Change cross-section tables to static arrays.  Move
     39//              absorptionCrossSection() from SpecialFunc.
     40// 20100520  M. Kelsey -- Add function to separate momentum from nucleon
     41
    2642#ifndef G4NUCLEI_MODEL_HH
    2743#define G4NUCLEI_MODEL_HH
    2844
    29 
    30 #ifndef G4INUCL_ELEMENTARY_PARTICLE_HH
    3145#include "G4InuclElementaryParticle.hh"
    32 #endif
    3346#include "G4CascadParticle.hh"
    34 #include "G4InuclSpecialFunctions.hh"
    35 #include "G4ElementaryParticleCollider.hh"
    36 
    37 
     47#include <algorithm>
    3848#include <vector>
    3949
    4050class G4InuclNuclei;
    41 
    42 using namespace G4InuclSpecialFunctions;
    43 
    44 typedef std::pair<G4InuclElementaryParticle, G4double> partner;
    45 typedef std::vector<partner> partners;
     51class G4ElementaryParticleCollider;
    4652
    4753class G4NucleiModel {
     
    5056
    5157  G4NucleiModel();
    52 
    53   G4NucleiModel(G4InuclNuclei* nuclei) {
    54     generateModel(nuclei->getA(), nuclei->getZ());
    55   }
     58  G4NucleiModel(G4InuclNuclei* nuclei);
    5659
    5760  void generateModel(G4double a, G4double z);
    58 
    5961
    6062  void reset() {
     
    7678  }
    7779
    78 
    79   G4double getFermiKinetic(G4int ip, G4int izone) const {
    80     G4double ekin = 0.0;
    81 
    82     if(ip < 3 && izone < number_of_zones) {
    83       G4double pf = fermi_momenta[ip - 1][izone];
    84       G4double mass = ip == 1 ? 0.93827 : 0.93957;
    85 
    86       ekin = std::sqrt(pf * pf + mass * mass) - mass;
    87     } 
    88     return ekin;
    89   }
    90 
     80  G4double getFermiKinetic(G4int ip, G4int izone) const;
    9181
    9282  G4double getPotential(G4int ip, G4int izone) const {
     
    9888
    9989
    100   std::vector<G4CascadParticle>
     90  const std::vector<G4CascadParticle>&
    10191  generateParticleFate(G4CascadParticle& cparticle,
    10292                       G4ElementaryParticleCollider* theElementaryParticleCollider);
     
    126116
    127117
    128   std::pair<std::vector<G4CascadParticle>, std::vector<G4InuclElementaryParticle> >
    129   initializeCascad(G4InuclNuclei* bullet, G4InuclNuclei* target);
     118  typedef std::pair<std::vector<G4CascadParticle>, std::vector<G4InuclElementaryParticle> > modelLists;
     119
     120  void initializeCascad(G4InuclNuclei* bullet, G4InuclNuclei* target,
     121                        modelLists& output);
    130122
    131123
     
    139131  G4InuclElementaryParticle generateNucleon(G4int type, G4int zone) const;
    140132
     133  G4LorentzVector generateNucleonMomentum(G4int type, G4int zone) const;
     134
     135  G4double absorptionCrossSection(G4double e, G4int type) const;
     136  G4double totalCrossSection(G4double ke, G4int rtype) const;
     137
    141138private:
    142  
    143139  G4int verboseLevel;
    144 
    145   void initTotalCrossSections();
    146   G4double totalCrossSection(G4double e, G4int rtype) const;
    147140
    148141  G4bool passFermi(const std::vector<G4InuclElementaryParticle>& particles,
     
    155148                                                 G4int zone) const;
    156149
    157   partners generateInteractionPartners(G4CascadParticle& cparticle) const;
     150  typedef std::pair<G4InuclElementaryParticle, G4double> partner;
     151
     152  std::vector<partner> thePartners;             // Buffer for output below
     153  void generateInteractionPartners(G4CascadParticle& cparticle);
     154
     155  // Function for std::sort() to use in organizing partners by path length
     156  static G4bool sortPartners(const partner& p1, const partner& p2) {
     157    return (p2.second > p1.second);
     158  }
    158159
    159160  G4double volNumInt(G4double r1, G4double r2, G4double cu,
     
    164165  G4double getRatio(G4int ip) const;
    165166
     167  std::vector<G4CascadParticle> outgoing_cparticles;    // Return buffer
     168
    166169  std::vector<std::vector<G4double> > nucleon_densities;
    167170
     
    191194
    192195  // Total cross sections
    193 
    194   G4double PPtot[30];
    195   G4double NPtot[30];
    196   G4double pipPtot[30];
    197   G4double pimPtot[30];
    198   G4double pizPtot[30];
    199   G4double kpPtot[30];
    200   G4double kpNtot[30];
    201   G4double kmPtot[30];
    202   G4double kmNtot[30];
    203   G4double lPtot[30];
    204   G4double spPtot[30];
    205   G4double smPtot[30];
    206   G4double xi0Ptot[30];
    207   G4double ximPtot[30];
    208 
     196  static const G4double PPtot[30];
     197  static const G4double NPtot[30];
     198  static const G4double pipPtot[30];
     199  static const G4double pimPtot[30];
     200  static const G4double pizPtot[30];
     201  static const G4double kpPtot[30];
     202  static const G4double kpNtot[30];
     203  static const G4double kmPtot[30];
     204  static const G4double kmNtot[30];
     205  static const G4double lPtot[30];
     206  static const G4double spPtot[30];
     207  static const G4double smPtot[30];
     208  static const G4double xi0Ptot[30];
     209  static const G4double ximPtot[30];
    209210};       
    210211
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4ParticleLargerBeta.hh

    r1197 r1315  
     1#ifndef G4ParticleLargerBeta_h
     2#define G4ParticleLargerBeta_h
    13//
    24// ********************************************************************
     
    2325// * acceptance of all terms of the Geant4 Software license.          *
    2426// ********************************************************************
     27// $Id: G4ParticleLargerBeta.hh,v 1.6 2010/05/15 04:25:17 mkelsey Exp $
     28// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2529//
    26 #ifndef G4ParticleLargerBeta_h
    27 #define G4ParticleLargerBeta_h
     30// 20100112  M. Kelsey -- Add additional operator() which uses pointers,
     31//              also fix bug which returns wrong result
    2832
    29 #ifndef G4INUCL_ELEMENTARY_PARTICLE_HH
    3033#include "G4InuclElementaryParticle.hh"
    31 #endif
    3234
    3335class G4ParticleLargerBeta {
    34 
    3536public:
    36  
    3737  G4bool operator() (const G4InuclElementaryParticle& part1,
    3838                     const G4InuclElementaryParticle& part2) {
    39 
    40     return part1.getMomModule()/part1.getEnergy() <=
    41            part2.getMomModule()/part2.getEnergy();
     39    return (part1.getMomModule()/part1.getEnergy() >=
     40            part2.getMomModule()/part2.getEnergy()
     41            );
    4242  }
    4343 
     44  G4bool operator() (const G4InuclElementaryParticle* part1,
     45                     const G4InuclElementaryParticle* part2) {
     46    return (part1 && part2 && operator()(*part1, *part2));
     47  }
    4448};
    4549
    46 #endif
     50#endif  /* G4ParticleLargerBeta_h */
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4ParticleLargerEkin.hh

    r819 r1315  
     1#ifndef G4PARTICLE_LARGER_EKIN_HH
     2#define G4PARTICLE_LARGER_EKIN_HH
    13//
    24// ********************************************************************
     
    2325// * acceptance of all terms of the Geant4 Software license.          *
    2426// ********************************************************************
     27// $Id: G4ParticleLargerEkin.hh,v 1.11 2010/05/15 04:25:17 mkelsey Exp $
     28// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2529//
    26 #ifndef G4PARTICLE_LARGER_EKIN_HH
    27 #define G4PARTICLE_LARGER_EKIN_HH
     30// Implements a *reverse* sorting: std::sort expects a less-than operator
     31// which returns true if arg1<arg2.  This function returns true if arg1>=arg2.
     32//
     33// 20091125  M. Kelsey -- Add additional operator() which uses pointers
    2834
    29 #ifndef G4INUCL_ELEMENTARY_PARTICLE_HH
    3035#include "G4InuclElementaryParticle.hh"
     36
     37#ifdef G4CASCADE_DEBUG_SORT
     38#include "G4ios.hh"
    3139#endif
    3240
    3341class G4ParticleLargerEkin {
    34 
    3542public:
    36  
    3743  G4bool operator() (const G4InuclElementaryParticle& part1,
    3844                     const G4InuclElementaryParticle& part2) {
    39 
    40     return part1.getKineticEnergy() >= part2.getKineticEnergy();
    41     //  return part1.getEnergy() >= part2.getEnergy();
    42     //  return part1.getMomModule() >= part2.getMomModule();
    43   };
     45#ifdef G4CASCADE_DEBUG_SORT
     46    G4cout << "part1 @ " << &part1 << ": ";
     47    part1.printParticle();
     48    G4cout << "part2 @ " << &part2 << ": ";
     49    part2.printParticle();
     50    G4cout << G4endl;
     51#endif
     52    return (part1.getKineticEnergy() >= part2.getKineticEnergy());
     53  }
    4454 
     55  G4bool operator() (const G4InuclElementaryParticle* part1,
     56                     const G4InuclElementaryParticle* part2) {
     57    return (part1 && part2 && operator()(*part1, *part2));
     58  }
    4559};
    4660
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4PreCompoundCascadeInterface.hh

    r819 r1315  
    2424// ********************************************************************
    2525//
    26 // $Id: G4PreCompoundCascadeInterface.hh,v 1.1 2007/05/23 14:37:28 miheikki Exp $
     26// $Id: G4PreCompoundCascadeInterface.hh,v 1.3 2010/05/21 18:07:30 mkelsey Exp $
    2727// Defines an interface to Bertini (BERT) INC with exitons. Evaporation is NOT included
     28//
     29// 20100520 M. Kelsey -- Add missing name string to ctor, follow code changes from
     30//              G4CascadeInterface.
    2831
    2932#ifndef G4PRECOMPOUNDCASCADEINTERFACE_H
     
    4245
    4346public:
    44   G4PreCompoundCascadeInterface();
     47  G4PreCompoundCascadeInterface(const G4String& nam="PreCompound Bertini Cascade");
    4548
    4649  ~G4PreCompoundCascadeInterface(){
     
    5255
    5356private:
    54   G4int operator==(G4PreCompoundCascadeInterface& right) {
     57  G4int operator==(const G4PreCompoundCascadeInterface& right) const {
    5558    return (this == &right);
    5659  }
    5760
    58   G4int operator!=(G4PreCompoundCascadeInterface& right) {
     61  G4int operator!=(const G4PreCompoundCascadeInterface& right) const {
    5962    return (this != &right);
    6063  }
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4PreCompoundInuclCollider.hh

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4PreCompoundInuclCollider.hh,v 1.6 2010/05/21 17:56:34 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100315  M. Kelsey -- Remove "using" directive and unneeded #includes.
     29// 20100413  M. Kelsey -- Pass G4CollisionOutput by ref to ::collide()
     30// 20100517  M. Kelsey -- Inherit from common base class, make other colliders
     31//              simple data members
     32
    2633#ifndef G4PRECOMPOUNDINUCL_COLLIDER_HH
    2734#define G4PRECOMPOUNDINUCL_COLLIDER_HH
    2835 
    29 #include "G4Collider.hh"
    30 #include "G4IntraNucleiCascader.hh"
    31 #include "G4NonEquilibriumEvaporator.hh"
    32 #include "G4BigBanger.hh"
    33 #include "G4ElementaryParticleCollider.hh"
    34 #include "G4InteractionCase.hh"
    35 #include "G4InuclNuclei.hh"
    36 #include "G4InuclSpecialFunctions.hh"
    37 #include "G4Analyser.hh"
     36#include "G4VCascadeCollider.hh"
    3837
    39 using namespace G4InuclSpecialFunctions;
     38class G4BigBanger;
     39class G4CollisionOutput;
     40class G4ElementaryParticleCollider;
     41class G4IntraNucleiCascader;
     42class G4InuclParticle;
     43class G4NonEquilibriumEvaporator;
    4044
    41 class G4PreCompoundInuclCollider {
    42 
     45class G4PreCompoundInuclCollider : public G4VCascadeCollider {
    4346public:
    44 
    4547  G4PreCompoundInuclCollider();
    46 
    47   G4PreCompoundInuclCollider(G4ElementaryParticleCollider* ecollider,
    48                   G4IntraNucleiCascader* incascader,
    49                   G4NonEquilibriumEvaporator* noeqevaporator,
    50                   G4BigBanger* bigbanger) {
    51 
    52     setElementaryParticleCollider(ecollider);
    53     setIntraNucleiCascader(incascader,ecollider);
    54     setNonEquilibriumEvaporator(noeqevaporator);
    55     setBigBanger(bigbanger);
    56 
    57   };
    58 
    59   void setElementaryParticleCollider(G4ElementaryParticleCollider* ecollider) {
    60 
    61     theElementaryParticleCollider = ecollider;   
    62   };
    63 
    64   void setIntraNucleiCascader(G4IntraNucleiCascader* incascader,
    65                               G4ElementaryParticleCollider* ecollider) {
    66 
    67     theIntraNucleiCascader = incascader;
    68     theIntraNucleiCascader->setElementaryParticleCollider(ecollider);
    69   };
    70 
    71   void setNonEquilibriumEvaporator(G4NonEquilibriumEvaporator* noeqevaporator) {
    72 
    73     theNonEquilibriumEvaporator = noeqevaporator;   
    74   };
    75 
    76   void setBigBanger(G4BigBanger* bigbanger) {
    77 
    78     theBigBanger = bigbanger;   
    79   };
     48  virtual ~G4PreCompoundInuclCollider();
    8049 
    81   G4CollisionOutput collide(G4InuclParticle* bullet,
    82                             G4InuclParticle* target);
     50  void collide(G4InuclParticle* bullet, G4InuclParticle* target,
     51               G4CollisionOutput& globalOutput);
    8352
    8453private:
    85   G4int verboseLevel;
    86 
    87   G4bool inelasticInteractionPossible(G4InuclParticle* bullet,
    88                                       G4InuclParticle* target,
    89                                       G4double ekin) const;
    90 
    91   G4InteractionCase bulletTargetSetter(G4InuclParticle* bullet,
    92                                        G4InuclParticle* target) const;
    93 
    94   G4bool explosion(G4InuclNuclei* target) const;
    95        
    9654  G4ElementaryParticleCollider* theElementaryParticleCollider;
    9755  G4IntraNucleiCascader* theIntraNucleiCascader;
    9856  G4NonEquilibriumEvaporator* theNonEquilibriumEvaporator;
    9957  G4BigBanger* theBigBanger;
    100 
    10158};       
    10259
    103 #endif // G4PRECOMPOUNDINUCL_COLLIDER_HH
     60#endif /* G4PRECOMPOUNDINUCL_COLLIDER_HH */
    10461
    10562
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4WatcherGun.hh

    r819 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4WatcherGun.hh,v 1.9 2010/04/08 15:48:00 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100407  M. Kelsey -- Return const-ref to avoid copy overhead.
     29
    2630#ifndef G4WATCHER_GUN_HH
    2731#define G4WATCHER_GUN_HH
     
    3741  void setWatchers();
    3842
    39   std::vector<G4NuclWatcher> getWatchers() const {
     43  const std::vector<G4NuclWatcher>& getWatchers() const {
    4044    return watchers;
    4145  };
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4Analyser.cc

    r819 r1315  
    2929
    3030G4Analyser::G4Analyser()
    31   :verboseLevel(1)  {
     31  :verboseLevel(0)  {
    3232
    3333  if (verboseLevel > 3) {
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4BigBanger.cc

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4BigBanger.cc,v 1.29 2010/05/21 17:56:34 mkelsey Exp $
     26// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100114  M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
     29// 20100301  M. Kelsey -- In generateBangInSCM(), restore old G4CascMom calcs.
     30//              for (N-1)th outgoing nucleon.
     31// 20100319  M. Kelsey -- Use new generateWithRandomAngles for theta,phi stuff
     32// 20100407  M. Kelsey -- Replace std::vector<> returns with data members.
     33// 20100413  M. Kelsey -- Pass G4CollisionOutput by ref to ::collide()
     34// 20100517  M. Kelsey -- Inherit from common base class, clean up code
     35
    2636#include "G4BigBanger.hh"
     37#include "G4CollisionOutput.hh"
    2738#include "G4InuclNuclei.hh"
     39#include "G4InuclElementaryParticle.hh"
     40#include "G4InuclSpecialFunctions.hh"
    2841#include "G4ParticleLargerEkin.hh"
    2942#include "G4LorentzConvertor.hh"
     43#include "G4HadTmpUtil.hh"
     44#include "G4NucleiProperties.hh"
    3045#include <algorithm>
    3146
     47using namespace G4InuclSpecialFunctions;
     48
    3249typedef std::vector<G4InuclElementaryParticle>::iterator particleIterator;
    3350
    34 G4BigBanger::G4BigBanger()
    35   : verboseLevel(1) {
    36   if (verboseLevel > 3) {
    37     G4cout << " >>> G4BigBanger::G4BigBanger" << G4endl;
    38   }
    39 }
    40 
    41 G4CollisionOutput G4BigBanger::collide(G4InuclParticle* /*bullet*/,
    42                                        G4InuclParticle* target) {
     51G4BigBanger::G4BigBanger() : G4VCascadeCollider("G4BigBanger") {}
     52
     53void
     54G4BigBanger::collide(G4InuclParticle* /*bullet*/, G4InuclParticle* target,
     55                     G4CollisionOutput& output) {
    4356
    4457  if (verboseLevel > 3) {
     
    5063  const G4double small_ekin = 1.0e-6;
    5164
    52   G4CollisionOutput output;
    53   G4CascadeMomentum totscm;
    54   G4CascadeMomentum totlab;
    55 
    56   if(G4InuclNuclei* nuclei_target = dynamic_cast<G4InuclNuclei*>(target)) {
    57  
    58     G4double A = nuclei_target->getA();
    59     G4double Z = nuclei_target->getZ();
    60     const G4CascadeMomentum& PEX = nuclei_target->getMomentum();
    61     G4double EEXS = nuclei_target->getExitationEnergy();
    62     G4InuclElementaryParticle dummy(small_ekin, 1);
    63     G4LorentzConvertor toTheNucleiSystemRestFrame;
    64 
    65     toTheNucleiSystemRestFrame.setBullet(dummy.getMomentum(), dummy.getMass());
    66     toTheNucleiSystemRestFrame.setTarget(PEX, nuclei_target->getMass());
    67     toTheNucleiSystemRestFrame.toTheTargetRestFrame();
    68 
    69     G4double etot = 0.001 * (EEXS - bindingEnergy(A, Z));
     65  G4LorentzVector totscm;
     66  G4LorentzVector totlab;
     67
     68  G4InuclNuclei* nuclei_target = dynamic_cast<G4InuclNuclei*>(target);
     69  if (!nuclei_target) {
     70    G4cerr << " BigBanger -> try to bang not nuclei " << G4endl;
     71    return;
     72  }
     73
     74  G4double A = nuclei_target->getA();
     75  G4double Z = nuclei_target->getZ();
     76  G4LorentzVector PEX = nuclei_target->getMomentum();
     77  G4double EEXS = nuclei_target->getExitationEnergy();
     78  G4InuclElementaryParticle dummy(small_ekin, 1);
     79  G4LorentzConvertor toTheNucleiSystemRestFrame;
     80 
     81  toTheNucleiSystemRestFrame.setBullet(dummy);
     82  toTheNucleiSystemRestFrame.setTarget(nuclei_target);
     83  toTheNucleiSystemRestFrame.toTheTargetRestFrame();
     84 
     85  G4double etot = (EEXS - G4NucleiProperties::GetBindingEnergy(G4lrint(A), G4lrint(Z) ) ) * MeV/GeV;  // To Bertini units
     86  if (etot < 0.0) etot = 0.0;
     87 
     88  if (verboseLevel > 2) {
     89    G4cout << " BigBanger: target " << G4endl;
     90    nuclei_target->printParticle();
     91    G4cout << " BigBanger: a " << A << " z " << Z << " eexs " << EEXS << " etot " <<
     92      etot << " nm " << nuclei_target->getMass() << G4endl;
     93  }
     94 
     95  generateBangInSCM(etot, A, Z);
     96 
     97  if (verboseLevel > 2) {
     98    G4cout << " particles " << particles.size() << G4endl;
     99    for(G4int i = 0; i < G4int(particles.size()); i++)
     100      particles[i].printParticle();
     101  }
     102
     103  if(!particles.empty()) { // convert back to Lab
     104    particleIterator ipart;
     105   
     106    for(ipart = particles.begin(); ipart != particles.end(); ipart++) {
     107      if (verboseLevel > 2) {
     108        totscm += ipart->getMomentum();
     109      }
     110      G4LorentzVector mom =
     111        toTheNucleiSystemRestFrame.backToTheLab(ipart->getMomentum());
     112      ipart->setMomentum(mom);
     113     
     114      if (verboseLevel > 2) {
     115        mom = ipart->getMomentum();
     116        totlab += mom;
     117      }
     118    }
     119
     120    std::sort(particles.begin(), particles.end(), G4ParticleLargerEkin());
    70121
    71122    if (verboseLevel > 2) {
    72       G4cout << " BigBanger: target " << G4endl;
    73       nuclei_target->printParticle();
    74       G4cout << " BigBanger: a " << A << " z " << Z << " eexs " << EEXS << " etot " <<
    75         etot << " nm " << nuclei_target->getMass() << G4endl;
    76     }
    77  
    78     std::vector<G4InuclElementaryParticle> particles =     
    79       generateBangInSCM(etot, A, Z, dummy.getParticleMass(1), dummy.getParticleMass(2));
    80 
    81     if (verboseLevel > 2) {
    82       G4cout << " particles " << particles.size() << G4endl;
    83       for(G4int i = 0; i < G4int(particles.size()); i++)
    84         particles[i].printParticle();
    85     }
    86     if(!particles.empty()) { // convert back to Lab
    87       //      if (verboseLevel > 2) {
    88       // not used    G4CascadeMomentum totscm;
    89       // not used    G4CascadeMomentum totlab;
    90       //      }
    91       particleIterator ipart;
    92 
    93       for(ipart = particles.begin(); ipart != particles.end(); ipart++) {
    94         if (verboseLevel > 2) {
    95           const G4CascadeMomentum& mom_scm = ipart->getMomentum();
    96 
    97           for(G4int i = 0; i < 4; i++) totscm[i] += mom_scm[i];
    98         }
    99         G4CascadeMomentum mom =
    100           toTheNucleiSystemRestFrame.backToTheLab(ipart->getMomentum());
    101         ipart->setMomentum(mom);
    102 
    103         if (verboseLevel > 2) {
    104           mom = ipart->getMomentum();
    105           for(G4int i = 0; i < 4; i++) totlab[i] += mom[i];
    106         }
    107       };
    108       std::sort(particles.begin(), particles.end(), G4ParticleLargerEkin());
    109       if (verboseLevel > 2) {
    110         G4cout << " In SCM: total outgoing momentum " << G4endl
    111                << " E " << totscm[0] << " px " << totscm[1]
    112                << " py " << totscm[2] << " pz " << totscm[3] << G4endl;
    113         G4cout << " In Lab: mom cons " << G4endl
    114                << " E " << PEX[0] + 0.001 * EEXS - totlab[0]
    115                << " px " << PEX[1] - totlab[1]
    116                << " py " << PEX[2] - totlab[2]
    117                << " pz " << PEX[3] - totlab[3] << G4endl;
    118       }
    119     }; 
    120     output.addOutgoingParticles(particles);
    121   }
    122   else {
    123     G4cout << " BigBanger -> try to bang not nuclei " << G4endl;
    124   };
    125 
    126   return output;
     123      G4cout << " In SCM: total outgoing momentum " << G4endl
     124             << " E " << totscm.e() << " px " << totscm.x()
     125             << " py " << totscm.y() << " pz " << totscm.z() << G4endl;
     126      G4cout << " In Lab: mom cons " << G4endl
     127             << " E " << PEX.e() + 0.001 * EEXS - totlab.e()
     128             << " px " << PEX.x() - totlab.x()
     129             << " py " << PEX.y() - totlab.y()
     130             << " pz " << PEX.z() - totlab.z() << G4endl;
     131    }
     132  }
     133
     134  output.addOutgoingParticles(particles);
     135
     136  return;
    127137}                   
    128138
    129 std::vector<G4InuclElementaryParticle>             
    130 G4BigBanger::generateBangInSCM(G4double etot,
    131                                G4double a,
    132                                G4double z,
    133                                G4double mp,
    134                                G4double mn) const {
    135 
     139void G4BigBanger::generateBangInSCM(G4double etot, G4double a, G4double z) {
    136140  if (verboseLevel > 3) {
    137141    G4cout << " >>> G4BigBanger::generateBangInSCM" << G4endl;
    138142  }
     143
     144  // Proton and neutron masses
     145  const G4double mp = G4InuclElementaryParticle::getParticleMass(1);
     146  const G4double mn = G4InuclElementaryParticle::getParticleMass(2);
    139147
    140148  const G4double ang_cut = 0.9999;
     
    147155    G4cout << " ia " << ia << " iz " << iz << G4endl;
    148156  }
    149   std::vector<G4InuclElementaryParticle> particles;
     157
     158  particles.clear();    // Reset output vector before filling
    150159 
    151160  if(ia == 1) {
     
    153162    G4double m = iz > 0 ? mp : mn;
    154163    G4double pmod = std::sqrt((etot + 2.0 * m) * etot);
    155     G4CascadeMomentum mom;
    156     std::pair<G4double, G4double> COS_SIN = randomCOS_SIN();
    157     G4double FI = randomPHI();
    158     G4double Pt = pmod * COS_SIN.second;
    159 
    160     mom[1] = Pt * std::cos(FI);
    161     mom[2] = Pt * std::sin(FI);
    162     mom[3] = Pt * COS_SIN.first;   
     164    G4LorentzVector mom = generateWithRandomAngles(pmod, m);
    163165
    164166    G4int knd = iz > 0 ? 1 : 2;
    165167
    166     //    particles.push_back(G4InuclElementaryParticle(mom, knd));
    167168    particles.push_back(G4InuclElementaryParticle(mom, knd, 8)); // modelId included
    168169
    169     return particles;
     170    return;
    170171  }; 
    171172     
    172   std::vector<G4double> pmod = generateMomentumModules(etot, a, z, mp, mn);
     173  generateMomentumModules(etot, a, z);
    173174  G4bool bad = true;
    174175  G4int itry = 0;
     
    176177  while(bad && itry < itry_max) {
    177178    itry++;
    178     std::vector<G4CascadeMomentum> scm_momentums;
    179     G4CascadeMomentum tot_mom;
     179    std::vector<G4LorentzVector> scm_momentums;
     180    G4LorentzVector tot_mom;
    180181
    181182    if(ia == 2) {
    182       G4CascadeMomentum mom;
    183       std::pair<G4double, G4double> COS_SIN = randomCOS_SIN();
    184       double FI = randomPHI();
    185       double Pt = pmod[0] * COS_SIN.second;
    186 
    187       mom[1] = Pt * std::cos(FI);
    188       mom[2] = Pt * std::sin(FI);
    189       mom[3] = Pt * COS_SIN.first;   
    190 
    191       for(G4int j = 1; j < 4; j++) tot_mom[j] += mom[j];                 
     183      // FIXME:  This isn't actually a correct four-vector, wrong mass!
     184      G4LorentzVector mom = generateWithRandomAngles(momModules[0]);
     185
     186      tot_mom += mom;           
    192187
    193188      scm_momentums.push_back(mom);
    194189
    195       G4CascadeMomentum mom1;
    196 
    197       for(G4int i = 1; i < 4; i++) mom1[i] = - mom[i];
     190      G4LorentzVector mom1 = -mom;
    198191
    199192      scm_momentums.push_back(mom1); 
    200193      bad = false;
    201     }
    202     else {
     194    } else {
    203195      for(G4int i = 0; i < ia - 2; i++) {
    204         G4CascadeMomentum mom;
    205         std::pair<G4double, G4double> COS_SIN = randomCOS_SIN();
    206         G4double FI = randomPHI();
    207         G4double Pt = pmod[i] * COS_SIN.second;
    208 
    209         mom[1] = Pt * std::cos(FI);
    210         mom[2] = Pt * std::sin(FI);
    211         mom[3] = Pt * COS_SIN.first;   
    212 
    213         for(G4int j = 1; j < 4; j++) tot_mom[j] += mom[j];               
     196        // FIXME:  This isn't actually a correct four-vector, wrong mass!
     197        G4LorentzVector mom = generateWithRandomAngles(momModules[i]);
     198
     199        tot_mom += mom;         
    214200
    215201        scm_momentums.push_back(mom);
     
    217203
    218204      //                handle last two
    219       G4double tot_mod = std::sqrt(tot_mom[1] * tot_mom[1] +
    220                               tot_mom[2] * tot_mom[2] +
    221                               tot_mom[3] * tot_mom[3]);
    222       G4double ct = -0.5 * (tot_mod * tot_mod + pmod[ia - 2] * pmod[ia - 2] -
    223                             pmod[ia - 1] * pmod[ia - 1]) / tot_mod / pmod[ia - 2];
     205      G4double tot_mod = tot_mom.rho();
     206      G4double ct = -0.5 * (tot_mod * tot_mod + momModules[ia - 2] * momModules[ia - 2] -
     207                            momModules[ia - 1] * momModules[ia - 1]) / tot_mod / momModules[ia - 2];
    224208
    225209      if (verboseLevel > 2) {
     
    228212 
    229213      if(std::fabs(ct) < ang_cut) {
    230         G4CascadeMomentum mom2 = generateWithFixedTheta(ct, pmod[ia - 2]);
     214        // FIXME:  These are not actually four-vectors, just three-momenta
     215        G4LorentzVector mom2 = generateWithFixedTheta(ct, momModules[ia - 2]);
    231216        //       rotate to the normal system
    232         G4CascadeMomentum apr = tot_mom;
    233         G4int i;
    234         for(i = 1; i < 4; i++) apr[i] /= tot_mod;
    235         G4double a_tr = std::sqrt(apr[1] * apr[1] + apr[2] * apr[2]);
    236         G4CascadeMomentum mom;
    237         mom[1] = mom2[3] * apr[1] + ( mom2[1] * apr[2] + mom2[2] * apr[3] * apr[1]) / a_tr; // ::: replace with clhep tools?
    238         mom[2] = mom2[3] * apr[2] + (-mom2[1] * apr[1] + mom2[2] * apr[3] * apr[2]) / a_tr;     
    239         mom[3] = mom2[3] * apr[3] - mom2[2] * a_tr;     
     217        G4LorentzVector apr = tot_mom/tot_mod;
     218        G4double a_tr = std::sqrt(apr.x()*apr.x() + apr.y()*apr.y());
     219        G4LorentzVector mom;
     220        mom.setX(mom2.z()*apr.x() + ( mom2.x()*apr.y() + mom2.y()*apr.z()*apr.x())/a_tr);
     221        mom.setY(mom2.z()*apr.y() + (-mom2.x()*apr.x() + mom2.y()*apr.z()*apr.y())/a_tr);
     222        mom.setZ(mom2.z()*apr.z() - mom2.y()*a_tr);
     223
    240224        scm_momentums.push_back(mom);
    241225        //               and the last one
    242         G4CascadeMomentum mom1;
    243         for(i = 1; i < 4; i++) mom1[i] = - mom[i] - tot_mom[i];
     226        G4LorentzVector mom1= - mom - tot_mom;
    244227        scm_momentums.push_back(mom1); 
    245228        bad = false;
     
    250233        G4int knd = i < iz ? 1 : 2;
    251234
    252         particles.push_back(G4InuclElementaryParticle(scm_momentums[i], knd));
     235        particles.push_back(G4InuclElementaryParticle(scm_momentums[i], knd, 8));
    253236      };
    254237    };
     
    258241  }
    259242
    260   return particles;
    261  
     243  return;
    262244}
    263245           
    264 std::vector<G4double> G4BigBanger::generateMomentumModules(G4double etot,
    265                                                              G4double a,
    266                                                              G4double z,
    267                                                              G4double mp,
    268                                                              G4double mn) const {
    269 
    270 
     246void G4BigBanger::generateMomentumModules(G4double etot, G4double a, G4double z) {
    271247  if (verboseLevel > 3) {
    272248    G4cout << " >>> G4BigBanger::generateMomentumModules" << G4endl;
    273249  }
    274250
    275   G4int ia = int(a + 0.1);
    276   G4int iz = int(z + 0.1);
    277   std::vector<G4double> pmod;
     251  // Proton and neutron masses
     252  const G4double mp = G4InuclElementaryParticle::getParticleMass(1);
     253  const G4double mn = G4InuclElementaryParticle::getParticleMass(2);
     254
     255  momModules.clear();           // Reset buffer for filling
     256
     257  G4int ia = G4int(a + 0.1);
     258  G4int iz = G4int(z + 0.1);
     259
    278260  G4double xtot = 0.0;
    279261  G4double promax = maxProbability(a);
     
    286268      G4cout << " i " << i << " x " << x << G4endl;
    287269    }
    288     pmod.push_back(x);
     270    momModules.push_back(x);
    289271    xtot += x;
    290272  };
     
    292274    G4double m = i < iz ? mp : mn;
    293275
    294     pmod[i] = pmod[i] * etot / xtot;
    295     pmod[i] = std::sqrt(pmod[i] * (pmod[i] + 2.0 * m));
     276    momModules[i] = momModules[i] * etot / xtot;
     277    momModules[i] = std::sqrt(momModules[i] * (momModules[i] + 2.0 * m));
    296278
    297279    if (verboseLevel > 2) {
    298       G4cout << " i " << i << " pmod " << pmod[i] << G4endl;
     280      G4cout << " i " << i << " pmod " << momModules[i] << G4endl;
    299281    }
    300282  };
    301283
    302   return pmod; 
    303 }
    304 
    305 G4double G4BigBanger::xProbability(G4double x,
    306                                    G4int ia) const {
     284  return; 
     285}
     286
     287G4double G4BigBanger::xProbability(G4double x, G4int ia) const {
    307288
    308289
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4CascadParticle.cc

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4CascadParticle.cc,v 1.14 2010/03/16 22:10:26 mkelsey Exp $
     26// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100112  M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
     29// 20100114  M. Kelsey -- Replace vector<G4Double> position with G4ThreeVector
     30
    2631#include "G4CascadParticle.hh"
     32#include "G4ios.hh"
     33#include <cmath>
    2734
    2835G4CascadParticle::G4CascadParticle()
    29   : verboseLevel(2) {
    30 
     36  : verboseLevel(0), current_zone(-1), current_path(-1.), movingIn(false),
     37    reflectionCounter(0), reflected(false), generation(-1) {
    3138  if (verboseLevel > 3) {
    3239    G4cout << " >>> G4CascadParticle::G4CascadParticle" << G4endl;
     
    3643G4double G4CascadParticle::getPathToTheNextZone(G4double rz_in,
    3744                                                G4double rz_out) {
    38   verboseLevel = 2;
    39 
    4045  if (verboseLevel > 3) {
    4146    G4cout << " >>> G4CascadParticle::getPathToTheNextZone" << G4endl;
    4247  }
    4348
     49  const G4LorentzVector& mom = getMomentum();
     50
    4451  G4double path = -1.0;
    45   G4double rp = 0.0;
    46   G4double rr = 0.0;
    47   G4double pp = 0.0;
    48   const G4CascadeMomentum& mom = theParticle.getMomentum();
    49 
    50   for (G4int i = 1; i < 4; i++) {
    51     rp += mom[i] * position[i - 1];
    52     rr += position[i - 1] * position[i - 1];
    53     pp += mom[i] * mom[i];
    54   };
     52  G4double rp = mom.vect().dot(position);
     53  G4double rr = position.mag2();
     54  G4double pp = mom.vect().mag2();
    5555
    5656  G4double ra = rr - rp * rp / pp;
     
    6363    ds = 1.0;
    6464    movingIn = false;
    65  
    6665  } else {
    67 
    6866    d2 = rz_in * rz_in - ra;
    69 
    7067    if (d2 > 0.0) {
    7168      ds = -1.0;
    7269      movingIn = true;
    73  
    7470    } else {
    75 
    7671      d2 = rz_out * rz_out - ra;
    7772      ds = 1.0;
    7873      movingIn = false;
    79     };
    80   };
     74    }
     75  }
    8176
    8277  path = ds * std::sqrt(d2) - rp / pp;
     
    8681
    8782void G4CascadParticle::propagateAlongThePath(G4double path) {
    88 
    8983  if (verboseLevel > 3) {
    9084    G4cout << " >>> G4CascadParticle::propagateAlongThePath" << G4endl;
    9185  }
    9286
    93   const G4CascadeMomentum& mom = theParticle.getMomentum();
    94   G4double pmod = theParticle.getMomModule();
     87  position += getMomentum().vect().unit()*path;
     88}
    9589
    96   for(G4int i = 0; i < 3; i++) position[i] += mom[i + 1] * path / pmod;
     90void G4CascadParticle::print() const {
     91  theParticle.printParticle();
     92  G4cout << " zone " << current_zone << " current_path " << current_path
     93         << " reflectionCounter " << reflectionCounter << G4endl
     94         << " x " << position.x() << " y " << position.y()
     95         << " z " << position.z() << G4endl;
     96}
    9797
    98 }
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4CascadeChannel.cc

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4CascadeChannel.cc,v 1.7 2010/05/15 04:25:17 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100514  M. Kelsey -- All functionality removed except quantum-number
     29//              validation functions.
    2630
    2731#include "G4CascadeChannel.hh"
    28 #include "Randomize.hh"
    29 
    30 std::pair<G4int, G4double>
    31 G4CascadeChannel::interpolateEnergy(G4double e)
    32 {
    33   G4int index = 30;
    34   G4double fraction = 0.0;
    35 
    36   for (G4int i = 1; i < 31; i++) {
    37     if (e < energyScale[i]) {
    38       index = i-1;
    39       fraction = (e - energyScale[index]) / (energyScale[i] - energyScale[index]);
    40       break;
    41     }
    42   }
    43   return std::pair<G4int, G4double>(index, fraction);
    44 }
     32#include "G4ParticleDefinition.hh"
     33#include <vector>
    4534
    4635
    47 G4int
    48 G4CascadeChannel::sampleFlat(std::vector<G4double> const& sigma)
    49 {
    50   G4int i;
    51   G4double sum(0.);
    52   for (i = 0; i < G4int(sigma.size()); i++) sum += sigma[i];
    53  
    54   G4double fsum = sum*G4UniformRand();
    55   G4double partialSum = 0.0;
    56   G4int channel = 0;
    57 
    58   for (i = 0; i < G4int(sigma.size()); i++) {
    59     partialSum += sigma[i];
    60     if (fsum < partialSum) {
    61       channel = i;
    62       break;
    63     }
    64   }
    65 
    66   return channel;
    67 }
    68 
    69 
    70 std::vector<G4int>
    71 G4CascadeChannel::getQnums(G4int type)
    72 {
     36std::vector<G4int> G4CascadeChannel::getQnums(G4int type) {
    7337  G4int bary=0, str=0, ch=0;
    7438  std::vector<G4int> Qnums(3);
     
    160124}
    161125
     126void
     127G4CascadeChannel::CheckQnums(const G4FastVector<G4ReactionProduct,256> &vec,
     128                             G4int &vecLen,
     129                             G4ReactionProduct &currentParticle,
     130                             G4ReactionProduct &targetParticle,
     131                             G4double Q, G4double B, G4double S) {
     132  G4ParticleDefinition* projDef = currentParticle.GetDefinition();
     133  G4ParticleDefinition* targDef = targetParticle.GetDefinition();
     134  G4double chargeSum = projDef->GetPDGCharge() + targDef->GetPDGCharge();
     135  G4double baryonSum = projDef->GetBaryonNumber() + targDef->GetBaryonNumber();
     136  G4double strangenessSum = projDef->GetQuarkContent(3) -
     137                            projDef->GetAntiQuarkContent(3) +
     138                            targDef->GetQuarkContent(3) -
     139                            targDef->GetAntiQuarkContent(3);
    162140
     141  G4ParticleDefinition* secDef = 0;
     142  for (G4int i = 0; i < vecLen; i++) {
     143    secDef = vec[i]->GetDefinition();
     144    chargeSum += secDef->GetPDGCharge();
     145    baryonSum += secDef->GetBaryonNumber();
     146    strangenessSum += secDef->GetQuarkContent(3)
     147                    - secDef->GetAntiQuarkContent(3);
     148  }
    163149
    164 const G4double G4CascadeChannel::energyScale[31] =
    165   { 0.0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45,
    166     0.5, 1.0,  1.5, 2.0,  2.5, 3.0,  3.5, 4.0,  4.5, 5.0,
    167     5.5, 6.0,  6.5, 7.0,  7.5, 8.0,  8.5, 9.0,  9.5, 10.0, 15.0 };
     150  G4bool OK = true;
     151  if (chargeSum != Q) {
     152    G4cout << " Charge not conserved " << G4endl;
     153    OK = false;
     154  }
     155  if (baryonSum != B) {
     156    G4cout << " Baryon number not conserved " << G4endl;
     157    OK = false;
     158  }
     159  if (strangenessSum != S) {
     160    G4cout << " Strangeness not conserved " << G4endl;
     161    OK = false;
     162  }
     163
     164  if (!OK) {
     165    G4cout << " projectile: " << projDef->GetParticleName()
     166           << "  target: " << targDef->GetParticleName() << G4endl;
     167    for (G4int i = 0; i < vecLen; i++) {
     168      secDef = vec[i]->GetDefinition();
     169      G4cout << secDef->GetParticleName() << " " ;
     170    }
     171    G4cout << G4endl;
     172  }
     173}
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4CascadeInterface.cc

    r1196 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4CascadeInterface.cc,v 1.77 2010/05/21 18:07:30 mkelsey Exp $
     26// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100114  M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
     29// 20100413  M. Kelsey -- Pass G4CollisionOutput by ref to ::collide()
     30// 20100414  M. Kelsey -- Check for K0L/K0S before using G4InuclElemPart::type
     31// 20100418  M. Kelsey -- Reference output particle lists via const-ref, use
     32//              const_iterator for both.
     33// 20100428  M. Kelsey -- Use G4InuclParticleNames enum
     34// 20100429  M. Kelsey -- Change "case gamma:" to "case photon:"
     35// 20100517  M. Kelsey -- Follow new ctors for G4*Collider family.
     36// 20100520  M. Kelsey -- Simplify collision loop, move momentum rotations to
     37//              G4CollisionOutput, copy G4DynamicParticle directly from
     38//              G4InuclParticle, no switch-block required.
    2639
    2740#include "G4CascadeInterface.hh"
    2841#include "globals.hh"
    29 #include "G4DynamicParticleVector.hh"
    30 #include "G4IonTable.hh"
     42#include "G4CollisionOutput.hh"
     43#include "G4DynamicParticle.hh"
    3144#include "G4InuclCollider.hh"
    32 // #include "G4IntraNucleiCascader.hh"
    3345#include "G4InuclElementaryParticle.hh"
    3446#include "G4InuclNuclei.hh"
    3547#include "G4InuclParticle.hh"
    36 #include "G4CollisionOutput.hh"
     48#include "G4InuclParticleNames.hh"
     49#include "G4KaonZeroShort.hh"
     50#include "G4KaonZeroLong.hh"
     51#include "G4LorentzRotation.hh"
     52#include "G4Nucleus.hh"
     53#include "G4ParticleDefinition.hh"
     54#include "G4Track.hh"
    3755#include "G4V3DNucleus.hh"
    38 #include "G4Track.hh"
    39 #include "G4Nucleus.hh"
    40 #include "G4NucleiModel.hh"
    41 #include "G4LorentzRotation.hh"
    42 
     56
     57using namespace G4InuclParticleNames;
    4358
    4459//#define BERTDEV 1  // A flag to activate a development version of Bertini cascade
    4560
    46 typedef std::vector<G4InuclElementaryParticle>::iterator particleIterator;
    47 typedef std::vector<G4InuclNuclei>::iterator nucleiIterator;
     61typedef std::vector<G4InuclElementaryParticle>::const_iterator particleIterator;
     62typedef std::vector<G4InuclNuclei>::const_iterator nucleiIterator;
    4863
    4964G4CascadeInterface::G4CascadeInterface(const G4String& nam)
     
    89104  // NOTE: Geant4 units are MeV = 1 and GeV = 1000. Cascade code by default use GeV = 1.
    90105
    91   enum particleType { nuclei = 0, proton = 1, neutron = 2, pionPlus = 3,
    92                       pionMinus = 5, pionZero = 7, photon = 10,
    93                       kaonPlus = 11, kaonMinus = 13, kaonZero = 15,
    94                       kaonZeroBar = 17, lambda = 21, sigmaPlus = 23,
    95                       sigmaZero = 25, sigmaMinus = 27, xiZero = 29, xiMinus = 31 };
    96 
    97   G4int bulletType = 0;
    98 
    99   // Coding particles
    100   if (aTrack.GetDefinition() ==    G4Proton::Proton()    ) bulletType = proton;
    101   if (aTrack.GetDefinition() ==   G4Neutron::Neutron()   ) bulletType = neutron;
    102   if (aTrack.GetDefinition() ==  G4PionPlus::PionPlus()  ) bulletType = pionPlus;
    103   if (aTrack.GetDefinition() == G4PionMinus::PionMinus() ) bulletType = pionMinus;
    104   if (aTrack.GetDefinition() ==  G4PionZero::PionZero()  ) bulletType = pionZero;
    105   if (aTrack.GetDefinition() ==     G4Gamma::Gamma()     ) bulletType = photon;
    106   if (aTrack.GetDefinition() == G4KaonPlus::KaonPlus()     ) bulletType = kaonPlus;
    107   if (aTrack.GetDefinition() == G4KaonMinus::KaonMinus()   ) bulletType = kaonMinus;
    108   if (aTrack.GetDefinition() == G4Lambda::Lambda()         ) bulletType = lambda;
    109   if (aTrack.GetDefinition() == G4SigmaPlus::SigmaPlus()   ) bulletType = sigmaPlus;
    110   if (aTrack.GetDefinition() == G4SigmaZero::SigmaZero()   ) bulletType = sigmaZero;
    111   if (aTrack.GetDefinition() == G4SigmaMinus::SigmaMinus() ) bulletType = sigmaMinus;
    112   if (aTrack.GetDefinition() == G4XiZero::XiZero()         ) bulletType = xiZero;
    113   if (aTrack.GetDefinition() == G4XiMinus::XiMinus()       ) bulletType = xiMinus; 
    114 
     106  G4int bulletType;
    115107  if (aTrack.GetDefinition() == G4KaonZeroLong::KaonZeroLong() ||
    116       aTrack.GetDefinition() == G4KaonZeroShort::KaonZeroShort() ) {
    117     if (G4UniformRand() > 0.5) {
    118       bulletType = kaonZero;
    119     } else {
    120       bulletType = kaonZeroBar;
    121     }
    122   }
     108      aTrack.GetDefinition() == G4KaonZeroShort::KaonZeroShort() )
     109    bulletType = (G4UniformRand() > 0.5) ? kaonZero : kaonZeroBar;
     110  else
     111    bulletType = G4InuclElementaryParticle::type(aTrack.GetDefinition());
    123112
    124113  // Code momentum and energy.
    125   G4double px,py,pz;
    126   px=aTrack.Get4Momentum().px() / GeV;
    127   py=aTrack.Get4Momentum().py() / GeV;
    128   pz=aTrack.Get4Momentum().pz() / GeV;
    129 
    130114  G4LorentzVector projectileMomentum = aTrack.Get4Momentum();
    131115  G4LorentzRotation toZ;
     
    134118  G4LorentzRotation toLabFrame = toZ.inverse();
    135119
    136   G4CascadeMomentum momentumBullet;
    137   momentumBullet[0] =0.;
    138   momentumBullet[1] =0;
    139   momentumBullet[2] =0;
    140   momentumBullet[3] =std::sqrt(px*px+py*py+pz*pz);
    141 
    142   G4InuclElementaryParticle *  bullet = new G4InuclElementaryParticle(momentumBullet, bulletType);
     120  G4LorentzVector momentumBullet(0., 0., aTrack.GetTotalMomentum()/GeV,
     121                                 aTrack.GetTotalEnergy()/GeV);
     122
     123  G4InuclElementaryParticle* bullet =
     124    new G4InuclElementaryParticle(momentumBullet, bulletType);
    143125
    144126  sumEnergy = bullet->getKineticEnergy(); // In GeV
    145 
    146   if (bulletType == proton || bulletType == neutron || bulletType == lambda ||
    147       bulletType == sigmaPlus || bulletType == sigmaZero || bulletType == sigmaMinus ||
    148       bulletType == xiZero || bulletType == xiMinus) {
    149 
    150     sumBaryon += 1;
    151   }
     127  sumBaryon += bullet->baryon();        // Returns baryon number (0, 1, or 2)
    152128
    153129  // Set target
    154130  G4InuclNuclei*   target  = 0;
    155131  G4InuclParticle* targetH = 0;
    156   // and outcoming particles
    157   G4DynamicParticle* cascadeParticle = 0;
    158 
    159   G4CascadeMomentum targetMomentum;
    160132
    161133  G4double theNucleusA = theNucleus.GetN();
    162134
    163   if ( !(G4int(theNucleusA) == 1) ) {
    164     target  = new G4InuclNuclei(targetMomentum,
    165                                 theNucleusA,
    166                                 theNucleus.GetZ());
    167     target->setEnergy();
    168 
    169     const G4CascadeMomentum& bmom = bullet->getMomentum();
    170     eInit = std::sqrt(bmom[0] * bmom[0]);
    171     const G4CascadeMomentum& tmom = target->getMomentum();
    172     eInit += std::sqrt(tmom[0] * tmom[0]);
     135  if ( G4int(theNucleusA) != 1 ) {
     136    target  = new G4InuclNuclei(theNucleusA, theNucleus.GetZ());
     137    eInit = bullet->getEnergy() + target->getEnergy();
    173138
    174139    sumBaryon += theNucleusA;
     
    187152
    188153  // Colliders initialisation
    189   //  G4ElementaryParticleCollider*   colep = new G4ElementaryParticleCollider;
    190   //  G4IntraNucleiCascader*            inc = new G4IntraNucleiCascader; // the actual cascade
    191   //  inc->setInteractionCase(1); // Interaction type is particle with nuclei.
    192   inc.setInteractionCase(1); // Interaction type is particle with nuclei.
    193 
    194   //  G4NonEquilibriumEvaporator*     noneq = new G4NonEquilibriumEvaporator;
    195   //  G4EquilibriumEvaporator*         eqil = new G4EquilibriumEvaporator;
    196   //  G4Fissioner*                     fiss = new G4Fissioner;
    197   //  G4BigBanger*                     bigb = new G4BigBanger;
    198   G4InuclCollider* collider = new G4InuclCollider(&colep, &inc, &noneq, &eqil, &fiss, &bigb);
    199 
    200       G4int  maxTries = 100; // maximum tries for inelastic collision to avoid infinite loop
    201       G4int  nTries   = 0;  // try counter
     154  G4InuclCollider* collider = new G4InuclCollider;
     155
     156  G4int  maxTries = 100; // maximum tries for inelastic collision to avoid infinite loop
     157  G4int  nTries   = 0;  // try counter
    202158
    203159#ifdef BERTDEV
    204       G4int coulombOK =0;  // flag for correct Coulomb barrier
    205 #endif
    206       if (G4int(theNucleusA) == 1) { // special treatment for target H(1,1) (proton)
    207 
    208         targetH = new G4InuclElementaryParticle(targetMomentum, 1);
    209 
    210         G4float cutElastic[32];
    211 
    212         cutElastic[proton   ] = 1.0; // GeV
    213         cutElastic[neutron  ] = 1.0;
    214         cutElastic[pionPlus ] = 0.6;
    215         cutElastic[pionMinus] = 0.2;
    216         cutElastic[pionZero ] = 0.2;
    217         cutElastic[kaonPlus ] = 0.5;
    218         cutElastic[kaonMinus] = 0.5;
    219         cutElastic[kaonMinus] = 0.5;
    220         cutElastic[kaonZero] = 0.5;
    221         cutElastic[kaonZeroBar] = 0.5;
    222         cutElastic[lambda] = 1.0;
    223         cutElastic[sigmaPlus] = 1.0;
    224         cutElastic[sigmaZero] = 1.0;
    225         cutElastic[sigmaMinus] = 1.0;
    226         cutElastic[xiZero] = 1.0;
    227         cutElastic[xiMinus] = 1.0;
    228 
    229         if (momentumBullet[3] > cutElastic[bulletType]) { // inelastic collision possible
    230 
    231           do {   // we try to create inelastic interaction
    232             output = collider->collide(bullet, targetH);
    233             nTries++;
    234           } while(
    235                   (nTries < maxTries)                                           &&
    236                   (output.getOutgoingParticles().size() == 2                    && // elastic: bullet + p = H(1,1) coming out
    237                    (output.getOutgoingParticles().begin()->type() == bulletType ||
    238                     output.getOutgoingParticles().begin()->type() == proton)
    239                    )
    240                   );
    241         } else { // only elastic collision is energetically possible
    242           output = collider->collide(bullet, targetH);
     160  G4int coulombOK =0;  // flag for correct Coulomb barrier
     161#endif
     162  if (G4int(theNucleusA) == 1) { // special treatment for target H(1,1) (proton)
     163   
     164    targetH = new G4InuclElementaryParticle(proton);
     165   
     166    G4float cutElastic[32];
     167   
     168    cutElastic[proton   ] = 1.0; // GeV
     169    cutElastic[neutron  ] = 1.0;
     170    cutElastic[pionPlus ] = 0.6;
     171    cutElastic[pionMinus] = 0.2;
     172    cutElastic[pionZero ] = 0.2;
     173    cutElastic[kaonPlus ] = 0.5;
     174    cutElastic[kaonMinus] = 0.5;
     175    cutElastic[kaonZero] = 0.5;
     176    cutElastic[kaonZeroBar] = 0.5;
     177    cutElastic[lambda] = 1.0;
     178    cutElastic[sigmaPlus] = 1.0;
     179    cutElastic[sigmaZero] = 1.0;
     180    cutElastic[sigmaMinus] = 1.0;
     181    cutElastic[xiZero] = 1.0;
     182    cutElastic[xiMinus] = 1.0;
     183   
     184    if (momentumBullet.z() > cutElastic[bulletType]) { // inelastic collision possible
     185     
     186      do {   // we try to create inelastic interaction
     187        output.reset();
     188        collider->collide(bullet, targetH, output);
     189        nTries++;
     190      } while(
     191              (nTries < maxTries) &&
     192              (output.getOutgoingParticles().size() == 2 && // elastic: bullet + p = H(1,1) coming out
     193               (output.getOutgoingParticles().begin()->type() == bulletType ||
     194                output.getOutgoingParticles().begin()->type() == proton)
     195               )
     196              );
     197    } else { // only elastic collision is energetically possible
     198      collider->collide(bullet, targetH, output);
     199    }
     200   
     201    sumBaryon += 1;
     202   
     203    eInit = bullet->getEnergy() + targetH->getEnergy();
     204   
     205    if (verboseLevel > 2) {
     206      G4cout << "Target:  " << G4endl;
     207      targetH->printParticle();
     208    }
     209   
     210  } else {  // treat all other targets excepet H(1,1)
     211   
     212    do { // we try to create inelastic interaction
     213
     214#ifdef BERTDEV
     215      coulombOK=0;  // by default coulomb analysis is OK
     216#endif
     217      output.reset();
     218      collider->collide(bullet, target, output);
     219      nTries++;
     220     
     221#ifdef BERTDEV
     222      G4double coulumbBarrier = 8.7 * MeV;
     223      const std::vector<G4InuclElementaryParticle>& p= output.getOutgoingParticles();
     224      if(!p.empty()) {
     225        for(    particleIterator ipart = p.begin(); ipart != p.end(); ipart++) {
     226          if (ipart->type() == proton) {
     227            G4double e = ipart->getKineticEnergy()*GeV;
     228            if (e < coulumbBarrier) coulombOK= 1; // If event with coulomb barrier violation detected -> retry
     229            //            G4cout << "///AH "<< e << "" << coulumbBarrier <<G4endl;
     230          }
    243231        }
    244 
    245         sumBaryon += 1;
    246 
    247         const G4CascadeMomentum& bmom = bullet->getMomentum();
    248         eInit = std::sqrt(bmom[0] * bmom[0]);
    249         const G4CascadeMomentum& tmom = targetH->getMomentum();
    250         eInit += std::sqrt(tmom[0] * tmom[0]);
    251 
    252         if (verboseLevel > 2) {
    253           G4cout << "Target:  " << G4endl;
    254           targetH->printParticle();
    255         }
    256 
    257       } else {  // treat all other targets excepet H(1,1)
    258 
    259         do  // we try to create inelastic interaction
    260           {
     232      }
     233#endif
     234    } while(
     235            (nTries < maxTries) &&  // conditions for next try
     236            (output.getOutgoingParticles().size()!=0) &&
    261237#ifdef BERTDEV
    262             coulombOK=0;  // by default coulomb analysis is OK
    263 #endif
    264             output = collider->collide(bullet, target );
    265             nTries++;
    266 
    267 #ifdef BERTDEV
    268             G4double coulumbBarrier = 8.7 * MeV;
    269             std::vector<G4InuclElementaryParticle> p= output.getOutgoingParticles();
    270             if(!p.empty()) {
    271               for(    particleIterator ipart = p.begin(); ipart != p.end(); ipart++) {
    272                 if (ipart->type() == proton) {
    273                   G4double e = ipart->getKineticEnergy()*GeV;
    274                   if (e < coulumbBarrier) coulombOK= 1; // If event with coulomb barrier violation detected -> retry
    275                   //              G4cout << "///AH "<< e << "" << coulumbBarrier <<G4endl;
    276                 }
    277               }
    278             }
    279           } while(
    280                   (nTries < maxTries) &&  // conditions for next try
    281                   (coulombOK==1) &&
    282                   ((output.getOutgoingParticles().size() + output.getNucleiFragments().size()) > 2.5) && 
    283                   (output.getOutgoingParticles().size()!=0)                                       
    284                   );
     238            (coulombOK==1) &&
     239            ((output.getOutgoingParticles().size() + output.getNucleiFragments().size()) > 2.5)
    285240#else
    286 
    287           } while(
    288                    (nTries < maxTries)                                                               &&
    289                    (output.getOutgoingParticles().size() + output.getNucleiFragments().size() < 2.5) &&
    290                    (output.getOutgoingParticles().size()!=0) &&
    291                    (output.getOutgoingParticles().begin()->type()==bullet->type())
    292                    );
    293 #endif
    294      }
    295 
    296   if (verboseLevel > 1)
    297     {
    298       G4cout << " Cascade output: " << G4endl;
    299       output.printCollisionOutput();
    300     }
     241            ((output.getOutgoingParticles().size() + output.getNucleiFragments().size()) < 2.5) && 
     242            (output.getOutgoingParticles().begin()->type()==bullet->type())
     243#endif
     244             );
     245  }
     246
     247  if (verboseLevel > 1) {
     248    G4cout << " Cascade output: " << G4endl;
     249    output.printCollisionOutput();
     250  }
    301251 
     252  // Rotate event to put Z axis along original projectile direction
     253  output.rotateEvent(toLabFrame);
     254
    302255  // Convert cascade data to use hadronics interface
    303   std::vector<G4InuclNuclei>            nucleiFragments = output.getNucleiFragments();
    304   std::vector<G4InuclElementaryParticle> particles =      output.getOutgoingParticles();
     256  const std::vector<G4InuclNuclei>& nucleiFragments = output.getNucleiFragments();
     257  const std::vector<G4InuclElementaryParticle>& particles = output.getOutgoingParticles();
    305258
    306259  theResult.SetStatusChange(stopAndKill);
    307260
     261  // Get outcoming particles
     262  G4DynamicParticle* cascadeParticle = 0;
    308263  if (!particles.empty()) {
    309     particleIterator ipart;
    310     G4int outgoingParticle;
    311 
    312     for (ipart = particles.begin(); ipart != particles.end(); ipart++) {
    313       outgoingParticle = ipart->type();
    314       const G4CascadeMomentum& mom = ipart->getMomentum();
    315       eTot   += std::sqrt(mom[0] * mom[0]);
    316 
    317       G4double ekin = ipart->getKineticEnergy() * GeV;
    318       G4ThreeVector aMom(mom[1], mom[2], mom[3]);
    319       aMom = aMom.unit();
    320 
    321       if (ipart->baryon() ) {
    322         sumBaryon -= 1;
     264    particleIterator ipart = particles.begin();
     265    for (; ipart != particles.end(); ipart++) {
     266      G4int outgoingType = ipart->type();
     267
     268      eTot += ipart->getEnergy();
     269      sumBaryon -= ipart->baryon();
     270      sumEnergy -= ipart->getKineticEnergy();
     271
     272      if (!ipart->valid() || ipart->quasi_deutron()) {
     273        G4cerr << " ERROR: G4CascadeInterface::Propagate incompatible"
     274               << " particle type " << outgoingType << G4endl;
     275        continue;
    323276      }
    324277
    325       sumEnergy -= ekin / GeV;
    326 
    327       switch(outgoingParticle) {
    328 
    329       case proton:
    330 #ifdef debug_G4CascadeInterface
    331         G4cerr << "proton " << counter << " " << aMom << " " << ekin << G4endl;
    332 #endif
    333         cascadeParticle =
    334           new G4DynamicParticle(G4Proton::ProtonDefinition(), aMom, ekin);
    335         break;
    336 
    337       case neutron:
    338 
    339 #ifdef debug_G4CascadeInterface
    340         G4cerr << "neutron "<< counter<<" "<<aMom<<" "<<  ekin<<G4endl;
    341 #endif
    342         cascadeParticle =
    343           new G4DynamicParticle(G4Neutron::NeutronDefinition(), aMom, ekin);
    344         break;
    345 
    346       case pionPlus:
    347         cascadeParticle =
    348           new G4DynamicParticle(G4PionPlus::PionPlusDefinition(), aMom, ekin);
    349 
    350 #ifdef debug_G4CascadeInterface
    351         G4cerr << "pionPlus "<< counter<<" "<<aMom<<" "<<  ekin<<G4endl;
    352 #endif
    353         break;
    354 
    355       case pionMinus:
    356         cascadeParticle =
    357           new G4DynamicParticle(G4PionMinus::PionMinusDefinition(), aMom, ekin);
    358 
    359 #ifdef debug_G4CascadeInterface
    360         G4cerr << "pionMinus "<< counter<<" "<<aMom<<" "<<  ekin<<G4endl;
    361 #endif
    362         break;
    363 
    364       case pionZero:
    365         cascadeParticle =
    366           new G4DynamicParticle(G4PionZero::PionZeroDefinition(), aMom, ekin);
    367 
    368 #ifdef debug_G4CascadeInterface
    369         G4cerr << "pionZero "<< counter<<" "<<aMom<<" "<<  ekin<<G4endl;
    370 #endif
    371         break;
    372 
    373       case photon:
    374         cascadeParticle =
    375           new G4DynamicParticle(G4Gamma::Gamma(), aMom, ekin);
    376 
    377 #ifdef debug_G4CascadeInterface
    378         G4cerr << "photon "<< counter<<" "<<aMom<<" "<<  ekin<<G4endl;
    379 #endif
    380         break;
    381 
    382 
    383       case kaonPlus:
    384         cascadeParticle =
    385           new G4DynamicParticle(G4KaonPlus::KaonPlusDefinition(), aMom, ekin);
    386         break;
    387 
    388       case kaonMinus:
    389         cascadeParticle =
    390          new G4DynamicParticle(G4KaonMinus::KaonMinusDefinition(), aMom, ekin);
    391         break;
    392 
    393       case kaonZero:
    394         if (G4UniformRand() > 0.5) {
    395           cascadeParticle = new G4DynamicParticle(
    396                               G4KaonZeroLong::KaonZeroLongDefinition(),
    397                               aMom, ekin);
    398         } else {
    399           cascadeParticle = new G4DynamicParticle(
    400                               G4KaonZeroShort::KaonZeroShortDefinition(),
    401                               aMom, ekin);
    402         }
    403         break;
    404 
    405       case kaonZeroBar:
    406         if (G4UniformRand() > 0.5) {
    407           cascadeParticle = new G4DynamicParticle(
    408                               G4KaonZeroLong::KaonZeroLongDefinition(),
    409                               aMom, ekin);
    410         } else {
    411           cascadeParticle = new G4DynamicParticle(
    412                               G4KaonZeroShort::KaonZeroShortDefinition(),
    413                               aMom, ekin);
    414         }
    415         break;
    416 
    417       case lambda:
    418         cascadeParticle =
    419          new G4DynamicParticle(G4Lambda::LambdaDefinition(), aMom, ekin);
    420         break;
    421 
    422       case sigmaPlus:
    423         cascadeParticle =
    424          new G4DynamicParticle(G4SigmaPlus::SigmaPlusDefinition(), aMom, ekin);
    425         break;
    426 
    427       case sigmaZero:
    428         cascadeParticle =
    429          new G4DynamicParticle(G4SigmaZero::SigmaZeroDefinition(), aMom, ekin);
    430         break;
    431 
    432       case sigmaMinus:
    433         cascadeParticle =
    434          new G4DynamicParticle(G4SigmaMinus::SigmaMinusDefinition(), aMom, ekin);
    435         break;
    436 
    437       case xiZero:
    438         cascadeParticle =
    439          new G4DynamicParticle(G4XiZero::XiZeroDefinition(), aMom, ekin);
    440         break;
    441 
    442       case xiMinus:
    443         cascadeParticle =
    444          new G4DynamicParticle(G4XiMinus::XiMinusDefinition(), aMom, ekin);
    445         break;
    446 
    447       default:
    448         G4cout << " ERROR: G4CascadeInterface::Propagate undefined particle type"
    449                << G4endl;
     278      // Copy local G4DynPart to public output (handle kaon mixing specially)
     279      if (outgoingType == kaonZero || outgoingType == kaonZeroBar) {
     280        G4ThreeVector momDir = ipart->getMomentum().vect().unit();
     281        G4double ekin = ipart->getKineticEnergy();
     282
     283        G4ParticleDefinition* pd = G4KaonZeroShort::Definition();
     284        if (G4UniformRand() > 0.5) pd = G4KaonZeroLong::Definition();
     285
     286        cascadeParticle = new G4DynamicParticle(pd, momDir, ekin);
     287      } else {
     288        cascadeParticle = new G4DynamicParticle(ipart->getDynamicParticle());
    450289      }
    451290
    452       cascadeParticle->Set4Momentum(cascadeParticle->Get4Momentum()*=toLabFrame);
    453291      theResult.AddSecondary(cascadeParticle);
    454292    }
     
    457295  // get nuclei fragments
    458296  G4DynamicParticle * aFragment = 0;
    459   G4ParticleDefinition * aIonDef = 0;
    460   G4ParticleTable *theTableOfParticles = G4ParticleTable::GetParticleTable();
    461 
    462297  if (!nucleiFragments.empty()) {
    463     nucleiIterator ifrag;
    464 
    465     for (ifrag = nucleiFragments.begin(); ifrag != nucleiFragments.end(); ifrag++)
    466       {
    467         G4double eKin = ifrag->getKineticEnergy() * GeV;
    468         const G4CascadeMomentum& mom = ifrag->getMomentum();
    469         eTot   += std::sqrt(mom[0] * mom[0]);
    470 
    471         G4ThreeVector aMom(mom[1], mom[2], mom[3]);
    472         aMom = aMom.unit();
    473 
    474         // hpw @@@ ==> Should be zero: G4double fragmentExitation = ifrag->getExitationEnergyInGeV();
    475 
    476         if (verboseLevel > 2) {
    477           G4cout << " Nuclei fragment: " << G4endl;
    478           ifrag->printParticle();
    479         }
    480 
    481         G4int A = G4int(ifrag->getA());
    482         G4int Z = G4int(ifrag->getZ());
    483         aIonDef = theTableOfParticles->FindIon(Z, A, 0, Z);
    484      
    485         aFragment =  new G4DynamicParticle(aIonDef, aMom, eKin);
    486 
    487         sumBaryon -= A;
    488         sumEnergy -= eKin / GeV;
    489 
    490         aFragment->Set4Momentum(aFragment->Get4Momentum()*=toLabFrame);
    491         theResult.AddSecondary(aFragment);
     298    nucleiIterator ifrag = nucleiFragments.begin();
     299    for (; ifrag != nucleiFragments.end(); ifrag++) {
     300      eTot += ifrag->getEnergy();
     301      sumBaryon -= ifrag->getA();
     302      sumEnergy -= ifrag->getKineticEnergy();
     303     
     304      // hpw @@@ ==> Should be zero: G4double fragmentExitation = ifrag->getExitationEnergyInGeV();
     305     
     306      if (verboseLevel > 2) {
     307        G4cout << " Nuclei fragment: " << G4endl;
     308        ifrag->printParticle();
    492309      }
    493   }
    494 
     310     
     311      // Copy local G4DynPart to public output
     312      aFragment =  new G4DynamicParticle(ifrag->getDynamicParticle());
     313      theResult.AddSecondary(aFragment);
     314    }
     315  }
     316
     317  // Report violations of energy, baryon conservation
    495318  if (verboseLevel > 2) {
    496319    if (sumBaryon != 0) {
     
    514337
    515338  delete bullet;
    516 //  delete inc;
    517339  delete collider;
    518340
    519341  if(target != 0) delete target;
    520342  if(targetH != 0) delete targetH;
    521  // if(cascadeParticle != 0) delete cascadeParticle;
    522  // if(aFragment != 0) delete aFragment;
    523343
    524344  return &theResult;
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4CascadeKminusNChannel.cc

    r962 r1315  
    2828
    2929namespace {
    30 
    31   // Total cross section as a function of kinetic energy
    32   G4double kmntot[31];
    33  
    34   // Multiplicities as a function of kinetic energy
    35   G4double kmnMultiplicities[6][31];
    36 
    37 
    38   const G4int kmnindex[6][2] =
    39     {{0, 5}, {5, 20}, {20, 48}, {48, 90}, {90, 110}, {110, 121}};
    40 
    4130  // Outgoing particle types of a given multiplicity
    4231
    43   const G4int kmn2bfs[5][2] =
     32  static const G4int kmn2bfs[5][2] =
    4433    {{2, 13}, {5, 21}, {5, 25}, {7, 27}, {15, 31} };
    4534
    46   const G4int kmn3bfs[15][3] =
     35  static const G4int kmn3bfs[15][3] =
    4736    {{1,5,13},   {2,7,13},   {2,5,17},   {5,7,21},   {5,5,23},
    4837     {5,7,25},   {7,7,27},   {3,5,27},   {13,15,21}, {13,15,25},
    4938     {15,17,27}, {11,13,27}, {5,15,29},  {7,15,31},  {5,11,31} };
    5039
    51   const G4int kmn4bfs[28][4] =
     40  static const G4int kmn4bfs[28][4] =
    5241    {{1,5,7,13},   {1,5,5,17},   {2,7,7,13},   {2,3,5,13},
    5342     {2,5,7,17},   {5,7,7,21},   {3,5,5,21},   {5,5,7,23},
     
    5847     {5,5,11,29},  {7,7,15,31},  {3,5,15,31},  {5,7,11,31} };
    5948
    60   const G4int kmn5bfs[42][5] =
     49  static const G4int kmn5bfs[42][5] =
    6150    {{1,5,7,7,13},   {1,3,5,5,13},   {1,5,5,7,17},   {2,7,7,7,13},
    6251     {2,3,5,7,13},   {2,5,7,7,17},   {2,3,5,5,17},   {5,7,7,7,21},
     
    7160     {5,7,7,11,31},  {3,5,5,11,31} };
    7261
    73   const G4int kmn6bfs[20][6] =
     62  static const G4int kmn6bfs[20][6] =
    7463    {{1,5,7,7,7,13}, {1,3,5,5,7,13}, {1,5,5,7,7,17}, {1,3,5,5,5,17},
    7564     {2,7,7,7,7,13}, {2,3,5,7,7,13}, {2,3,3,5,5,13}, {2,5,7,7,7,17},
     
    7867     {3,3,5,5,5,25}, {7,7,7,7,7,27}, {3,5,7,7,7,27}, {3,3,5,5,7,27} };
    7968
    80   const G4int kmn7bfs[11][7] =
     69  static const G4int kmn7bfs[11][7] =
    8170    {{1,5,7,7,7,7,13}, {1,3,5,5,7,7,13}, {1,3,3,5,5,5,13},
    8271     {1,5,5,7,7,7,17}, {1,3,5,5,5,7,17}, {2,7,7,7,7,7,13},
     
    9584  // second index: kinetic energy
    9685  //
    97   const G4float kmnCrossSections[121][31] = {
     86  static const G4double kmnCrossSections[121][31] = {
    9887    //
    9988    // multiplicity 2 (5 channels)
     
    721710
    722711G4CascadeKminusNChannelData::data_t
    723 G4CascadeKminusNChannelData::data = { kmntot,
    724                                       kmnMultiplicities,
    725                                       kmnindex,
    726                                       kmn2bfs,
    727                                       kmn3bfs,
    728                                       kmn4bfs,
    729                                       kmn5bfs,
    730                                       kmn6bfs,
    731                                       kmn7bfs,
    732                                       kmnCrossSections };
    733 namespace {
    734   struct initializer
    735   {
    736     initializer() { G4CascadeKminusNChannelData::data.initialize(); }
    737   };
    738  
    739   initializer init;
    740 }
    741 
     712G4CascadeKminusNChannelData::data(kmn2bfs, kmn3bfs, kmn4bfs,
     713                                  kmn5bfs, kmn6bfs, kmn7bfs,
     714                                  kmnCrossSections);
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4CascadeKminusPChannel.cc

    r962 r1315  
    2828
    2929namespace {
    30 
    31   // Total cross section as a function of kinetic energy
    32   G4double kmptot[31];
    33  
    34   // Multiplicities as a function of kinetic energy
    35   G4double kmpMultiplicities[6][31];
    36 
    37 
    38   const G4int kmpindex[6][2] =
    39     {{0, 8}, {8, 28}, {28, 62}, {62, 110}, {110, 132}, {132, 148}};
    40 
    4130  // Outgoing particle types of a given multiplicity
    4231
    43   const G4int kmp2bfs[8][2] =
     32  static const G4int kmp2bfs[8][2] =
    4433    {{1, 13}, {2, 17}, {7, 21},  {5, 23},
    4534     {7, 25}, {3, 27}, {15, 29}, {11, 31} };
    4635
    47   const G4int kmp3bfs[20][3] =
     36  static const G4int kmp3bfs[20][3] =
    4837    {{1,7,13},   {1,5,17},   {2,3,13},   {2,7,17},   {7,7,21},
    4938     {3,5,21},   {11,13,21}, {15,17,21}, {5,7,23},   {13,15,23},
     
    5140     {11,17,27}, {7,15,29},  {5,11,29},  {3,15,31},  {7,11,31} };
    5241 
    53   const G4int kmp4bfs[34][4] =
     42  static const G4int kmp4bfs[34][4] =
    5443    {{1,7,7,13},   {1,3,5,13},   {1,5,7,17},   {2,3,7,13},
    5544     {2,7,7,17},   {2,3,5,17},   {7,7,7,21},   {3,5,7,21},
     
    6251     {7,7,11,31},  {3,5,11,31} };
    6352
    64   const G4int kmp5bfs[48][5] =
     53  static const G4int kmp5bfs[48][5] =
    6554    {{1,7,7,7,13},   {1,3,5,7,13},   {1,5,7,7,17},   {1,3,5,5,17},
    6655     {2,3,7,7,13},   {2,3,3,5,13},   {2,7,7,7,17},   {2,3,5,7,17},
     
    7665     {7,7,7,11,31},  {3,5,7,11,31},  {3,7,7,15,31},  {3,3,5,15,31} };
    7766
    78   const G4int kmp6bfs[22][6] =
     67  static const G4int kmp6bfs[22][6] =
    7968    {{1,7,7,7,7,13}, {1,3,5,7,7,13}, {1,3,3,5,5,13}, {1,5,7,7,7,17},
    8069     {1,3,5,5,7,17}, {2,3,7,7,7,13}, {2,3,3,5,7,13}, {2,7,7,7,7,17},
     
    8473     {3,3,5,7,7,27}, {3,3,3,5,5,27} };
    8574
    86   const G4int kmp7bfs[16][7] =
     75  static const G4int kmp7bfs[16][7] =
    8776    {{1,7,7,7,7,7,13}, {1,3,5,7,7,7,13}, {1,3,3,5,5,7,13},
    8877     {1,5,7,7,7,7,17}, {1,3,5,5,7,7,17}, {1,3,3,5,5,5,17},
     
    10392  // second index: kinetic energy
    10493  //
    105   const G4float kmpCrossSections[148][31] = {
     94  static const G4double kmpCrossSections[148][31] = {
    10695    //
    10796    // multiplicity 2 (8 channels)
     
    864853
    865854G4CascadeKminusPChannelData::data_t
    866 G4CascadeKminusPChannelData::data = { kmptot,
    867                                       kmpMultiplicities,
    868                                       kmpindex,
    869                                       kmp2bfs,
    870                                       kmp3bfs,
    871                                       kmp4bfs,
    872                                       kmp5bfs,
    873                                       kmp6bfs,
    874                                       kmp7bfs,
    875                                       kmpCrossSections };
    876 
    877 namespace {
    878   struct initializer
    879   {
    880     initializer() { G4CascadeKminusPChannelData::data.initialize(); }
    881   };
    882 
    883   initializer init;
    884 }
     855G4CascadeKminusPChannelData::data(kmp2bfs, kmp3bfs, kmp4bfs,
     856                                  kmp5bfs, kmp6bfs, kmp7bfs,
     857                                  kmpCrossSections);
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4CascadeKplusNChannel.cc

    r962 r1315  
    2828 
    2929namespace {
    30 
    31   // Total cross section as a function of kinetic energy
    32   G4double kpntot[31];
    33  
    34   // Multiplicities as a function of kinetic energy
    35   G4double kpnMultiplicities[6][31];
    36 
    37   const G4int kpnindex[6][2] =
    38     {{0, 2}, {2, 7}, {7,20}, {20,42}, {42,74}, {74,115}};
    39  
    40                                                    
    4130  // Outgoing particle types of a given multiplicity
    4231 
    43   const G4int kpn2bfs[2][2] =
     32  static const G4int kpn2bfs[2][2] =
    4433    {{2,11}, {1,15}};
    4534 
    46   const G4int kpn3bfs[5][3] =
     35  static const G4int kpn3bfs[5][3] =
    4736    {{2,7,11}, {1,5,11}, {2,3,15}, {1,7,15}, {11,15,21}}; 
    4837 
    49   const G4int kpn4bfs[13][4] =
     38  static const G4int kpn4bfs[13][4] =
    5039    {{2,7,7,11},   {2,3,5,11},   {1,5,7,11},   {2,3,7,15},   {1,7,7,15},
    5140     {1,3,5,15},   {2,11,11,13}, {2,11,15,17}, {1,15,15,17}, {1,11,13,15},
    5241     {7,11,15,21}, {5,11,11,21}, {3,15,15,21}};
    5342 
    54   const G4int kpn5bfs[22][5] =
     43  static const G4int kpn5bfs[22][5] =
    5544    {{2,11,7,7,7},   {2,3,5,7,11},   {1,5,7,7,11},   {1,3,5,5,11},
    5645     {2,3,7,7,15},   {2,3,3,5,15},   {1,7,7,7,15},   {1,3,5,7,15},
     
    6049     {5,7,11,11,21}, {3,7,15,15,21}};
    6150
    62   const G4int kpn6bfs[32][6] =
     51  static const G4int kpn6bfs[32][6] =
    6352    {{2,7,7,7,7,11},   {2,3,5,7,7,11},   {2,3,3,5,5,11},   {1,5,7,7,7,11},
    6453     {1,3,5,5,7,11},   {2,3,7,7,7,15},   {2,3,3,5,7,15},   {1,7,7,7,7,15},
     
    7059     {5,7,7,11,11,21}, {3,5,5,11,11,21}, {3,7,7,15,15,21}, {3,3,5,15,15,21}};
    7160 
    72   const G4int kpn7bfs[41][7] =
     61  static const G4int kpn7bfs[41][7] =
    7362    {{2,7,7,7,7,7,11},   {2,3,5,7,7,7,11},   {2,3,3,5,5,7,11},
    7463     {1,5,7,7,7,7,11},   {1,3,5,5,7,7,11},   {1,3,3,5,5,5,11},
     
    9887  // second index: kinetic energy
    9988  //
    100   const G4float kpnCrossSections[115][31] = {
     89  static const G4double kpnCrossSections[115][31] = {
    10190    //
    10291    // multiplicity 2 (2 channels)
     
    689678
    690679G4CascadeKplusNChannelData::data_t
    691 G4CascadeKplusNChannelData::data = { kpntot,
    692                                      kpnMultiplicities,
    693                                      kpnindex,
    694                                      kpn2bfs,
    695                                      kpn3bfs,
    696                                      kpn4bfs,
    697                                      kpn5bfs,
    698                                      kpn6bfs,
    699                                      kpn7bfs,
    700                                      kpnCrossSections };
    701 
    702 namespace {
    703   struct initializer
    704   {
    705     initializer() { G4CascadeKplusNChannelData::data.initialize(); }
    706   };
    707  
    708   initializer init;
    709 }
     680G4CascadeKplusNChannelData::data(kpn2bfs, kpn3bfs, kpn4bfs,
     681                                 kpn5bfs, kpn6bfs, kpn7bfs,
     682                                 kpnCrossSections);
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4CascadeKplusPChannel.cc

    r962 r1315  
    2828
    2929namespace {
    30 
    31   // Total cross section as a function of kinetic energy
    32   G4double kpptot[31];
    33  
    34   // Multiplicities as a function of kinetic energy
    35   G4double kppMultiplicities[6][31];
    36 
    37   const G4int kppindex[6][2] =
    38     {{0, 1}, {1, 5}, {5,15}, {15,34}, {34,62}, {62,100}};
    39 
    4030  // Outgoing particle types of a given multiplicity
    4131
    42   const G4int kpp2bfs[1][2] =
     32  static const G4int kpp2bfs[1][2] =
    4333    {{1, 11}};
    4434
    45   const G4int kpp3bfs[4][3] =
     35  static const G4int kpp3bfs[4][3] =
    4636    {{1,7,11}, {2,3,11}, {1,3,15}, {11,11,21}};
    4737 
    48   const G4int kpp4bfs[10][4] =
     38  static const G4int kpp4bfs[10][4] =
    4939    {{1,7,7,11},  {1,3,5,11},  {2,3,7,11},  {1,3,7,15},  {2,3,3,15},
    5040     {1,11,15,17},{1,11,11,13},{2,11,11,17},{7,11,11,21},{3,11,15,21}};
    5141
    52   const G4int kpp5bfs[19][5] =
     42  static const G4int kpp5bfs[19][5] =
    5343    {{1,7,7,7,11},   {1,3,5,7,11},   {2,3,7,7,11},   {2,3,3,5,11},
    5444     {1,3,7,7,15},   {1,3,3,5,15},   {2,3,3,7,15},   {1,7,11,15,17},
     
    5747     {3,5,11,11,21}, {3,7,11,15,21}, {3,3,15,15,21}};
    5848 
    59   const G4int kpp6bfs[28][6] =
     49  static const G4int kpp6bfs[28][6] =
    6050    {{1,7,7,7,7,11},   {1,3,5,7,7,11},   {1,3,3,5,5,11},
    6151     {2,3,7,7,7,11},   {2,3,3,5,7,11},   {1,3,7,7,7,15},
     
    6959     {3,3,7,15,15,21}};
    7060 
    71   const G4int kpp7bfs[38][7] =
     61  static const G4int kpp7bfs[38][7] =
    7262    {{1,7,7,7,7,7,11},   {1,3,5,7,7,7,11},   {1,3,3,5,5,7,11},
    7363     {2,3,7,7,7,7,11},   {2,3,3,5,7,7,11},   {2,3,3,3,5,5,11},
     
    9585  // second index: kinetic energy
    9686  //
    97   const G4float kppCrossSections[100][31] = {
     87  static const G4double kppCrossSections[100][31] = {
    9888    //
    9989    // multiplicity 2 (1 channel)
     
    613603
    614604G4CascadeKplusPChannelData::data_t
    615 G4CascadeKplusPChannelData::data = { kpptot,
    616                                      kppMultiplicities,
    617                                      kppindex,
    618                                      kpp2bfs,
    619                                      kpp3bfs,
    620                                      kpp4bfs,
    621                                      kpp5bfs,
    622                                      kpp6bfs,
    623                                      kpp7bfs,
    624                                      kppCrossSections };
    625 
    626 namespace {
    627   struct initializer
    628   {
    629     initializer() { G4CascadeKplusPChannelData::data.initialize(); }
    630   };
    631 
    632   initializer init;
    633 }
     605G4CascadeKplusPChannelData::data(kpp2bfs, kpp3bfs, kpp4bfs,
     606                                 kpp5bfs, kpp6bfs, kpp7bfs,
     607                                 kppCrossSections);
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4CascadeKzeroBarNChannel.cc

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
    25 //
     25// $Id: G4CascadeKzeroBarNChannel.cc,v 1.5 2010/05/16 05:18:36 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2627
    2728#include "G4CascadeKzeroBarNChannel.hh"
    2829
    2930namespace {
    30 
    31   // Total cross section as a function of kinetic energy
    32   G4double kzbntot[31];
    33  
    34   // Multiplicities as a function of kinetic energy
    35   G4double kzbnMultiplicities[6][31];
    36 
    37   const G4int kzbnindex[6][2] =
    38     {{0, 8}, {8, 28}, {28, 62}, {62, 110}, {110, 132}, {132, 148}};
    39 
    4031  // Outgoing particle types of a given multiplicity
    4132
    42   const G4int kzbn2bfs[8][2] =
     33  static const G4int kzbn2bfs[8][2] =
    4334    {{2, 17}, {1, 13}, {7, 21},  {5, 23},
    4435     {7, 25}, {3, 27}, {15, 29}, {11, 31} };
    4536
    46   const G4int kzbn3bfs[20][3] =
     37  static const G4int kzbn3bfs[20][3] =
    4738    {{2,7,17},   {2,3,13},   {1,5,17},   {1,7,13},   {7,7,21},
    4839     {3,5,21},   {11,13,21}, {15,17,21}, {5,7,23},   {13,15,23},
     
    5041     {11,17,27}, {7,15,29},  {5,11,29},  {3,15,31},  {7,11,31} };
    5142
    52   const G4int kzbn4bfs[34][4] =
     43  static const G4int kzbn4bfs[34][4] =
    5344    {{2,7,7,17},   {2,3,5,17},   {2,3,7,13},   {1,5,7,17},
    5445     {1,7,7,13},   {1,3,5,13},   {7,7,7,21},   {3,5,7,21},
     
    6152     {7,7,11,31},  {3,5,11,31} };
    6253
    63   const G4int kzbn5bfs[48][5] =
     54  static const G4int kzbn5bfs[48][5] =
    6455    {{2,7,7,7,17},   {2,3,5,7,17},   {2,3,7,7,13},   {2,3,3,5,13},
    6556     {1,5,7,7,17},   {1,3,5,5,17},   {1,7,7,7,13},   {1,3,5,7,13},   
     
    7566     {7,7,7,11,31},  {3,5,7,11,31},  {3,7,7,15,31},  {3,3,5,15,31} };
    7667
    77   const G4int kzbn6bfs[22][6] =
     68  static const G4int kzbn6bfs[22][6] =
    7869    {{2,7,7,7,7,17}, {2,3,5,7,7,17}, {2,3,3,5,5,17}, {2,3,7,7,7,13},
    7970     {2,3,3,5,7,13}, {1,5,7,7,7,17}, {1,3,5,5,7,17}, {1,7,7,7,7,13},
     
    8374     {3,3,5,7,7,27}, {3,3,3,5,5,27} };
    8475
    85   const G4int kzbn7bfs[16][7] =
     76  static const G4int kzbn7bfs[16][7] =
    8677    {{2,7,7,7,7,7,17}, {2,3,5,7,7,7,17}, {2,3,3,5,5,7,17},
    8778     {2,3,7,7,7,7,13}, {2,3,3,5,7,7,13}, {2,3,3,3,5,5,13},
     
    10293  // second index: kinetic energy
    10394  //
    104   const G4float kzbnCrossSections[148][31] = {
     95  static const G4double kzbnCrossSections[148][31] = {
    10596    //
    10697    // multiplicity 2 (8 channels)
     
    863854
    864855G4CascadeKzeroBarNChannelData::data_t
    865 G4CascadeKzeroBarNChannelData::data = { kzbntot,
    866                                         kzbnMultiplicities,
    867                                         kzbnindex,
    868                                         kzbn2bfs,
    869                                         kzbn3bfs,
    870                                         kzbn4bfs,
    871                                         kzbn5bfs,
    872                                         kzbn6bfs,
    873                                         kzbn7bfs,
    874                                         kzbnCrossSections };
    875 
    876 namespace {
    877   struct initializer
    878   {
    879     initializer() { G4CascadeKzeroBarNChannelData::data.initialize(); }
    880   };
    881 
    882   initializer init;
    883 }
     856G4CascadeKzeroBarNChannelData::data(kzbn2bfs, kzbn3bfs, kzbn4bfs,
     857                                    kzbn5bfs, kzbn6bfs, kzbn7bfs,
     858                                    kzbnCrossSections);
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4CascadeKzeroBarPChannel.cc

    r962 r1315  
    2828
    2929namespace {
    30 
    31   // Total cross section as a function of kinetic energy
    32   G4double kzbptot[31];
    33  
    34   // Multiplicities as a function of kinetic energy
    35   G4double kzbpMultiplicities[6][31];
    36 
    37   const G4int kzbpindex[6][2] =
    38     {{0, 5}, {5, 20}, {20, 48}, {48, 90}, {90, 110}, {110, 121}};
    39 
    4030  // Outgoing particle types of a given multiplicity
    4131
    42   const G4int kzbp2bfs[5][2] =
     32  static const G4int kzbp2bfs[5][2] =
    4333    {{1, 17}, {3, 21}, {3, 25}, {7, 23}, {11, 29} };
    4434
    45   const G4int kzbp3bfs[15][3] =
     35  static const G4int kzbp3bfs[15][3] =
    4636    {{2,3,17},   {1,7,17},   {1,3,13},   {3,7,21},   {11,17,21},   
    4737     {3,3,27},   {3,7,25},   {7,7,23},   {3,5,23},   {11,17,25},
    4838     {15,17,23}, {11,13,23}, {3,11,31},  {7,11,29},  {3,15,29} };
    4939
    50   const G4int kzbp4bfs[28][4] =
     40  static const G4int kzbp4bfs[28][4] =
    5141    {{2,3,7,17},   {2,3,3,13},   {1,7,7,17},   {1,3,5,17},   
    5242     {1,3,7,13},   {3,7,7,21},   {3,3,5,21},   {7,11,17,21},
     
    5747     {3,3,15,31},  {7,7,11,29},  {3,5,11,29},  {3,7,15,29} };
    5848
    59   const G4int kzbp5bfs[42][5] =
     49  static const G4int kzbp5bfs[42][5] =
    6050    {{2,3,7,7,17},   {2,3,3,5,17},   {2,3,3,7,13},   {1,7,7,7,17},
    6151     {1,3,5,7,17},   {1,3,7,7,13},   {1,3,3,5,13},   {3,7,7,7,21},
     
    7060     {3,7,7,15,29},  {3,3,5,15,29} }; 
    7161
    72   const G4int kzbp6bfs[20][6] =
     62  static const G4int kzbp6bfs[20][6] =
    7363    {{2,3,7,7,7,17}, {2,3,3,5,7,17}, {2,3,3,7,7,13}, {2,3,3,3,5,13},
    7464     {1,7,7,7,7,17}, {1,3,5,7,7,17}, {1,3,3,5,5,17}, {1,3,7,7,7,13},
     
    7767     {3,3,3,5,5,25}, {7,7,7,7,7,23}, {3,5,7,7,7,23}, {3,3,5,5,7,23} };
    7868
    79   const G4int kzbp7bfs[11][7] =
     69  static const G4int kzbp7bfs[11][7] =
    8070    {{2,3,7,7,7,7,17}, {2,3,3,5,7,7,17}, {2,3,3,3,5,5,17},
    8171     {2,3,3,7,7,7,13}, {2,3,3,3,5,7,13}, {1,7,7,7,7,7,17},
     
    9484  // second index: kinetic energy
    9585  //
    96   const G4float kzbpCrossSections[121][31] = {
     86  static const G4double kzbpCrossSections[121][31] = {
    9787    //
    9888    // multiplicity 2 (5 channels)
     
    720710
    721711G4CascadeKzeroBarPChannelData::data_t
    722 G4CascadeKzeroBarPChannelData::data = { kzbptot,
    723                                         kzbpMultiplicities,
    724                                         kzbpindex,
    725                                         kzbp2bfs,
    726                                         kzbp3bfs,
    727                                         kzbp4bfs,
    728                                         kzbp5bfs,
    729                                         kzbp6bfs,
    730                                         kzbp7bfs,
    731                                         kzbpCrossSections };
    732 
    733 namespace {
    734   struct initializer
    735   {
    736     initializer() { G4CascadeKzeroBarPChannelData::data.initialize(); }
    737   };
    738 
    739   initializer init;
    740 }
     712G4CascadeKzeroBarPChannelData::data(kzbp2bfs, kzbp3bfs, kzbp4bfs,
     713                                    kzbp5bfs, kzbp6bfs, kzbp7bfs,
     714                                    kzbpCrossSections);
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4CascadeKzeroNChannel.cc

    r962 r1315  
    2828
    2929namespace {
    30 
    31   // Total cross section as a function of kinetic energy
    32   G4double k0ntot[31];
    33  
    34   // Multiplicities as a function of kinetic energy
    35   G4double k0nMultiplicities[6][31];
    36 
    37   const G4int k0nindex[6][2] =
    38     {{0, 1}, {1, 5}, {5,15}, {15,34}, {34,62}, {62,100}};
    39 
    4030  // Outgoing particle types of a given multiplicity
    4131
    42   const G4int k0n2bfs[1][2] =
     32  static const G4int k0n2bfs[1][2] =
    4333    {{2,15}};
    4434
    45   const G4int k0n3bfs[4][3] =
     35  static const G4int k0n3bfs[4][3] =
    4636    {{2,7,15}, {2,5,11}, {1,5,15}, {15,15,21}};
    4737
    48   const G4int k0n4bfs[10][4] =
     38  static const G4int k0n4bfs[10][4] =
    4939    {{2,7,7,15},  {1,5,5,11},  {2,5,7,11},  {1,5,7,15},  {2,3,5,15},
    5040     {1,13,15,15},{2,11,13,15},{2,15,15,17},{7,15,15,21},{5,11,15,21}};
    5141
    52   const G4int k0n5bfs[19][5] =
     42  static const G4int k0n5bfs[19][5] =
    5343    {{2,7,7,7,15},   {1,5,5,7,11},   {2,5,7,7,11},   {2,3,5,5,11},
    5444     {1,5,7,7,15},   {1,3,5,5,15},   {2,3,5,7,15},   {1,7,13,15,15},
     
    5747     {5,5,11,11,21}, {5,7,11,15,21}, {3,5,15,15,21}};
    5848
    59   const G4int k0n6bfs[28][6] =
     49  static const G4int k0n6bfs[28][6] =
    6050    {{2,7,7,7,7,15},   {1,5,5,7,7,11},   {1,3,5,5,5,11},
    6151     {2,5,7,7,7,11},   {2,3,5,5,7,11},   {1,5,7,7,7,15},
     
    6959     {3,5,7,15,15,21}};
    7060 
    71   const G4int k0n7bfs[38][7] =
     61  static const G4int k0n7bfs[38][7] =
    7262    {{2,7,7,7,7,7,15},   {1,3,5,5,5,7,11},   {1,5,5,7,7,7,11},
    7363     {2,5,7,7,7,7,11},   {2,3,5,5,7,7,11},   {2,3,3,5,5,5,11},
     
    9585  // second index: kinetic energy
    9686  //
    97   const G4float k0nCrossSections[100][31] = {
     87  static const G4double k0nCrossSections[100][31] = {
    9888    //
    9989    // multiplicity 2 (1 channel)
     
    613603
    614604G4CascadeKzeroNChannelData::data_t
    615 G4CascadeKzeroNChannelData::data = { k0ntot,
    616                                      k0nMultiplicities,
    617                                      k0nindex,
    618                                      k0n2bfs,
    619                                      k0n3bfs,
    620                                      k0n4bfs,
    621                                      k0n5bfs,
    622                                      k0n6bfs,
    623                                      k0n7bfs,
    624                                      k0nCrossSections };
    625 
    626 namespace {
    627   struct initializer
    628   {
    629     initializer() { G4CascadeKzeroNChannelData::data.initialize(); }
    630   };
    631 
    632   initializer init;
    633 }
     605G4CascadeKzeroNChannelData::data(k0n2bfs, k0n3bfs, k0n4bfs,
     606                                 k0n5bfs, k0n6bfs, k0n7bfs,
     607                                 k0nCrossSections);
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4CascadeKzeroPChannel.cc

    r962 r1315  
    2828
    2929namespace {
    30 
    31   // Total cross section as a function of kinetic energy
    32   G4double k0ptot[31];
    33  
    34   // Multiplicities as a function of kinetic energy
    35   G4double k0pMultiplicities[6][31];
    36 
    37   const G4int k0pindex[6][2] =
    38     {{0, 2}, {2, 7}, {7,20}, {20,42}, {42,74}, {74,115}};
    39  
    40                                                    
    4130  // Outgoing particle types of a given multiplicity
    4231 
    43   const G4int k0p2bfs[2][2] =
     32  static const G4int k0p2bfs[2][2] =
    4433    {{1,15}, {2,11}};
    4534 
    46   const G4int k0p3bfs[5][3] =
     35  static const G4int k0p3bfs[5][3] =
    4736    {{1,7,15}, {2,3,15}, {1,5,11}, {2,7,11}, {11,15,21}};
    4837 
    49   const G4int k0p4bfs[13][4] =
     38  static const G4int k0p4bfs[13][4] =
    5039    {{1,7,7,15},   {1,3,5,15},   {2,3,7,15},   {1,5,7,11},   {2,7,7,11},
    5140     {2,3,5,11},   {1,11,13,15}, {1,15,15,17}, {2,11,15,17}, {2,11,11,13},
    5241     {7,11,15,21}, {5,11,11,21}, {3,15,15,21}};
    5342 
    54   const G4int k0p5bfs[22][5] =
     43  static const G4int k0p5bfs[22][5] =
    5544    {{1,7,7,7,15},   {1,3,5,7,15},   {2,3,7,7,15},   {2,3,3,5,15},
    5645     {1,5,7,7,11},   {1,3,5,5,11},   {2,7,7,7,11},   {2,3,5,7,11},
     
    6049     {5,7,11,11,21}, {3,7,15,15,21}};
    6150
    62   const G4int k0p6bfs[32][6] =
     51  static const G4int k0p6bfs[32][6] =
    6352    {{1,7,7,7,7,15},   {1,3,5,7,7,15},   {1,3,3,5,5,15},   {2,3,7,7,7,15}, 
    6453     {2,3,3,5,7,15},   {1,5,7,7,7,11},   {1,3,5,5,7,11},   {2,7,7,7,7,11},
     
    7059     {5,7,7,11,11,21}, {3,5,5,11,11,21}, {3,7,7,15,15,21}, {3,3,5,15,15,21}};
    7160
    72   const G4int k0p7bfs[41][7] =
     61  static const G4int k0p7bfs[41][7] =
    7362    {{1,7,7,7,7,7,15},   {1,3,5,7,7,7,15},   {1,3,3,5,5,7,15},
    7463     {2,3,7,7,7,7,15},   {2,3,3,5,7,7,15},   {2,3,3,3,5,5,15},
     
    9887  // second index: kinetic energy
    9988  //
    100   const G4float k0pCrossSections[115][31] = {
     89  static const G4double k0pCrossSections[115][31] = {
    10190    //
    10291    // multiplicity 2 (2 channels)
     
    689678
    690679G4CascadeKzeroPChannelData::data_t
    691 G4CascadeKzeroPChannelData::data = { k0ptot,
    692                                      k0pMultiplicities,
    693                                      k0pindex,
    694                                      k0p2bfs,
    695                                      k0p3bfs,
    696                                      k0p4bfs,
    697                                      k0p5bfs,
    698                                      k0p6bfs,
    699                                      k0p7bfs,
    700                                      k0pCrossSections };
    701 
    702 namespace {
    703   struct initializer
    704   {
    705     initializer() { G4CascadeKzeroPChannelData::data.initialize(); }
    706   };
    707 
    708   initializer init;
    709 }
     680G4CascadeKzeroPChannelData::data(k0p2bfs, k0p3bfs, k0p4bfs,
     681                                 k0p5bfs, k0p6bfs, k0p7bfs,
     682                                 k0pCrossSections);
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4CascadeLambdaNChannel.cc

    r962 r1315  
    2828
    2929namespace {
    30 
    31   // Total cross section as a function of kinetic energy
    32   G4double lntot[31];
    33  
    34   // Multiplicities as a function of kinetic energy
    35   G4double lnMultiplicities[6][31];
    36 
    37   const G4int lnindex[6][2] =
    38     {{0, 3}, {3, 15}, {15,48}, {48,107}, {107,137}, {137,157}};
    39 
    4030  // Outgoing particle types of a given multiplicity
    4131
    42   const G4int ln2bfs[3][2] =
     32  static const G4int ln2bfs[3][2] =
    4333    {{2, 21}, {2,25}, {1,27}};
    4434
    45   const G4int ln3bfs[12][3] =
     35  static const G4int ln3bfs[12][3] =
    4636    {{1,2,13}, {2,2,17}, {1,5,21}, {2,7,21},  {1,7,27},  {2,3,27},
    4737     {1,5,25}, {2,7,25}, {2,5,23}, {1,15,31}, {2,11,31}, {2,15,29}};
    4838
    49   const G4int ln4bfs[33][4] =
     39  static const G4int ln4bfs[33][4] =
    5040    {{1,1,5,13},   {1,2,7,13},   {1,2,5,17},   {2,2,3,13},   {2,2,7,17},
    5141     {1,5,7,21},   {2,3,5,21},   {2,7,7,21},   {1,13,15,21}, {2,11,13,21},
     
    5646     {2,7,15,29},  {1,5,15,29},  {2,5,11,29}};   
    5747
    58   const G4int ln5bfs[59][5] =
     48  static const G4int ln5bfs[59][5] =
    5949    {{1,1,5,7,13},   {1,1,5,5,17},   {1,2,5,7,17},   {1,2,7,7,13},
    6050     {2,2,3,5,17},   {1,2,3,5,13},   {2,2,7,7,17},   {2,2,3,7,13},
     
    7363     {1,3,5,15,31},  {2,3,5,11,31},  {2,3,7,15,31}};
    7464
    75   const G4int ln6bfs[30][6] =
     65  static const G4int ln6bfs[30][6] =
    7666    {{1,1,5,7,7,13},   {1,1,3,5,5,13},   {1,1,5,5,7,17},
    7767     {1,2,3,5,5,17},   {1,2,7,7,7,13},   {1,2,3,5,7,13},
     
    8575     {1,3,5,5,5,23},   {2,5,7,7,7,23},   {2,3,5,5,7,23}}; 
    8676
    87   const G4int ln7bfs[20][7] =
     77  static const G4int ln7bfs[20][7] =
    8878    {{1,1,5,7,7,7,13},  {1,1,3,5,5,7,13},  {1,2,3,3,5,5,13},
    8979     {1,1,5,5,7,7,17},  {1,1,3,5,5,5,17},  {1,2,7,7,7,7,13},
     
    10595  // second index: kinetic energy
    10696  //
    107   const G4float lnCrossSections[157][31] = {
     97  static const G4double lnCrossSections[157][31] = {
    10898    //
    10999    // multiplicity 2 (3 channels)
     
    912902
    913903G4CascadeLambdaNChannelData::data_t
    914 G4CascadeLambdaNChannelData::data = { lntot,
    915                                       lnMultiplicities,
    916                                       lnindex,
    917                                       ln2bfs,
    918                                       ln3bfs,
    919                                       ln4bfs,
    920                                       ln5bfs,
    921                                       ln6bfs,
    922                                       ln7bfs,
    923                                       lnCrossSections };
    924 
    925 namespace {
    926   struct initializer
    927   {
    928     initializer() { G4CascadeLambdaNChannelData::data.initialize(); }
    929   };
    930 
    931   initializer init;   
    932 }
     904G4CascadeLambdaNChannelData::data(ln2bfs, ln3bfs, ln4bfs,
     905                                  ln5bfs, ln6bfs, ln7bfs,
     906                                  lnCrossSections);
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4CascadeLambdaPChannel.cc

    r962 r1315  
    2828
    2929namespace {
    30 
    31   // Total cross section as a function of kinetic energy
    32   G4double lptot[31];
    33  
    34   // Multiplicities as a function of kinetic energy
    35   G4double lpMultiplicities[6][31];
    36 
    37   const G4int lpindex[6][2] =
    38     {{0, 3}, {3, 15}, {15,48}, {48,107}, {107,137}, {137,157}};
    39 
    4030  // Outgoing particle types of a given multiplicity
    4131
    42   const G4int lp2bfs[3][2] =
     32  static const G4int lp2bfs[3][2] =
    4333    {{1, 21}, {1,25}, {2,23}};
    4434
    45   const G4int lp3bfs[12][3] =
     35  static const G4int lp3bfs[12][3] =
    4636    {{1,1,13}, {1,2,17}, {1,7,21}, {2,3,21},  {1,5,23},  {2,7,23},
    4737     {1,7,25}, {2,3,25}, {1,3,27}, {1,15,29}, {2,11,29}, {1,11,31}}; 
    4838
    49   const G4int lp4bfs[33][4] =
     39  static const G4int lp4bfs[33][4] =
    5040    {{1,1,7,13},   {1,1,5,17},   {1,2,7,17},   {1,2,3,13},   {2,2,3,17},
    5141     {1,7,7,21},   {1,3,5,21},   {2,3,7,21},   {1,15,17,21}, {1,11,13,21},
     
    5646     {1,7,11,31},  {1,3,15,31},  {2,3,11,31}};       
    5747
    58   const G4int lp5bfs[59][5] =
     48  static const G4int lp5bfs[59][5] =
    5949    {{1,1,7,7,13},   {1,1,3,5,13},   {1,1,5,7,17},   {1,2,7,7,17},
    6050     {1,2,3,5,17},   {1,2,3,7,13},   {2,2,3,7,17},   {2,2,3,3,13},
     
    7363     {1,3,7,15,31},  {2,3,7,11,31},  {2,3,3,15,31}};
    7464
    75   const G4int lp6bfs[30][6] =
     65  static const G4int lp6bfs[30][6] =
    7666    {{1,1,7,7,7,13},   {1,1,3,5,7,13},   {1,1,5,7,7,17},
    7767     {1,1,3,5,5,17},   {1,2,7,7,7,17},   {1,2,3,5,7,17},
     
    8575     {1,3,3,5,7,27},   {2,3,3,7,7,27},   {2,3,3,3,5,27}};
    8676
    87   const G4int lp7bfs[20][7] =
     77  static const G4int lp7bfs[20][7] =
    8878    {{1,1,7,7,7,7,13},  {1,1,3,5,7,7,13},  {1,1,3,3,5,5,13},
    8979     {1,1,5,7,7,7,17},  {1,1,3,5,5,7,17},  {1,2,7,7,7,7,17},
     
    10595  // second index: kinetic energy
    10696  //
    107   const G4float lpCrossSections[157][31] = {
     97  static const G4double lpCrossSections[157][31] = {
    10898    //
    10999    // multiplicity 2 (3 channels)
     
    912902
    913903G4CascadeLambdaPChannelData::data_t
    914 G4CascadeLambdaPChannelData::data = { lptot,
    915                                       lpMultiplicities,
    916                                       lpindex,
    917                                       lp2bfs,
    918                                       lp3bfs,
    919                                       lp4bfs,
    920                                       lp5bfs,
    921                                       lp6bfs,
    922                                       lp7bfs,
    923                                       lpCrossSections };
    924 
    925 namespace {
    926   struct initializer
    927   {
    928     initializer() { G4CascadeLambdaPChannelData::data.initialize(); }
    929   };
    930 
    931   initializer init;
    932 }
    933 
     904G4CascadeLambdaPChannelData::data(lp2bfs, lp3bfs, lp4bfs,
     905                                  lp5bfs, lp6bfs, lp7bfs,
     906                                  lpCrossSections);
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4CascadeSigmaMinusNChannel.cc

    r962 r1315  
    2828
    2929namespace {
    30 
    31   // Total cross section as a function of kinetic energy
    32   G4double smntot[31];
    33  
    34   // Multiplicities as a function of kinetic energy
    35   G4double smnMultiplicities[6][31];
    36 
    37   const G4int smnindex[6][2] =
    38     {{0, 1}, {1, 7}, {7,27}, {27,69}, {69,94}, {94,111}};
    39 
    4030  // Outgoing particle types of a given multiplicity
    4131
    42   const G4int smn2bfs[1][2] =
     32  static const G4int smn2bfs[1][2] =
    4333    {{2,27}};
    4434
    45   const G4int smn3bfs[6][3] =
     35  static const G4int smn3bfs[6][3] =
    4636    {{2,2,13}, {2,5,21}, {2,7,27}, {1,5,27},  {2,5,25},  {2,15,31}};
    4737
    48   const G4int smn4bfs[20][4] =
     38  static const G4int smn4bfs[20][4] =
    4939    {{1,2,5,13},   {2,2,5,17}, {2,2,7,13},  {2,5,7,21},   {1,5,5,21},
    5040     {2,13,15,21}, {2,5,5,23}, {2,5,7,25},  {1,5,5,25},   {2,7,7,27},
     
    5242     {1,13,15,27}, {2,5,15,29},{2,5,11,31}, {2,7,15,31},  {1,5,15,31}};
    5343
    54   const G4int smn5bfs[42][5] =
     44  static const G4int smn5bfs[42][5] =
    5545    {{2,2,5,7,17},   {2,2,3,5,13},   {2,2,7,7,13},   {1,2,5,7,13},
    5646     {1,2,5,5,17},   {1,1,5,5,13},   {1,5,5,7,21},   {2,3,5,5,21},
     
    6555     {2,5,7,15,29},  {1,5,5,15,29}};
    6656
    67   const G4int smn6bfs[25][6] =
     57  static const G4int smn6bfs[25][6] =
    6858    {{2,2,7,7,7,13}, {2,2,3,5,7,13}, {2,2,5,7,7,17}, {2,2,3,5,5,17},
    6959     {1,2,5,7,7,13}, {1,2,3,5,5,13}, {1,2,5,5,7,17}, {1,1,5,5,7,13},
     
    7464     {1,5,5,5,7,23}};
    7565
    76   const G4int smn7bfs[17][7] =
     66  static const G4int smn7bfs[17][7] =
    7767    {{2,2,7,7,7,7,13}, {2,2,3,5,7,7,13}, {2,2,3,3,5,5,13},
    7868     {2,2,5,7,7,7,17}, {2,2,3,5,5,7,17}, {1,2,5,5,7,7,17},
     
    9383  // second index: kinetic energy
    9484  //
    95   const G4float smnCrossSections[111][31] = {
     85  static const G4double smnCrossSections[111][31] = {
    9686    //
    9787    // multiplicity 2 (1 channel)
     
    670660
    671661G4CascadeSigmaMinusNChannelData::data_t
    672 G4CascadeSigmaMinusNChannelData::data = { smntot,
    673                                           smnMultiplicities,
    674                                           smnindex,
    675                                           smn2bfs,
    676                                           smn3bfs,
    677                                           smn4bfs,
    678                                           smn5bfs,
    679                                           smn6bfs,
    680                                           smn7bfs,
    681                                           smnCrossSections };
    682 
    683 namespace {
    684   struct initializer
    685   {
    686     initializer() { G4CascadeSigmaMinusNChannelData::data.initialize(); }
    687   };
    688 
    689   initializer init;
    690 }
     662G4CascadeSigmaMinusNChannelData::data(smn2bfs, smn3bfs, smn4bfs,
     663                                      smn5bfs, smn6bfs, smn7bfs,
     664                                      smnCrossSections);
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4CascadeSigmaMinusPChannel.cc

    r962 r1315  
    2828
    2929namespace {
    30 
    31   // Total cross section as a function of kinetic energy
    32   G4double smptot[31];
    33  
    34   // Multiplicities as a function of kinetic energy
    35   G4double smpMultiplicities[6][31];
    36 
    37   const G4int smpindex[6][2] =
    38     {{0, 3}, {3, 15}, {15,48}, {48,107}, {107,137}, {137,157}};
    39 
    4030  // Outgoing particle types of a given multiplicity
    4131
    42   const G4int smp2bfs[3][2] =
     32  static const G4int smp2bfs[3][2] =
    4333    {{1,27}, {2,21}, {2,25}};
    4434
    45   const G4int smp3bfs[12][3] =
     35  static const G4int smp3bfs[12][3] =
    4636    {{1,2,13}, {2,2,17}, {2,7,21}, {1,5,21},  {2,5,23},  {2,7,25},
    4737     {1,5,25}, {1,7,27}, {2,3,27}, {2,15,29}, {1,15,31}, {2,11,31}}; 
    4838
    49   const G4int smp4bfs[33][4] =
     39  static const G4int smp4bfs[33][4] =
    5040    {{1,1,5,13},   {1,2,7,13},   {1,2,5,17},   {2,2,3,13},   {2,2,7,17},   
    5141     {1,5,7,21},   {2,7,7,21},   {2,3,5,21},   {1,13,15,21}, {2,11,13,21},
     
    5646     {2,3,15,31},  {1,5,11,31},  {1,7,15,31}};
    5747
    58   const G4int smp5bfs[59][5] =
     48  static const G4int smp5bfs[59][5] =
    5949    {{1,1,5,7,13},   {1,1,5,5,17},   {1,2,7,7,13},   {1,2,3,5,13},
    6050     {1,2,5,7,17},   {2,2,3,7,13},   {2,2,7,7,17},   {2,2,3,5,17},
     
    7363     {1,7,7,15,31},  {1,3,5,15,31},  {1,5,7,11,31}}; 
    7464
    75   const G4int smp6bfs[30][6] =
     65  static const G4int smp6bfs[30][6] =
    7666    {{1,1,5,7,7,13}, {1,1,3,5,5,13}, {1,1,5,5,7,17},
    7767     {1,2,7,7,7,13}, {1,2,3,5,7,13}, {1,2,5,7,7,17},
     
    8575     {1,3,3,5,5,27}, {2,3,7,7,7,27}, {2,3,3,5,7,27}};
    8676
    87   const G4int smp7bfs[20][7] =
     77  static const G4int smp7bfs[20][7] =
    8878    {{1,1,5,7,7,7,13}, {1,1,3,5,5,7,13}, {1,1,5,5,7,7,17},
    8979     {1,1,3,5,5,5,17}, {1,2,7,7,7,7,13}, {1,2,3,5,7,7,13},
     
    10595  // second index: kinetic energy
    10696  //
    107   const G4float smpCrossSections[157][31] = {
     97  static const G4double smpCrossSections[157][31] = {
    10898    //
    10999    // multiplicity 2 (3 channels)
     
    911901
    912902G4CascadeSigmaMinusPChannelData::data_t
    913 G4CascadeSigmaMinusPChannelData::data = { smptot,
    914                                           smpMultiplicities,
    915                                           smpindex,
    916                                           smp2bfs,
    917                                           smp3bfs,
    918                                           smp4bfs,
    919                                           smp5bfs,
    920                                           smp6bfs,
    921                                           smp7bfs,
    922                                           smpCrossSections };
    923 
    924 namespace {
    925   struct initializer
    926   {
    927     initializer() { G4CascadeSigmaMinusPChannelData::data.initialize(); }
    928   };
    929 
    930   initializer init;
    931 }
     903G4CascadeSigmaMinusPChannelData::data(smp2bfs, smp3bfs, smp4bfs,
     904                                      smp5bfs, smp6bfs, smp7bfs,
     905                                      smpCrossSections);
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4CascadeSigmaPlusNChannel.cc

    r1196 r1315  
    2828
    2929namespace {
    30   // Total cross section as a function of kinetic energy
    31   G4double spntot[31];
    32  
    33   // Multiplicities as a function of kinetic energy
    34   G4double spnMultiplicities[6][31];
    35 
    36   const G4int spnindex[6][2] =
    37     {{0, 3}, {3, 15}, {15,48}, {48,107}, {107,137}, {137,157}};
    38 
    3930  // Outgoing particle types of a given multiplicity
    4031
    41   const G4int spn2bfs[3][2] =
     32  static const G4int spn2bfs[3][2] =
    4233    {{2,23}, {1,21}, {1,25}};
    4334
    44   const G4int spn3bfs[12][3] =
     35  static const G4int spn3bfs[12][3] =
    4536    {{1,1,13}, {1,2,17}, {2,7,23}, {2,3,25},  {1,5,23},  {1,7,25},
    4637     {1,7,21}, {2,3,21}, {1,3,27}, {1,15,29}, {2,11,29}, {1,11,31}}; 
    4738
    48   const G4int spn4bfs[33][4] =
     39  static const G4int spn4bfs[33][4] =
    4940    {{1,1,7,13},   {1,1,5,17},   {1,2,7,17},   {1,2,3,13},   {2,2,3,17},
    5041     {2,7,7,23},   {2,3,5,23},   {2,3,7,25},   {2,15,17,23}, {2,11,13,23},
     
    5546     {1,7,11,31},  {1,3,15,31},  {2,3,11,31}};       
    5647
    57   const G4int spn5bfs[59][5] =
     48  static const G4int spn5bfs[59][5] =
    5849    {{1,1,7,7,13},   {1,1,3,5,13},   {1,1,5,7,17},   {1,2,7,7,17},
    5950     {1,2,3,5,17},   {1,2,3,7,13},   {2,2,3,7,17},   {2,2,3,3,13},
     
    7263     {1,3,7,15,31},  {2,3,7,11,31},  {2,3,3,15,31}};
    7364
    74   const G4int spn6bfs[30][6] =
     65  static const G4int spn6bfs[30][6] =
    7566    {{1,1,7,7,7,13},   {1,1,3,5,7,13},   {1,1,5,7,7,17},
    7667     {1,1,3,5,5,17},   {1,2,7,7,7,17},   {1,2,3,5,7,17},
     
    8475     {1,3,3,5,7,27},   {2,3,3,7,7,27},   {2,3,3,3,5,27}};
    8576
    86   const G4int spn7bfs[20][7] =
     77  static const G4int spn7bfs[20][7] =
    8778    {{1,1,7,7,7,7,13},  {1,1,3,5,7,7,13},  {1,1,3,3,5,5,13},
    8879     {1,1,5,7,7,7,17},  {1,1,3,5,5,7,17},  {1,2,7,7,7,7,17},
     
    10495  // second index: kinetic energy
    10596  //
    106   const G4float spnCrossSections[157][31] = {
     97  static const G4double spnCrossSections[157][31] = {
    10798    //
    10899    // multiplicity 2 (3 channels)
     
    911902
    912903G4CascadeSigmaPlusNChannelData::data_t
    913 G4CascadeSigmaPlusNChannelData::data = { spntot,
    914                                          spnMultiplicities,
    915                                          spnindex,
    916                                          spn2bfs,
    917                                          spn3bfs,
    918                                          spn4bfs,
    919                                          spn5bfs,
    920                                          spn6bfs,
    921                                          spn7bfs,
    922                                          spnCrossSections };
    923 
    924 namespace {
    925   struct initializer
    926   {
    927     initializer() { G4CascadeSigmaPlusNChannelData::data.initialize(); }
    928   };
    929 
    930   initializer init;
    931 }
     904G4CascadeSigmaPlusNChannelData::data(spn2bfs, spn3bfs, spn4bfs,
     905                                     spn5bfs, spn6bfs, spn7bfs,
     906                                     spnCrossSections);
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4CascadeSigmaPlusPChannel.cc

    r962 r1315  
    2828
    2929namespace {
    30 
    31   // Total cross section as a function of kinetic energy
    32   G4double spptot[31];
    33 
    34   // Multiplicities as a function of kinetic energy
    35   G4double sppMultiplicities[6][31];
    36 
    37   const G4int sppindex[6][2] =
    38     {{0, 1}, {1, 7}, {7,27}, {27,69}, {69,94}, {94,111}};
    39 
    4030  // Outgoing particle types of a given multiplicity
    4131
    42   const G4int spp2bfs[1][2] =
     32  static const G4int spp2bfs[1][2] =
    4333    {{1,23}};
    4434
    45   const G4int spp3bfs[6][3] =
     35  static const G4int spp3bfs[6][3] =
    4636    {{1,1,17}, {1,3,21}, {1,7,23}, {2,3,23},  {1,3,25},  {1,11,29}};
    4737
    48   const G4int spp4bfs[20][4] =
     38  static const G4int spp4bfs[20][4] =
    4939    {{1,1,7,17},   {1,1,3,13},   {1,2,3,17}, {1,3,7,21}, {2,3,3,21},
    5040     {1,11,17,21}, {1,7,7,23},   {1,3,5,23}, {2,3,7,23}, {1,15,17,23},
     
    5242     {1,3,3,27},   {1,7,11,29},  {1,3,15,29},{2,3,11,29},{1,3,11,31}};
    5343
    54   const G4int spp5bfs[42][5] =
     44  static const G4int spp5bfs[42][5] =
    5545    {{1,1,7,7,17},   {1,1,3,5,17},   {1,1,3,7,13},   {1,2,3,7,17},   
    5646     {1,2,3,3,13},   {2,2,3,3,17},   {1,3,7,7,21},   {1,3,3,5,21},   
     
    6555     {1,3,3,15,31},  {2,3,3,11,31}};
    6656
    67   const G4int spp6bfs[25][6] =
     57  static const G4int spp6bfs[25][6] =
    6858    {{1,1,7,7,7,17}, {1,1,3,5,7,17}, {1,1,3,7,7,13}, {1,1,3,3,5,13},
    6959     {1,2,3,7,7,17}, {1,2,3,3,5,17}, {1,2,3,3,7,13}, {2,2,3,3,7,17},
     
    7464     {2,3,3,3,7,27}};
    7565
    76   const G4int spp7bfs[17][7] =
     66  static const G4int spp7bfs[17][7] =
    7767    {{1,1,7,7,7,7,17}, {1,1,3,5,7,7,17}, {1,1,3,3,5,5,17},
    7868     {1,1,3,7,7,7,13}, {1,1,3,3,5,7,13}, {1,2,3,7,7,7,17},
     
    9383  // second index: kinetic energy
    9484  //
    95   const G4float sppCrossSections[111][31] = {
     85  static const G4double sppCrossSections[111][31] = {
    9686    //
    9787    // multiplicity 2 (1 channel)
     
    670660
    671661G4CascadeSigmaPlusPChannelData::data_t
    672 G4CascadeSigmaPlusPChannelData::data = { spptot,
    673                                          sppMultiplicities,
    674                                          sppindex,
    675                                          spp2bfs,
    676                                          spp3bfs,
    677                                          spp4bfs,
    678                                          spp5bfs,
    679                                          spp6bfs,
    680                                          spp7bfs,
    681                                          sppCrossSections };
    682 
    683 namespace {
    684   struct initializer
    685   {
    686     initializer() {G4CascadeSigmaPlusPChannelData::data.initialize(); }
    687   };
    688 
    689   initializer init;
    690 }
    691 
     662G4CascadeSigmaPlusPChannelData::data(spp2bfs, spp3bfs, spp4bfs,
     663                                     spp5bfs, spp6bfs, spp7bfs,
     664                                     sppCrossSections);
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4CascadeSigmaZeroNChannel.cc

    r962 r1315  
    2828
    2929namespace {
    30 
    31   // Total cross section as a function of kinetic energy
    32   G4double s0ntot[31];
    33  
    34   // Multiplicities as a function of kinetic energy
    35   G4double s0nMultiplicities[6][31];
    36 
    37   const G4int s0nindex[6][2] =
    38     {{0, 3}, {3, 15}, {15,48}, {48,107}, {107,137}, {137,157}};
    39 
    4030  // Outgoing particle types of a given multiplicity
    4131
    42   const G4int s0n2bfs[3][2] =
     32  static const G4int s0n2bfs[3][2] =
    4333    {{2, 25}, {2,21}, {1,27}};
    4434
    45   const G4int s0n3bfs[12][3] =
     35  static const G4int s0n3bfs[12][3] =
    4636    {{1,2,13}, {2,2,17}, {1,5,25}, {2,7,25},  {1,7,27},  {2,3,27},
    4737     {1,5,21}, {2,7,21}, {2,5,23}, {1,15,31}, {2,11,31}, {2,15,29}};
    4838
    49   const G4int s0n4bfs[33][4] =
     39  static const G4int s0n4bfs[33][4] =
    5040    {{1,1,5,13},   {1,2,7,13},   {1,2,5,17},   {2,2,3,13},   {2,2,7,17},
    5141     {1,5,7,25},   {2,3,5,25},   {2,7,7,25},   {1,13,15,25}, {2,11,13,25},
     
    5646     {2,7,15,29},  {1,5,15,29},  {2,5,11,29}};   
    5747
    58   const G4int s0n5bfs[59][5] =
     48  static const G4int s0n5bfs[59][5] =
    5949    {{1,1,5,7,13},   {1,1,5,5,17},   {1,2,5,7,17},   {1,2,7,7,13},
    6050     {2,2,3,5,17},   {1,2,3,5,13},   {2,2,7,7,17},   {2,2,3,7,13},
     
    7363     {1,3,5,15,31},  {2,3,5,11,31},  {2,3,7,15,31}};
    7464
    75   const G4int s0n6bfs[30][6] =
     65  static const G4int s0n6bfs[30][6] =
    7666    {{1,1,5,7,7,13},   {1,1,3,5,5,13},   {1,1,5,5,7,17},
    7767     {1,2,3,5,5,17},   {1,2,7,7,7,13},   {1,2,3,5,7,13},
     
    8575     {1,3,5,5,5,23},   {2,5,7,7,7,23},   {2,3,5,5,7,23}}; 
    8676
    87   const G4int s0n7bfs[20][7] =
     77  static const G4int s0n7bfs[20][7] =
    8878    {{1,1,5,7,7,7,13},  {1,1,3,5,5,7,13},  {1,2,3,3,5,5,13},
    8979     {1,1,5,5,7,7,17},  {1,1,3,5,5,5,17},  {1,2,7,7,7,7,13},
     
    10595  // second index: kinetic energy
    10696  //
    107   const G4float s0nCrossSections[157][31] = {
     97  static const G4double s0nCrossSections[157][31] = {
    10898    //
    10999    // multiplicity 2 (3 channels)
     
    912902
    913903G4CascadeSigmaZeroNChannelData::data_t
    914 G4CascadeSigmaZeroNChannelData::data = { s0ntot,
    915                                          s0nMultiplicities,
    916                                          s0nindex,
    917                                          s0n2bfs,
    918                                          s0n3bfs,
    919                                          s0n4bfs,
    920                                          s0n5bfs,
    921                                          s0n6bfs,
    922                                          s0n7bfs,
    923                                          s0nCrossSections };
    924 
    925 namespace {
    926   struct initializer
    927   {
    928     initializer() { G4CascadeSigmaZeroNChannelData::data.initialize(); }
    929   };
    930 
    931   initializer init;
    932 }
     904G4CascadeSigmaZeroNChannelData::data(s0n2bfs, s0n3bfs, s0n4bfs,
     905                                     s0n5bfs, s0n6bfs, s0n7bfs,
     906                                     s0nCrossSections);
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4CascadeSigmaZeroPChannel.cc

    r962 r1315  
    2828
    2929namespace {
    30 
    31   // Total cross section as a function of kinetic energy
    32   G4double s0ptot[31];
    33 
    34   // Multiplicities as a function of kinetic energy
    35   G4double s0pMultiplicities[6][31];
    36 
    37   const G4int s0pindex[6][2] =
    38     {{0, 3}, {3, 15}, {15,48}, {48,107}, {107,137}, {137,157}};
    39 
    4030  // Outgoing particle types of a given multiplicity
    4131
    42   const G4int s0p2bfs[3][2] =
     32  static const G4int s0p2bfs[3][2] =
    4333    {{1, 25}, {1,21}, {2,23}};
    4434
    45   const G4int s0p3bfs[12][3] =
     35  static const G4int s0p3bfs[12][3] =
    4636    {{1,1,13}, {1,2,17}, {1,7,25}, {2,3,25},  {1,5,23},  {2,7,23},
    4737     {1,7,21}, {2,3,21}, {1,3,27}, {1,15,29}, {2,11,29}, {1,11,31}}; 
    4838
    49   const G4int s0p4bfs[33][4] =
     39  static const G4int s0p4bfs[33][4] =
    5040    {{1,1,7,13},   {1,1,5,17},   {1,2,7,17},   {1,2,3,13},   {2,2,3,17},
    5141     {1,7,7,25},   {1,3,5,25},   {2,3,7,25},   {1,15,17,25}, {1,11,13,25},
     
    5646     {1,7,11,31},  {1,3,15,31},  {2,3,11,31}};       
    5747
    58   const G4int s0p5bfs[59][5] =
     48  static const G4int s0p5bfs[59][5] =
    5949    {{1,1,7,7,13},   {1,1,3,5,13},   {1,1,5,7,17},   {1,2,7,7,17},
    6050     {1,2,3,5,17},   {1,2,3,7,13},   {2,2,3,7,17},   {2,2,3,3,13},
     
    7363     {1,3,7,15,31},  {2,3,7,11,31},  {2,3,3,15,31}};
    7464
    75   const G4int s0p6bfs[30][6] =
     65  static const G4int s0p6bfs[30][6] =
    7666    {{1,1,7,7,7,13},   {1,1,3,5,7,13},   {1,1,5,7,7,17},
    7767     {1,1,3,5,5,17},   {1,2,7,7,7,17},   {1,2,3,5,7,17},
     
    8575     {1,3,3,5,7,27},   {2,3,3,7,7,27},   {2,3,3,3,5,27}};
    8676
    87   const G4int s0p7bfs[20][7] =
     77  static const G4int s0p7bfs[20][7] =
    8878    {{1,1,7,7,7,7,13},  {1,1,3,5,7,7,13},  {1,1,3,3,5,5,13},
    8979     {1,1,5,7,7,7,17},  {1,1,3,5,5,7,17},  {1,2,7,7,7,7,17},
     
    10595  // second index: kinetic energy
    10696  //
    107   const G4float s0pCrossSections[157][31] = {
     97  static const G4double s0pCrossSections[157][31] = {
    10898    //
    10999    // multiplicity 2 (3 channels)
     
    912902
    913903G4CascadeSigmaZeroPChannelData::data_t
    914 G4CascadeSigmaZeroPChannelData::data = { s0ptot,
    915                                          s0pMultiplicities,
    916                                          s0pindex,
    917                                          s0p2bfs,
    918                                          s0p3bfs,
    919                                          s0p4bfs,
    920                                          s0p5bfs,
    921                                          s0p6bfs,
    922                                          s0p7bfs,
    923                                          s0pCrossSections };
    924 namespace {
    925   struct initializer {
    926     initializer() { G4CascadeSigmaZeroPChannelData::data.initialize(); }
    927   };
    928 
    929   initializer init;
    930 }
     904G4CascadeSigmaZeroPChannelData::data(s0p2bfs, s0p3bfs, s0p4bfs,
     905                                     s0p5bfs, s0p6bfs, s0p7bfs,
     906                                     s0pCrossSections);
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4CascadeXiMinusNChannel.cc

    r962 r1315  
    2828
    2929namespace {
    30   // Total cross section as a function of kinetic energy
    31   G4double xmntot[31];
    32  
    33   // Multiplicities as a function of kinetic energy
    34   G4double xmnMultiplicities[6][31];
    35 
    36   const G4int xmnindex[6][2] =
    37     {{0, 3}, {3, 21}, {21,74}, {74,76}, {76,78}, {78,80}};
    38 
    3930  // Outgoing particle types of a given multiplicity
    4031
    41   const G4int xmn2bfs[3][2] =
     32  static const G4int xmn2bfs[3][2] =
    4233    {{2, 31}, {21,27}, {25,27}};
    4334
    44   const G4int xmn3bfs[18][3] =
     35  static const G4int xmn3bfs[18][3] =
    4536    {{2,13,21}, {5,21,21}, {1,13,27}, {2,13,25}, {7,21,27}, {5,23,27},
    4637     {7,25,27}, {3,27,27}, {2,17,27}, {5,21,25}, {5,25,25}, {2,5,29},
    4738     {2,7,31},  {15,21,31},{11,27,31},{15,27,29},{1,5,31},  {15,25,31}}; 
    4839
    49   const G4int xmn4bfs[53][4] =
     40  static const G4int xmn4bfs[53][4] =
    5041    {{1,2,13,13},  {1,5,13,21},  {1,5,13,25},  {1,7,13,27},  {1,5,17,27}, 
    5142     {1,5,5,29},   {1,5,7,31},   {1,13,15,31}, {2,2,13,17},  {2,7,13,21},
     
    6051     {3,15,27,31}, {7,11,27,31}, {7,15,27,29}};
    6152
    62   const G4int xmn5bfs[2][5] =
     53  static const G4int xmn5bfs[2][5] =
    6354    {{2,7,7,7,31},  {2,3,5,7,31}};
    6455
    65   const G4int xmn6bfs[2][6] =
     56  static const G4int xmn6bfs[2][6] =
    6657    {{2,7,7,7,7,31},  {2,3,5,7,7,31}};
    6758
    68   const G4int xmn7bfs[2][7] =
     59  static const G4int xmn7bfs[2][7] =
    6960    {{2,7,7,7,7,7,31},  {2,3,5,7,7,7,31}};
    7061
     
    8071  // second index: kinetic energy
    8172  //
    82   const G4float xmnCrossSections[80][31] = {
     73  static const G4double xmnCrossSections[80][31] = {
    8374    //
    8475    // multiplicity 2 (3 channels)
     
    501492
    502493G4CascadeXiMinusNChannelData::data_t
    503 G4CascadeXiMinusNChannelData::data = { xmntot,
    504                                        xmnMultiplicities,
    505                                        xmnindex,
    506                                        xmn2bfs,
    507                                        xmn3bfs,
    508                                        xmn4bfs,
    509                                        xmn5bfs,
    510                                        xmn6bfs,
    511                                        xmn7bfs,
    512                                        xmnCrossSections };
    513 namespace {
    514   struct initializer
    515   {
    516     initializer() { G4CascadeXiMinusNChannelData::data.initialize(); }
    517   };
    518 
    519   initializer init;
    520 }
     494G4CascadeXiMinusNChannelData::data(xmn2bfs, xmn3bfs, xmn4bfs,
     495                                   xmn5bfs, xmn6bfs, xmn7bfs,
     496                                   xmnCrossSections);
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4CascadeXiMinusPChannel.cc

    r962 r1315  
    2828
    2929namespace {
    30 
    31   // Total cross section as a function of kinetic energy
    32   G4double xmptot[31];
    33 
    34   // Multiplicities as a function of kinetic energy
    35   G4double xmpMultiplicities[6][31];
    36 
    37 
    38  
    39   const G4int xmpindex[6][2] =
    40     {{0, 6}, {6,30}, {30,34}, {34,38}, {38,42}, {42,46}};
    41 
    4230  // Outgoing particle types of a given multiplicity
    4331
    44   const G4int xmp2bfs[6][2] =
     32  static const G4int xmp2bfs[6][2] =
    4533    {{1,31}, {2,29}, {21,21}, {21,25}, {25,25}, {23,27}};
    4634
    47   const G4int xmp3bfs[24][3] =
     35  static const G4int xmp3bfs[24][3] =
    4836    {{1,13,21},  {1,13,25}, {1,17,27}, {1,5,29},   {1,7,31},   {2,17,21},
    4937     {2,17,25},  {2,13,23}, {2,7,29},  {2,3,31},   {7,21,21},  {7,21,25},
     
    5139     {15,23,31}, {7,25,25}, {3,25,27}, {15,25,29}, {11,25,31}, {11,27,29}};
    5240
    53   const G4int xmp4bfs[4][4] =
     41  static const G4int xmp4bfs[4][4] =
    5442    {{1,7,13,21}, {2,7,17,21}, {1,3,5,31}, {2,3,5,29}};
    5543
    56   const G4int xmp5bfs[4][5] =
     44  static const G4int xmp5bfs[4][5] =
    5745    {{1,3,5,13,21}, {2,3,5,17,21}, {1,3,5,7,31}, {2,3,5,7,29}};
    5846
    59   const G4int xmp6bfs[4][6] =
     47  static const G4int xmp6bfs[4][6] =
    6048    {{1,3,5,7,13,21}, {2,3,5,7,17,21}, {1,3,3,5,5,31}, {2,3,3,5,5,29}};
    6149
    62   const G4int xmp7bfs[4][7] =
     50  static const G4int xmp7bfs[4][7] =
    6351    {{1,3,3,5,5,13,21}, {2,3,3,5,5,17,21}, {1,3,3,5,5,7,31}, {2,3,3,5,5,7,29}};
    6452
     
    7462  // second index: kinetic energy
    7563  //
    76   const G4float xmpCrossSections[46][31] = {
     64  static const G4double xmpCrossSections[46][31] = {
    7765    //
    7866    // multiplicity 2 (6 channels)
     
    326314
    327315G4CascadeXiMinusPChannelData::data_t
    328 G4CascadeXiMinusPChannelData::data = { xmptot,
    329                                        xmpMultiplicities,
    330                                        xmpindex,
    331                                        xmp2bfs,
    332                                        xmp3bfs,
    333                                        xmp4bfs,
    334                                        xmp5bfs,
    335                                        xmp6bfs,
    336                                        xmp7bfs,
    337                                        xmpCrossSections };
    338 namespace {
    339   struct initializer
    340   {
    341     initializer() { G4CascadeXiMinusPChannelData::data.initialize(); }
    342   };
    343 
    344   initializer init;
    345 }
     316G4CascadeXiMinusPChannelData::data(xmp2bfs, xmp3bfs, xmp4bfs,
     317                                   xmp5bfs, xmp6bfs, xmp7bfs,
     318                                   xmpCrossSections);
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4CascadeXiZeroNChannel.cc

    r962 r1315  
    2828
    2929namespace {
    30 
    31   // Total cross section as a function of kinetic energy
    32   G4double x0ntot[31];
    33  
    34   // Multiplicities as a function of kinetic energy
    35   G4double x0nMultiplicities[6][31];
    36 
    37   const G4int x0nindex[6][2] =
    38     {{0, 6}, {6,30}, {30,34}, {34,38}, {38,42}, {42,46}};
    39 
    4030  // Outgoing particle types of a given multiplicity
    4131
    42   const G4int x0n2bfs[6][2] =
     32  static const G4int x0n2bfs[6][2] =
    4333    {{2,29}, {1,31}, {21,21}, {21,25}, {25,25}, {23,27}};
    4434
    45   const G4int x0n3bfs[24][3] =
     35  static const G4int x0n3bfs[24][3] =
    4636    {{1,13,21},  {1,13,25}, {1,17,27}, {1,5,29},   {1,7,31},   {2,17,21},
    4737     {2,17,25},  {2,13,23}, {2,7,29},  {2,3,31},   {7,21,21},  {7,21,25},
     
    4939     {15,23,31}, {7,25,25}, {3,25,27}, {15,25,29}, {11,25,31}, {11,27,29}};
    5040
    51   const G4int x0n4bfs[4][4] =
     41  static const G4int x0n4bfs[4][4] =
    5242    {{1,7,13,21}, {2,7,17,21}, {1,3,5,31}, {2,3,5,29}};
    5343
    54   const G4int x0n5bfs[4][5] =
     44  static const G4int x0n5bfs[4][5] =
    5545    {{1,3,5,13,21}, {2,3,5,17,21}, {1,3,5,7,31}, {2,3,5,7,29}};
    5646
    57   const G4int x0n6bfs[4][6] =
     47  static const G4int x0n6bfs[4][6] =
    5848    {{1,3,5,7,13,21}, {2,3,5,7,17,21}, {1,3,3,5,5,31}, {2,3,3,5,5,29}};
    5949
    60   const G4int x0n7bfs[4][7] =
     50  static const G4int x0n7bfs[4][7] =
    6151    {{1,3,3,5,5,13,21}, {2,3,3,5,5,17,21}, {1,3,3,5,5,7,31}, {2,3,3,5,5,7,29}};
    6252
     
    7262  // second index: kinetic energy
    7363  //
    74   const G4float x0nCrossSections[46][31] = {
     64  static const G4double x0nCrossSections[46][31] = {
    7565    //
    7666    // multiplicity 2 (6 channels)
     
    324314
    325315G4CascadeXiZeroNChannelData::data_t
    326 G4CascadeXiZeroNChannelData::data = { x0ntot,
    327                                       x0nMultiplicities,
    328                                       x0nindex,
    329                                       x0n2bfs,
    330                                       x0n3bfs,
    331                                       x0n4bfs,
    332                                       x0n5bfs,
    333                                       x0n6bfs,
    334                                       x0n7bfs,
    335                                       x0nCrossSections };
    336 
    337 namespace {
    338   struct initializer
    339   {
    340     initializer() { G4CascadeXiZeroNChannelData::data.initialize(); }
    341   };
    342 
    343   initializer init;
    344 }
     316G4CascadeXiZeroNChannelData::data(x0n2bfs, x0n3bfs, x0n4bfs,
     317                                  x0n5bfs, x0n6bfs, x0n7bfs,
     318                                  x0nCrossSections);
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4CascadeXiZeroPChannel.cc

    r962 r1315  
    2828
    2929namespace {
    30 
    31   // Total cross section as a function of kinetic energy
    32   G4double x0ptot[31];
    33 
    34   // Multiplicities as a function of kinetic energy
    35   G4double x0pMultiplicities[6][31];
    36 
    37 
    38   const G4int x0pindex[6][2] =
    39     {{0, 3}, {3, 21}, {21,74}, {74,76}, {76,78}, {78,80}};
    40 
    4130  // Outgoing particle types of a given multiplicity
    4231
    43   const G4int x0p2bfs[3][2] =
     32  static const G4int x0p2bfs[3][2] =
    4433    {{1, 29}, {21,23}, {23,25}};
    4534
    46   const G4int x0p3bfs[18][3] =
     35  static const G4int x0p3bfs[18][3] =
    4736    {{1,17,21}, {3,21,21}, {1,13,23}, {2,17,23}, {7,21,23}, {5,23,23},
    4837     {7,23,25}, {3,23,27}, {1,17,25}, {3,21,25}, {3,25,25}, {1,7,29},
    4938     {2,3,29},  {11,21,29},{11,25,29},{15,23,29},{1,3,31},  {11,23,31}}; 
    5039
    51   const G4int x0p4bfs[53][4] =
     40  static const G4int x0p4bfs[53][4] =
    5241    {{1,1,13,17},  {1,2,17,17},  {1,7,17,21},  {1,3,13,21},  {1,7,17,25}, 
    5342     {1,3,13,25},  {1,7,13,23},  {1,5,17,23},  {1,3,17,27},  {1,7,7,29},
     
    6251     {3,15,23,31}, {7,11,23,31}, {3,11,27,29}};
    6352
    64   const G4int x0p5bfs[2][5] =
     53  static const G4int x0p5bfs[2][5] =
    6554    {{1,7,7,7,29},  {1,3,5,7,29}};
    6655
    67   const G4int x0p6bfs[2][6] =
     56  static const G4int x0p6bfs[2][6] =
    6857    {{1,7,7,7,7,29},  {1,3,5,7,7,29}};
    6958
    70   const G4int x0p7bfs[2][7] =
     59  static const G4int x0p7bfs[2][7] =
    7160    {{1,7,7,7,7,7,29},  {1,3,5,7,7,7,29}};
    7261
     
    8271  // second index: kinetic energy
    8372  //
    84   const G4float x0pCrossSections[80][31] = {
     73  static const G4double x0pCrossSections[80][31] = {
    8574    //
    8675    // multiplicity 2 (3 channels)
     
    503492
    504493G4CascadeXiZeroPChannelData::data_t
    505 G4CascadeXiZeroPChannelData::data = { x0ptot,
    506                                       x0pMultiplicities,
    507                                       x0pindex,
    508                                       x0p2bfs,
    509                                       x0p3bfs,
    510                                       x0p4bfs,
    511                                       x0p5bfs,
    512                                       x0p6bfs,
    513                                       x0p7bfs,
    514                                       x0pCrossSections };
    515 
    516 namespace {
    517   struct initializer
    518   {
    519     initializer() { G4CascadeXiZeroPChannelData::data.initialize(); }
    520   };
    521 
    522   initializer init;
    523 }
    524 
     494G4CascadeXiZeroPChannelData::data(x0p2bfs, x0p3bfs, x0p4bfs,
     495                                  x0p5bfs, x0p6bfs, x0p7bfs,
     496                                  x0pCrossSections);
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4CollisionOutput.cc

    r1196 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4CollisionOutput.cc,v 1.23 2010/05/21 18:07:30 mkelsey Exp $
     26// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100114  M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
     29// 20100309  M. Kelsey -- Introduced bug checking i3 for valid tuning pair
     30// 20100409  M. Kelsey -- Move non-inlinable code here out of .hh file, replace
     31//              loop over push_back() with block insert().
     32// 20100418  M. Kelsey -- Add function to boost output lists to lab frame
     33// 20100520  M. Kelsey -- Add function to rotate Z axis, from G4Casc.Interface
     34
    2635#include "G4CollisionOutput.hh"
    2736#include "G4ParticleLargerEkin.hh"
     37#include "G4LorentzConvertor.hh"
     38#include "G4LorentzRotation.hh"
    2839#include <algorithm>
    2940
    3041typedef std::vector<G4InuclElementaryParticle>::iterator particleIterator;
     42typedef std::vector<G4InuclNuclei>::iterator nucleiIterator;
    3143
    3244
     
    5163}
    5264
     65void G4CollisionOutput::reset() {
     66  nucleiFragments.clear();
     67  outgoingParticles.clear();
     68}
     69
     70
     71void G4CollisionOutput::addOutgoingParticles(const std::vector<G4InuclElementaryParticle>& particles) {
     72  outgoingParticles.insert(outgoingParticles.end(),
     73                           particles.begin(), particles.end());
     74}
     75
     76
     77void G4CollisionOutput::addTargetFragments(const std::vector<G4InuclNuclei>& nuclea) {
     78  nucleiFragments.insert(nucleiFragments.end(), nuclea.begin(), nuclea.end());
     79}
     80
     81
     82G4LorentzVector G4CollisionOutput::getTotalOutputMomentum() const {
     83  G4LorentzVector tot_mom;
     84  double eex_r = 0.0;
     85  G4int i(0);
     86  for(i = 0; i < G4int(outgoingParticles.size()); i++) {
     87    tot_mom += outgoingParticles[i].getMomentum();
     88  }
     89  for(i = 0; i < G4int(nucleiFragments.size()); i++) {
     90    tot_mom += nucleiFragments[i].getMomentum();
     91    eex_r += 0.001 * nucleiFragments[i].getExitationEnergy();
     92  }
     93  tot_mom.setE(tot_mom.e() + eex_r);
     94  return tot_mom;
     95}
     96
     97void G4CollisionOutput::printCollisionOutput() const {
     98  G4int i(0);
     99
     100  G4cout << " Output: " << G4endl 
     101         << " Outgoing Particles: " << outgoingParticles.size() << G4endl;
     102  for(i = 0; i < G4int(outgoingParticles.size()); i++)
     103    outgoingParticles[i].printParticle();
     104
     105  G4cout << " Nuclei fragments: " << nucleiFragments.size() << G4endl;     
     106  for(i = 0; i < G4int(nucleiFragments.size()); i++)
     107    nucleiFragments[i].printParticle();
     108}
     109
     110
     111// Boost particles and fragment to LAB -- "convertor" must already be configured
     112
     113void G4CollisionOutput::boostToLabFrame(const G4LorentzConvertor& convertor) {
     114  G4bool withReflection = convertor.reflectionNeeded();
     115
     116  if (!outgoingParticles.empty()) {
     117    particleIterator ipart = outgoingParticles.begin();
     118    for(; ipart != outgoingParticles.end(); ipart++) {
     119      G4LorentzVector mom = ipart->getMomentum();
     120     
     121      if (withReflection) mom.setZ(-mom.z());
     122      mom = convertor.rotate(mom);
     123      mom = convertor.backToTheLab(mom);
     124      ipart->setMomentum(mom);
     125    }
     126
     127    std::sort(outgoingParticles.begin(), outgoingParticles.end(), G4ParticleLargerEkin());
     128  }
     129 
     130  if (!nucleiFragments.empty()) {
     131    nucleiIterator inuc = nucleiFragments.begin();
     132   
     133    for (; inuc != nucleiFragments.end(); inuc++) {
     134      G4LorentzVector mom = inuc->getMomentum();
     135     
     136      if (withReflection) mom.setZ(-mom.z());
     137      mom = convertor.rotate(mom);
     138      mom = convertor.backToTheLab(mom);
     139      inuc->setMomentum(mom);
     140    }
     141  }
     142}
     143
     144
     145// Apply LorentzRotation to all particles in event
     146
     147void G4CollisionOutput::rotateEvent(const G4LorentzRotation& rotate) {
     148  particleIterator ipart = outgoingParticles.begin();
     149  for(; ipart != outgoingParticles.end(); ipart++)
     150    ipart->setMomentum(ipart->getMomentum()*=rotate);
     151
     152  nucleiIterator inuc = nucleiFragments.begin();
     153  for (; inuc != nucleiFragments.end(); inuc++)
     154    inuc->setMomentum(inuc->getMomentum()*=rotate);
     155}
     156
     157
     158void G4CollisionOutput::trivialise(G4InuclParticle* bullet,
     159                                   G4InuclParticle* target) {
     160  if (G4InuclNuclei* nuclei_target = dynamic_cast<G4InuclNuclei*>(target)) {
     161    nucleiFragments.push_back(*nuclei_target);
     162  } else {
     163    G4InuclElementaryParticle* particle =
     164      dynamic_cast<G4InuclElementaryParticle*>(target);
     165    outgoingParticles.push_back(*particle);
     166  }
     167
     168  if (G4InuclNuclei* nuclei_bullet = dynamic_cast<G4InuclNuclei*>(bullet)) {
     169    nucleiFragments.push_back(*nuclei_bullet);
     170  } else {
     171    G4InuclElementaryParticle* particle =
     172      dynamic_cast<G4InuclElementaryParticle*>(bullet);
     173    outgoingParticles.push_back(*particle);
     174  }
     175}
     176
    53177
    54178void G4CollisionOutput::setOnShell(G4InuclParticle* bullet,
     
    63187  on_shell = false;
    64188   
    65   G4CascadeMomentum ini_mom = bullet->getMomentum();
    66   const G4CascadeMomentum& momt = target->getMomentum();
    67 
    68   G4int i;
    69   for(i = 0; i < 4; i++) ini_mom[i] += momt[i];
    70  
    71   G4CascadeMomentum out_mom = getTotalOutputMomentum();
    72   G4CascadeMomentum mon_non_cons;
     189  G4LorentzVector ini_mom = bullet->getMomentum();
     190  G4LorentzVector momt = target->getMomentum();
     191
     192  ini_mom += momt;
     193 
     194  G4LorentzVector out_mom = getTotalOutputMomentum();
     195  G4LorentzVector mon_non_cons;
    73196  if(verboseLevel > 2){
    74     G4cout << " bullet momentum = " << ini_mom[0]<<", "<< ini_mom[1]<<", "<< ini_mom[2]<<", "<< ini_mom[3]<<G4endl;
    75     G4cout << " target momentum = " << momt[0]<<", "<< momt[1]<<", "<< momt[2]<<", "<< momt[3]<<G4endl;
    76     G4cout << " Fstate momentum = " << out_mom[0]<<", "<< out_mom[1]<<", "<< out_mom[2]<<", "<< out_mom[3]<<G4endl;
    77   }
    78 
    79   for(i = 0; i < 4; i++) mon_non_cons[i] = ini_mom[i] - out_mom[i];
    80 
    81   G4double pnc = std::sqrt(mon_non_cons[1] * mon_non_cons[1] +
    82                       mon_non_cons[2] * mon_non_cons[2] +
    83                       mon_non_cons[3] * mon_non_cons[3]);
     197    G4cout << " bullet momentum = " << ini_mom.e() <<", "<< ini_mom.x() <<", "<< ini_mom.y()<<", "<< ini_mom.z()<<G4endl;
     198    G4cout << " target momentum = " << momt.e()<<", "<< momt.x()<<", "<< momt.y()<<", "<< momt.z()<<G4endl;
     199    G4cout << " Fstate momentum = " << out_mom.e()<<", "<< out_mom.x()<<", "<< out_mom.y()<<", "<< out_mom.z()<<G4endl;
     200  }
     201
     202  mon_non_cons = ini_mom - out_mom;
     203
     204  G4double pnc = mon_non_cons.rho();
    84205
    85206  setRemainingExitationEnergy();       
     
    88209    printCollisionOutput();
    89210    G4cout << " momentum non conservation: " << G4endl
    90            << " e " << mon_non_cons[0]
     211           << " e " << mon_non_cons.e()
    91212           << " p " << pnc << G4endl;
    92213    G4cout << " remaining exitation " << eex_rest << G4endl;
    93214  }
    94215
    95   if(std::fabs(mon_non_cons[0]) > accuracy || pnc > accuracy) { // renormalization
     216  if(std::fabs(mon_non_cons.e()) > accuracy || pnc > accuracy) { // renormalization
    96217    G4int npart = outgoingParticles.size();
    97218 
    98219    if(npart > 0) {
    99220
    100       G4CascadeMomentum last_mom = outgoingParticles[npart - 1].getMomentum();
    101 
    102       for(G4int i = 1; i < 4; i++) last_mom[i] += mon_non_cons[i];
     221      G4LorentzVector last_mom = outgoingParticles[npart - 1].getMomentum();
     222
     223      last_mom += mon_non_cons;
    103224      outgoingParticles[npart - 1].setMomentum(last_mom);
    104225    }
     
    109230      if(nnuc > 0) {
    110231
    111         G4CascadeMomentum last_mom = nucleiFragments[nnuc - 1].getMomentum();
    112 
    113         for(G4int i = 1; i < 4; i++) last_mom[i] += mon_non_cons[i];
     232        G4LorentzVector last_mom = nucleiFragments[nnuc - 1].getMomentum();
     233
     234        last_mom += mon_non_cons;
    114235        nucleiFragments[nnuc - 1].setMomentum(last_mom);
    115236        nucleiFragments[nnuc - 1].setEnergy();
     
    117238    };
    118239    out_mom = getTotalOutputMomentum();
    119     for(G4int i = 0; i < 4; i++) mon_non_cons[i] = ini_mom[i] - out_mom[i];
    120     pnc = std::sqrt(mon_non_cons[1] * mon_non_cons[1] +
    121                mon_non_cons[2] * mon_non_cons[2] +
    122                mon_non_cons[3] * mon_non_cons[3]);
     240    mon_non_cons = ini_mom - out_mom;
     241    pnc = mon_non_cons.rho();
    123242
    124243    if(verboseLevel > 2){
    125244      printCollisionOutput();
    126245      G4cout << " momentum non conservation after (1): " << G4endl
    127              << " e " << mon_non_cons[0] << " p " << pnc << G4endl;
     246             << " e " << mon_non_cons.e() << " p " << pnc << G4endl;
    128247    }
    129248    G4bool need_hard_tuning = true;
     
    134253        G4double eex = nucleiFragments[i].getExitationEnergyInGeV();
    135254
    136         if(eex > 0.0 && eex + mon_non_cons[0] >= 0.0) {
    137           nucleiFragments[i].setExitationEnergy(1000.0 * (eex + mon_non_cons[0]));
     255        if(eex > 0.0 && eex + mon_non_cons.e() >= 0.0) {
     256          nucleiFragments[i].setExitationEnergy(1000.0 * (eex + mon_non_cons.e()));
    138257          need_hard_tuning = false;
    139258          break;
    140259        };
    141260      };
    142       if(need_hard_tuning && mon_non_cons[0] > 0.) {
    143         nucleiFragments[0].setExitationEnergy(1000.0 * mon_non_cons[0]);
     261      if(need_hard_tuning && mon_non_cons.e() > 0.) {
     262        nucleiFragments[0].setExitationEnergy(1000.0 * mon_non_cons.e());
    144263        need_hard_tuning = false;
    145264      };
     
    148267    if(need_hard_tuning) {
    149268     
    150       std::pair<std::pair<G4int, G4int>, G4int> tune_par = selectPairToTune(mon_non_cons[0]);
     269      std::pair<std::pair<G4int, G4int>, G4int> tune_par = selectPairToTune(mon_non_cons.e());
    151270      std::pair<G4int, G4int> tune_particles = tune_par.first;
    152271      G4int mom_ind = tune_par.second;
     
    157276      }
    158277      if(tune_particles.first >= 0 && tune_particles.second >= 0 &&
    159          mom_ind >= 1) { // tunning possible
    160 
    161         G4CascadeMomentum mom1 = outgoingParticles[tune_particles.first].getMomentum();
    162         G4CascadeMomentum mom2 = outgoingParticles[tune_particles.second].getMomentum();
    163         G4double newE12 = mom1[0] + mom2[0] + mon_non_cons[0];
    164         G4double R = 0.5 * (newE12 * newE12 + mom2[0] * mom2[0] - mom1[0] * mom1[0]) / newE12;
     278         mom_ind >= G4LorentzVector::X) { // tunning possible
     279
     280        G4LorentzVector mom1 = outgoingParticles[tune_particles.first].getMomentum();
     281        G4LorentzVector mom2 = outgoingParticles[tune_particles.second].getMomentum();
     282        G4double newE12 = mom1.e() + mom2.e() + mon_non_cons.e();
     283        G4double R = 0.5 * (newE12 * newE12 + mom2.e() * mom2.e() - mom1.e() * mom1.e()) / newE12;
    165284        G4double Q = -(mom1[mom_ind] + mom2[mom_ind]) / newE12;
    166285        G4double UDQ = 1.0 / (Q * Q - 1.0);
    167286        G4double W = (R * Q + mom2[mom_ind]) * UDQ;
    168         G4double V = (mom2[0] * mom2[0] - R * R) * UDQ;
     287        G4double V = (mom2.e() * mom2.e() - R * R) * UDQ;
    169288        G4double DET = W * W + V;
    170289
     
    177296          G4double x = 0.0;
    178297
    179           if(mon_non_cons[0] > 0.0) { // x has to be > 0.0
     298          if(mon_non_cons.e() > 0.0) { // x has to be > 0.0
    180299            if(x1 > 0.0) {
    181300              if(R + Q * x1 >= 0.0) {
     
    204323              };
    205324            };
    206           }
     325          }     // if(mon_non_cons.e() > 0.0)
    207326          if(xset) { // retune momentums
    208327            mom1[mom_ind] += x;
     
    212331            out_mom = getTotalOutputMomentum();
    213332            std::sort(outgoingParticles.begin(), outgoingParticles.end(), G4ParticleLargerEkin());
    214             for(G4int i = 0; i < 4; i++) mon_non_cons[i] = ini_mom[i] - out_mom[i];
    215             pnc = std::sqrt(mon_non_cons[1] * mon_non_cons[1] +
    216                        mon_non_cons[2] * mon_non_cons[2] +
    217                        mon_non_cons[3] * mon_non_cons[3]);
     333            mon_non_cons = ini_mom - out_mom;
     334            pnc = mon_non_cons.rho();
    218335            if(verboseLevel > 2){
    219336              G4cout << " momentum non conservation tuning: " << G4endl
    220                      << " e " << mon_non_cons[0] << " p " << pnc << G4endl;
     337                     << " e " << mon_non_cons.e() << " p " << pnc << G4endl;
    221338            }
    222             if(std::fabs(mon_non_cons[0]) < accuracy || pnc < accuracy) on_shell = true;
     339            if(std::fabs(mon_non_cons.e()) < accuracy || pnc < accuracy) on_shell = true;
    223340          }
    224341          else {
     
    226343              G4cout << " no appropriate solution found " << G4endl;
    227344            }
    228           };
     345          }     // if(xset)
    229346        }
    230347        else {
     
    232349            G4cout << " DET < 0 " << G4endl;
    233350          }
    234         };   
     351        }       // if(DET > 0.0)
    235352      }
    236353      else {
     
    238355          G4cout << " tuning impossible " << G4endl;
    239356        }
    240       }
     357      } // if (<tuning-possible>)
    241358    }
    242359    else {
    243360      on_shell = true;
    244     };
     361    }   // if(need_hard_tuning)
    245362  }
    246363  else {
    247364    on_shell = true;
    248   };
    249  
    250 }
    251 
    252 std::pair<std::pair<G4int, G4int>, G4int> G4CollisionOutput::selectPairToTune(G4double de) const {
    253 
     365  };    // if (<renormalization>)
     366}
     367
     368
     369void G4CollisionOutput::setRemainingExitationEnergy() {
     370  eex_rest = 0.0;
     371  for(G4int i = 0; i < G4int(nucleiFragments.size()); i++)
     372    eex_rest += 0.001 * nucleiFragments[i].getExitationEnergy();
     373}
     374
     375
     376std::pair<std::pair<G4int, G4int>, G4int>
     377G4CollisionOutput::selectPairToTune(G4double de) const {
    254378  if (verboseLevel > 3) {
    255379    G4cout << " >>> G4CollisionOutput::selectPairToTune" << G4endl;
     
    258382  std::pair<G4int, G4int> tup(-1, -1);
    259383  G4int i3 = -1;
    260   std::pair<std::pair<G4int, G4int>, G4int> badp(tup, i3);
    261 
    262   if(outgoingParticles.size() < 2) {
    263 
    264     return badp;
    265   }
    266   else {
    267 
    268     G4int ibest1 = -1;
    269     G4int ibest2 = -1; 
    270     G4double pbest = 0.0;
    271     G4double pcut = 0.3 * std::sqrt(1.88 * std::fabs(de));
    272     G4double p1 = 0.0;
    273     G4double p2;
    274    
    275     for(G4int i = 0; i < G4int(outgoingParticles.size()) - 1; i++) {
    276 
    277       const G4CascadeMomentum& mom1 = outgoingParticles[i].getMomentum();
    278 
    279       for(G4int j = i+1; j < G4int(outgoingParticles.size()); j++) {
    280 
    281         const G4CascadeMomentum& mom2 = outgoingParticles[j].getMomentum();
    282 
    283         for(G4int l = 1; l < 4; l++) {
    284           if(mom1[l] * mom2[l] < 0.0) {
    285             if(std::fabs(mom1[l]) > pcut && std::fabs(mom2[l]) > pcut) {
    286 
    287               G4double psum = std::fabs(mom1[l]) + std::fabs(mom2[l]); 
    288 
    289               if(psum > pbest) {
    290                 ibest1 = i;
    291                 ibest2 = j;
    292                 i3 = l;
    293                 p1 = mom1[l];
    294                 p2 = mom2[l];
    295                 pbest = psum;
    296               };
    297             };
    298           };
    299         };
    300       };
    301     };                 
    302     if(i3 > 0) {
    303       if(de > 0.0) {
    304         if(p1 > 0.0) {
    305           tup.first  = ibest1;
    306           tup.second = ibest2;
    307         }
    308         else {
    309           tup.first  = ibest2;
    310           tup.second = ibest1;
    311         };               
    312       }
    313       else {
    314         if(p1 < 0.0) {
    315           tup.first  = ibest2;
    316           tup.second = ibest1;
    317         }
    318         else {
    319           tup.first  = ibest1;
    320           tup.second = ibest2;
    321         };               
    322       };
    323 
    324       return std::pair<std::pair<G4int, G4int>, G4int>(tup, i3);
    325     };
    326   }; 
    327 
    328   return badp;
    329 }
     384  std::pair<std::pair<G4int, G4int>, G4int> tuner(tup, i3);     // Set invalid
     385
     386  if (outgoingParticles.size() < 2) return tuner;       // Nothing to do
     387
     388  G4int ibest1 = -1;
     389  G4int ibest2 = -1; 
     390  G4double pbest = 0.0;
     391  G4double pcut = 0.3 * std::sqrt(1.88 * std::fabs(de));
     392  G4double p1 = 0.0;
     393  G4double p2;
     394 
     395  for (G4int i = 0; i < G4int(outgoingParticles.size()) - 1; i++) {
     396    G4LorentzVector mom1 = outgoingParticles[i].getMomentum();
     397   
     398    for (G4int j = i+1; j < G4int(outgoingParticles.size()); j++) {
     399      G4LorentzVector mom2 = outgoingParticles[j].getMomentum();
     400     
     401      for (G4int l = G4LorentzVector::X; l<=G4LorentzVector::Z; l++) {
     402        if (mom1[l]*mom2[l]<0.0) {
     403          if (std::fabs(mom1[l])>pcut && std::fabs(mom2[l])>pcut) {
     404            G4double psum = std::fabs(mom1[l]) + std::fabs(mom2[l]); 
     405           
     406            if(psum > pbest) {
     407              ibest1 = i;
     408              ibest2 = j;
     409              i3 = l;
     410              p1 = mom1[l];
     411              p2 = mom2[l];
     412              pbest = psum;
     413            }   // psum > pbest
     414          }     // mom1 and mom2 > pcut
     415        }       // mom1 ~ -mom2
     416      } // for (G4int l ...
     417    }   // for (G4int j ...
     418  }     // for (G4int i ...
     419
     420  if (i3 < 0) return tuner;             
     421 
     422  tuner.second = i3;            // Momentum axis for tuning
     423 
     424  // NOTE: Sign of de determines order for special case of p1==0.
     425  if (de > 0.0) {
     426    tuner.first.first  = (p1>0.) ? ibest1 : ibest2;
     427    tuner.first.second = (p1>0.) ? ibest2 : ibest1;
     428  } else {
     429    tuner.first.first  = (p1<0.) ? ibest2 : ibest1;
     430    tuner.first.second = (p1<0.) ? ibest1 : ibest2;
     431  }             
     432 
     433  return tuner;
     434}
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4ElementaryParticleCollider.cc

    r1196 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4ElementaryParticleCollider.cc,v 1.64 2010/05/21 18:26:16 mkelsey Exp $
     26// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
    26 
     28// 20100114  M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
     29// 20100316  D. Wright (restored by M. Kelsey) -- Replace original (incorrect)
     30//              pp, pn, nn 2-body to 2-body scattering angular distributions
     31//              with a new parametrization of elastic scattering data using
     32//              the sum of two exponentials.
     33// 20100319  M. Kelsey -- Use new generateWithRandomAngles for theta,phi stuff;
     34//              eliminate some unnecessary std::pow()
     35// 20100407  M. Kelsey -- Replace std::vector<>::resize(0) with ::clear()
     36//              Eliminate return-by-value std::vector<> by creating buffers
     37//              buffers for particles, momenta, and particle types.
     38//              The following functions now return void and are non-const:
     39//                ::generateSCMfinalState()
     40//                ::generateMomModules()
     41//                ::generateStrangeChannelPartTypes()
     42//                ::generateSCMpionAbsorption()
     43// 20100408  M. Kelsey -- Follow changes to G4*Sampler to pass particle_kinds
     44//              as input buffer.
     45// 20100413  M. Kelsey -- Pass G4CollisionOutput by ref to ::collide()
     46// 20100428  M. Kelsey -- Use G4InuclParticleNames enum
     47// 20100429  M. Kelsey -- Change "photon()" to "isPhoton()"
     48// 20100507  M. Kelsey -- Rationalize multiplicity returns to be actual value
     49// 20100511  M. Kelsey -- Replace G4PionSampler and G4NucleonSampler with new
     50//              pi-N and N-N classes, reorganize if-cascades
     51// 20100511  M. Kelsey -- Eliminate three residual random-angles blocks.
     52// 20100511  M. Kelsey -- Bug fix: pi-N two-body final states not correctly
     53//              tested for charge-exchange case.
     54// 20100512  M. Kelsey -- Rationalize multiplicity returns to be actual value
     55// 20100512  M. Kelsey -- Add some additional debugging messages for 2-to-2
     56// 20100512  M. Kelsey -- Replace "if (is==)" cascades with switch blocks.
     57//              Use G4CascadeInterpolator for angular distributions.
     58// 20100517  M. Kelsey -- Inherit from common base class, make arrays static
     59// 20100519  M. Kelsey -- Use G4InteractionCase to compute "is" values.
     60
     61#include "G4ElementaryParticleCollider.hh"
     62
     63#include "G4CascadePiMinusNChannel.hh"
     64#include "G4CascadePiMinusPChannel.hh"
     65#include "G4CascadePiPlusNChannel.hh"
     66#include "G4CascadePiPlusPChannel.hh"
     67#include "G4CascadePiZeroNChannel.hh"
     68#include "G4CascadePiZeroPChannel.hh"
    2769#include "G4CascadeKplusPChannel.hh"
    2870#include "G4CascadeKplusNChannel.hh"
     
    3375#include "G4CascadeKzeroBarPChannel.hh"
    3476#include "G4CascadeKzeroBarNChannel.hh"
     77#include "G4CascadeNNChannel.hh"
     78#include "G4CascadeNPChannel.hh"
     79#include "G4CascadePPChannel.hh"
    3580#include "G4CascadeLambdaPChannel.hh"
    3681#include "G4CascadeLambdaNChannel.hh"
     
    4691#include "G4CascadeXiMinusNChannel.hh"
    4792
    48 #include "G4Collider.hh"
    49 #include "G4ElementaryParticleCollider.hh"
     93#include "G4CascadeInterpolator.hh"
     94#include "G4CollisionOutput.hh"
     95#include "G4InuclParticleNames.hh"
     96#include "G4InuclSpecialFunctions.hh"
    5097#include "G4ParticleLargerEkin.hh"
     98#include "G4LorentzConvertor.hh"
     99#include "Randomize.hh"
    51100#include <algorithm>
     101#include <vector>
     102
     103using namespace G4InuclParticleNames;
     104using namespace G4InuclSpecialFunctions;
    52105
    53106typedef std::vector<G4InuclElementaryParticle>::iterator particleIterator;
     
    55108
    56109G4ElementaryParticleCollider::G4ElementaryParticleCollider()
    57   : verboseLevel(1)
     110  : G4VCascadeCollider("G4ElementaryParticleCollider") {}
     111
     112
     113void
     114G4ElementaryParticleCollider::collide(G4InuclParticle* bullet,
     115                                      G4InuclParticle* target,
     116                                      G4CollisionOutput& output)
    58117{
    59   if (verboseLevel > 3) {
    60     G4cout << " >>> G4ElementaryParticleCollider ctor " << G4endl;
    61   }
    62 
    63   initializeArrays();
    64 }
    65 
    66 
    67 G4CollisionOutput 
    68 G4ElementaryParticleCollider::collide(G4InuclParticle* bullet,
    69                                       G4InuclParticle* target)
    70 {
     118  if (!useEPCollider(bullet,target)) {          // Sanity check
     119    G4cerr << " ElementaryParticleCollider -> can collide only particle with particle "
     120           << G4endl;
     121    return;
     122  }
     123
     124  interCase.set(bullet, target);        // To identify kind of collision
     125
    71126  G4InuclElementaryParticle* particle1 =
    72127    dynamic_cast<G4InuclElementaryParticle*>(bullet);
     
    74129    dynamic_cast<G4InuclElementaryParticle*>(target);
    75130
    76   G4CollisionOutput output;
    77 
    78   if (!(particle1 && particle2)) {
    79     G4cout << " ElementaryParticleCollider -> can collide only particle with particle "
     131  if (particle1->isPhoton() || particle2->isPhoton()) {
     132    G4cout << " ElementaryParticleCollider -> cannot collide photons "
    80133           << G4endl;
    81134  } else {
    82     collide(particle1, particle2, output);
    83   }
    84   return output;       
    85 }
    86 
    87 
    88 void
    89 G4ElementaryParticleCollider::collide(G4InuclElementaryParticle* particle1,
    90                                       G4InuclElementaryParticle* particle2,
    91                                       G4CollisionOutput& output) {
    92135
    93136  // Generate nucleon or pion collision with nucleon
    94137  // or pion with quasi-deuteron
    95138
    96   if (!particle1->photon() && !particle2->photon()) { // ok
    97139    if (particle1->nucleon() || particle2->nucleon()) { // ok
    98140      G4LorentzConvertor convertToSCM;
    99141      if(particle2->nucleon()) {
    100         convertToSCM.setBullet(particle1->getMomentum(), particle1->getMass());
    101         convertToSCM.setTarget(particle2->getMomentum(), particle2->getMass());
     142        convertToSCM.setBullet(particle1);
     143        convertToSCM.setTarget(particle2);
    102144      } else {
    103         convertToSCM.setBullet(particle2->getMomentum(), particle2->getMass());
    104         convertToSCM.setTarget(particle1->getMomentum(), particle1->getMass());
     145        convertToSCM.setBullet(particle2);
     146        convertToSCM.setTarget(particle1);
    105147      }; 
    106148      convertToSCM.toTheCenterOfMass();
     
    109151      G4double pscm = convertToSCM.getSCMMomentum();
    110152
    111       std::vector<G4InuclElementaryParticle> particles =           
    112         generateSCMfinalState(ekin, etot_scm, pscm, particle1, particle2, &convertToSCM);
     153      generateSCMfinalState(ekin, etot_scm, pscm, particle1, particle2,
     154                            &convertToSCM);
    113155
    114156      if(verboseLevel > 2){
     
    120162      }
    121163      if(!particles.empty()) { // convert back to Lab
     164        G4LorentzVector mom;            // Buffer to avoid memory churn
    122165        particleIterator ipart;
    123166        for(ipart = particles.begin(); ipart != particles.end(); ipart++) {     
    124           G4CascadeMomentum mom =
    125             convertToSCM.backToTheLab(ipart->getMomentum());
     167          mom = convertToSCM.backToTheLab(ipart->getMomentum());
    126168          ipart->setMomentum(mom);
    127169        };
    128170        std::sort(particles.begin(), particles.end(), G4ParticleLargerEkin());
     171        output.addOutgoingParticles(particles);
    129172      };
    130       output.addOutgoingParticles(particles);
    131 
    132173    } else {
    133174      if(particle1->quasi_deutron() || particle2->quasi_deutron()) {
     
    135176          G4LorentzConvertor convertToSCM;
    136177          if(particle1->pion()) {
    137             convertToSCM.setBullet(particle1->getMomentum(), particle1->getMass());
    138             convertToSCM.setTarget(particle2->getMomentum(), particle2->getMass());
     178            convertToSCM.setBullet(particle1);
     179            convertToSCM.setTarget(particle2);
    139180          } else {
    140             convertToSCM.setBullet(particle2->getMomentum(), particle2->getMass());
    141             convertToSCM.setTarget(particle1->getMomentum(), particle1->getMass());
     181            convertToSCM.setBullet(particle2);
     182            convertToSCM.setTarget(particle1);
    142183          };
    143184          convertToSCM.toTheCenterOfMass();
    144185          G4double etot_scm = convertToSCM.getTotalSCMEnergy();
    145           std::vector<G4InuclElementaryParticle> particles =
    146             generateSCMpionAbsorption(etot_scm, particle1, particle2);
     186
     187          generateSCMpionAbsorption(etot_scm, particle1, particle2);
    147188
    148189          if(!particles.empty()) { // convert back to Lab
     190            G4LorentzVector mom;        // Buffer to avoid memory churn
    149191            particleIterator ipart;
    150192            for(ipart = particles.begin(); ipart != particles.end(); ipart++) {
    151               G4CascadeMomentum mom =
    152                 convertToSCM.backToTheLab(ipart->getMomentum());
     193              mom = convertToSCM.backToTheLab(ipart->getMomentum());
    153194              ipart->setMomentum(mom);
    154195            };
     
    167208    }; 
    168209
    169   } else {
    170 
    171     G4cout << " ElementaryParticleCollider -> cannot collide photons "
    172            << G4endl;
    173   };
     210  }
    174211
    175212}
     
    181218{
    182219  G4int mul = 0;
    183   G4int l = is;
    184 
    185   if ( ( l > 10 && l < 14 ) || ( l > 14 && l < 63 ) ) {
    186     // strange particle branch
    187     if ( l == 11 ) {
    188       mul = G4CascadeKplusPChannel::getMultiplicity(ekin);
    189     } else if ( l == 13 ) {
    190       mul = G4CascadeKminusPChannel::getMultiplicity(ekin);
    191     } else if ( l == 15 ) {
    192       mul = G4CascadeKzeroPChannel::getMultiplicity(ekin);
    193     } else if ( l == 17 ) {
    194       mul = G4CascadeKzeroBarPChannel::getMultiplicity(ekin);
    195     } else if ( l == 21 ) {
    196       mul = G4CascadeLambdaPChannel::getMultiplicity(ekin);
    197     } else if ( l == 23 ) {
    198       mul = G4CascadeSigmaPlusPChannel::getMultiplicity(ekin);
    199     } else if ( l == 25 ) {
    200       mul = G4CascadeSigmaZeroPChannel::getMultiplicity(ekin);
    201     } else if ( l == 27 ) {
    202       mul = G4CascadeSigmaMinusPChannel::getMultiplicity(ekin);
    203     } else if ( l == 29 ) {
    204       mul = G4CascadeXiZeroPChannel::getMultiplicity(ekin);
    205     } else if ( l == 31 ) {
    206       mul = G4CascadeXiMinusPChannel::getMultiplicity(ekin);
    207 
    208     } else if ( l == 22 ) {
    209       mul = G4CascadeKplusNChannel::getMultiplicity(ekin);
    210     } else if ( l == 26 ) {
    211       mul = G4CascadeKminusNChannel::getMultiplicity(ekin);
    212     } else if ( l == 30 ) {
    213       mul = G4CascadeKzeroNChannel::getMultiplicity(ekin);
    214     } else if ( l == 34 ) {
    215       mul = G4CascadeKzeroBarNChannel::getMultiplicity(ekin);
    216     } else if ( l == 42 ) {
    217       mul = G4CascadeLambdaNChannel::getMultiplicity(ekin);
    218     } else if ( l == 46 ) {
    219       mul = G4CascadeSigmaPlusNChannel::getMultiplicity(ekin);
    220     } else if ( l == 50 ) {
    221       mul = G4CascadeSigmaZeroNChannel::getMultiplicity(ekin);
    222     } else if ( l == 54 ) {
    223       mul = G4CascadeSigmaMinusNChannel::getMultiplicity(ekin);
    224     } else if ( l == 58 ) {
    225       mul = G4CascadeXiZeroNChannel::getMultiplicity(ekin);
    226     } else if ( l == 62 ) {
    227       mul = G4CascadeXiMinusNChannel::getMultiplicity(ekin);
    228 
    229     } else {
    230       G4cout << " G4ElementaryParticleCollider:"
    231              << " Unknown strange interaction channel - multiplicity not generated "
    232              << G4endl;
    233     }
    234 
    235   // Non-strange branch
    236   } else if (l == 1 || l == 4) {
    237     mul = nucSampler.GetMultiplicityT1(ekin) - 2;
    238     if (mul > 7) G4cout << " Nuc sampler pp mult too high: mul = " << mul << G4endl;
    239   } else if (l == 2) {
    240     mul = nucSampler.GetMultiplicityT0(ekin) - 2;
    241     if (mul > 7) G4cout << " Nuc sampler np mult too high: mul = " << mul << G4endl;
    242   } else if (l == 3 || l == 10) {
    243     // |T,Tz> = |3/2,3/2>
    244     mul = piSampler.GetMultiplicityT33(ekin) - 2;
    245   } else if (l == 5 || l == 6) {
    246     // |T,Tz> = |3/2,1/2>
    247     mul = piSampler.GetMultiplicityT31(ekin) - 2;
    248   } else if (l == 7 || l == 14) {
    249     // |T,Tz> = |1/2,1/2>
    250     mul = piSampler.GetMultiplicityT11(ekin) - 2;
    251   } else {
    252     G4cout << " G4ElementaryParticleCollider: "
    253            << " Unknown interaction channel - multiplicity not generated "
    254            << G4endl;
     220
     221  switch (is) {
     222  case  1: mul = G4CascadePPChannel::getMultiplicity(ekin); break;
     223  case  2: mul = G4CascadeNPChannel::getMultiplicity(ekin); break;
     224  case  3: mul = G4CascadePiPlusPChannel::getMultiplicity(ekin); break;
     225  case  4: mul = G4CascadeNNChannel::getMultiplicity(ekin); break;
     226  case  5: mul = G4CascadePiMinusPChannel::getMultiplicity(ekin); break;
     227  case  6: mul = G4CascadePiPlusNChannel::getMultiplicity(ekin); break;
     228  case  7: mul = G4CascadePiZeroPChannel::getMultiplicity(ekin); break;
     229  case 10: mul = G4CascadePiMinusNChannel::getMultiplicity(ekin); break;
     230  case 11: mul = G4CascadeKplusPChannel::getMultiplicity(ekin); break;
     231  case 13: mul = G4CascadeKminusPChannel::getMultiplicity(ekin); break;
     232  case 14: mul = G4CascadePiZeroNChannel::getMultiplicity(ekin); break;
     233  case 15: mul = G4CascadeKzeroPChannel::getMultiplicity(ekin); break;
     234  case 17: mul = G4CascadeKzeroBarPChannel::getMultiplicity(ekin); break;
     235  case 21: mul = G4CascadeLambdaPChannel::getMultiplicity(ekin); break;
     236  case 22: mul = G4CascadeKplusNChannel::getMultiplicity(ekin); break;
     237  case 23: mul = G4CascadeSigmaPlusPChannel::getMultiplicity(ekin); break;
     238  case 25: mul = G4CascadeSigmaZeroPChannel::getMultiplicity(ekin); break;
     239  case 26: mul = G4CascadeKminusNChannel::getMultiplicity(ekin); break;
     240  case 27: mul = G4CascadeSigmaMinusPChannel::getMultiplicity(ekin); break;
     241  case 29: mul = G4CascadeXiZeroPChannel::getMultiplicity(ekin); break;
     242  case 30: mul = G4CascadeKzeroNChannel::getMultiplicity(ekin); break;
     243  case 31: mul = G4CascadeXiMinusPChannel::getMultiplicity(ekin); break;
     244  case 34: mul = G4CascadeKzeroBarNChannel::getMultiplicity(ekin); break;
     245  case 42: mul = G4CascadeLambdaNChannel::getMultiplicity(ekin); break;
     246  case 46: mul = G4CascadeSigmaPlusNChannel::getMultiplicity(ekin); break;
     247  case 50: mul = G4CascadeSigmaZeroNChannel::getMultiplicity(ekin); break;
     248  case 54: mul = G4CascadeSigmaMinusNChannel::getMultiplicity(ekin); break;
     249  case 58: mul = G4CascadeXiZeroNChannel::getMultiplicity(ekin); break;
     250  case 62: mul = G4CascadeXiMinusNChannel::getMultiplicity(ekin); break;
     251  default:
     252    G4cerr << " G4ElementaryParticleCollider: Unknown interaction channel "
     253           << is << " - multiplicity not generated " << G4endl;
    255254  }
    256255
    257256  if(verboseLevel > 3){
    258257    G4cout << " G4ElementaryParticleCollider::generateMultiplicity: " 
    259            << " multiplicity = " << mul + 2 << G4endl;
    260   }
    261 
    262   return mul + 2;
     258           << " multiplicity = " << mul << G4endl;
     259  }
     260
     261  return mul;
    263262}
    264263
    265264 
    266 std::vector<G4InuclElementaryParticle>
     265void
    267266G4ElementaryParticleCollider::generateSCMfinalState(G4double ekin,
    268267                                     G4double etot_scm,
     
    270269                                     G4InuclElementaryParticle* particle1,
    271270                                     G4InuclElementaryParticle* particle2,
    272                                      G4LorentzConvertor* toSCM) const
    273 {
     271                                     G4LorentzConvertor* toSCM) {
    274272  if (verboseLevel > 3) {
    275273    G4cout << " >>> G4ElementaryParticleCollider::generateSCMfinalState"
     
    281279  const G4int itry_max = 10;
    282280  G4InuclElementaryParticle dummy;
    283   std::vector<G4InuclElementaryParticle> particles;
    284   std::vector<G4int> particle_kinds;
     281
    285282  G4int type1 = particle1->type();
    286283  G4int type2 = particle2->type();
     284
    287285  G4int is = type1 * type2;
    288286
     
    293291  G4int multiplicity = 0;
    294292  G4bool generate = true;
    295    
     293
     294  particles.clear();            // Initialize buffers for this event
     295  particle_kinds.clear();
     296
    296297  while (generate) {
    297 
    298298    if(multiplicity == 0) {
    299299      multiplicity = generateMultiplicity(is, ekin);
    300300    } else {
    301301      multiplicity = generateMultiplicity(is, ekin);
    302       particle_kinds.resize(0);
     302      particle_kinds.clear();
    303303    }
    304304
    305     if(multiplicity == 2) { // 2 -> 2
    306       G4int kw = 1;
    307       if ( (is > 10 && is < 14) || (is > 14 && is < 63) ) {
    308         particle_kinds =
    309           generateStrangeChannelPartTypes(is, 2, ekin);
    310 
    311         G4int finaltype = particle_kinds[0]*particle_kinds[1];
    312         if (finaltype != is) kw = 2;  // Charge or strangeness exchange
    313 
    314       } else if (is == 1 || is == 2 || is == 4) {
    315           particle_kinds.push_back(type1);
    316           particle_kinds.push_back(type2);
    317 
    318       } else if (is == 3) {
    319         particle_kinds = piSampler.GetFSPartTypesForPipP(2, ekin);
    320         if (particle_kinds[0] != G4PionSampler::pro) kw = 2;
    321 
    322       } else if (is == 10) {
    323         particle_kinds = piSampler.GetFSPartTypesForPimN(2, ekin);
    324         if (particle_kinds[0] != G4PionSampler::neu) kw = 2;
    325 
    326       } else if (is == 5) {
    327         particle_kinds = piSampler.GetFSPartTypesForPimP(2, ekin);
    328         if (particle_kinds[0] != G4PionSampler::pro) kw = 2;
    329 
    330       } else if (is == 6) {
    331         particle_kinds = piSampler.GetFSPartTypesForPipN(2, ekin);
    332         if (particle_kinds[0] != G4PionSampler::neu) kw = 2;
    333 
    334       } else if (is == 7) {
    335         particle_kinds = piSampler.GetFSPartTypesForPizP(2, ekin);
    336         if (particle_kinds[0] != G4PionSampler::pro) kw = 2;
    337 
    338       } else if (is == 14) {
    339         particle_kinds = piSampler.GetFSPartTypesForPizN(2, ekin);
    340         if (particle_kinds[0] != G4PionSampler::neu) kw = 2;
    341 
    342       } else {
    343         G4cout << " Unexpected interaction type (2->2) is = " << is << G4endl;
    344       }
    345 
    346       G4CascadeMomentum mom;
    347 
    348       if (kw == 2) { // need to rescale momentum
     305    // Generate list of final-state particles
     306    generateOutgoingPartTypes(is, multiplicity, ekin);
     307
     308    if (particle_kinds.empty()) continue;
     309    // G4cout << " Particle kinds = " ;
     310    // for (G4int i = 0; i < multiplicity; i++) G4cout << particle_kinds[i] << " , " ;
     311    // G4cout << G4endl;
     312
     313    if (multiplicity == 2) {
     314      // Identify charge or strangeness exchange (non-elastic scatter)
     315      G4int finaltype = particle_kinds[0]*particle_kinds[1];
     316      G4int kw = (finaltype != is) ? 2 : 1;
     317
     318      G4double pmod = pscm;     // May need to rescale momentum
     319      if (kw == 2) {
    349320        G4double m1 = dummy.getParticleMass(particle_kinds[0]);
    350321        m1 *= m1;
     
    354325        G4double em = a * a - m1 * m2;
    355326
    356         if (em > 0) { //  see if it is possible to rescale?
    357           G4double np = std::sqrt( em / (m1 + m2 + 2.0 * a));
    358           mom = particleSCMmomentumFor2to2(is, kw, ekin, np);
    359         } else { // rescaling not possible
    360           mom = particleSCMmomentumFor2to2(is, kw, ekin, pscm);
     327        if (em > 0) {           //  It is possible to rescale
     328          pmod = std::sqrt( em / (m1 + m2 + 2.0 * a));
    361329        }
    362 
    363       } else {
    364         mom = particleSCMmomentumFor2to2(is, kw, ekin, pscm);
    365       };
    366 
    367       //      G4cout << " Particle kinds = " << particle_kinds[0] << " , " << particle_kinds[1] << G4endl;
     330      }
     331
     332      G4LorentzVector mom = sampleCMmomentumFor2to2(is, kw, ekin, pmod);
    368333
    369334      if (verboseLevel > 3){
    370         G4cout << " before rotation px " << mom[1] << " py " << mom[2] <<
    371           " pz " << mom[3] << G4endl;
     335        G4cout << " Particle kinds = " << particle_kinds[0] << " , "
     336               << particle_kinds[1] << G4endl
     337               << " before rotation px " << mom.x() << " py " << mom.y()
     338               << " pz " << mom.z() << G4endl;
    372339      }
    373340
     
    375342
    376343      if (verboseLevel > 3){
    377         G4cout << " after rotation px " << mom[1] << " py " << mom[2] <<
    378           " pz " << mom[3] << G4endl;
     344        G4cout << " after rotation px " << mom.x() << " py " << mom.y() <<
     345          " pz " << mom.z() << G4endl;
    379346      }
    380       G4CascadeMomentum mom1;
    381 
    382       for (G4int i = 1; i < 4; i++) mom1[i] = -mom[i];
     347      G4LorentzVector mom1 = -mom;
    383348
    384349      particles.push_back(G4InuclElementaryParticle(mom, particle_kinds[0], 3));
    385       // register modelId
    386350      particles.push_back(G4InuclElementaryParticle(mom1, particle_kinds[1],3));
    387351      generate = false;
    388352
    389     } else { // 2 -> many
    390 
    391       if ( (is > 10 && is < 14) || (is > 14 && is < 63) ) {
    392         particle_kinds =
    393           generateStrangeChannelPartTypes(is, multiplicity, ekin);
    394 
    395       } else if (is == 1) {
    396         particle_kinds = nucSampler.GetFSPartTypesForPP(multiplicity, ekin);
    397 
    398       } else if (is == 2) {
    399         particle_kinds = nucSampler.GetFSPartTypesForNP(multiplicity, ekin);
    400 
    401       } else if (is == 4) {
    402         particle_kinds = nucSampler.GetFSPartTypesForNN(multiplicity, ekin);
    403 
    404       } else if (is == 3) {
    405         particle_kinds = piSampler.GetFSPartTypesForPipP(multiplicity, ekin);
    406 
    407       } else if (is == 10) {
    408         particle_kinds = piSampler.GetFSPartTypesForPimN(multiplicity, ekin);
    409 
    410       } else if (is == 5) {
    411         particle_kinds = piSampler.GetFSPartTypesForPimP(multiplicity, ekin);
    412 
    413       } else if (is == 6) {
    414         particle_kinds = piSampler.GetFSPartTypesForPipN(multiplicity, ekin);
    415 
    416       } else if (is == 7) {
    417         particle_kinds = piSampler.GetFSPartTypesForPizP(multiplicity, ekin);
    418 
    419       } else if (is == 14) {
    420         particle_kinds = piSampler.GetFSPartTypesForPizN(multiplicity, ekin);
    421 
    422       } else {
    423         G4cout << " Unexpected interaction type is = " << is << G4endl;
    424       }
    425 
    426       //      G4cout << " Particle kinds = " ;
    427       //      for (G4int i = 0; i < multiplicity; i++) G4cout << particle_kinds[i] << " , " ;
    428       //       G4cout << G4endl;
    429 
     353    } else {                     // 2 -> many
    430354      G4int itry = 0;
    431355      G4bool bad = true;
     
    444368        }
    445369
    446         std::vector<G4double> modules =
    447           generateMomModules(particle_kinds, multiplicity, is, ekin, etot_scm);
    448 
    449         if (G4int(modules.size()) == multiplicity) {
    450 
    451           if (multiplicity == 3) {
    452             G4CascadeMomentum mom3 =
    453               particleSCMmomentumFor2to3(is, knd_last, ekin, modules[2]);
    454 
    455             mom3 = toSCM->rotate(mom3);
    456 
    457             // generate the momentum of first
    458             G4double ct = -0.5 * (modules[2] * modules[2] +
    459                                   modules[0] * modules[0] -
    460                                   modules[1] * modules[1]) /
    461               modules[2] / modules[0];   
    462 
    463             if(std::fabs(ct) < ang_cut) {
    464 
     370        generateMomModules(multiplicity, is, ekin, etot_scm);
     371        if (G4int(modules.size()) != multiplicity) continue;
     372
     373        if (multiplicity == 3) {
     374          G4LorentzVector mom3 =
     375            particleSCMmomentumFor2to3(is, knd_last, ekin, modules[2]);
     376         
     377          mom3 = toSCM->rotate(mom3);
     378         
     379          // generate the momentum of first
     380          G4double ct = -0.5 * (modules[2] * modules[2] +
     381                                modules[0] * modules[0] -
     382                                modules[1] * modules[1]) /
     383            modules[2] / modules[0];   
     384         
     385          if(std::fabs(ct) < ang_cut) {
     386           
     387            if(verboseLevel > 2){
     388              G4cout << " ok for mult " << multiplicity << G4endl;
     389            }
     390           
     391            G4LorentzVector mom1 = generateWithFixedTheta(ct, modules[0]);
     392           
     393            mom1 = toSCM->rotate(mom3, mom1);
     394           
     395            G4LorentzVector mom2 = -(mom3 + mom1);
     396           
     397            bad = false;
     398            generate = false;
     399           
     400            particles.push_back(G4InuclElementaryParticle(mom1, particle_kinds[0],3));
     401            particles.push_back(G4InuclElementaryParticle(mom2, particle_kinds[1],3));
     402            particles.push_back(G4InuclElementaryParticle(mom3, particle_kinds[2],3));
     403          };
     404        } else { // multiplicity > 3
     405          // generate first mult - 2 momentums
     406          std::vector<G4LorentzVector> scm_momentums;
     407          G4LorentzVector tot_mom;
     408         
     409          for (G4int i = 0; i < multiplicity - 2; i++) {
     410            G4double p0 = particle_kinds[i] < 3 ? 0.36 : 0.25;
     411            G4double alf = 1.0 / p0 / (p0 - (modules[i] + p0) *
     412                                       std::exp(-modules[i] / p0));
     413            G4double st = 2.0;
     414            G4int itry1 = 0;
     415           
     416            while (std::fabs(st) > ang_cut && itry1 < itry_max) {
     417              itry1++;
     418              G4double s1 = modules[i] * inuclRndm();
     419              G4double s2 = alf * difr_const * p0 * inuclRndm();
     420             
     421              if(verboseLevel > 3){
     422                G4cout << " s1 * alf * std::exp(-s1 / p0) "
     423                       << s1 * alf * std::exp(-s1 / p0)
     424                       << " s2 " << s2 << G4endl;
     425              }
     426             
     427              if(s1 * alf * std::exp(-s1 / p0) > s2) st = s1 / modules[i];
     428             
     429            };
     430           
     431            if(verboseLevel > 3){
     432              G4cout << " itry1 " << itry1 << " i " << i << " st " << st
     433                     << G4endl;
     434            }
     435           
     436            if(itry1 == itry_max) {
    465437              if(verboseLevel > 2){
    466                 G4cout << " ok for mult " << multiplicity << G4endl;
     438                G4cout << " high energy angles generation: itry1 " << itry1
     439                       << G4endl;
    467440              }
    468 
    469               G4CascadeMomentum mom1 = generateWithFixedTheta(ct, modules[0]);
    470 
    471               mom1 = toSCM->rotate(mom3, mom1);
    472 
    473               G4CascadeMomentum mom2;
    474 
    475               for(G4int i = 1; i < 4; i++) mom2[i] = - (mom3[i] + mom1[i]);
    476 
    477               bad = false;
    478               generate = false;
    479 
    480               particles.push_back(G4InuclElementaryParticle(mom1, particle_kinds[0]));
    481               particles.push_back(G4InuclElementaryParticle(mom2, particle_kinds[1]));
    482               particles.push_back(G4InuclElementaryParticle(mom3, particle_kinds[2]));
     441             
     442              st = 0.5 * inuclRndm();
    483443            };
    484444
    485           } else { // multiplicity > 3
    486 
    487             // generate first mult - 2 momentums
    488             std::vector<G4CascadeMomentum> scm_momentums;
    489             G4CascadeMomentum tot_mom;
    490 
    491             for (G4int i = 0; i < multiplicity - 2; i++) {
    492               G4double p0 = particle_kinds[i] < 3 ? 0.36 : 0.25;
    493               G4double alf = 1.0 / p0 / (p0 - (modules[i] + p0) *
    494                                          std::exp(-modules[i] / p0));
    495               G4double st = 2.0;
    496               G4int itry1 = 0;
    497 
    498               while (std::fabs(st) > ang_cut && itry1 < itry_max) {
    499                 itry1++;
    500                 G4double s1 = modules[i] * inuclRndm();
    501                 G4double s2 = alf * difr_const * p0 * inuclRndm();
    502 
    503                 if(verboseLevel > 3){
    504                   G4cout << " s1 * alf * std::exp(-s1 / p0) " << s1 * alf * std::exp(-s1 / p0)
    505                          << " s2 " << s2 << G4endl;
    506                 }
    507 
    508                 if(s1 * alf * std::exp(-s1 / p0) > s2) st = s1 / modules[i];
    509 
    510               };
    511 
    512               if(verboseLevel > 3){
    513                 G4cout << " itry1 " << itry1 << " i " << i << " st " << st << G4endl;
    514               }
    515 
    516               if(itry1 == itry_max) {
    517 
    518                 if(verboseLevel > 2){
    519                   G4cout << " high energy angles generation: itry1 " << itry1 << G4endl;
    520                 }
    521 
    522                 st = 0.5 * inuclRndm();
    523               };
    524 
    525               G4double ct = std::sqrt(1.0 - st * st);
    526 
    527               if(inuclRndm() > 0.5) ct = -ct;
    528 
    529               G4double pt = modules[i]*st;
    530               G4double phi = randomPHI();
    531 
    532               G4CascadeMomentum mom;
    533 
    534               mom[1] = pt * std::cos(phi);
    535               mom[2] = pt * std::sin(phi);
    536               mom[3] = modules[i] * ct;
    537 
    538               for(G4int i = 1; i < 4; i++) tot_mom[i] += mom[i];                 
    539 
    540               scm_momentums.push_back(mom);
    541             };
    542 
    543             // handle last two
    544             G4double tot_mod = std::sqrt(tot_mom[1] * tot_mom[1] +
    545                                          tot_mom[2] * tot_mom[2] + tot_mom[3] * tot_mom[3]);
    546             G4double ct = -0.5 * (tot_mod * tot_mod +
    547                                   modules[multiplicity - 2] * modules[multiplicity - 2] -
    548                                   modules[multiplicity - 1] * modules[multiplicity - 1]) / tot_mod /
    549               modules[multiplicity - 2]; 
    550 
     445            G4double ct = std::sqrt(1.0 - st * st);
     446            if (inuclRndm() > 0.5) ct = -ct;
     447           
     448            G4LorentzVector mom = generateWithFixedTheta(ct,modules[i]);
     449
     450            tot_mom += mom;
     451           
     452            scm_momentums.push_back(mom);
     453          };
     454         
     455          // handle last two
     456          G4double tot_mod = tot_mom.rho();
     457          G4double ct = -0.5 * (tot_mod * tot_mod +
     458                                modules[multiplicity - 2] * modules[multiplicity - 2] -
     459                                modules[multiplicity - 1] * modules[multiplicity - 1]) / tot_mod /
     460            modules[multiplicity - 2]; 
     461         
     462          if (verboseLevel > 2){
     463            G4cout << " ct last " << ct << G4endl;
     464          }           
     465         
     466          if (std::fabs(ct) < ang_cut) {
     467           
     468            G4int i(0);
     469            for (i = 0; i < multiplicity - 2; i++)
     470              scm_momentums[i] = toSCM->rotate(scm_momentums[i]);
     471           
     472            tot_mom = toSCM->rotate(tot_mom); 
     473           
     474            G4LorentzVector mom =
     475              generateWithFixedTheta(ct, modules[multiplicity - 2]);
     476           
     477            mom = toSCM->rotate(tot_mom, mom);
     478            scm_momentums.push_back(mom);
     479
     480            // and the last one
     481            G4LorentzVector mom1 = -(mom+tot_mom);
     482           
     483            scm_momentums.push_back(mom1); 
     484            bad = false;
     485            generate = false;
     486           
    551487            if (verboseLevel > 2){
    552               G4cout << " ct last " << ct << G4endl;
    553             }           
    554 
    555             if (std::fabs(ct) < ang_cut) {
    556 
    557               G4int i(0);
    558               for (i = 0; i < multiplicity - 2; i++)
    559                 scm_momentums[i] = toSCM->rotate(scm_momentums[i]);
    560 
    561               tot_mom = toSCM->rotate(tot_mom); 
    562 
    563               G4CascadeMomentum mom =
    564                 generateWithFixedTheta(ct, modules[multiplicity - 2]);
    565 
    566               mom = toSCM->rotate(tot_mom, mom);
    567               scm_momentums.push_back(mom);
    568 
    569               // and the last one
    570               G4CascadeMomentum mom1;
    571 
    572               for (i = 1; i < 4; i++) mom1[i] = -mom[i] - tot_mom[i];
    573 
    574               scm_momentums.push_back(mom1); 
    575               bad = false;
    576               generate = false;
    577 
    578               if (verboseLevel > 2){
    579                 G4cout << " ok for mult " << multiplicity << G4endl;
    580               }
    581 
    582               for (i = 0; i < multiplicity; i++) {
    583                 particles.push_back(G4InuclElementaryParticle(
    584                                                               scm_momentums[i], particle_kinds[i]));
    585               };
     488              G4cout << " ok for mult " << multiplicity << G4endl;
     489            }
     490           
     491            for (i = 0; i < multiplicity; i++) {
     492              particles.push_back(G4InuclElementaryParticle(scm_momentums[i], particle_kinds[i],3));
    586493            };
    587           }; 
    588         };
     494          };
     495        }; 
    589496      };
    590497
    591498      if (itry == itry_max) {
    592 
    593499        if (verboseLevel > 2){
    594500          G4cout << " cannot generate the distr. for mult " << multiplicity  <<
    595501            G4endl << " and set it to " << multiplicity - 1 << G4endl;
    596502        }
    597 
    598503      };
    599504    };
     
    601506
    602507  if (verboseLevel > 3) {
    603     G4cout << " <<< G4ElementaryParticleCollider::generateSCMfinalState" << G4endl;
    604   }
    605 
    606   return particles;
     508    G4cout << " <<< G4ElementaryParticleCollider::generateSCMfinalState"
     509           << G4endl;
     510  }
     511
     512  return;       // Particles buffer filled
    607513}
    608514
    609 std::vector<G4double>
    610 G4ElementaryParticleCollider::generateMomModules(
    611                    const std::vector<G4int>& kinds,
    612                    G4int mult,
    613                    G4int is,
    614                    G4double ekin,
    615                    G4double etot_cm) const
    616 {
     515void
     516G4ElementaryParticleCollider::generateMomModules(G4int mult,
     517                                                 G4int is,
     518                                                 G4double ekin,
     519                                                 G4double etot_cm) {
    617520  if (verboseLevel > 3) {
    618521    G4cout << " >>> G4ElementaryParticleCollider::generateMomModules"
     
    621524
    622525  if (verboseLevel > 2){
    623     G4cout << " mult " << mult << " is " << is << " ekin " << ekin << " etot_cm " <<
    624       etot_cm << G4endl;
     526    G4cout << " mult " << mult << " is " << is << " ekin " << ekin
     527           << " etot_cm " << etot_cm << G4endl;
    625528  }
    626529
     
    630533  G4int itry = 0;
    631534
    632   std::vector<G4double> modules(mult);
     535  // FIXME:  Code below wants to set modules[i] directly.  Bad practice
     536  modules.clear();                      // Initialize buffer for this attempt
     537  modules.insert(modules.begin(), mult, 0.);
     538
    633539  std::vector<G4double> masses2(mult);
    634540
    635541  for (G4int i = 0; i < mult; i++) {
    636     G4double mass = dummy.getParticleMass(kinds[i]);
     542    G4double mass = dummy.getParticleMass(particle_kinds[i]);
    637543    masses2[i] = mass * mass;
    638544  };
     
    641547
    642548  if (verboseLevel > 3){
    643     G4cout << " knd_last " << kinds[mult - 1] << " mlast "
     549    G4cout << " knd_last " << particle_kinds[mult - 1] << " mlast "
    644550           << mass_last << G4endl;
    645551  }
     
    657563
    658564      G4double pmod =
    659         getMomModuleFor2toMany(is, mult, kinds[i], ekin);
     565        getMomModuleFor2toMany(is, mult, particle_kinds[i], ekin);
    660566
    661567      if (pmod < small) break;
     
    663569
    664570      if (verboseLevel > 3){
    665         G4cout << " kp " << kinds[i] << " pmod " << pmod << " mass2 "
     571        G4cout << " kp " << particle_kinds[i] << " pmod " << pmod << " mass2 "
    666572               << masses2[i] << G4endl;
    667573        G4cout << " x1 " << eleft - mass_last << G4endl;
     
    684590
    685591        if (mult == 3) {
    686           if(satisfyTriangle(modules)) {
    687             return modules;
    688           }
    689 
    690         } else {
    691           return modules;
    692         }
     592          if (satisfyTriangle(modules)) return;
     593        } else return;
    693594      }
    694595    }
    695596  }
    696597
    697   modules.resize(0);
    698   return modules;   
     598  modules.clear();              // Something went wrong, throw away partial
     599  return;   
    699600}
    700601
     
    709610  }
    710611
    711   G4bool good = true;
    712   if(modules.size() == 3) {
    713 
    714     if(std::fabs(modules[1] - modules[2]) > modules[0] ||
    715        modules[0] > modules[1] + modules[2] ||
    716        std::fabs(modules[0] - modules[2]) > modules[1] ||
    717        modules[1] > modules[0] + modules[2] ||
    718        std::fabs(modules[0] - modules[1]) > modules[2] ||
    719        modules[2] > modules[1] + modules[0]) good = false;
    720 
    721   }
     612  G4bool good = ( (modules.size() != 3) ||
     613                  !(std::fabs(modules[1] - modules[2]) > modules[0] ||
     614                    modules[0] > modules[1] + modules[2] ||
     615                    std::fabs(modules[0] - modules[2]) > modules[1] ||
     616                    modules[1] > modules[0] + modules[2] ||
     617                    std::fabs(modules[0] - modules[1]) > modules[2] ||
     618                    modules[2] > modules[1] + modules[0]));
    722619
    723620  return good;
     
    725622
    726623
    727 std::vector<G4int>
    728 G4ElementaryParticleCollider::generateStrangeChannelPartTypes(
    729                               G4int is, G4int mult, G4double ekin) const
     624void
     625G4ElementaryParticleCollider::generateOutgoingPartTypes(G4int is, G4int mult,
     626                                                        G4double ekin)
    730627{
    731   std::vector<G4int> kinds;
    732 
    733   if (is == 11) {
    734     kinds = G4CascadeKplusPChannel::getOutgoingParticleTypes(mult, ekin);
    735   } else if (is == 13) {
    736     kinds = G4CascadeKminusPChannel::getOutgoingParticleTypes(mult, ekin);
    737   } else if (is == 15) {
    738     kinds = G4CascadeKzeroPChannel::getOutgoingParticleTypes(mult, ekin);
    739   } else if (is == 17) {
    740     kinds = G4CascadeKzeroBarPChannel::getOutgoingParticleTypes(mult, ekin);
    741   } else if (is == 21) {
    742     kinds = G4CascadeLambdaPChannel::getOutgoingParticleTypes(mult, ekin);
    743   } else if (is == 23) {
    744     kinds = G4CascadeSigmaPlusPChannel::getOutgoingParticleTypes(mult, ekin);
    745   } else if (is == 25) {
    746     kinds = G4CascadeSigmaZeroPChannel::getOutgoingParticleTypes(mult, ekin);
    747   } else if (is == 27) {
    748     kinds = G4CascadeSigmaMinusPChannel::getOutgoingParticleTypes(mult, ekin);
    749   } else if (is == 29) {
    750     kinds = G4CascadeXiZeroPChannel::getOutgoingParticleTypes(mult, ekin);
    751   } else if (is == 31) {
    752     kinds = G4CascadeXiMinusPChannel::getOutgoingParticleTypes(mult, ekin);
    753 
    754   } else if (is == 22) {
    755     kinds = G4CascadeKplusNChannel::getOutgoingParticleTypes(mult, ekin);
    756   } else if (is == 26) {
    757     kinds = G4CascadeKminusNChannel::getOutgoingParticleTypes(mult, ekin);
    758   } else if (is == 30) {
    759     kinds = G4CascadeKzeroNChannel::getOutgoingParticleTypes(mult, ekin);
    760   } else if (is == 34) {
    761     kinds = G4CascadeKzeroBarNChannel::getOutgoingParticleTypes(mult, ekin);
    762   } else if (is == 42) {
    763     kinds = G4CascadeLambdaNChannel::getOutgoingParticleTypes(mult, ekin);
    764   } else if (is == 46) {
    765     kinds = G4CascadeSigmaPlusNChannel::getOutgoingParticleTypes(mult, ekin);
    766   } else if (is == 50) {
    767     kinds = G4CascadeSigmaZeroNChannel::getOutgoingParticleTypes(mult, ekin);
    768   } else if (is == 54) {
    769     kinds = G4CascadeSigmaMinusNChannel::getOutgoingParticleTypes(mult, ekin);
    770   } else if (is == 58) {
    771     kinds = G4CascadeXiZeroNChannel::getOutgoingParticleTypes(mult, ekin);
    772   } else if (is == 62) {
    773     kinds = G4CascadeXiMinusNChannel::getOutgoingParticleTypes(mult, ekin);
    774 
    775   } else {
    776     G4cout << " G4ElementaryParticleCollider:"
    777            << " Unknown strange interaction channel - outgoing kinds not generated "
    778            << G4endl;
    779   }
    780 
    781   return kinds;
     628  particle_kinds.clear();       // Initialize buffer for generation
     629
     630  switch (is) {
     631  case  1: G4CascadePPChannel::getOutgoingParticleTypes(particle_kinds, mult, ekin); break;
     632  case  2: G4CascadeNPChannel::getOutgoingParticleTypes(particle_kinds, mult, ekin); break;
     633  case  3: G4CascadePiPlusPChannel::getOutgoingParticleTypes(particle_kinds, mult, ekin); break;
     634  case  4: G4CascadeNNChannel::getOutgoingParticleTypes(particle_kinds, mult, ekin); break;
     635  case  5: G4CascadePiMinusPChannel::getOutgoingParticleTypes(particle_kinds, mult, ekin); break;
     636  case  6: G4CascadePiPlusNChannel::getOutgoingParticleTypes(particle_kinds, mult, ekin); break;
     637  case  7: G4CascadePiZeroPChannel::getOutgoingParticleTypes(particle_kinds, mult, ekin); break;
     638  case 10: G4CascadePiMinusNChannel::getOutgoingParticleTypes(particle_kinds, mult, ekin); break;
     639  case 11: G4CascadeKplusPChannel::getOutgoingParticleTypes(particle_kinds, mult, ekin); break;
     640  case 13: G4CascadeKminusPChannel::getOutgoingParticleTypes(particle_kinds, mult, ekin); break;
     641  case 14: G4CascadePiZeroNChannel::getOutgoingParticleTypes(particle_kinds, mult, ekin); break;
     642  case 15: G4CascadeKzeroPChannel::getOutgoingParticleTypes(particle_kinds, mult, ekin); break;
     643  case 17: G4CascadeKzeroBarPChannel::getOutgoingParticleTypes(particle_kinds, mult, ekin); break;
     644  case 21: G4CascadeLambdaPChannel::getOutgoingParticleTypes(particle_kinds, mult, ekin); break;
     645  case 22: G4CascadeKplusNChannel::getOutgoingParticleTypes(particle_kinds, mult, ekin); break;
     646  case 23: G4CascadeSigmaPlusPChannel::getOutgoingParticleTypes(particle_kinds, mult, ekin); break;
     647  case 25: G4CascadeSigmaZeroPChannel::getOutgoingParticleTypes(particle_kinds, mult, ekin); break;
     648  case 26: G4CascadeKminusNChannel::getOutgoingParticleTypes(particle_kinds, mult, ekin); break;
     649  case 27: G4CascadeSigmaMinusPChannel::getOutgoingParticleTypes(particle_kinds, mult, ekin); break;
     650  case 29: G4CascadeXiZeroPChannel::getOutgoingParticleTypes(particle_kinds, mult, ekin); break;
     651  case 30: G4CascadeKzeroNChannel::getOutgoingParticleTypes(particle_kinds, mult, ekin); break;
     652  case 31: G4CascadeXiMinusPChannel::getOutgoingParticleTypes(particle_kinds, mult, ekin); break;
     653  case 34: G4CascadeKzeroBarNChannel::getOutgoingParticleTypes(particle_kinds, mult, ekin); break;
     654  case 42: G4CascadeLambdaNChannel::getOutgoingParticleTypes(particle_kinds, mult, ekin); break;
     655  case 46: G4CascadeSigmaPlusNChannel::getOutgoingParticleTypes(particle_kinds, mult, ekin); break;
     656  case 50: G4CascadeSigmaZeroNChannel::getOutgoingParticleTypes(particle_kinds, mult, ekin); break;
     657  case 54: G4CascadeSigmaMinusNChannel::getOutgoingParticleTypes(particle_kinds, mult, ekin); break;
     658  case 58: G4CascadeXiZeroNChannel::getOutgoingParticleTypes(particle_kinds, mult, ekin); break;
     659  case 62: G4CascadeXiMinusNChannel::getOutgoingParticleTypes(particle_kinds, mult, ekin); break;
     660  default:
     661    G4cout << " G4ElementaryParticleCollider: Unknown interaction channel "
     662           << is << " - outgoing kinds not generated " << G4endl;
     663  }
     664
     665  return;
    782666}
    783667
     
    816700  if(knd == 1 || knd == 2) JM = 1;
    817701  for(G4int m = 0; m < 3; m++) PS += rmn[8 + IM + m][7 + JM][KM - 1] * std::pow(ekin, m);
    818   G4double PRA = PS * std::sqrt(S) * (PR + (1 - PQ) * std::pow(S, 4));
     702  G4double PRA = PS * std::sqrt(S) * (PR + (1 - PQ) * (S*S*S*S));
    819703
    820704  return std::fabs(PRA);
     
    822706
    823707
    824 G4CascadeMomentum
     708G4LorentzVector
    825709G4ElementaryParticleCollider::particleSCMmomentumFor2to3(
    826710                           G4int is,
     
    861745      W += V * std::pow(S, l);
    862746    }; 
    863     ct = 2.0 * std::sqrt(S) * (W + (1.0 - U) * std::pow(S, 4)) - 1.0;
     747    ct = 2.0 * std::sqrt(S) * (W + (1.0 - U) * (S*S*S*S)) - 1.0;
    864748  };
    865749
     
    873757  };
    874758
    875   G4double pt = pmod * std::sqrt(1.0 - ct * ct);
    876   G4double phi = randomPHI();
    877 
    878   G4CascadeMomentum mom;
    879 
    880   mom[1] = pt * std::cos(phi);
    881   mom[2] = pt * std::sin(phi);
    882   mom[3] = pmod * ct;
    883  
    884   return mom; 
     759  return generateWithFixedTheta(ct, pmod);
    885760}
    886761
    887762
    888 std::pair<G4double, G4double>
    889 G4ElementaryParticleCollider::adjustIntervalForElastic(G4double ekin, G4double ak,
    890                                                        G4double ae, G4int k,
    891                                                        G4int l,
    892                                                        const std::vector<G4double>& ssv,
    893                                                        G4double st) const {
    894 
    895   if (verboseLevel > 3) {
    896     G4cout << " >>> G4ElementaryParticleCollider::adjustIntervalForElastic"
     763G4LorentzVector
     764G4ElementaryParticleCollider::sampleCMmomentumFor2to2(G4int is, G4int kw,
     765                                                      G4double ekin,
     766                                                      G4double pscm) const
     767{
     768  if (verboseLevel > 3)
     769    G4cout << " >>> G4ElementaryParticleCollider::sampleCMmomentumFor2to2"
     770           << " is " << is << " kw " << kw << " ekin " << ekin << " pscm "
     771           << pscm << G4endl;
     772
     773  G4double pA=0.0, pC=0.0, pCos=0.0, pFrac=0.0;         // Angular parameters
     774
     775  // Arrays below are parameters for two-exponential sampling of angular
     776  // distributions of two-body scattering in the specified channels
     777
     778  if (is == 1 || is == 2 || is == 4 ||
     779      is == 21 || is == 23 || is == 25 || is == 27 || is ==29 || is == 31 ||
     780      is == 42 || is == 46 || is == 50 || is == 54 || is ==58 || is == 62) {
     781    // nucleon-nucleon or hyperon-nucleon
     782    if (verboseLevel > 3) G4cout << " nucleon/hyperon elastic" << G4endl;
     783
     784    static const G4double nnke[9] =  { 0.0,   0.44, 0.59,   0.80,   1.00,   2.24,   4.40,   6.15,  10.00};
     785    static const G4double nnA[9] =   { 0.0,   0.34, 2.51,   4.59,   4.2,    5.61,   6.38,   7.93,   8.7};
     786    static const G4double nnC[9] =   { 0.0,   0.0,  1.21,   1.54,   1.88,   1.24,   1.91,   4.04,   8.7};
     787    static const G4double nnCos[9] = {-1.0,  -1.0, 0.4226, 0.4226, 0.4384, 0.7193, 0.8788, 0.9164,  0.95};
     788    static const G4double nnFrac[9] = {1.0,   1.0, 0.4898, 0.7243, 0.7990, 0.8892, 0.8493, 0.9583,  1.0};
     789
     790    static G4CascadeInterpolator<9> interp(nnke);       // Only need one!
     791    pA = interp.interpolate(ekin, nnA);
     792    pC = interp.interpolate(ekin, nnC);
     793    pCos = interp.interpolate(ekin, nnCos);
     794    pFrac = interp.interpolate(ekin, nnFrac);
     795  } else if (kw == 2) {
     796    // pion charge exchange (pi-p -> pi0n, pi+n -> pi0p, pi0p -> pi+n, pi0n -> pi-p
     797    if (verboseLevel > 3) G4cout << " pion-nucleon charge exchange " << G4endl;
     798
     799    static const G4double nnke[10] =   {0.0,   0.062,  0.12,   0.217,  0.533,  0.873,  1.34,   2.86,   5.86,  10.0};
     800    static const G4double nnA[10] =    {0.0,   0.0,    2.48,   7.93,  10.0,    9.78,   5.08,   8.13,   8.13,   8.13};
     801    static const G4double nnC[10] =    {0.0, -39.58, -12.55,  -4.38,   1.81,  -1.99,  -0.33,   1.2,    1.43,   8.13};
     802    static const G4double nnCos[10] =  {1.0,   1.0,    0.604, -0.033,  0.25,   0.55,   0.65,   0.80,   0.916,  0.916};
     803    static const G4double nnFrac[10] = {0.0,   0.0,    0.1156, 0.5832, 0.8125, 0.3357, 0.3269, 0.7765, 0.8633, 1.0};
     804
     805    static G4CascadeInterpolator<10> interp(nnke);      // Only need one!
     806    pA = interp.interpolate(ekin, nnA);
     807    pC = interp.interpolate(ekin, nnC);
     808    pCos = interp.interpolate(ekin, nnCos);
     809    pFrac = interp.interpolate(ekin, nnFrac);
     810  } else if (is == 3 || is == 7 || is == 14 || is == 10 || is == 11 ||
     811             is == 30 || is == 17 || is == 26) {
     812    // pi+p, pi0p, pi0n, pi-n, k+p, k0n, k0bp, or k-n
     813    if (verboseLevel > 3) G4cout << " meson-nucleon elastic (1)" << G4endl;
     814
     815    static const G4double nnke[10] =   {0.0,  0.062,  0.12,   0.217,  0.533,  0.873,  1.34,   2.86,   5.86,  10.0};
     816    static const G4double nnA[10] =    {0.0,  0.0,   27.58,  19.83,   6.46,   4.59,   6.47,   6.68,   6.43,   6.7};
     817    static const G4double nnC[10] =    {0.0, -26.4, -30.55, -19.42,  -5.05,  -5.24,  -1.00,   2.14,   2.9,    6.7};
     818    static const G4double nnCos[10] =  {1.0,  1.0,    0.174, -0.174, -0.7,   -0.295,  0.5,    0.732,  0.837,  0.89};
     819    static const G4double nnFrac[10] = {0.0,  0.0,    0.2980, 0.7196, 0.9812, 0.8363, 0.5602, 0.9601, 0.9901, 1.0};
     820
     821    static G4CascadeInterpolator<10> interp(nnke);      // Only need one!
     822    pA = interp.interpolate(ekin, nnA);
     823    pC = interp.interpolate(ekin, nnC);
     824    pCos = interp.interpolate(ekin, nnCos);
     825    pFrac = interp.interpolate(ekin, nnFrac);
     826  } else if (is == 5 || is == 6 || is == 13 || is == 34 || is == 22 ||
     827             is == 15) {
     828    // pi-p, pi+n, k-p, k0bn, k+n, or k0p
     829    if (verboseLevel > 3) G4cout << " meson-nucleon elastic (2)" << G4endl;
     830
     831    static const G4double nnke[10] =   {0.0,  0.062, 0.12,   0.217,  0.533,  0.873,  1.34,   2.86,   5.86,  10.0};
     832    static const G4double nnA[10] =    {0.0, 27.08, 19.32,   9.92,   7.74,   9.86,   5.51,   7.25,   7.23,   7.3};
     833    static const G4double nnC[10] =    {0.0,  0.0, -19.49, -15.78,  -9.78,  -2.74,  -1.16,   2.31,   2.96,   7.3};
     834    static const G4double nnCos[10] = {-1.0, -1.0,  -0.235, -0.259, -0.276,  0.336,  0.250,  0.732,  0.875,  0.9};
     835    static const G4double nnFrac[10] = {1.0,  1.0,   0.6918, 0.6419, 0.7821, 0.6542, 0.8382, 0.9722, 0.9784, 1.0};
     836
     837    static G4CascadeInterpolator<10> interp(nnke);      // Only need one!
     838    pA = interp.interpolate(ekin, nnA);
     839    pC = interp.interpolate(ekin, nnC);
     840    pCos = interp.interpolate(ekin, nnCos);
     841    pFrac = interp.interpolate(ekin, nnFrac);
     842  } else {
     843    G4cout << " G4ElementaryParticleCollider::sampleCMmomentumFor2to2: interaction not recognized "
    897844           << G4endl;
    898   }
    899 
    900   const G4int itry_max = 100;
    901   const G4double small = 1.0e-4;
    902   G4double a = 1.0;
    903   G4double b = 0.0;
    904   G4int adj_type = 0;
    905   G4double s1 = 0.0;
    906   G4double s2 = 0.0;
    907 
    908   if (k == 1) {
    909     adj_type = 1;
    910     s1 = 0.0;
    911     s2 = 0.5;
    912   } else if(k == 2) {
    913 
    914     if(l != 2) {
    915       // adj_type == 0;
    916 
    917     } else {
    918 
    919       adj_type = 1;
    920       s1 = 0.0;
    921       s2 = 0.67;
    922     };
    923        
     845  }
     846
     847  // Use parameters determined above to get polar angle
     848  G4double ct = sampleCMcosFor2to2(pscm, pFrac, pA, pC, pCos);
     849
     850  return generateWithFixedTheta(ct, pscm);
     851}
     852
     853
     854G4double
     855G4ElementaryParticleCollider::sampleCMcosFor2to2(G4double pscm, G4double pFrac,
     856                                                 G4double pA, G4double pC,
     857                                                 G4double pCos) const
     858{
     859  G4double term1;
     860  G4double term2;
     861  G4double randScale;
     862  G4double randVal;
     863  G4double costheta = 1.0;
     864
     865  if (verboseLevel>3) {
     866    G4cout << " sampleCMcosFor2to2: pscm " << pscm << " pFrac " << pFrac
     867           << " pA " << pA << " pC " << pC << " pCos " << pCos << G4endl;
     868  }
     869
     870  if (G4UniformRand() < pFrac) {
     871    // Sample small angles ( 0 < theta < theta0 )
     872    term1 = 2.0*pscm*pscm*pA;
     873    term2 = std::exp(-2.0*term1);
     874    randScale = (std::exp(-term1*(1.0 - pCos)) - term2)/(1.0 - term2);
     875    randVal = (1.0 - randScale)*G4UniformRand() + randScale;
    924876  } else {
    925 
    926     if(ekin < 0.32) {
    927       // adj_type == 0;
    928 
    929     } else {
    930 
    931       adj_type = 2;
    932       s1 = 0.1813;
    933       s2 = 1.0;
    934     };     
    935 
    936   };
    937 
    938   if(adj_type > 0) {
    939     G4int itry = 0;
    940     G4double su;
    941     G4double ct;
    942  
    943     if(adj_type == 1) {
    944       G4double s2_old = s2;
    945       G4double s1c = s1;
    946       G4double s2_new;
    947 
    948       while(itry < itry_max) {
    949         itry++;
    950         s2_new = 0.5 * (s2_old + s1c);
    951         su = 0.0;     
    952 
    953         for(G4int i = 0; i < 4; i++) su += ssv[i] * std::pow(s2_new, i);
    954 
    955         ct = ak * std::sqrt(s2_new) * (su + (1.0 - st) * std::pow(s2_new, 4)) + ae;
    956 
    957         if(ct > 1.0) {
    958           s2_old = s2_new;
    959 
    960         } else {
    961 
    962           if(1.0 - ct < small) {
    963 
    964             break;
    965 
    966           } else {
    967 
    968             s1c = s2_new;
    969           };   
    970         };
    971       };
    972 
    973       a = s2_new - s1;
    974       b = s1;
    975 
    976     } else {
    977 
    978       G4double s1_old = s1;
    979       G4double s2c = s2;
    980       G4double s1_new = 0.0;
    981 
    982       while (itry < itry_max) {
    983         itry++;
    984         s1_new = 0.5 * (s1_old + s2c);
    985         su = 0.0;
    986      
    987         for (G4int i = 0; i < 4; i++) su += ssv[i] * std::pow(s1_new, i);
    988         ct = ak * std::sqrt(s1_new) * (su + (1.0 - st) * std::pow(s1_new, 4)) + ae;
    989 
    990         if(ct < -1.0) {
    991           s1_old = s1_new;
    992 
    993         } else {
    994 
    995           if (1.0 + ct < small) {
    996 
    997             break;
    998 
    999           } else {
    1000 
    1001             s2c = s1_new;
    1002           };   
    1003         };
    1004       };
    1005       a = s2 - s1_new;
    1006       b = s1_new;
    1007     };
    1008 
    1009     if (itry == itry_max) {
    1010 
    1011       if (verboseLevel > 2){
    1012         G4cout << " in adjustIntervalForElastic: " << itry_max << G4endl;
    1013         G4cout << " e " << ekin << " ak " << ak << " ae " << ae << G4endl << " k " << k
    1014                << " is " << l << " adj_type " << adj_type << G4endl;
    1015       }
    1016 
    1017       a = 1.0;
    1018       b = 0.0;
    1019     };
    1020   };
    1021 
    1022   return std::pair<G4double, G4double>(a, b);
    1023 
    1024 
    1025 
    1026 G4CascadeMomentum
    1027 G4ElementaryParticleCollider::particleSCMmomentumFor2to2(
    1028                            G4int is,
    1029                            G4int kw,
    1030                            G4double ekin,
    1031                            G4double pscm) const
    1032 {
    1033   if (verboseLevel > 3) {
    1034     G4cout << " >>> G4ElementaryParticleCollider::particleSCMmomentumFor2to2"
    1035            << G4endl;
    1036   }
    1037 
    1038   const G4int itry_max = 100;
    1039   const G4double ct_cut = 0.9999;
    1040   const G4double huge_num = 60.0;
    1041   G4int k = getElasticCase(is, kw, ekin);
    1042   G4double ae = -1.0;
    1043   G4double ak = 2.0;
    1044 
    1045   if(k == 1) {
    1046     if(is != 2) { ak = 1.0; ae = 0.0;};
    1047   } else if(k == 2) {
    1048     if(is != 2) { ak = 0.5; ae = 0.0; };
    1049   }
    1050 
    1051   G4double ct = 2.0;
    1052   G4double ab;
    1053   G4double ac;
    1054   G4double ad;
    1055   G4int itry = 0;
    1056  
    1057   if(k == 14) {
    1058     ab = 7.5;
    1059     if(is == 1 || is == 2 || is == 4) ab = 8.7;
    1060     ac = -2.0 * ab * pscm * pscm;
    1061     ad = 2.0 * ac;
    1062     if(ad < -huge_num) {
    1063       ad = std::exp(ad);
    1064 
    1065     } else {
    1066 
    1067       ad = std::exp(-huge_num);
    1068     };   
    1069 
    1070     while(std::fabs(ct) > ct_cut && itry < itry_max) {
    1071       itry++;
    1072       ct = 1.0 - std::log(inuclRndm() * (1.0 - ad) + ad) / ac;
    1073     };     
    1074 
    1075   } else if(k == 0) {
    1076     ct = 2.0 * inuclRndm() - 1;
    1077 
    1078   } else {
    1079     G4int k1 = k - 1;
    1080     // first set all coefficients
    1081     std::vector<G4double> ssv(4);
    1082     G4double st = 0.0;
    1083 
    1084     for(G4int i = 0; i < 4; i++) {
    1085       G4double ss = 0.0;
    1086 
    1087       for(G4int m = 0; m < 4; m++) ss += ang[m][i][k1] * std::pow(ekin, m);
    1088       st += ss;
    1089       ssv[i] = ss;
    1090     };
    1091 
    1092     G4double a = 1.0;
    1093     G4double b = 0.0;
    1094 
    1095     if(k <= 3) {
    1096       std::pair<G4double, G4double> ab = adjustIntervalForElastic(ekin, ak, ae, k, is, ssv, st);
    1097 
    1098       a = ab.first;
    1099       b = ab.second;
    1100     };
    1101 
    1102     while(std::fabs(ct) > ct_cut && itry < itry_max) {
    1103       itry++;
    1104       G4double mrand = a * inuclRndm() + b;
    1105 
    1106       G4double su = 0.0;
    1107 
    1108       for(G4int i = 0; i < 4; i++) su += ssv[i] * std::pow(mrand, i);
    1109 
    1110       ct = ak * std::sqrt(mrand) * (su + (1.0 - st) * std::pow(mrand, 4)) + ae;
    1111     };
    1112 
    1113   };
    1114 
    1115   if(itry == itry_max) {
    1116     if(verboseLevel > 2){
    1117       G4cout << " particleSCMmomentumFor2to2 -> itry = itry_max "
    1118              << itry << G4endl;
    1119     }
    1120     ct = 2.0 * inuclRndm() - 1.0;
    1121   }
    1122 
    1123   G4double pt = pscm * std::sqrt(1.0 - ct * ct);
    1124   G4double phi = randomPHI();
    1125   G4CascadeMomentum mom;
    1126 
    1127   mom[1] = pt * std::cos(phi);
    1128   mom[2] = pt * std::sin(phi);
    1129   mom[3] = pscm * ct;
    1130  
    1131   return mom; 
     877    // Sample large angles ( theta0 < theta < 180 )
     878    term1 = 2.0*pscm*pscm*pC;
     879    term2 = std::exp(-2.0*term1);
     880    randScale = (std::exp(-term1*(1.0 - pCos)) - term2)/(1.0 - term2);
     881    randVal = randScale*G4UniformRand();
     882  }
     883
     884  costheta = 1.0 + std::log(randVal*(1.0 - term2) + term2)/term1;
     885
     886  if (verboseLevel>3) {
     887    G4cout << " term1 " << term1 << " term2 " << term2 << " randVal "
     888           << randVal << " => costheta " << costheta << G4endl;
     889  }
     890
     891  return costheta;
    1132892}
    1133893
    1134894
    1135 G4int
    1136 G4ElementaryParticleCollider::getElasticCase(G4int is,
    1137                                              G4int kw,
    1138                                              G4double ekin) const
    1139 {
    1140   if (verboseLevel > 3) {
    1141     G4cout << " >>> G4ElementaryParticleCollider::getElasticCase"
    1142            << G4endl;
    1143   }
    1144 
    1145   G4int l = is;
    1146   G4int k = 0; // isotropic
    1147 
    1148   if(l == 4) {
    1149     l = 1;
    1150   } else if(l == 10 || l == 7 || l == 14) {
    1151     l = 3;
    1152   } else if(l == 5 || l == 6) {
    1153     l = 4;
    1154   }
    1155 
    1156   if(l < 3) { // nucleon nucleon
    1157 
    1158     if(ekin > 2.8) {
    1159       // DHW      k = 2;
    1160       // DHW      if(ekin > 10.0) k = 14;
    1161       k = 14;
    1162 
    1163     } else {
    1164       if(l == 1) { // PP or NN
    1165         if(ekin > 0.46) k = 1;
    1166       } else {
    1167         k = 3;
    1168         if(ekin >= 0.97) k = 1;
    1169       }
    1170     }
    1171          
    1172   } else { // pi nucleon
    1173 
    1174     if(l == 3) { // pi+ P, pi- N, pi0 P, pi0 N
    1175       k = 8;
    1176       if(ekin > 0.08) k = 9;
    1177       if(ekin > 0.3) k = 10;
    1178       if(ekin > 1.0) k = 11;
    1179       if(ekin > 2.4) k = 14;
    1180 
    1181     } else { // pi- P, pi+ N
    1182 
    1183       if(kw == 1) {
    1184         k = 4;
    1185         if(ekin > 0.08) k = 5;
    1186         if(ekin > 0.3) k = 6;
    1187         if(ekin > 1.0) k = 7;
    1188         if (ekin > 2.4) k = 14;
    1189 
    1190       } else {
    1191 
    1192         k = 12;
    1193         if (ekin > 0.08) k = 13;
    1194         if (ekin > 0.3) k = 6;
    1195         if (ekin > 1.0) k = 7;
    1196         if (ekin > 2.4) k = 14;
    1197       }
    1198     } 
    1199   }     
    1200 
    1201   return k;
    1202 }
    1203 
    1204 
    1205 std::vector<G4InuclElementaryParticle>
     895void
    1206896G4ElementaryParticleCollider::generateSCMpionAbsorption(G4double etot_scm,
    1207897                                     G4InuclElementaryParticle* particle1,
    1208                                      G4InuclElementaryParticle* particle2) const
    1209 {
    1210   if (verboseLevel > 3) {
    1211     G4cout << " >>> G4ElementaryParticleCollider::generateSCMpionAbsorption"
    1212            << G4endl;
    1213   }
     898                                     G4InuclElementaryParticle* particle2) {
     899  if (verboseLevel > 3) G4cout << " >>> G4ElementaryParticleCollider::generateSCMpionAbsorption"
     900                               << G4endl;
    1214901
    1215902  // generate nucleons momenta for pion absorption
     
    1217904
    1218905  G4InuclElementaryParticle dummy;
    1219   std::vector<G4InuclElementaryParticle> particles;
    1220   std::vector<G4int> particle_kinds;
     906
     907  particles.clear();            // Initialize buffers for this event
     908  particle_kinds.clear();
     909
    1221910  G4int type1 = particle1->type();
    1222911  G4int type2 = particle2->type();
     
    1230919      G4cout << " pion absorption: pi+ + PP -> ? " << G4endl;
    1231920
    1232       return particles;
     921      return;
    1233922    }
    1234923    else if(type2 == 112) { // pi+ + PN -> PP
     
    1254943      G4cout << " pion absorption: pi- + NN -> ? " << G4endl;
    1255944
    1256       return particles;
     945      return;
    1257946    };     
    1258947  }
     
    1273962   
    1274963  G4double m1 = dummy.getParticleMass(particle_kinds[0]);
    1275 
    1276   m1 *= m1;
     964  G4double m1sq = m1*m1;
    1277965
    1278966  G4double m2 = dummy.getParticleMass(particle_kinds[1]);
    1279 
    1280   m2 *= m2;     
    1281 
    1282   G4double a = 0.5 * (etot_scm * etot_scm - m1 - m2);
    1283 
    1284   G4double pmod = std::sqrt((a * a - m1 * m2) / (m1 + m2 + 2.0 * a));
    1285   G4CascadeMomentum mom;
    1286   std::pair<G4double, G4double> COS_SIN = randomCOS_SIN();
    1287   G4double FI = randomPHI();
    1288   G4double pt = pmod * COS_SIN.second;
    1289 
    1290   mom[1] = pt * std::cos(FI);
    1291   mom[2] = pt * std::sin(FI);
    1292   mom[3] = pmod * COS_SIN.first;
    1293 
    1294   G4CascadeMomentum mom1 = mom;
    1295 
    1296   for(G4int i = 1; i < 4; i++) mom1[i] *= -1.0;
    1297   particles.push_back(G4InuclElementaryParticle(mom , particle_kinds[0]));
    1298   particles.push_back(G4InuclElementaryParticle(mom1, particle_kinds[1]));
    1299 
    1300   return particles;
     967  G4double m2sq = m2*m2;
     968
     969  G4double a = 0.5 * (etot_scm * etot_scm - m1sq - m2sq);
     970
     971  G4double pmod = std::sqrt((a * a - m1sq * m2sq) / (m1sq + m2sq + 2.0 * a));
     972  G4LorentzVector mom1 = generateWithRandomAngles(pmod, m1);
     973  G4LorentzVector mom2;
     974  mom2.setVectM(-mom1.vect(), m2);
     975
     976  particles.push_back(G4InuclElementaryParticle(mom1, particle_kinds[0],3));
     977  particles.push_back(G4InuclElementaryParticle(mom2, particle_kinds[1],3));
     978
     979  return;
    1301980}
    1302981
    1303 void G4ElementaryParticleCollider::initializeArrays()
    1304 {
    1305   // Parameter array for momentum calculation of many body final states
    1306   const G4double rmnData[14][10][2] = {
    1307     {{0.5028,   0.6305}, {3.1442, -3.7333}, {-7.8172,  13.464}, {8.1667, -18.594},
    1308      {1.6208,   1.9439}, {-4.3139, -4.6268}, {12.291,  9.7879}, {-15.288, -9.6074},
    1309      {   0.0,     0.0}, {   0.0,      0.0}},     
    1310 
    1311     {{0.9348,   2.1801}, {-10.59,  1.5163}, { 29.227,  -16.38}, {-34.55,  27.944},
    1312      {-0.2009, -0.3464}, {1.3641,   1.1093}, {-3.403, -1.9313}, { 3.8559,  1.7064},
    1313      {   0.0,     0.0}, {    0.0,     0.0}},   
    1314 
    1315     {{-0.0967, -1.2886}, {4.7335,  -2.457}, {-14.298,  15.129}, {17.685, -23.295},
    1316      { 0.0126,  0.0271}, {-0.0835, -0.1164}, { 0.186,  0.2697}, {-0.2004, -0.3185},
    1317      {   0.0,     0.0}, {    0.0,     0.0}},   
    1318 
    1319     {{-0.025,   0.2091}, {-0.6248, 0.5228}, { 2.0282, -2.8687}, {-2.5895, 4.2688},
    1320      {-0.0002, -0.0007}, {0.0014,   0.0051}, {-0.0024, -0.015}, { 0.0022,  0.0196},
    1321      {    0.0,    0.0}, {    0.0,     0.0}},     
    1322 
    1323     {{1.1965,   0.9336}, {-0.8289,-1.8181}, { 1.0426,  5.5157}, { -1.909,-8.5216},
    1324      { 1.2419,  1.8693}, {-4.3633, -5.5678}, { 13.743, 14.795}, {-18.592, -16.903},
    1325      {    0.0,    0.0}, {    0.0,     0.0}},     
    1326 
    1327     {{0.287,    1.7811}, {-4.9065,-8.2927}, { 16.264,  20.607}, {-19.904,-20.827},
    1328      {-0.244,  -0.4996}, {1.3158,   1.7874}, {-3.5691, -4.133}, { 4.3867,  3.8393},
    1329      {    0.0,    0.0}, {   0.0,      0.0}},
    1330    
    1331     {{-0.2449, -1.5264}, { 2.9191, 6.8433}, {-9.5776, -16.067}, { 11.938, 16.845},
    1332      {0.0157,   0.0462}, {-0.0826, -0.1854}, { 0.2143, 0.4531}, {-0.2585, -0.4627},
    1333      {    0.0,    0.0}, {   0.0,      0.0}},
    1334 
    1335     {{0.0373,   0.2713}, {-0.422, -1.1944}, { 1.3883,  2.7495}, {-1.7476,-2.9045},
    1336      {-0.0003, -0.0013}, {0.0014,   0.0058}, {-0.0034,-0.0146}, { 0.0039,  0.0156},
    1337      {    0.0,    0.0}, {    0.0,     0.0}},     
    1338 
    1339     {{   0.0,      0.0}, {    0.0,    0.0}, {    0.0,     0.0}, {    0.0,     0.0},
    1340      {    0.0,     0.0}, {   0.0,      0.0}, {    0.0,    0.0}, {    0.0,     0.0},
    1341      { 0.1451,  0.0929},{ 0.1538,  0.1303}}, 
    1342 
    1343     {{   0.0,      0.0}, {    0.0,    0.0}, {    0.0,     0.0}, {    0.0,     0.0},
    1344      {    0.0,     0.0}, {   0.0,      0.0}, {    0.0,    0.0}, {    0.0,     0.0},
    1345      { 0.4652,  0.5389},{ 0.2744,  0.4071}}, 
    1346 
    1347     {{   0.0,      0.0}, {    0.0,    0.0}, {    0.0,     0.0}, {    0.0,     0.0},
    1348      {    0.0,     0.0}, {   0.0,      0.0}, {    0.0,    0.0}, {    0.0,     0.0},
    1349      { -0.033, -0.0545},{-0.0146, -0.0288}}, 
    1350 
    1351     {{   0.0,      0.0}, {    0.0,    0.0}, {    0.0,     0.0}, {    0.0,     0.0},
    1352      {    0.0,     0.0}, {   0.0,      0.0}, {    0.0,    0.0}, {    0.0,     0.0},
    1353      { 0.6296,  0.1491},{ 0.8381,  0.1802}}, 
    1354 
    1355     {{   0.0,      0.0}, {    0.0,    0.0}, {    0.0,     0.0}, {    0.0,     0.0},
    1356      {    0.0,     0.0}, {   0.0,      0.0}, {    0.0,    0.0}, {    0.0,     0.0},
    1357      { 0.1787,   0.385},{ 0.0086,  0.3302}}, 
    1358 
    1359     {{   0.0,      0.0}, {    0.0,    0.0}, {    0.0,     0.0}, {    0.0,     0.0},
    1360      {    0.0,     0.0}, {   0.0,      0.0}, {    0.0,    0.0}, {    0.0,     0.0},
    1361      {-0.0026, -0.0128},{ 0.0033, -0.0094}}
    1362   };
    1363 
    1364   // Copy to class scope
    1365   for (G4int i = 0; i < 14; i++) {
    1366     for (G4int j = 0; j < 10; j++) {
    1367       for (G4int k = 0; k < 2; k++) rmn[i][j][k] = rmnData[i][j][k];
    1368     }
    1369   }
    1370 
    1371   // Parameter array for angular distribution calculation
    1372   const G4double angData[4][4][13] = {
    1373     {{ 2.7404, -30.853,  0.1026,-0.3829,  0.2499, 3.9025, 19.402,
    1374        0.1579, 0.3153,-17.953, 0.4217, 0.1499,  0.5369},
    1375      {-9.6998,  106.24, -1.0542, 3.7587,  32.028,-91.126,-224.46,
    1376        2.9671,-7.4981, 109.72, 147.05, 2.8753, -13.216},
    1377      { 10.400, -129.39,  11.389,-6.5144, -118.82, 323.73, 747.33,
    1378        -5.5251, 43.295,-239.54,-653.35,-5.3078,  81.011},
    1379      { 2.3882,  54.339, -16.638, 6.7740,  150.99,-400.48,-935.70,
    1380        6.8925,-76.460, 228.26, 915.07, 6.2233, -142.85}},
    1381 
    1382     {{-7.5137,  19.465, -0.4961, 103.81, -2.6994,-20.619,-44.180,
    1383       -7.0218,-6.5373, 91.968,-3.5198,-5.9558, -10.550},
    1384      { 44.096, -68.102,  11.800,-272.82, -460.45, 491.70, 471.94,
    1385       -205.34, 193.07,-519.63,-260.19,-162.03,  296.29},
    1386      {-74.379,  96.358, -90.857, 477.59,  1895.9,-1715.5,-1485.6,
    1387       569.51,-1018.1, 1126.6, 1225.0, 430.79, -1695.7},
    1388      { 46.038, -56.827,  164.76,-512.22, -2519.0, 2114.3, 1805.5,
    1389      -898.58, 1742.6,-1074.0,-1748.1,-625.48,  2893.5}},
    1390 
    1391     {{ 7.5479, -3.4831,  1.5437,-1788.2,  16.268, 33.004, 31.567,
    1392        134.96, 46.864,-132.70, 3.6373, 128.75,  69.621},
    1393      {-39.274,  12.341, -33.769, 4305.2,  2138.4,-766.84,-301.76,
    1394        4872.2,-1303.0, 741.12, 155.92, 3140.2, -1924.5},
    1395      { 64.835, -18.592,  251.92,-7931.4, -9126.2, 2700.3, 907.63,
    1396        -14674., 6729.1,-1600.0,-752.01,-7918.9, 10620.0},
    1397      { 41.609,  12.024, -450.71, 9347.1, 12431.0,-3352.5,-1077.3,
    1398        23924.,-11075., 1524.9, 1079.6, 10983., -17468.}},
    1399 
    1400     {{-1.8369,  0.1894, -1.2021, 7147.5, -29.654,-16.367,-6.8648,
    1401       -821.16,-95.192, 58.598,-0.7804,-851.61, -138.65},
    1402      { 8.6911, -0.6788,  0.2534,-3339.5, -3182.3, 373.94, 60.476,
    1403       -32586., 2637.3,-318.74,-30.563,-18780.,  3928.1},
    1404      {-13.060,  1.0665, -186.58,-4139.2,  13944.,-1320.2,-175.20,
    1405        100980.,-12857., 677.51, 147.95, 44607., -20293.},
    1406      { 7.1880, -0.7291,  332.54,-4436.4, -19342., 1642.3, 203.81,
    1407        -165530.,20294.,-640.11,-212.50,-58790.,  32058.}}
    1408   };
    1409 
    1410   // Copy to class scope
    1411   for (G4int i = 0; i < 4; i++) {
    1412     for (G4int j = 0; j < 4; j++) {
    1413       for (G4int k = 0; k < 13; k++) ang[i][j][k] = angData[i][j][k];
    1414     }
    1415   }
    1416 
    1417   const G4double abnData[4][4][4] = {
    1418     {{0.0856,  0.0716,  0.1729,  0.0376},  {5.0390,  3.0960,  7.1080,  1.4331},
    1419      {-13.782, -11.125, -17.961, -3.1350},  {14.661,  18.130,  16.403,  6.4864}},
    1420     {{0.0543,  0.0926, -0.1450,  0.2383}, {-9.2324, -3.2186, -13.032,  1.8253},
    1421      {36.397,  20.273,  41.781,  1.7648}, {-42.962, -33.245, -40.799, -16.735}},
    1422     {{-0.0511, -0.0515,  0.0454, -0.1541}, {4.6003,  0.8989,  8.3515, -1.5201},
    1423      {-20.534, -7.5084, -30.260, -1.5692},  {27.731,  13.188,  32.882,  17.185}},
    1424     {{0.0075,  0.0058, -0.0048,  0.0250}, {-0.6253, -0.0017, -1.4095,  0.3059},
    1425      {2.9159,  0.7022,  5.3505,  0.3252}, {-4.1101, -1.4854, -6.0946, -3.5277}}
    1426   };
    1427 
    1428   // Copy to class scope
    1429   for (G4int i = 0; i < 4; i++) {
    1430     for (G4int j = 0; j < 4; j++) {
    1431       for (G4int k = 0; k < 4; k++) abn[i][j][k] = abnData[i][j][k];
    1432     }
    1433   }
    1434 
    1435 }
     982
     983// Parameter array for momentum calculation of many body final states
     984const G4double G4ElementaryParticleCollider::rmn[14][10][2] = {
     985  {{0.5028,   0.6305}, {3.1442, -3.7333}, {-7.8172,  13.464}, {8.1667, -18.594},
     986   {1.6208,   1.9439}, {-4.3139, -4.6268}, {12.291,  9.7879}, {-15.288, -9.6074},
     987   {   0.0,     0.0}, {   0.0,      0.0}},     
     988
     989  {{0.9348,   2.1801}, {-10.59,  1.5163}, { 29.227,  -16.38}, {-34.55,  27.944},
     990   {-0.2009, -0.3464}, {1.3641,   1.1093}, {-3.403, -1.9313}, { 3.8559,  1.7064},
     991   {   0.0,     0.0}, {    0.0,     0.0}},   
     992 
     993  {{-0.0967, -1.2886}, {4.7335,  -2.457}, {-14.298,  15.129}, {17.685, -23.295},
     994   { 0.0126,  0.0271}, {-0.0835, -0.1164}, { 0.186,  0.2697}, {-0.2004, -0.3185},
     995   {   0.0,     0.0}, {    0.0,     0.0}},   
     996 
     997  {{-0.025,   0.2091}, {-0.6248, 0.5228}, { 2.0282, -2.8687}, {-2.5895, 4.2688},
     998   {-0.0002, -0.0007}, {0.0014,   0.0051}, {-0.0024, -0.015}, { 0.0022,  0.0196},
     999   {    0.0,    0.0}, {    0.0,     0.0}},     
     1000 
     1001  {{1.1965,   0.9336}, {-0.8289,-1.8181}, { 1.0426,  5.5157}, { -1.909,-8.5216},
     1002   { 1.2419,  1.8693}, {-4.3633, -5.5678}, { 13.743, 14.795}, {-18.592, -16.903},
     1003   {    0.0,    0.0}, {    0.0,     0.0}},     
     1004 
     1005  {{0.287,    1.7811}, {-4.9065,-8.2927}, { 16.264,  20.607}, {-19.904,-20.827},
     1006   {-0.244,  -0.4996}, {1.3158,   1.7874}, {-3.5691, -4.133}, { 4.3867,  3.8393},
     1007   {    0.0,    0.0}, {   0.0,      0.0}},
     1008 
     1009  {{-0.2449, -1.5264}, { 2.9191, 6.8433}, {-9.5776, -16.067}, { 11.938, 16.845},
     1010   {0.0157,   0.0462}, {-0.0826, -0.1854}, { 0.2143, 0.4531}, {-0.2585, -0.4627},
     1011   {    0.0,    0.0}, {   0.0,      0.0}},
     1012 
     1013  {{0.0373,   0.2713}, {-0.422, -1.1944}, { 1.3883,  2.7495}, {-1.7476,-2.9045},
     1014   {-0.0003, -0.0013}, {0.0014,   0.0058}, {-0.0034,-0.0146}, { 0.0039,  0.0156},
     1015   {    0.0,    0.0}, {    0.0,     0.0}},     
     1016 
     1017  {{   0.0,      0.0}, {    0.0,    0.0}, {    0.0,     0.0}, {    0.0,     0.0},
     1018   {    0.0,     0.0}, {   0.0,      0.0}, {    0.0,    0.0}, {    0.0,     0.0},
     1019   { 0.1451,  0.0929},{ 0.1538,  0.1303}}, 
     1020 
     1021  {{   0.0,      0.0}, {    0.0,    0.0}, {    0.0,     0.0}, {    0.0,     0.0},
     1022   {    0.0,     0.0}, {   0.0,      0.0}, {    0.0,    0.0}, {    0.0,     0.0},
     1023   { 0.4652,  0.5389},{ 0.2744,  0.4071}}, 
     1024 
     1025  {{   0.0,      0.0}, {    0.0,    0.0}, {    0.0,     0.0}, {    0.0,     0.0},
     1026   {    0.0,     0.0}, {   0.0,      0.0}, {    0.0,    0.0}, {    0.0,     0.0},
     1027   { -0.033, -0.0545},{-0.0146, -0.0288}}, 
     1028 
     1029  {{   0.0,      0.0}, {    0.0,    0.0}, {    0.0,     0.0}, {    0.0,     0.0},
     1030   {    0.0,     0.0}, {   0.0,      0.0}, {    0.0,    0.0}, {    0.0,     0.0},
     1031   { 0.6296,  0.1491},{ 0.8381,  0.1802}}, 
     1032 
     1033  {{   0.0,      0.0}, {    0.0,    0.0}, {    0.0,     0.0}, {    0.0,     0.0},
     1034   {    0.0,     0.0}, {   0.0,      0.0}, {    0.0,    0.0}, {    0.0,     0.0},
     1035   { 0.1787,   0.385},{ 0.0086,  0.3302}}, 
     1036 
     1037  {{   0.0,      0.0}, {    0.0,    0.0}, {    0.0,     0.0}, {    0.0,     0.0},
     1038   {    0.0,     0.0}, {   0.0,      0.0}, {    0.0,    0.0}, {    0.0,     0.0},
     1039   {-0.0026, -0.0128},{ 0.0033, -0.0094}}
     1040};
     1041
     1042const G4double G4ElementaryParticleCollider::abn[4][4][4] = {
     1043  {{0.0856,  0.0716,  0.1729,  0.0376},  {5.0390,  3.0960,  7.1080,  1.4331},
     1044   {-13.782, -11.125, -17.961, -3.1350},  {14.661,  18.130,  16.403,  6.4864}},
     1045  {{0.0543,  0.0926, -0.1450,  0.2383}, {-9.2324, -3.2186, -13.032,  1.8253},
     1046   {36.397,  20.273,  41.781,  1.7648}, {-42.962, -33.245, -40.799, -16.735}},
     1047  {{-0.0511, -0.0515,  0.0454, -0.1541}, {4.6003,  0.8989,  8.3515, -1.5201},
     1048   {-20.534, -7.5084, -30.260, -1.5692},  {27.731,  13.188,  32.882,  17.185}},
     1049  {{0.0075,  0.0058, -0.0048,  0.0250}, {-0.6253, -0.0017, -1.4095,  0.3059},
     1050   {2.9159,  0.7022,  5.3505,  0.3252}, {-4.1101, -1.4854, -6.0946, -3.5277}}
     1051};
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4EquilibriumEvaporator.cc

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4EquilibriumEvaporator.cc,v 1.32 2010/05/21 17:56:34 mkelsey Exp $
     26// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100114  M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
     29// 20100308  M. Kelsey -- Bug fix for setting masses of evaporating nuclei
     30// 20100319  M. Kelsey -- Use new generateWithRandomAngles for theta,phi stuff;
     31//              eliminate some unnecessary std::pow()
     32// 20100319  M. Kelsey -- Bug fix in new GetBindingEnergy() use right after
     33//              goodRemnant() -- Q1 should be outside call.
     34// 20100412  M. Kelsey -- Pass G4CollisionOutput by ref to ::collide()
     35// 20100413  M. Kelsey -- Pass buffers to paraMaker[Truncated]
     36// 20100419  M. Kelsey -- Handle fission output list via const-ref
     37// 20100517  M. Kelsey -- Use G4CascadeInterpolator for QFF
     38// 20100520  M. Kelsey -- Inherit from common base class, make other colliders
     39//              simple data members.  Rename timeToBigBang() to override
     40//              base explosion().
     41
    2642#define RUN
    2743
    2844#include "G4EquilibriumEvaporator.hh"
     45#include "G4BigBanger.hh"
     46#include "G4CollisionOutput.hh"
     47#include "G4CascadeInterpolator.hh"
     48#include "G4Fissioner.hh"
     49#include "G4HadTmpUtil.hh"
    2950#include "G4InuclNuclei.hh"
     51#include "G4InuclSpecialFunctions.hh"
    3052#include "G4LorentzConvertor.hh"
     53#include "G4LorentzVector.hh"
     54#include "G4NucleiProperties.hh"
     55#include "G4ThreeVector.hh"
     56
     57using namespace G4InuclSpecialFunctions;
     58
    3159
    3260G4EquilibriumEvaporator::G4EquilibriumEvaporator()
    33   : verboseLevel(1) {
    34  
    35   if (verboseLevel > 3) {
    36     G4cout << " >>> G4EquilibriumEvaporator::G4EquilibriumEvaporator" << G4endl;
    37   }
     61  : G4VCascadeCollider("G4EquilibriumEvaporator"),
     62    theFissioner(new G4Fissioner),
     63    theBigBanger(new G4BigBanger) {}
     64
     65G4EquilibriumEvaporator::~G4EquilibriumEvaporator() {
     66  delete theFissioner;
     67  delete theBigBanger;
    3868}
    3969
    40 G4CollisionOutput G4EquilibriumEvaporator::collide(G4InuclParticle* /*bullet*/,
    41                                                    G4InuclParticle* target) {
    42 
     70
     71void G4EquilibriumEvaporator::collide(G4InuclParticle* /*bullet*/,
     72                                      G4InuclParticle* target,
     73                                      G4CollisionOutput& output) {
    4374  if (verboseLevel > 3) {
    4475    G4cout << " >>> G4EquilibriumEvaporator::collide" << G4endl;
     76  }
     77
     78  // Sanity check
     79  G4InuclNuclei* nuclei_target = dynamic_cast<G4InuclNuclei*>(target);
     80  if (!nuclei_target) {
     81    G4cerr << " EquilibriumEvaporator -> target is not nuclei " << G4endl;   
     82    return;
    4583  }
    4684
     
    4886  const G4double huge_num = 50.0;
    4987  const G4double small = -50.0;
    50   const G4double one_third = 1.0 / 3.0;
    51   const G4double two_thirds = 2.0 / 3.0;
    5288  const G4double prob_cut_off = 1.0e-15;
    5389  const G4double Q1[6] = { 0.0, 0.0, 2.23, 8.49, 7.72, 28.3 };
     
    78114
    79115  G4double coul_coeff;
    80   G4CollisionOutput output;
    81 
    82   if (G4InuclNuclei* nuclei_target = dynamic_cast<G4InuclNuclei*>(target)) {
     116
    83117    G4double A = nuclei_target->getA();
    84118    G4double Z = nuclei_target->getZ();
    85     G4CascadeMomentum PEX = nuclei_target->getMomentum();
     119    G4LorentzVector PEX = nuclei_target->getMomentum();
    86120    G4double EEXS = nuclei_target->getExitationEnergy();
    87121
     
    92126    G4InuclElementaryParticle dummy(small_ekin, 1);
    93127    G4LorentzConvertor toTheNucleiSystemRestFrame;
    94     toTheNucleiSystemRestFrame.setBullet(dummy.getMomentum(), dummy.getMass());
    95     G4CascadeMomentum ppout;
     128    toTheNucleiSystemRestFrame.setBullet(dummy);
     129    G4LorentzVector ppout;
    96130 
    97     if (timeToBigBang(A, Z, EEXS)) {
     131    if (explosion(A, Z, EEXS)) {
    98132
    99133      if (verboseLevel > 3) {
     
    101135      }
    102136
    103       return theBigBanger->collide(0, target);
    104 
     137      theBigBanger->collide(0, target, output);
     138      return;
    105139    } else {     
    106140
     
    114148      G4InuclNuclei dummy_nuc;
    115149      G4double EEXS_new;
    116       G4CascadeMomentum pin = PEX;
    117       pin[0] += 0.001 * EEXS;
     150      G4LorentzVector pin = PEX;
     151      pin.setE(pin.e() + 0.001 * EEXS);
    118152      G4bool try_again = true; 
    119153      G4bool fission_open = true;
     
    121155      G4int itry_global = 0;
    122156
     157      // Buffer for parameter sets
     158      std::pair<std::vector<G4double>, std::vector<G4double> > parms;
     159
    123160      while (try_again && itry_global < itry_global_max) {
    124161        itry_global++;
     
    129166
    130167        nuc_mass = dummy_nuc.getNucleiMass(A, Z);
    131         PEX[0] = std::sqrt(PEX[1] * PEX[1] +
    132                       PEX[2] * PEX[2] +
    133                       PEX[3] * PEX[3] +
    134                       nuc_mass * nuc_mass);     
     168        PEX.setVectM(PEX.vect(), nuc_mass);     
    135169        toTheNucleiSystemRestFrame.setTarget(PEX, nuc_mass);
    136170        toTheNucleiSystemRestFrame.toTheTargetRestFrame();
    137171
    138         if (timeToBigBang(A, Z, EEXS)) { // big bang
     172        if (explosion(A, Z, EEXS)) { // big bang
    139173     
    140174          if (verboseLevel > 2){
     
    147181          nuclei.setExitationEnergy(EEXS);     
    148182
    149           G4CollisionOutput explosion = theBigBanger->collide(0, &nuclei);
    150 
    151           output.addOutgoingParticles(explosion.getOutgoingParticles());
    152 
    153           return output;       
     183          theBigBanger->collide(0, &nuclei, output);
     184          return;       
    154185
    155186        } else { // normal chain
     
    160191            G4double parlev = getPARLEVDEN(A, Z);
    161192            G4double u1 = parlev * A;
    162             std::pair<std::vector<G4double>, std::vector<G4double> > parms = paraMaker(Z);
    163             std::vector<G4double> AK = parms.first;
    164             std::vector<G4double> CPA = parms.second;
    165             G4double DM0 = bindingEnergy(A, Z);   
     193
     194            paraMaker(Z, parms);
     195            const std::vector<G4double>& AK = parms.first;
     196            const std::vector<G4double>& CPA = parms.second;
     197
     198            //      G4double DM0 = bindingEnergy(A, Z);   
     199            G4double DM0 = G4NucleiProperties::GetBindingEnergy(G4lrint(A), G4lrint(Z));
    166200            G4int i(0);
    167201
     
    173207
    174208              if (goodRemnant(A1[i], Z1[i])) {
    175                 G4double QB = DM0 - bindingEnergy(A1[i], Z1[i]) - Q1[i];
     209                //              G4double QB = DM0 - bindingEnergy(A1[i], Z1[i]) - Q1[i];
     210                G4double QB = DM0 - G4NucleiProperties::GetBindingEnergy(G4lrint(A1[i]), G4lrint(Z1[i])) - Q1[i];
    176211                V[i] = coul_coeff * Z * Q[i] * AK[i] / (1.0 + EEXS / E0) /
    177                   (std::pow(A1[i], one_third) + std::pow(AN[i], one_third));
     212                  (G4cbrt(A1[i]) + G4cbrt(AN[i]));
    178213                TM[i] = EEXS - QB - V[i] * A / A1[i]; 
    179214              };
     
    185220            if (TM[0] > cut_off_energy) {
    186221              G4double AL = getAL(A);
    187               W[0] = BE * std::pow(A1[0], two_thirds) * G[0] * AL;
     222              W[0] = BE * G4cbrt(A1[0]*A1[0]) * G[0] * AL;
    188223              G4double TM1 = 2.0 * std::sqrt(u[0] * TM[0]) - ue;
    189224
     
    204239
    205240              if (TM[i] > cut_off_energy) {
    206                 W[i] = BE * std::pow(A1[i], two_thirds) * G[i] * (1.0 + CPA[i]);
     241                W[i] = BE * G4cbrt(A1[i]*A1[i]) * G[i] * (1.0 + CPA[i]);
    207242                G4double TM1 = 2.0 * std::sqrt(u[i] * TM[i]) - ue;
    208243
     
    268303
    269304                if (T04 < EEXS) {
    270                   FMAX = std::pow(T04, 4) * std::exp((EEXS - T04) / T00);               
    271 
     305                  FMAX = (T04*T04*T04*T04) * std::exp((EEXS - T04) / T00);
    272306                } else {
    273                   FMAX = std::pow(EEXS, 4);
     307                  FMAX = EEXS*EEXS*EEXS*EEXS;
    274308                };
    275309
     
    279313                  itry++;
    280314                  S = EEXS * inuclRndm();
    281                   G4double X1 = std::pow(S, 4) * std::exp((EEXS - S) / T00);
     315                  G4double X1 = (S*S*S*S) * std::exp((EEXS - S) / T00);
    282316
    283317                  if (X1 > FMAX * inuclRndm()) break;
     
    290324                  particle.setModel(6);
    291325                  G4double pmod = 0.001 * S;
    292                   G4CascadeMomentum mom;
    293                   std::pair<G4double, G4double> COS_SIN = randomCOS_SIN();
    294                   G4double FI = randomPHI();
    295                   G4double P1 = pmod * COS_SIN.second;
    296                   mom[1] = P1 * std::cos(FI);
    297                   mom[2] = P1 * std::sin(FI);
    298                   mom[3] = pmod * COS_SIN.first;
    299                   mom[0] = pmod;
    300                   G4CascadeMomentum mom_at_rest;
    301 
    302                   for (G4int i = 1; i < 4; i++) mom_at_rest[i] = -mom[i];
    303                   mom_at_rest[0] = std::sqrt(mom_at_rest[1] * mom_at_rest[1] +
    304                                         mom_at_rest[2] * mom_at_rest[2] +
    305                                         mom_at_rest[3] * mom_at_rest[3] +
    306                                         nuc_mass * nuc_mass);
    307 
    308                   G4CascadeMomentum part_mom =
    309                     toTheNucleiSystemRestFrame.backToTheLab(mom);
    310 
    311                   part_mom[0] = std::sqrt(part_mom[1] * part_mom[1] +
    312                                      part_mom[2] * part_mom[2] +
    313                                      part_mom[3] * part_mom[3]);
    314 
    315                   G4CascadeMomentum ex_mom =
    316                     toTheNucleiSystemRestFrame.backToTheLab(mom_at_rest);
    317 
    318                   ex_mom[0] = std::sqrt(ex_mom[1] * ex_mom[1] +
    319                                    ex_mom[2] * ex_mom[2]
    320                                    + ex_mom[3] * ex_mom[3] +
    321                                    nuc_mass * nuc_mass);                       
    322                   EEXS_new = 1000.0 * (PEX[0] + 0.001 * EEXS -
    323                                        part_mom[0] - ex_mom[0]);
     326                  G4LorentzVector mom = generateWithRandomAngles(pmod, 0.);
     327
     328                  G4LorentzVector ex_mom;
     329                  ex_mom.setVectM(-mom.vect(), nuc_mass);
     330
     331                  mom = toTheNucleiSystemRestFrame.backToTheLab(mom);
     332                  ex_mom = toTheNucleiSystemRestFrame.backToTheLab(ex_mom);
     333
     334                  EEXS_new = 1000.0 * (PEX.e() + 0.001 * EEXS -
     335                                       mom.e() - ex_mom.e());
    324336
    325337                  if (EEXS_new > 0.0) { // everything ok
    326338                    PEX = ex_mom;
    327339                    EEXS = EEXS_new;
    328                     particle.setMomentum(part_mom);
     340                    particle.setMomentum(mom);
    329341                    output.addOutgoingParticle(particle);
    330342
    331                     for (G4int i = 0; i < 4; i++) ppout[i] += part_mom[i];
     343                    ppout += mom;
    332344
    333345                  } else {
     
    388400                      // generate particle momentum
    389401                      G4double pmod = std::sqrt((2.0 * mass + S) * S);
    390                       G4CascadeMomentum mom;
    391                       std::pair<G4double, G4double> COS_SIN = randomCOS_SIN();
    392                       G4double FI = randomPHI();
    393                       G4double P1 = pmod * COS_SIN.second;
    394                       mom[1] = P1 * std::cos(FI);
    395                       mom[2] = P1 * std::sin(FI);
    396                       mom[3] = pmod * COS_SIN.first;
    397                       G4CascadeMomentum mom_at_rest;
    398 
    399                       for (G4int i = 1; i < 4; i++) mom_at_rest[i] = -mom[i];
    400                       G4double new_nuc_mass = dummy_nuc.getNucleiMass(A1[icase],
    401                                                                       Z1[icase]);
    402                       mom_at_rest[0] = std::sqrt(mom_at_rest[1] * mom_at_rest[1] +
    403                                             mom_at_rest[2] * mom_at_rest[2] +
    404                                             mom_at_rest[3] * mom_at_rest[3] +
    405                                             new_nuc_mass * new_nuc_mass);
    406                       mom[0] = std::sqrt(mom[1] * mom[1] + mom[2] * mom[2] +
    407                                     mom[3] * mom[3] + mass * mass);
    408 
    409                       G4CascadeMomentum part_mom =
    410                         toTheNucleiSystemRestFrame.backToTheLab(mom);
    411                       part_mom[0] = std::sqrt(part_mom[1] * part_mom[1] +
    412                                          part_mom[2] * part_mom[2] +
    413                                          part_mom[3] * part_mom[3] +
    414                                          mass * mass);
    415                       G4CascadeMomentum ex_mom =
    416                         toTheNucleiSystemRestFrame.backToTheLab(mom_at_rest);
    417                       ex_mom[0] = std::sqrt(ex_mom[1] * ex_mom[1] +
    418                                        ex_mom[2] * ex_mom[2] +
    419                                        ex_mom[3] * ex_mom[3] +
    420                                        new_nuc_mass * new_nuc_mass);                   
    421                       EEXS_new = 1000.0 * (PEX[0] + 0.001 * EEXS -
    422                                            part_mom[0] - ex_mom[0]);
     402                      G4LorentzVector mom = generateWithRandomAngles(pmod, mass);
     403
     404                      G4double new_nuc_mass =
     405                        dummy_nuc.getNucleiMass(A1[icase], Z1[icase]);
     406
     407                      G4LorentzVector ex_mom;
     408                      ex_mom.setVectM(-mom.vect(), new_nuc_mass);
     409
     410                      mom = toTheNucleiSystemRestFrame.backToTheLab(mom);
     411                      ex_mom = toTheNucleiSystemRestFrame.backToTheLab(ex_mom);
     412
     413                      EEXS_new = 1000.0 * (PEX.e() + 0.001 * EEXS -
     414                                           mom.e() - ex_mom.e());
    423415
    424416                      if (EEXS_new > 0.0) { // everything ok
     
    427419                        A = A1[icase];
    428420                        Z = Z1[icase];       
    429                         particle.setMomentum(part_mom);
     421                        particle.setMomentum(mom);
    430422                        output.addOutgoingParticle(particle);
    431                         for (G4int i = 0; i < 4; i++) ppout[i] += part_mom[i];
     423                        ppout += mom;
    432424                        bad = false;
    433425                      };
    434 
    435426                    } else {
    436427                      G4InuclNuclei nuclei(AN[icase], Q[icase]);
     
    439430                      // generate particle momentum
    440431                      G4double pmod = std::sqrt((2.0 * mass + S) * S);
    441                       G4CascadeMomentum mom;
    442                       std::pair<G4double, G4double> COS_SIN = randomCOS_SIN();
    443                       G4double FI = randomPHI();
    444                       G4double P1 = pmod * COS_SIN.second;
    445                       mom[1] = P1 * std::cos(FI);
    446                       mom[2] = P1 * std::sin(FI);
    447                       mom[3] = pmod * COS_SIN.first;
    448                       G4CascadeMomentum mom_at_rest;
    449 
    450                       for (G4int i = 1; i < 4; i++) mom_at_rest[i] = -mom[i];
    451                       G4double new_nuc_mass = dummy_nuc.getNucleiMass(A1[icase],
    452                                                                       Z1[icase]);
    453                       mom_at_rest[0] = std::sqrt(mom_at_rest[1] * mom_at_rest[1] +
    454                                             mom_at_rest[2] * mom_at_rest[2] +
    455                                             mom_at_rest[3] * mom_at_rest[3] +
    456                                             new_nuc_mass * new_nuc_mass);
    457                       mom[0] = std::sqrt(mom[1] * mom[1] +
    458                                     mom[2] * mom[2] +
    459                                     mom[3] * mom[3] +
    460                                     mass * mass);
    461                       G4CascadeMomentum part_mom =
    462                         toTheNucleiSystemRestFrame.backToTheLab(mom);
    463                       part_mom[0] = std::sqrt(part_mom[1] * part_mom[1] +
    464                                          part_mom[2] * part_mom[2] +
    465                                          part_mom[3] * part_mom[3] +
    466                                          mass * mass);
    467                       G4CascadeMomentum ex_mom =
    468                         toTheNucleiSystemRestFrame.backToTheLab(mom_at_rest);
    469                       ex_mom[0] = std::sqrt(ex_mom[1] * ex_mom[1] +
    470                                        ex_mom[2] * ex_mom[2] +
    471                                        ex_mom[3] * ex_mom[3] +
    472                                        new_nuc_mass * new_nuc_mass);                   
    473                       EEXS_new = 1000.0 * (PEX[0] + 0.001 * EEXS -
    474                                            part_mom[0] - ex_mom[0]);
     432                      G4LorentzVector mom = generateWithRandomAngles(pmod,mass);
     433
     434                      G4double new_nuc_mass =
     435                        dummy_nuc.getNucleiMass(A1[icase], Z1[icase]);
     436
     437                      G4LorentzVector ex_mom;
     438                      ex_mom.setVectM(-mom.vect(), new_nuc_mass);
     439
     440                      mom = toTheNucleiSystemRestFrame.backToTheLab(mom);
     441                      ex_mom = toTheNucleiSystemRestFrame.backToTheLab(ex_mom);
     442
     443                      EEXS_new = 1000.0 * (PEX.e() + 0.001 * EEXS -
     444                                           mom.e() - ex_mom.e());
    475445
    476446                      if (EEXS_new > 0.0) { // everything ok
     
    480450                        Z = Z1[icase];
    481451             
    482                         for (G4int i = 0; i < 4; i++) ppout[i] += part_mom[i];
    483                         nuclei.setMomentum(part_mom);
     452                        ppout += mom;
    484453                        nuclei.setExitationEnergy(0.0);
    485                         nuclei.setEnergy();
     454                        nuclei.setMomentum(mom);
    486455                        output.addTargetFragment(nuclei);
    487456                        bad = false;
     
    503472                }
    504473
    505                 G4CollisionOutput foutput = theFissioner->collide(0, &nuclei);
    506                 std::vector<G4InuclNuclei> nuclea = foutput.getNucleiFragments();
    507 
    508                 if (nuclea.size() == 2) { // fission o'k
    509                   // convert back to the lab
    510 
     474                // Catch fission output separately for verification
     475                G4CollisionOutput foutput;
     476                theFissioner->collide(0, &nuclei, foutput);
     477
     478                if (foutput.getNucleiFragments().size() == 2) { // fission o'k
     479                  // Copy fragment list and convert back to the lab
     480                  std::vector<G4InuclNuclei> nuclea(foutput.getNucleiFragments());
     481                  G4LorentzVector mom;
    511482                  for(G4int i = 0; i < 2; i++) {
    512                     G4CascadeMomentum mom = nuclea[i].getMomentum();
    513                     mom = toTheNucleiSystemRestFrame.backToTheLab(mom);
     483                    mom = toTheNucleiSystemRestFrame.backToTheLab(nuclea[i].getMomentum());
    514484                    nuclea[i].setMomentum(mom);
    515                     nuclea[i].setEnergy();
    516                   };         
    517 
    518                   G4CollisionOutput output1 = this->collide(0, &nuclea[0]);
    519 
    520                   output.addOutgoingParticles(output1.getOutgoingParticles());
    521                   output.addTargetFragments(output1.getNucleiFragments());
    522 
    523                   output1 = this->collide(0, &nuclea[1]);
    524 
    525                   output.addOutgoingParticles(output1.getOutgoingParticles());
    526                   output.addTargetFragments(output1.getNucleiFragments());
    527 
    528                   return output;
    529 
     485                  }
     486
     487                  this->collide(0, &nuclea[0], output);
     488                  this->collide(0, &nuclea[1], output);
     489                  return;
    530490                } else { // fission forbidden now
    531491                  fission_open = false;
     
    549509      }
    550510
    551       G4CascadeMomentum pnuc;
    552 
    553       for (G4int i = 1; i < 4; i++) pnuc[i] = pin[i] - ppout[i];
     511      G4LorentzVector pnuc = pin - ppout;
    554512
    555513      G4InuclNuclei nuclei(pnuc, A, Z);
    556514      nuclei.setModel(6);
    557       nuclei.setEnergy();
    558515      pnuc = nuclei.getMomentum();
    559       G4double eout = pnuc[0] + ppout[0]
    560       G4double eex_real = 1000.0 * (pin[0] - eout);       
     516      G4double eout = pnuc.e() + ppout.e()
     517      G4double eex_real = 1000.0 * (pin.e() - eout);       
    561518   
    562519      nuclei.setExitationEnergy(eex_real);
    563520   
    564521      output.addTargetFragment(nuclei);
    565     };
    566 
    567   } else {
    568     G4cout << " EquilibriumEvaporator -> target is not nuclei " << G4endl;   
    569   };
    570 
    571   return output;
     522    }
     523
     524  return;
    572525}                   
    573526
    574 G4bool G4EquilibriumEvaporator::timeToBigBang(G4double a,
    575                                               G4double z,
    576                                               G4double e) const {
    577 
     527G4bool G4EquilibriumEvaporator::explosion(G4double a,
     528                                          G4double z,
     529                                          G4double e) const {
    578530  if (verboseLevel > 3) {
    579     G4cout << " >>> G4EquilibriumEvaporator::timeToBigBang" << G4endl;
     531    G4cout << " >>> G4EquilibriumEvaporator::explosion" << G4endl;
    580532  }
    581533
    582534  const G4double be_cut = 3.0;
    583   G4bool bigb = true;
    584 
    585   if (a >= 12 && z >= 6.0 && z < 3.0 * (a - z)) {
    586     bigb = false; 
    587 
    588   } else {
    589 
    590     if (e < be_cut * bindingEnergy(a, z)) bigb = false;
    591   };
     535
     536  // Different criteria from base class, since nucleus more "agitated"
     537  G4bool bigb = (!(a >= 12 && z >= 6.0 && z < 3.0 * (a - z)) &&
     538                 (e >= be_cut * G4NucleiProperties::GetBindingEnergy(G4lrint(a), G4lrint(z)))
     539                 );
    592540
    593541  return bigb;
     
    596544G4bool G4EquilibriumEvaporator::goodRemnant(G4double a,
    597545                                            G4double z) const {
    598  
    599546  if (verboseLevel > 3) {
    600547    G4cout << " >>> G4EquilibriumEvaporator::goodRemnant" << G4endl;
     
    613560  }
    614561 
    615   const G4double QFREP[72] = { 
     562  static const G4double QFREP[72] = { 
    616563    //     TL201 *     *   *    *
    617564    //      1    2     3   4    5
     
    642589    6.2,  3.8,  5.6,  4.0,  4.0,  4.2,  4.2,  3.5 };
    643590     
    644   const G4double XREP[72] = {
     591  static const G4double XREP[72] = {
    645592    //      1      2     3      4      5
    646593    0.6761, 0.677, 0.6788, 0.6803, 0.685,
     
    671618
    672619  if (x < XMIN || x > XMAX) {
    673 
    674620    G4double X1 = 1.0 - 0.02 * x2;
    675     G4double FX = (0.73 + (3.33 * X1 - 0.66) * X1) * std::pow(X1, 3);
    676 
    677     QFF = G0 * FX * std::pow(a, 2.0 / 3.0);
    678  
     621    G4double FX = (0.73 + (3.33 * X1 - 0.66) * X1) * (X1*X1*X1);
     622
     623    QFF = G0 * FX * G4cbrt(a*a);
    679624  } else {
    680 
    681     for (G4int i = 1; i < 72; i++) {
    682 
    683       if (x <= XREP[i]) {
    684         QFF = QFREP[i - 1] + (QFREP[i] - QFREP[i - 1]) * (x - XREP[i - 1])/
    685           (XREP[i] - XREP[i - 1]);
    686 
    687         break;
    688       };
    689     };
    690   };
     625    static G4CascadeInterpolator<72> interp(XREP);      // Only need one!
     626    QFF = interp.interpolate(x, QFREP);
     627  }
    691628
    692629  if (QFF < 0.0) QFF = 0.0;
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4EvaporationInuclCollider.cc

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4EvaporationInuclCollider.cc,v 1.10 2010/05/21 17:56:34 mkelsey Exp $
     26// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100114  M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
     29// 20100309  M. Kelsey -- Eliminate some unnecessary std::pow()
     30// 20100413  M. Kelsey -- Pass G4CollisionOutput by ref to ::collide()
     31// 20100517  M. Kelsey -- Inherit from common base class, make other colliders
     32//              simple data members.  Eliminate unnecessary G4InuclNuclei ctor.
     33
    2634#include "G4EvaporationInuclCollider.hh"
    27 #include "G4InuclElementaryParticle.hh"
    28 #include "G4LorentzConvertor.hh"
    29 #include "G4ParticleLargerEkin.hh"
    30 #include <algorithm>
     35#include "G4CollisionOutput.hh"
     36#include "G4EquilibriumEvaporator.hh"
     37#include "G4InuclNuclei.hh"
     38
    3139
    3240typedef std::vector<G4InuclElementaryParticle>::iterator particleIterator;
    3341typedef std::vector<G4InuclNuclei>::iterator nucleiIterator;
     42
    3443         
    3544G4EvaporationInuclCollider::G4EvaporationInuclCollider()
    36   : verboseLevel(0) {
     45  : G4VCascadeCollider("G4EvaporationInuclCollider"),
     46    theEquilibriumEvaporator(new G4EquilibriumEvaporator) {}
    3747
    38   if (verboseLevel > 3) {
    39     G4cout << " >>> G4EvaporationInuclCollider::G4EvaporationInuclCollider" << G4endl;
    40   }
    41 }
    42 
    43 G4CollisionOutput G4EvaporationInuclCollider::collide(G4InuclParticle* /*bullet*/, G4InuclParticle* target) {
    44 
    45   verboseLevel = 0;
     48void
     49G4EvaporationInuclCollider::collide(G4InuclParticle* /*bullet*/,
     50                                    G4InuclParticle* target,
     51                                    G4CollisionOutput& globalOutput) {
    4652  if (verboseLevel > 3) {
    4753    G4cout << " >>> G4EvaporationInuclCollider::evaporate" << G4endl;
    4854  }
    4955
    50   G4CollisionOutput globalOutput;
     56  if (!dynamic_cast<G4InuclNuclei*>(target)) return;    // Only nuclei evaporate
    5157
    52   G4LorentzConvertor convertToTargetRestFrame;
    53   G4InuclNuclei* ntarget = dynamic_cast<G4InuclNuclei*>(target);
    54   convertToTargetRestFrame.setTarget(ntarget->getMomentum(), ntarget->getMass());
     58  target->printParticle();      // FIXME: Why is this not verbose protected???
    5559
    56   G4double at = ntarget->getA();
    57   G4double zt = ntarget->getZ();
    58   G4double eEx = ntarget->getExitationEnergy();
    59 
    60   G4CascadeMomentum bmom;
    61   bmom[3] = convertToTargetRestFrame.getTRSMomentum();
    62 
    63   G4InuclNuclei targ(at, zt);
    64   G4CascadeMomentum tmom;
    65   targ.setExitationEnergy(eEx);
    66   targ.setMomentum(tmom);
    67   targ.setEnergy();
    68 
    69   targ.printParticle();
    70 
    71   G4CollisionOutput output;
    72   output = theEquilibriumEvaporator->collide(0, &targ);
    73 
    74   G4CollisionOutput TRFoutput;     
    75   TRFoutput.addOutgoingParticles(output.getOutgoingParticles()); 
    76   TRFoutput.addTargetFragments(output.getNucleiFragments());         
     60  theEquilibriumEvaporator->collide(0, target, globalOutput);
    7761
    7862  if (verboseLevel > 3) {
    7963    G4cout << " After EquilibriumEvaporator " << G4endl;
    80     output.printCollisionOutput();
    81   };
    82          
    83 
    84   std::vector<G4InuclElementaryParticle> particles = TRFoutput.getOutgoingParticles();
    85   std::vector<G4InuclNuclei> nucleus = TRFoutput.getNucleiFragments();
    86 
    87   globalOutput.addOutgoingParticles(particles);
    88   globalOutput.addTargetFragments(nucleus);
    89 
    90   if (verboseLevel > 3) G4cout << "G4EvaporationInuclCollider::collide end" << G4endl;
    91  
    92        
    93   return globalOutput;
    94        
     64    globalOutput.printCollisionOutput();
     65    G4cout << "G4EvaporationInuclCollider::collide end" << G4endl;
     66  }
    9567}
    96        
    97              
    98 G4bool G4EvaporationInuclCollider::inelasticInteractionPossible(G4InuclParticle* bullet,
    99                                                      G4InuclParticle* target,
    100                                                      G4double ekin) const {
    101 
    102   if (verboseLevel > 3) {
    103     G4cout << " >>> G4EvaporationInuclCollider::inelasticInteractionPossible" << G4endl;
    104   }
    105 
    106   const G4double coeff = 0.001 * 1.2;
    107   const G4double one_third = 1.0 / 3.0;
    108 
    109   G4bool possible = true;
    110   G4double at;
    111   G4double zt;
    112   G4double ab;
    113   G4double zb;
    114 
    115   if (G4InuclNuclei* nuclei_target = dynamic_cast<G4InuclNuclei*>(target)) {
    116     at = nuclei_target->getA();
    117     zt = nuclei_target->getZ();
    118     if (G4InuclNuclei* nuclei_bullet = dynamic_cast<G4InuclNuclei*>(bullet)) {
    119       ab = nuclei_bullet->getA();
    120       zb = nuclei_bullet->getZ();     
    121     } else {
    122       G4InuclElementaryParticle* particle =
    123         dynamic_cast<G4InuclElementaryParticle*>(bullet);
    124 
    125       ab = 1;
    126       zb = particle->getCharge();
    127     };
    128   } else {
    129     if(G4InuclNuclei* nuclei_bullet = dynamic_cast<G4InuclNuclei*>(bullet)) {
    130       ab = nuclei_bullet->getA();
    131       zb = nuclei_bullet->getZ();     
    132 
    133       G4InuclElementaryParticle* particle =
    134         dynamic_cast<G4InuclElementaryParticle*>(target);
    135 
    136       at = 1;
    137       zt = particle->getCharge();   
    138     } else {
    139 
    140       return possible;
    141     }; 
    142   };
    143 
    144   // VCOL used  for testing if elastic collision possible
    145   G4double VCOL = coeff * zt * zb / (std::pow(at, one_third) + std::pow(ab, one_third));
    146 
    147   // possible = VCOL < ekin; // NOTE: inelastic collision if not true
    148   possible = true; // we force elastic
    149 
    150   if (verboseLevel > 3) {
    151     G4cout << " >>> G4EvaporationInuclCollider::inelasticInteractionPossible" << G4endl;
    152     G4cout << " VCOL: " << VCOL << " ekin: " << ekin << " inelastic possible: " << possible << G4endl;
    153   }
    154 
    155   return possible;
    156 
    157 }
    158        
    159 G4InteractionCase G4EvaporationInuclCollider::bulletTargetSetter(G4InuclParticle* bullet,
    160                                                       G4InuclParticle* target) const {
    161 
    162   if (verboseLevel > 3) {
    163     G4cout << " >>> G4EvaporationInuclCollider::bulletTargetSetter" << G4endl;
    164   }
    165 
    166   G4InteractionCase interCase;
    167 
    168   if (G4InuclNuclei* nuclei_target = dynamic_cast<G4InuclNuclei*>(target)) {     
    169     if (G4InuclNuclei* nuclei_bullet = dynamic_cast<G4InuclNuclei*>(bullet)) { // A + A         
    170       interCase.setInterCase(2);
    171       if (nuclei_target->getA() >= nuclei_bullet->getA()) {
    172         interCase.setBulletTarget(bullet, target);
    173       } else {
    174         interCase.setBulletTarget(target, bullet);
    175       };
    176     } else {
    177       interCase.setInterCase(1);
    178       interCase.setBulletTarget(bullet, target);
    179     };
    180   } else {
    181     G4InuclNuclei* nuclei_bullet = dynamic_cast<G4InuclNuclei*>(bullet);
    182     if (nuclei_bullet) {
    183       G4InuclElementaryParticle* part =
    184         dynamic_cast<G4InuclElementaryParticle*>(target);
    185       if (part) {
    186         interCase.setInterCase(1);
    187         interCase.setBulletTarget(target, bullet);
    188       };
    189     };
    190   };
    191 
    192   return interCase;
    193 }       
    194 
    195 G4bool G4EvaporationInuclCollider::explosion(G4InuclNuclei* target) const {
    196 
    197   if (verboseLevel > 3) {
    198     G4cout << " >>> G4EvaporationInuclCollider::explosion" << G4endl;
    199   }
    200 
    201   const G4double a_cut = 20.0;
    202   const G4double be_cut = 3.0;
    203 
    204   G4double a = target->getA();
    205   G4double z = target->getZ();
    206   G4double eexs = target->getExitationEnergy();
    207   G4bool explo = true;
    208 
    209   if (a > a_cut) {
    210     explo = false;
    211   } else {
    212     if (eexs < be_cut * bindingEnergy(a, z)) explo = false;
    213   };   
    214 
    215   return explo;
    216 }
    217  
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4FissionStore.cc

    r819 r1315  
    2828
    2929G4FissionStore::G4FissionStore()
    30   : verboseLevel(2){
     30  : verboseLevel(0){
    3131
    3232  if (verboseLevel > 3) {
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4Fissioner.cc

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4Fissioner.cc,v 1.28 2010/05/21 17:56:34 mkelsey Exp $
     26// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100114  M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
     29// 20100318  M. Kelsey -- Bug fix setting mass with G4LV
     30// 20100319  M. Kelsey -- Use new generateWithRandomAngles for theta,phi stuff;
     31//              eliminate some unnecessary std::pow()
     32// 20100413  M. Kelsey -- Pass G4CollisionOutput by ref to ::collide()
     33// 20100517  M. Kelsey -- Inherit from common base class
     34
    2635#include "G4Fissioner.hh"
     36#include "G4CollisionOutput.hh"
    2737#include "G4InuclNuclei.hh"
     38#include "G4InuclParticle.hh"
    2839#include "G4FissionStore.hh"
    2940#include "G4FissionConfiguration.hh"
    30 
    31 G4Fissioner::G4Fissioner()
    32   : verboseLevel(1) {
    33  
    34   if (verboseLevel > 3) {
    35     G4cout << " >>> G4Fissioner::G4Fissioner" << G4endl;
    36   }
    37 }
    38 
    39 G4CollisionOutput G4Fissioner::collide(G4InuclParticle* /*bullet*/,
    40                                        G4InuclParticle* target) {
    41 
     41#include "G4NucleiProperties.hh"
     42#include "G4HadTmpUtil.hh"
     43#include "G4InuclSpecialFunctions.hh"
     44
     45using namespace G4InuclSpecialFunctions;
     46
     47
     48G4Fissioner::G4Fissioner() : G4VCascadeCollider("G4Fissioner") {}
     49
     50void G4Fissioner::collide(G4InuclParticle* /*bullet*/,
     51                          G4InuclParticle* target,
     52                          G4CollisionOutput& output) {
    4253  if (verboseLevel > 3) {
    4354    G4cout << " >>> G4Fissioner::collide" << G4endl;
    4455  }
    4556
    46   const G4double one_third = 1.0 / 3.0;
    47   const G4double two_thirds = 2.0 / 3.0;
    4857  //  const G4int itry_max = 1000;
    49   G4CollisionOutput output;
    5058
    5159  if (G4InuclNuclei* nuclei_target = dynamic_cast<G4InuclNuclei*>(target)) {
     
    6270    G4double mass_in = nuclei_target->getMass();
    6371    G4double e_in = mass_in + 0.001 * EEXS;
    64     G4double PARA = 0.055 * std::pow(A, two_thirds) * (std::pow(A - Z, one_third) + std::pow(Z, one_third));
     72    G4double PARA = 0.055 * G4cbrt(A*A) * (G4cbrt(A - Z) + G4cbrt(Z));
    6573    G4double TEM = std::sqrt(EEXS / PARA);
    66     G4double TETA = 0.494 * std::pow(A, one_third) * TEM;
     74    G4double TETA = 0.494 * G4cbrt(A) * TEM;
    6775
    6876    TETA = TETA / std::sinh(TETA);
     
    7482    G4double A2 = A - A1;
    7583    G4double ALMA = -1000.0;
    76     G4double DM1 = bindingEnergy(A, Z);
     84    //    G4double DM1 = bindingEnergy(A, Z);
     85    G4double DM1 = G4NucleiProperties::GetBindingEnergy(G4lrint(A), G4lrint(Z));
    7786    G4double EVV = EEXS - DM1;
    7887    G4double DM2 = bindingEnergyAsymptotic(A, Z);
     
    8493    std::vector<G4double> BET1(2, 0.05);
    8594    G4FissionStore fissionStore;
    86     G4double R12 = std::pow(A1, one_third) + std::pow(A2, one_third);
     95    G4double R12 = G4cbrt(A1) + G4cbrt(A2);
    8796 
    8897    for (G4int i = 0; i < 50 && A1 > 30.0; i++) {
    8998      A1 -= 1.0;
    9099      A2 = A - A1;
    91       G4double X3 = 1.0 / std::pow(A1, one_third);
    92       G4double X4 = 1.0 / std::pow(A2, one_third);
     100      G4double X3 = 1.0 / G4cbrt(A1);
     101      G4double X4 = 1.0 / G4cbrt(A2);
    93102      Z1 = G4int(getZopt(A1, A2, Z, X3, X4, R12)) - 1.0;
    94103      std::vector<G4double> EDEF1(2);
     
    98107      potentialMinimization(VPOT, EDEF1, VCOUL, A1, A2, Z1, Z2, AL1, BET1, R12);
    99108
    100       G4double DM3 = bindingEnergy(A1, Z1);
     109      //      G4double DM3 = bindingEnergy(A1, Z1);
     110      G4double DM3 = G4NucleiProperties::GetBindingEnergy(G4lrint(A1), G4lrint(Z1));
    101111      G4double DM4 = bindingEnergyAsymptotic(A1, Z1);
    102       G4double DM5 = bindingEnergy(A2, Z2);
     112      //      G4double DM5 = bindingEnergy(A2, Z2);
     113      G4double DM5 = G4NucleiProperties::GetBindingEnergy(G4lrint(A2), G4lrint(Z2));
    103114      G4double DM6 = bindingEnergyAsymptotic(A2, Z2);
    104115      G4double DMT1 = DM4 + DM6 - DM2;
     
    120131        if (EZ >= ALMA) ALMA = EZ;
    121132        G4double EK = VCOUL + DEfin + 0.5 * TEM;
    122         G4double EV = EVV + bindingEnergy(A1, Z1) + bindingEnergy(A2, Z2) - EK;
     133        //      G4double EV = EVV + bindingEnergy(A1, Z1) + bindingEnergy(A2, Z2) - EK;
     134        G4double EV = EVV
     135                    + G4NucleiProperties::GetBindingEnergy(G4lrint(A1), G4lrint(Z1))
     136                    + G4NucleiProperties::GetBindingEnergy(G4lrint(A2), G4lrint(Z2))
     137                    - EK;
    123138       
    124139        if (EV > 0.0) fissionStore.addConfig(A1, Z1, EZ, EK, EV);
     
    147162      G4double EK = config.ekin;
    148163      G4double pmod = std::sqrt(0.001 * EK * mass1 * mass2 / mass_in);
    149       std::pair<G4double, G4double> COS_SIN = randomCOS_SIN();
    150       G4double Fi = randomPHI();
    151       G4double P1 = pmod * COS_SIN.second;
    152       G4CascadeMomentum mom1;
    153       G4CascadeMomentum mom2;
    154 
    155       mom1[1] = P1 * std::cos(Fi);
    156       mom1[2] = P1 * std::sin(Fi);
    157       mom1[3] = pmod * COS_SIN.first;
    158 
    159       for (G4int i = 1; i < 4; i++) mom2[i] = -mom1[i];
    160 
    161       G4double e_out = std::sqrt(pmod * pmod + mass1 * mass1) +
    162         std::sqrt(pmod * pmod + mass2 * mass2);
     164
     165      G4LorentzVector mom1 = generateWithRandomAngles(pmod, mass1);
     166      G4LorentzVector mom2; mom2.setVectM(-mom1.vect(), mass2);
     167
     168      G4double e_out = mom1.e() + mom2.e();
    163169      G4double EV = 1000.0 * (e_in - e_out) / A;
    164170
     
    191197  };
    192198
    193   return output;
     199  return;
    194200}
    195201
     
    205211
    206212  G4double C2 = 124.57 * (1.0 / A1 + 1.0 / A2) + 0.78 * (X3 + X4) - 176.9 *
    207     (std::pow(X3, 4) + std::pow(X4, 4)) + 219.36 * (1.0 / (A1 * A1) + 1.0 / (A2 * A2)) - 1.108 / R12;
     213    ((X3*X3*X3*X3) + (X4*X4*X4*X4)) + 219.36 * (1.0 / (A1 * A1) + 1.0 / (A2 * A2)) - 1.108 / R12;
    208214
    209215  return C2;   
     
    222228
    223229  G4double Zopt = (87.7 * (X4 - X3) * (1.0 - 1.25 * (X4 + X3)) +
    224                    ZT * ((124.57 / A2 + 0.78 * X4 - 176.9 * std::pow(X4, 4) + 219.36 / (A2 * A2)) - 0.554 / R12)) /
     230                   ZT * ((124.57 / A2 + 0.78 * X4 - 176.9 * (X4*X4*X4*X4) + 219.36 / (A2 * A2)) - 0.554 / R12)) /
    225231    getC2(A1, A2, X3, X4, R12);
    226232
     
    244250
    245251  const G4double huge_num = 2.0e35;
    246   const G4double one_third = 1.0 / 3.0;
    247   //  const G4double two_thirds = 2.0 / 3.0;
    248252  const G4int itry_max = 2000;
    249253  const G4double DSOL1 = 1.0e-6;
     
    267271
    268272  for (i = 0; i < 2; i++) {
    269     R[i] = std::pow(A1[i], one_third);
     273    R[i] = G4cbrt(A1[i]);
    270274    Y1 = R[i] * R[i];
    271275    Y2 = Z1[i] * Z1[i] / R[i];
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4IntraNucleiCascader.cc

    r1007 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4IntraNucleiCascader.cc,v 1.35 2010/05/21 17:56:34 mkelsey Exp $
     26// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
    26 
     28// 20100114  M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
     29// 20100307  M. Kelsey -- Bug fix: momentum_out[0] should be momentum_out.e()
     30// 20100309  M. Kelsey -- Eliminate some unnecessary std::pow()
     31// 20100407  M. Kelsey -- Pass "all_particles" as argument to initializeCascad,
     32//              following recent change to G4NucleiModel.
     33// 20100413  M. Kelsey -- Pass G4CollisionOutput by ref to ::collide()
     34// 20100517  M. Kelsey -- Inherit from common base class, make other colliders
     35//              simple data members
     36
     37#include "G4IntraNucleiCascader.hh"
    2738#define RUN
    2839
    29 #include "G4IntraNucleiCascader.hh"
     40#include "G4CascadParticle.hh"
     41#include "G4CollisionOutput.hh"
     42#include "G4ElementaryParticleCollider.hh"
     43#include "G4HadTmpUtil.hh"
    3044#include "G4InuclElementaryParticle.hh"
    3145#include "G4InuclNuclei.hh"
    32 #include "G4LorentzConvertor.hh"
     46#include "G4InuclSpecialFunctions.hh"
     47#include "G4NucleiModel.hh"
     48#include "G4NucleiProperties.hh"
    3349#include "G4ParticleLargerEkin.hh"
    34 #include "G4NucleiModel.hh"
    35 #include "G4CascadParticle.hh"
    3650#include "Randomize.hh"
    3751#include <algorithm>
    3852
     53using namespace G4InuclSpecialFunctions;
     54
     55
    3956typedef std::vector<G4InuclElementaryParticle>::iterator particleIterator;
    4057
    4158G4IntraNucleiCascader::G4IntraNucleiCascader()
    42   : verboseLevel(1) {
     59  : G4VCascadeCollider("G4IntraNucleiCascader"),
     60    theElementaryParticleCollider(new G4ElementaryParticleCollider) {}
     61
     62G4IntraNucleiCascader::~G4IntraNucleiCascader() {
     63  delete theElementaryParticleCollider;
     64}
     65
     66
     67void G4IntraNucleiCascader::collide(G4InuclParticle* bullet,
     68                                    G4InuclParticle* target,
     69                                    G4CollisionOutput& output) {
    4370
    4471  if (verboseLevel > 3) {
    45     G4cout << " >>> G4IntraNucleiCascader::G4IntraNucleiCascader" << G4endl;
    46   }
    47 
    48 }
    49 
    50 G4CollisionOutput G4IntraNucleiCascader::collide(G4InuclParticle* bullet,
    51                                                  G4InuclParticle* target) {
    52 
    53   if (verboseLevel > 3) {
    54     G4cout << " >>> G4IntraNucleiCascader::collide" << G4endl;
     72    G4cout << " >>> G4IntraNucleiCascader::collide inter_case " << inter_case
     73           << G4endl;
    5574  }
    5675
     
    6382    target->printParticle();
    6483  }
    65 
    66   G4CollisionOutput output;
    6784
    6885#ifdef RUN
     
    7390  G4NucleiModel model(tnuclei);
    7491  G4double coulombBarrier = 0.00126*tnuclei->getZ()/
    75                                       (1.+std::pow(tnuclei->getA(),0.333));
    76 
    77   G4CascadeMomentum momentum_in = bullet->getMomentum();
    78 
    79   momentum_in[0] += tnuclei->getMass();
     92                                      (1.+G4cbrt(tnuclei->getA()));
     93
     94  G4LorentzVector momentum_in = bullet->getMomentum();
     95
     96  momentum_in.setE(momentum_in.e()+tnuclei->getMass());
    8097
    8198  G4double ekin_in;
     
    83100  if (verboseLevel > 3) {
    84101    model.printModel();
    85     G4cout << " intitial momentum  E " << momentum_in[0] << " Px " << momentum_in[1]
    86            << " Py " << momentum_in[2] << " Pz " << momentum_in[3] << G4endl;
     102    G4cout << " intitial momentum  E " << momentum_in.e() << " Px "
     103           << momentum_in.x() << " Py " << momentum_in.y() << " Pz "
     104           << momentum_in.z() << G4endl;
    87105  }
    88106
     
    117135      zfin += zb;
    118136
    119       std::pair<std::vector<G4CascadParticle>, std::vector<G4InuclElementaryParticle> >
    120         all_particles = model.initializeCascad(bnuclei, tnuclei);
     137      G4NucleiModel::modelLists all_particles;    // Buffer to receive lists
     138      model.initializeCascad(bnuclei, tnuclei, all_particles);
    121139
    122140      cascad_particles = all_particles.first;
     
    139157
    140158        for (i = 0; i < ihn; i++) theExitonConfiguration.incrementHoles(2);
    141 
    142159        for (i = 0; i < ihz; i++) theExitonConfiguration.incrementHoles(1);
    143160      };
     
    208225                                            (1./KE - 1./coulombBarrier)*
    209226                                         std::sqrt(mass*(coulombBarrier-KE)) );
     227
    210228            if (G4UniformRand() < CBP) {
    211229              output_particles.push_back(currentParticle);
     
    241259    }
    242260
    243     G4CascadeMomentum momentum_out;
     261    G4LorentzVector momentum_out;
    244262    particleIterator ipart;
    245263
    246264    for (ipart = output_particles.begin(); ipart != output_particles.end(); ipart++) {
    247       const G4CascadeMomentum& mom = ipart->getMomentum();
    248 
    249       for (G4int j = 0; j < 4; j++) momentum_out[j] += mom[j];
     265      momentum_out += ipart->getMomentum();
    250266
    251267      zfin -= ipart->getCharge();
     
    260276      G4InuclNuclei outgoing_nuclei(afin, zfin);
    261277      G4double mass = outgoing_nuclei.getMass();
    262       momentum_out[0] += mass;       
    263 
    264       for (int j = 0; j < 4; j++) momentum_out[j] = momentum_in[j] - momentum_out[j];
     278      momentum_out.setE(momentum_out.e()+mass);
     279
     280      momentum_out = momentum_in - momentum_out;
    265281
    266282      if (verboseLevel > 3) {
    267         G4cout << "  Eex + Ekin " << momentum_out[0]  <<  G4endl;
     283        G4cout << "  Eex + Ekin " << momentum_out.e()  <<  G4endl;
    268284      }
    269285
    270       if (momentum_out[0] > 0.0) { // Eex + Ekin > 0.0
    271         G4double pnuc = momentum_out[1] * momentum_out[1] +
    272           momentum_out[2] * momentum_out[2] +
    273           momentum_out[3] * momentum_out[3];
     286      if (momentum_out.e() > 0.0) { // Eex + Ekin > 0.0
     287        G4double pnuc = momentum_out.vect().mag2();
    274288        G4double ekin = std::sqrt(mass * mass + pnuc) - mass;
    275         G4double Eex = 1000.0 * (momentum_out[0] - ekin);
     289        G4double Eex = 1000.0 * (momentum_out.e() - ekin);
    276290
    277291        if (verboseLevel > 3) {
     
    283297          output.addOutgoingParticles(output_particles);
    284298          outgoing_nuclei.setMomentum(momentum_out);
    285           outgoing_nuclei.setEnergy();
    286299          outgoing_nuclei.setExitationEnergy(Eex);
    287300          outgoing_nuclei.setExitonConfiguration(theExitonConfiguration);                                         
    288301          output.addTargetFragment(outgoing_nuclei);
    289302
    290           return output;
     303          return;
    291304        };
    292305      };
     
    296309      if (afin == 1.0) { // recoiling nucleon
    297310
    298         for (int j = 0; j < 4; j++) momentum_out[j] = momentum_in[j] - momentum_out[j];
     311        momentum_out = momentum_in - momentum_out;
    299312
    300313        G4InuclElementaryParticle  last_particle;
     
    314327      output.addOutgoingParticles(output_particles);
    315328
    316       return output;
     329      return;
    317330    };
    318331  };
     
    322335  // special branch to avoid the cascad generation but to get the input for evaporation etc
    323336
    324   G4CascadeMomentum momentum_out;
     337  G4LorentzVector momentum_out;
    325338  G4InuclNuclei outgoing_nuclei(169, 69);
    326339
    327340  outgoing_nuclei.setMomentum(momentum_out);
    328   outgoing_nuclei.setEnergy();
    329341  outgoing_nuclei.setExitationEnergy(150.0);
    330342
     
    334346  output.addTargetFragment(outgoing_nuclei);
    335347
    336   return output;
     348  return;
    337349
    338350  /*
     
    342354    output.addOutgoingParticle(*bparticle);
    343355    output.addTargetFragment(*tnuclei);
    344     return output;
     356    return;
    345357  */
    346358
     
    354366  output.trivialise(bullet, target);
    355367
    356   return output;
     368  return;
    357369}
    358370
     
    374386  if (eexs > eexs_cut) {
    375387    G4double eexs_max0z = 1000.0 * ein / ediv_cut;
    376     G4double dm = bindingEnergy(a, z);
     388    //    G4double dm = bindingEnergy(a, z);
     389    G4double dm = G4NucleiProperties::GetBindingEnergy(G4lrint(a), G4lrint(z));
    377390    G4double eexs_max = eexs_max0z > reason_cut*dm ? eexs_max0z : reason_cut * dm;
    378391
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4InuclCollider.cc

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4InuclCollider.cc,v 1.30 2010/05/21 17:56:34 mkelsey Exp $
     26// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100114  M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
     29// 20100309  M. Kelsey -- Eliminate some unnecessary std::pow()
     30// 20100413  M. Kelsey -- Pass G4CollisionOutput by ref to ::collide()
     31// 20100418  M. Kelsey -- Move lab-frame transformation code to G4CollisonOutput
     32// 20100429  M. Kelsey -- Change "photon()" to "isPhoton()"
     33// 20100517  M. Kelsey -- Inherit from common base class, make other colliders
     34//              simple data members, consolidate code
     35
    2636#include "G4InuclCollider.hh"
     37#include "G4BigBanger.hh"
     38#include "G4CollisionOutput.hh"
     39#include "G4ElementaryParticleCollider.hh"
     40#include "G4EquilibriumEvaporator.hh"
     41#include "G4IntraNucleiCascader.hh"
    2742#include "G4InuclElementaryParticle.hh"
    2843#include "G4LorentzConvertor.hh"
    29 #include "G4ParticleLargerEkin.hh"
    30 #include <algorithm>
    31 
    32 typedef std::vector<G4InuclElementaryParticle>::iterator particleIterator;
    33 typedef std::vector<G4InuclNuclei>::iterator nucleiIterator;
    34          
     44#include "G4NonEquilibriumEvaporator.hh"
     45
     46
    3547G4InuclCollider::G4InuclCollider()
    36   : verboseLevel(0) {
    37 
    38   if (verboseLevel > 3) {
    39     G4cout << " >>> G4InuclCollider::G4InuclCollider" << G4endl;
    40   }
     48  : G4VCascadeCollider("G4InuclCollider"),
     49    theElementaryParticleCollider(new G4ElementaryParticleCollider),
     50    theIntraNucleiCascader(new G4IntraNucleiCascader),
     51    theNonEquilibriumEvaporator(new G4NonEquilibriumEvaporator),
     52    theEquilibriumEvaporator(new G4EquilibriumEvaporator),
     53    theBigBanger(new G4BigBanger) {}
     54
     55G4InuclCollider::~G4InuclCollider() {
     56  delete theElementaryParticleCollider;
     57  delete theIntraNucleiCascader;
     58  delete theNonEquilibriumEvaporator;
     59  delete theEquilibriumEvaporator;
     60  delete theBigBanger;
    4161}
    4262
    43 G4CollisionOutput G4InuclCollider::collide(G4InuclParticle* bullet,
    44                                            G4InuclParticle* target) {
    45 
    46   verboseLevel = 0;
     63
     64void G4InuclCollider::collide(G4InuclParticle* bullet, G4InuclParticle* target,
     65                              G4CollisionOutput& globalOutput) {
    4766  if (verboseLevel > 3) {
    4867    G4cout << " >>> G4InuclCollider::collide" << G4endl;
     
    5170  const G4int itry_max = 1000;
    5271                     
    53   G4CollisionOutput globalOutput;
    54   G4InuclElementaryParticle* particle1 =
    55     dynamic_cast<G4InuclElementaryParticle*>(bullet);
    56   G4InuclElementaryParticle* particle2 =
    57     dynamic_cast<G4InuclElementaryParticle*>(target);
    58  
    59   if (particle1 && particle2) { // particle + particle (NOTE: also the h + H(1,1) treated here)
     72  if (useEPCollider(bullet,target)) {
    6073    if (verboseLevel > 2) {
    61       particle1->printParticle();
    62       particle2->printParticle();
     74      bullet->printParticle();
     75      target->printParticle();
    6376    }
    6477
    65     globalOutput = theElementaryParticleCollider->collide(bullet, target);
    66 
     78    theElementaryParticleCollider->collide(bullet, target, globalOutput);
    6779  } else { // needs to call all machinery       
    6880    G4LorentzConvertor convertToTargetRestFrame;
    69     G4InteractionCase interCase = bulletTargetSetter(bullet, target);
    70     G4int intcase = interCase.getInterCase();
    71      
    72     if (intcase > 0) { // ok
     81
     82    interCase.set(bullet,target);
     83    if (interCase.valid()) { // ok
    7384      G4InuclNuclei* ntarget =
    7485        dynamic_cast<G4InuclNuclei*>(interCase.getTarget());
    7586
    76       convertToTargetRestFrame.setTarget(ntarget->getMomentum(),
    77                                          ntarget->getMass());
     87      convertToTargetRestFrame.setTarget(ntarget);
    7888      G4int btype = 0;
    7989      G4double ab = 0.0;
     
    8292      G4double zt = ntarget->getZ();
    8393       
    84       if (intcase == 1) { // particle with nuclei
     94      if (interCase.hadNucleus()) { // particle with nuclei
    8595        G4InuclElementaryParticle* pbullet =
    8696          dynamic_cast<G4InuclElementaryParticle*>(interCase.getBullet());
    8797         
    88         if (pbullet->photon()) {
    89           G4cout << " InuclCollider -> can not collide with photon " << G4endl;
     98        if (pbullet->isPhoton()) {
     99          G4cerr << " InuclCollider -> can not collide with photon " << G4endl;
    90100
    91101          globalOutput.trivialise(bullet, target);
    92 
    93           return globalOutput;
     102          return;
    94103        } else {
    95           convertToTargetRestFrame.setBullet(pbullet->getMomentum(),
    96                                              pbullet->getMass());   
     104          convertToTargetRestFrame.setBullet(pbullet);   
    97105          btype = pbullet->type();
    98106        };
     
    102110          dynamic_cast<G4InuclNuclei*>(interCase.getBullet());
    103111
    104         convertToTargetRestFrame.setBullet(nbullet->getMomentum(),
    105                                            nbullet->getMass());   
     112        convertToTargetRestFrame.setBullet(nbullet);   
    106113        ab = nbullet->getA();
    107114        zb = nbullet->getZ();
     
    121128        }
    122129
    123         G4CascadeMomentum bmom;
    124 
    125         bmom[3] = convertToTargetRestFrame.getTRSMomentum();
    126 
    127         G4InuclNuclei ntarget(at, zt);
    128         G4CascadeMomentum tmom;
    129 
    130         ntarget.setMomentum(tmom);
    131         ntarget.setEnergy();
    132         theIntraNucleiCascader->setInteractionCase(intcase);
     130        G4LorentzVector bmom;
     131        bmom.setZ(convertToTargetRestFrame.getTRSMomentum());
     132
     133        G4InuclNuclei ntarget(at, zt);          // Default is at rest
     134
     135        theIntraNucleiCascader->setInteractionCase(interCase.code());
    133136         
    134137        G4bool bad = true;
    135138        G4int itry = 0;
    136139         
     140        G4CollisionOutput TRFoutput;
     141        G4CollisionOutput output;
    137142        while (bad && itry < itry_max) {
    138           G4CollisionOutput TRFoutput;
    139           G4CollisionOutput output;
    140 
    141143          itry++;
    142           if (intcase == 1) {
     144
     145          output.reset();       // Clear buffers for this attempt
     146          TRFoutput.reset();
     147
     148          if (interCase.hadNucleus()) {
    143149            G4InuclElementaryParticle pbullet(bmom, btype);
    144150
    145             output = theIntraNucleiCascader->collide(&pbullet, &ntarget);
     151            theIntraNucleiCascader->collide(&pbullet, &ntarget, output);
    146152          } else {
    147             G4InuclNuclei nbullet(ab, zb);
    148             nbullet.setMomentum(bmom);
    149             nbullet.setEnergy();
    150             output = theIntraNucleiCascader->collide(&nbullet, &ntarget);
     153            G4InuclNuclei nbullet(bmom, ab, zb);
     154            theIntraNucleiCascader->collide(&nbullet, &ntarget, output);
    151155          };   
    152156
    153157          if (verboseLevel > 3) {
    154158            G4cout << " After Cascade " << G4endl;
    155 
    156159            output.printCollisionOutput();
    157160          }
    158161         
    159162          // the rest, if any
     163          // FIXME:  The code below still does too much copying!
    160164          TRFoutput.addOutgoingParticles(output.getOutgoingParticles());
    161165
    162           if (output.numberOfNucleiFragments() == 1) { // there is smth. after     
     166          if (output.numberOfNucleiFragments() == 1) { // there is smth. after
    163167            G4InuclNuclei cascad_rec_nuclei = output.getNucleiFragments()[0];
    164168            if (explosion(&cascad_rec_nuclei)) {
     
    167171              };
    168172
    169               output = theBigBanger->collide(0,&cascad_rec_nuclei);
    170               TRFoutput.addOutgoingParticles(output.getOutgoingParticles());
     173              theBigBanger->collide(0,&cascad_rec_nuclei, TRFoutput);
    171174            } else {
    172               output = theNonEquilibriumEvaporator->collide(0, &cascad_rec_nuclei);
     175              output.reset();
     176              theNonEquilibriumEvaporator->collide(0, &cascad_rec_nuclei, output);
    173177
    174178              if (verboseLevel > 3) {
     
    179183              TRFoutput.addOutgoingParticles(output.getOutgoingParticles());
    180184              G4InuclNuclei exiton_rec_nuclei = output.getNucleiFragments()[0];
    181               output = theEquilibriumEvaporator->collide(0, &exiton_rec_nuclei);
     185
     186              output.reset();
     187              theEquilibriumEvaporator->collide(0, &exiton_rec_nuclei, output);
    182188
    183189              if (verboseLevel > 3) {
    184190                G4cout << " After EquilibriumEvaporator " << G4endl;
    185 
    186191                output.printCollisionOutput();
    187192              };
    188193
    189194              TRFoutput.addOutgoingParticles(output.getOutgoingParticles()); 
    190               TRFoutput.addTargetFragments(output.getNucleiFragments());         
     195              TRFoutput.addTargetFragments(output.getNucleiFragments());
    191196            };
    192197          };
    193198         
    194           // convert to the LAB       
    195           G4bool withReflection = convertToTargetRestFrame.reflectionNeeded();       
    196           std::vector<G4InuclElementaryParticle> particles =
    197             TRFoutput.getOutgoingParticles();
    198 
    199           if (!particles.empty()) {
    200             particleIterator ipart;
    201             for(ipart = particles.begin(); ipart != particles.end(); ipart++) {
    202               G4CascadeMomentum mom = ipart->getMomentum();
    203 
    204               if (withReflection) mom[3] = -mom[3];
    205               mom = convertToTargetRestFrame.rotate(mom);
    206               ipart->setMomentum(mom);
    207               mom = convertToTargetRestFrame.backToTheLab(ipart->getMomentum());
    208               ipart->setMomentum(mom);
    209             };
    210             std::sort(particles.begin(), particles.end(), G4ParticleLargerEkin());
    211           };
    212            
    213           std::vector<G4InuclNuclei> nucleus = TRFoutput.getNucleiFragments();
    214 
    215           if (!nucleus.empty()) {
    216             nucleiIterator inuc;
    217 
    218             for (inuc = nucleus.begin(); inuc != nucleus.end(); inuc++) {
    219               G4CascadeMomentum mom = inuc->getMomentum();
    220 
    221               if (withReflection) mom[3] = -mom[3];
    222               mom = convertToTargetRestFrame.rotate(mom);
    223               inuc->setMomentum(mom);
    224               inuc->setEnergy();
    225               mom = convertToTargetRestFrame.backToTheLab(inuc->getMomentum());
    226               inuc->setMomentum(mom);
    227               inuc->setEnergy();
    228             };
    229           };
    230           globalOutput.addOutgoingParticles(particles);
    231           globalOutput.addTargetFragments(nucleus);
     199          // convert to the LAB
     200          TRFoutput.boostToLabFrame(convertToTargetRestFrame);
     201
     202          globalOutput.addOutgoingParticles(TRFoutput.getOutgoingParticles());
     203          globalOutput.addTargetFragments(TRFoutput.getNucleiFragments());
    232204          globalOutput.setOnShell(bullet, target);
    233           if(globalOutput.acceptable()) {
    234 
    235             return globalOutput;
    236           } else {
    237             globalOutput.reset();
    238           };
     205          if (globalOutput.acceptable()) return;
     206
     207          globalOutput.reset();         // Clear and try again
    239208        };
    240209
     
    243212                 << itry_max << " attempts " << G4endl;
    244213        }
    245 
    246         globalOutput.trivialise(bullet, target);
    247 
    248         return globalOutput;       
    249214      } else {
    250 
    251215        if (verboseLevel > 3) {
    252216          G4cout << " InuclCollider -> inelastic interaction is impossible " << G4endl
    253217                 << " due to the coulomb barirer " << G4endl;
    254218        }
    255 
    256         globalOutput.trivialise(bullet, target);
    257 
    258         return globalOutput;
    259       };
    260        
     219      }
     220
     221      globalOutput.trivialise(bullet, target);
     222      return;
    261223    } else {
    262 
    263224      if (verboseLevel > 3) {
    264         G4cout << " InuclCollider -> inter case " << intcase << G4endl;
     225        G4cout << " InuclCollider -> inter case " << interCase.code() << G4endl;
    265226      };
    266227    };       
    267228  };
    268229
    269   return globalOutput;
     230  return;
    270231}
    271                      
    272 G4bool G4InuclCollider::inelasticInteractionPossible(G4InuclParticle* bullet,
    273                                                      G4InuclParticle* target,
    274                                                      G4double ekin) const {
    275 
    276   if (verboseLevel > 3) {
    277     G4cout << " >>> G4InuclCollider::inelasticInteractionPossible" << G4endl;
    278   }
    279 
    280   const G4double coeff = 0.001 * 1.2;
    281   const G4double one_third = 1.0 / 3.0;
    282 
    283   G4bool possible = true;
    284   G4double at;
    285   G4double zt;
    286   G4double ab;
    287   G4double zb;
    288 
    289   if (G4InuclNuclei* nuclei_target = dynamic_cast<G4InuclNuclei*>(target)) {
    290     at = nuclei_target->getA();
    291     zt = nuclei_target->getZ();
    292     if (G4InuclNuclei* nuclei_bullet = dynamic_cast<G4InuclNuclei*>(bullet)) {
    293       ab = nuclei_bullet->getA();
    294       zb = nuclei_bullet->getZ();     
    295     } else {
    296       G4InuclElementaryParticle* particle =
    297         dynamic_cast<G4InuclElementaryParticle*>(bullet);
    298 
    299       ab = 1;
    300       zb = particle->getCharge();
    301     };
    302   } else {
    303     if(G4InuclNuclei* nuclei_bullet = dynamic_cast<G4InuclNuclei*>(bullet)) {
    304       ab = nuclei_bullet->getA();
    305       zb = nuclei_bullet->getZ();     
    306 
    307       G4InuclElementaryParticle* particle =
    308         dynamic_cast<G4InuclElementaryParticle*>(target);
    309 
    310       at = 1;
    311       zt = particle->getCharge();   
    312     } else {
    313 
    314       return possible;
    315     }; 
    316   };
    317 
    318   // VCOL used  for testing if elastic collision possible
    319   G4double VCOL = coeff * zt * zb / (std::pow(at, one_third) + std::pow(ab, one_third));
    320 
    321   // possible = VCOL < ekin; // NOTE: inelastic collision if not true
    322   possible = true; // we force elastic
    323 
    324   if (verboseLevel > 3) {
    325     G4cout << " >>> G4InuclCollider::inelasticInteractionPossible" << G4endl;
    326     G4cout << " VCOL: " << VCOL << " ekin: " << ekin << " inelastic possible: " << possible << G4endl;
    327   }
    328 
    329   return possible;
    330 
    331 }
    332        
    333 G4InteractionCase G4InuclCollider::bulletTargetSetter(G4InuclParticle* bullet,
    334                                                       G4InuclParticle* target) const {
    335 
    336   if (verboseLevel > 3) {
    337     G4cout << " >>> G4InuclCollider::bulletTargetSetter" << G4endl;
    338   }
    339 
    340   G4InteractionCase interCase;
    341 
    342   if (G4InuclNuclei* nuclei_target = dynamic_cast<G4InuclNuclei*>(target)) {     
    343     if (G4InuclNuclei* nuclei_bullet = dynamic_cast<G4InuclNuclei*>(bullet)) { // A + A         
    344       interCase.setInterCase(2);
    345       if (nuclei_target->getA() >= nuclei_bullet->getA()) {
    346         interCase.setBulletTarget(bullet, target);
    347       } else {
    348         interCase.setBulletTarget(target, bullet);
    349       };
    350     } else {
    351       interCase.setInterCase(1);
    352       interCase.setBulletTarget(bullet, target);
    353     };
    354   } else {
    355     G4InuclNuclei* nuclei_bullet = dynamic_cast<G4InuclNuclei*>(bullet);
    356     if (nuclei_bullet) {
    357       G4InuclElementaryParticle* part =
    358         dynamic_cast<G4InuclElementaryParticle*>(target);
    359       if (part) {
    360         interCase.setInterCase(1);
    361         interCase.setBulletTarget(target, bullet);
    362       };
    363     };
    364   };
    365 
    366   return interCase;
    367 }       
    368 
    369 G4bool G4InuclCollider::explosion(G4InuclNuclei* target) const {
    370 
    371   if (verboseLevel > 3) {
    372     G4cout << " >>> G4InuclCollider::explosion" << G4endl;
    373   }
    374 
    375   const G4double a_cut = 20.0;
    376   const G4double be_cut = 3.0;
    377 
    378   G4double a = target->getA();
    379   G4double z = target->getZ();
    380   G4double eexs = target->getExitationEnergy();
    381   G4bool explo = true;
    382 
    383   if (a > a_cut) {
    384     explo = false;
    385   } else {
    386     if (eexs < be_cut * bindingEnergy(a, z)) explo = false;
    387   };   
    388 
    389   return explo;
    390 }
    391  
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4InuclEvaporation.cc

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4InuclEvaporation.cc,v 1.18 2010/05/21 18:26:16 mkelsey Exp $
     26// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
    26 // $Id: G4InuclEvaporation.cc,v 1.8 2008/10/24 20:49:07 dennis Exp $
    27 //
     28// 20100114  M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
     29// 20100405  M. Kelsey -- Pass const-ref std::vector<>
     30// 20100413  M. Kelsey -- Pass G4CollisionOutput by ref to ::collide(), use
     31//              const_iterator.
     32// 20100428  M. Kelsey -- Use G4InuclParticleNames enum
     33// 20100429  M. Kelsey -- Change "case gamma:" to "case photon:"
     34// 20100517  M. Kelsey -- Follow new ctors for G4*Collider family.  Make
     35//              G4EvaporationInuclCollider a data member.
     36// 20100520  M. Kelsey -- Simplify collision loop, move momentum rotations to
     37//              G4CollisionOutput, copy G4DynamicParticle directly from
     38//              G4InuclParticle, no switch-block required.  Fix scaling factors.
     39
    2840#include <numeric>
    2941#include "G4IonTable.hh"
     
    4153#include "G4LorentzVector.hh"
    4254#include "G4EquilibriumEvaporator.hh"
    43 #include "G4Fissioner.hh"
    44 #include "G4BigBanger.hh"
    4555#include "G4InuclElementaryParticle.hh"
    4656#include "G4InuclParticle.hh"
    4757#include "G4CollisionOutput.hh"
     58#include "G4InuclParticleNames.hh"
    4859
    49 typedef std::vector<G4InuclElementaryParticle>::iterator particleIterator;
    50 typedef std::vector<G4InuclNuclei>::iterator nucleiIterator;
     60using namespace G4InuclParticleNames;
     61
     62typedef std::vector<G4InuclElementaryParticle>::const_iterator particleIterator;
     63typedef std::vector<G4InuclNuclei>::const_iterator nucleiIterator;
    5164
    5265
    53 G4InuclEvaporation::G4InuclEvaporation() {
    54   verboseLevel=0;
    55 }
     66G4InuclEvaporation::G4InuclEvaporation()
     67  : verboseLevel(0),   evaporator(new G4EvaporationInuclCollider) {}
    5668
    5769G4InuclEvaporation::G4InuclEvaporation(const G4InuclEvaporation &) : G4VEvaporation() {
     
    5971}
    6072
    61 
    6273G4InuclEvaporation::~G4InuclEvaporation() {
     74  delete evaporator;
    6375}
    6476
     
    8193}
    8294
    83 G4FragmentVector * G4InuclEvaporation::BreakItUp(const G4Fragment &theNucleus) {
    84  
    85   enum particleType { nuclei = 0, proton = 1, neutron = 2, pionPlus = 3,
    86                       pionMinus = 5, pionZero = 7, photon = 10,
    87                       kaonPlus = 11, kaonMinus = 13, kaonZero = 15,
    88                       kaonZeroBar = 17, lambda = 21, sigmaPlus = 23,
    89                       sigmaZero = 25, sigmaMinus = 27, xiZero = 29, xiMinus = 31 }; 
    90 
    91   std::vector< G4DynamicParticle * > secondaryParticleVector;
    92   G4FragmentVector * theResult = new G4FragmentVector;
     95G4FragmentVector* G4InuclEvaporation::BreakItUp(const G4Fragment &theNucleus) {
     96  G4FragmentVector* theResult = new G4FragmentVector;
    9397
    9498  if (theNucleus.GetExcitationEnergy() <= 0.0) { // Check that Excitation Energy > 0
     
    100104  G4double Z = theNucleus.GetZ();
    101105  G4double mTar  = G4NucleiProperties::GetNuclearMass(A, Z); // Mass of the target nucleus
    102   G4LorentzVector tmp =theNucleus.GetMomentum();
    103106
    104   G4ThreeVector momentum = tmp.vect();
     107  G4ThreeVector momentum =  theNucleus.GetMomentum().vect() / GeV;
    105108  //  G4double energy = tmp.e();
    106109  G4double exitationE = theNucleus.GetExcitationEnergy();
     
    108111  // Move to CMS frame, save initial velocity of the nucleus to boostToLab vector.
    109112  //   G4ThreeVector boostToLab( ( 1/G4NucleiProperties::GetNuclearMass( A, Z ) ) * momentum );
    110   G4InuclNuclei* tempNuc = new G4InuclNuclei(A, Z);
    111   G4double mass=tempNuc->getMass()*1000;
    112   G4ThreeVector boostToLab( ( 1/mass) * momentum );
     113
     114  G4double mass = mTar / GeV;
     115  G4ThreeVector boostToLab( momentum/mass );
    113116
    114117  if ( verboseLevel > 2 )
     
    122125
    123126  G4InuclNuclei* nucleus = new G4InuclNuclei(A, Z);
    124   nucleus->setExitationEnergy(exitationE/1000);
    125   G4CascadeMomentum tmom;
    126   nucleus->setMomentum(tmom);
    127   nucleus->setEnergy();
     127  nucleus->setExitationEnergy(exitationE);
    128128
    129   G4EquilibriumEvaporator*          eqil = new G4EquilibriumEvaporator;
    130   G4Fissioner*                      fiss = new G4Fissioner;
    131   G4BigBanger*                      bigb = new G4BigBanger;
    132   G4EvaporationInuclCollider* evaporator = new G4EvaporationInuclCollider(eqil, fiss, bigb);
    133129  G4CollisionOutput output;
     130  evaporator->collide(0, nucleus, output);
    134131
    135   output = evaporator->collide(0, nucleus);
     132  const std::vector<G4InuclNuclei>& nucleiFragments = output.getNucleiFragments();
     133  const std::vector<G4InuclElementaryParticle>& particles = output.getOutgoingParticles();
    136134
    137   std::vector<G4InuclNuclei>             nucleiFragments = output.getNucleiFragments();
    138   std::vector<G4InuclElementaryParticle> particles =       output.getOutgoingParticles();
     135  G4double eTot=0.0;
     136  G4int  i=1;
    139137
    140   G4double ekin,emas;
    141   G4double eTot=0.0;
    142   G4DynamicParticle* cascadeParticle = 0;
    143   G4int  i=1;
    144   //G4cout << "# particles: " << output.getOutgoingParticles().size() << G4endl;
    145138  if (!particles.empty()) {
    146     particleIterator ipart;
    147     G4int outgoingParticle;
    148 
    149     for (ipart = particles.begin(); ipart != particles.end(); ipart++) {
    150      
    151       outgoingParticle = ipart->type();
     139    G4int outgoingType;
     140    particleIterator ipart = particles.begin();
     141    for (; ipart != particles.end(); ipart++) {
     142      outgoingType = ipart->type();
    152143
    153144      if (verboseLevel > 2) {
    154         G4cout << "Evaporated particle:  " << i << " of type: " << outgoingParticle << G4endl;
     145        G4cout << "Evaporated particle:  " << i << " of type: " << outgoingType << G4endl;
    155146        i++;
    156147        //              ipart->printParticle();
    157148      }
    158149
    159       const G4CascadeMomentum& mom = ipart->getMomentum();
    160       eTot   += std::sqrt(mom[0]*1000 * mom[0]*1000);
     150      eTot += ipart->getEnergy();
     151     
     152      G4LorentzVector vlab = ipart->getMomentum().boost(boostToLab);
    161153
    162       ekin = ipart->getKineticEnergy()*1000;
    163       emas = ipart->getMass()*1000;
    164 
    165       G4ThreeVector aMom(mom[1]*1000, mom[2]*1000, mom[3]*1000);
    166 
    167       G4LorentzVector v(aMom, (ekin+emas));
    168       v.boost( boostToLab );
    169 
    170       switch(outgoingParticle) {
    171 
    172       case proton:
    173         cascadeParticle = new G4DynamicParticle(G4Proton::ProtonDefinition(), v.vect(), v.e());
    174         break;
    175 
    176       case neutron:
    177         cascadeParticle = new G4DynamicParticle(G4Neutron::NeutronDefinition(), v.vect(), v.e());
    178         break;
    179 
    180       case photon:
    181         cascadeParticle = new G4DynamicParticle(G4Gamma::Gamma(), v.vect(), v.e());
    182         break;
    183       default:
    184         G4cout << " ERROR: GInuclEvapration::Propagate undefined particle type" << G4endl;
    185       };
    186 
    187       secondaryParticleVector.push_back( cascadeParticle );
     154      theResult->push_back( new G4Fragment(vlab, ipart->getDefinition()) );
    188155      //      theResult.AddSecondary(cascadeParticle);
    189156    } 
    190157  }
    191   fillResult( secondaryParticleVector, theResult);
    192  
    193158
    194159  //  G4cout << "# fragments " << output.getNucleiFragments().size() << G4endl;
    195160  i=1;
    196161  if (!nucleiFragments.empty()) {
    197     nucleiIterator ifrag;
    198 
    199     for (ifrag = nucleiFragments.begin(); ifrag != nucleiFragments.end(); ifrag++) {
    200 
    201       ekin = ifrag->getKineticEnergy()*1000;
    202       emas = ifrag->getMass()*1000;
    203       const G4CascadeMomentum& mom = ifrag->getMomentum();
    204       eTot  += std::sqrt(mom[0]*1000 * mom[0]*1000);
    205 
    206       G4ThreeVector aMom(mom[1]*1000, mom[2]*1000, mom[3]*1000);
    207       //      aMom = aMom.unit();
    208 
    209       G4LorentzVector v(aMom, (ekin+emas));
    210       v.boost( boostToLab );
    211 
     162    nucleiIterator ifrag = nucleiFragments.begin();
     163    for (; ifrag != nucleiFragments.end(); ifrag++) {
    212164      if (verboseLevel > 2) {
    213165        G4cout << " Nuclei fragment: " << i << G4endl; i++;
    214         //      ifrag->printParticle();
    215166      }
    216167
     168      eTot += ifrag->getEnergy();
     169
     170      G4LorentzVector vlab = ifrag->getMomentum().boost(boostToLab);
     171 
    217172      G4int A = G4int(ifrag->getA());
    218173      G4int Z = G4int(ifrag->getZ());
    219       //        cascadeParticle = new G4DynamicParticle(G4Proton::ProtonDefinition(), v.vect(), v.e());
    220174      if (verboseLevel > 2) {
    221         G4cout << "boosted v" << v << G4endl;
     175        G4cout << "boosted v" << vlab << G4endl;
    222176      }
    223       // theResult->push_back( new G4Fragment(A, Z, tmp) );
    224       theResult->push_back( new G4Fragment(A, Z, v) );
     177      theResult->push_back( new G4Fragment(A, Z, vlab) );
    225178    }
    226179  }
     
    229182  return theResult;
    230183}
    231 
    232 void G4InuclEvaporation::fillResult( std::vector<G4DynamicParticle *> secondaryParticleVector,
    233                                      G4FragmentVector * aResult )
    234 {
    235   // Fill the vector pParticleChange with secondary particles stored in vector.
    236   for ( size_t i = 0 ; i < secondaryParticleVector.size() ; i++ )
    237     {
    238       G4int aZ = static_cast<G4int> (secondaryParticleVector[i]->GetDefinition()->GetPDGCharge() );
    239       G4int aA = static_cast<G4int> (secondaryParticleVector[i]->GetDefinition()->GetBaryonNumber());
    240       G4LorentzVector aMomentum = secondaryParticleVector[i]->Get4Momentum();
    241       if(aA>0) {
    242         aResult->push_back( new G4Fragment(aA, aZ, aMomentum) );
    243       } else {
    244         aResult->push_back( new G4Fragment(aMomentum, secondaryParticleVector[i]->GetDefinition()) );
    245       }
    246     }
    247   return;
    248 }
    249 
    250 
    251 
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4InuclSpecialFunctions.cc

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4InuclSpecialFunctions.cc,v 1.19 2010/03/19 05:03:23 mkelsey Exp $
     26// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100114  M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
     29
    2630#include "G4InuclSpecialFunctions.hh"
     31#include "G4LorentzVector.hh"
     32#include "G4ThreeVector.hh"
    2733#include "Randomize.hh"
     34#include <cmath>
    2835
    2936G4double G4InuclSpecialFunctions::getAL(G4double A) {
     
    3441  }
    3542
    36   return 0.76 + 2.2 / std::pow(A, 0.333333);
     43  return 0.76 + 2.2 / G4cbrt(A);
    3744}
    3845
     
    8491
    8592  const G4double C = 55.4;
    86   G4double Ef;
     93  G4double arg = (ntype==0) ? (A-Z)/A : Z/A;
    8794
    88   if (ntype == 0) {
    89     Ef = C * std::pow((A - Z) / A, 0.666667);
     95  return C * G4cbrt(arg*arg);   // 2/3 power
     96}
    9097
    91   } else {
    92     Ef = C * std::pow(Z / A, 0.666667);
    93   };
    94 
    95   return Ef;
     98G4double G4InuclSpecialFunctions::G4cbrt(G4double x) {
     99  return x==0 ? 0. : (x<0?-1.:1.)*std::exp(std::log(std::fabs(x))/3.);
    96100}
    97101
     
    150154}
    151155
    152 G4CascadeMomentum G4InuclSpecialFunctions::generateWithFixedTheta(G4double ct,
    153                                                                         G4double p) {
    154   G4int verboseLevel = 2;
    155 
     156G4LorentzVector
     157G4InuclSpecialFunctions::generateWithFixedTheta(G4double ct, G4double p,
     158                                                G4double m) {
     159  const G4int verboseLevel = 0;
    156160  if (verboseLevel > 3) {
    157161    G4cout << " >>> G4InuclSpecialFunctions::generateWithFixedTheta" << G4endl;
    158162  }
    159163
    160   G4CascadeMomentum momr;
    161164  G4double phi = randomPHI();
    162165  G4double pt = p * std::sqrt(std::fabs(1.0 - ct * ct));
    163   //  not used:  G4CascadeMomentum mom1;
    164   momr[1] = pt * std::cos(phi);
    165   momr[2] = pt * std::sin(phi);
    166   momr[3] = p * ct;
     166
     167  static G4ThreeVector pvec;    // Buffers to avoid memory thrashing
     168  static G4LorentzVector momr;
     169
     170  pvec.set(pt*std::cos(phi), pt*std::sin(phi), p*ct);
     171  momr.setVectM(pvec, m);
    167172
    168173  return momr;
    169174}
     175
     176G4LorentzVector
     177G4InuclSpecialFunctions::generateWithRandomAngles(G4double p, G4double m) {
     178  std::pair<G4double, G4double> COS_SIN = randomCOS_SIN();
     179  G4double phi = randomPHI();
     180  G4double pt = p * COS_SIN.second;
     181 
     182  static G4ThreeVector pvec;    // Buffers to avoid memory thrashing
     183  static G4LorentzVector momr;
     184
     185  pvec.set(pt*std::cos(phi), pt*std::sin(phi), p*COS_SIN.first);
     186  momr.setVectM(pvec, m);
     187
     188  return momr;
     189}
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4LorentzConvertor.cc

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4LorentzConvertor.cc,v 1.23 2010/05/21 17:56:34 mkelsey Exp $
     26// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100108  Michael Kelsey -- Use G4LorentzVector internally
     29// 20100112  M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
     30// 20100308  M. Kelsey -- Bug fix in toTheTargetRestFrame: scm_momentum should
     31//              be data member, not local.
     32// 20100409  M. Kelsey -- Protect std::sqrt(ga) against round-off negatives
     33// 20100519  M. Kelsey -- Add interfaces to pass G4InuclParticles directly
     34
    2635#include "G4LorentzConvertor.hh"
     36#include "G4ThreeVector.hh"
    2737#include "G4HadronicException.hh"
     38#include "G4InuclParticle.hh"
     39
     40
     41const G4double G4LorentzConvertor::small = 1.0e-10;
    2842
    2943G4LorentzConvertor::G4LorentzConvertor()
    30   : verboseLevel(2), degenerated(false) {
     44  : verboseLevel(0), degenerated(false) {
    3145
    3246  if (verboseLevel > 3) {
     
    3549}
    3650
     51// Extract four-vectors from input particles
     52void G4LorentzConvertor::setBullet(const G4InuclParticle* bullet) {
     53  setBullet(bullet->getMomentum());
     54}
     55
     56void G4LorentzConvertor::setTarget(const G4InuclParticle* target) {
     57  setTarget(target->getMomentum());
     58}
     59
     60// Boost bullet and target four-vectors into destired frame
     61
    3762void G4LorentzConvertor::toTheCenterOfMass() {
    38    
    3963  if (verboseLevel > 3) {
    4064    G4cout << " >>> G4LorentzConvertor::toTheCenterOfMass" << G4endl;
    4165  }
    4266
    43   const G4double small = 1.0e-10;
    44 
    45   v2 = 0.0;
    46 
    47   G4double pv = 0.0;
    48 
    49    G4double e_sum = target_mom[0] + bullet_mom[0];
    50 
    51   velocity.resize(4);
    52   G4int i(0);
    53   for(i = 1; i < 4; i++) {
    54     velocity[i] = (target_mom[i] + bullet_mom[i]) / e_sum;
    55     v2 += velocity[i] * velocity[i];
    56     pv += target_mom[i] * velocity[i];
    57   };
    58    
    59   gamma = 1.0 / std::sqrt(std::fabs(1.0 - v2));
    60   ecm_tot = e_sum / gamma;
    61 
    62   G4double pa = 0.0;
    63 
    64   G4double pb = 0.0;
    65 
    66   G4double xx = pv * (gamma - 1.0) / v2 - target_mom[0] * gamma;
    67 
    68   for(i = 1; i < 4; i++) {
    69     scm_momentum[i] = -target_mom[i] - velocity[i] * xx;
    70 
    71     if (verboseLevel > 3) {
    72       G4cout << " i " << i << " pscm(i) " << scm_momentum[i] << G4endl;
    73     }
    74 
    75     pa += scm_momentum[i] * scm_momentum[i];
    76     pb += scm_momentum[i] * velocity[i];
    77   };
    78   ga = v2 - pb * pb / pa;
    79   if(ga < small) {
    80     ga = small;
    81     degenerated = true;
    82 
    83     if (verboseLevel > 3) {
    84       G4cout << " degenerated case " << G4endl;
    85     }
    86 
    87   } else {
    88     ga = std::sqrt(ga);
    89   };
    90 
    91   if (verboseLevel > 3) {
    92     G4cout << " ga " << ga << " v2 " << v2 << " pb " << pb <<
    93       " pb * pb / pa " << pb * pb / pa << " pv " << pv << G4endl;
    94   }
    95 
    96   pscm = std::sqrt(pa);
     67  G4LorentzVector cm4v = target_mom + bullet_mom;
     68  velocity = cm4v.boostVector();
     69
     70  // "SCM" is reverse target momentum in the CM frame
     71  scm_momentum = target_mom;
     72  scm_momentum.boost(-velocity);
     73  scm_momentum.setVect(-scm_momentum.vect());
     74
     75  if (verboseLevel > 3)
     76    G4cout << " i 1 pscm(i) " << scm_momentum.x() << G4endl
     77           << " i 2 pscm(i) " << scm_momentum.y() << G4endl
     78           << " i 3 pscm(i) " << scm_momentum.z() << G4endl;
     79
     80  // Compute kinematic quantities for rotate() functions
     81  v2 = velocity.mag2();
     82  gamma = cm4v.e()/cm4v.m();
     83
     84  ecm_tot = cm4v.m();
     85
     86  G4double pscm = scm_momentum.rho();
     87  G4double pa   = scm_momentum.vect().mag2();
     88  G4double pb   = scm_momentum.vect().dot(velocity);
     89
     90  G4double gasq = v2-pb*pb/pa;
     91  ga = (gasq > small*small) ? std::sqrt(gasq) : 0.;
     92
    9793  gb = pb / pscm;
    9894  gbpp = gb / pscm;
    9995  gapp = ga * pscm;
    100 }
    101 
    102 G4CascadeMomentum G4LorentzConvertor::rotate(const G4CascadeMomentum& mom) const {
    103 
    104   if (verboseLevel > 3) {
    105     G4cout << " >>> G4LorentzConvertor::rotate(G4CascadeMomentum)" << G4endl;
    106   }
    107 
    108   G4CascadeMomentum mom_rot;
    109 
    110   if (verboseLevel > 3) {
    111     G4cout << " ga " << ga << " gbpp " << gbpp << " gapp " << gapp << G4endl; 
    112     G4cout << " gegenerated " << degenerated << G4endl;
    113     G4cout << " before rotation: px " << mom[1] << " py " << mom[2] <<
    114       " pz " << mom[3] << G4endl;
    115   }
    116 
    117   if(degenerated) {
    118     mom_rot = mom;
    119   } else {
    120     mom_rot[1] = mom[1] * (velocity[1] - gbpp * scm_momentum[1]) / ga +
    121       mom[2] * (scm_momentum[2] * velocity[3] - scm_momentum[3] * velocity[2]) / gapp +
    122       mom[3] * scm_momentum[1] / pscm;
    123     mom_rot[2] = mom[1] * (velocity[2] - gbpp * scm_momentum[2]) / ga +
    124       mom[2] * (scm_momentum[3] * velocity[1] - scm_momentum[1] * velocity[3]) / gapp +
    125       mom[3] * scm_momentum[2] / pscm;
    126     mom_rot[3] = mom[1] * (velocity[3] - gbpp * scm_momentum[3]) / ga +
    127       mom[2] * (scm_momentum[1] * velocity[2] - scm_momentum[2] * velocity[1]) / gapp +
    128       mom[3] * scm_momentum[3] / pscm;
     96
     97  degenerated = (ga < small);
     98  if (degenerated && verboseLevel > 3)
     99    G4cout << " degenerated case " << G4endl;
     100
     101  if (verboseLevel > 3) {
     102    G4double pv = target_mom.vect().dot(velocity);
     103    G4cout << " ga " << ga << " v2 " << v2 << " pb " << pb
     104           << " pb * pb / pa " << pb * pb / pa << " pv " << pv << G4endl;
     105  }
     106}
     107
     108void G4LorentzConvertor::toTheTargetRestFrame() {
     109  if (verboseLevel > 3) {
     110    G4cout << " >>> G4LorentzConvertor::toTheTargetRestFrame" << G4endl;
     111  }
     112
     113  velocity = target_mom.boostVector();
     114
     115  // "SCM" is bullet momentum in the target's frame
     116  scm_momentum = bullet_mom;
     117  scm_momentum.boost(-velocity);
     118
     119  if (verboseLevel > 3)
     120    G4cout << " rf: i 1 pscm(i) " << scm_momentum.x() << G4endl
     121           << " rf: i 2 pscm(i) " << scm_momentum.y() << G4endl
     122           << " rf: i 3 pscm(i) " << scm_momentum.z() << G4endl;
     123
     124  // Compute kinematic quantities for rotate() functions
     125  v2 = velocity.mag2();
     126  gamma = target_mom.e() / target_mom.m();
     127
     128  G4double pscm = scm_momentum.rho();
     129  G4double pa   = scm_momentum.vect().mag2();
     130  G4double pb   = velocity.dot(scm_momentum.vect());
     131
     132  G4double gasq = v2-pb*pb/pa;
     133  ga = (gasq > small*small) ? std::sqrt(gasq) : 0.;
     134
     135  gb = pb/pscm;
     136  gbpp = gb/pscm;
     137  gapp = ga*pscm;
     138
     139  degenerated = (ga < small);
     140  if (degenerated && verboseLevel > 3)
     141    G4cout << " degenerated case " << G4endl;
     142}
     143
     144G4LorentzVector
     145G4LorentzConvertor::backToTheLab(const G4LorentzVector& mom) const {
     146  if (verboseLevel > 3) {
     147    G4cout << " >>> G4LorentzConvertor::backToTheLab" << G4endl
     148           << " at rest: px " << mom.x() << " py " << mom.y() << " pz "
     149           << mom.z() << " e " << mom.e() << G4endl
     150           << " v2 " << v2 << G4endl;
     151  }
     152
     153  G4LorentzVector mom1 = mom;
     154  if (v2 > small) mom1.boost(velocity);
     155
     156  if (verboseLevel > 3)
     157    G4cout << " at lab: px " << mom1.x() << " py " << mom1.y() << " pz "
     158           << mom1.z() << G4endl;
     159
     160  return mom1;
     161}
     162
     163
     164// Bullet kinematics in target rest frame (LAB frame, usually)
     165
     166G4double G4LorentzConvertor::getKinEnergyInTheTRS() const {
     167  G4double pv = bullet_mom.vect().dot(target_mom.vect());
     168 
     169   G4double ekin_trf =
     170    (target_mom.e() * bullet_mom.e() - pv) / target_mom.m()
     171    - bullet_mom.m();
     172 
     173  return ekin_trf;
     174}
     175
     176G4double G4LorentzConvertor::getTRSMomentum() const {
     177  G4LorentzVector bmom = bullet_mom;
     178  bmom.boost(-target_mom.boostVector());
     179  return bmom.rho();
     180}
     181
     182G4LorentzVector G4LorentzConvertor::rotate(const G4LorentzVector& mom) const {
     183  if (verboseLevel > 3) {
     184    G4cout << " >>> G4LorentzConvertor::rotate(G4LorentzVector)" << G4endl
     185           << " ga " << ga << " gbpp " << gbpp << " gapp " << gapp << G4endl
     186           << " degenerated " << degenerated << G4endl
     187           << " before rotation: px " << mom.x() << " py " << mom.y()
     188           << " pz " << mom.z() << G4endl;
     189  }
     190
     191  G4LorentzVector mom_rot = mom;
     192  if (!degenerated) {
     193    G4ThreeVector vscm = velocity - gbpp*scm_momentum.vect();
     194    G4ThreeVector vxcm = scm_momentum.vect().cross(velocity);
     195
     196    mom_rot.setVect(mom.x()*vscm/ga + mom.y()*vxcm/gapp +
     197                    mom.z()*scm_momentum.vect().unit() );
    129198  };
    130199
    131200  if (verboseLevel > 3) {
    132     G4cout << " after rotation: px " << mom_rot[1] << " py " << mom_rot[2] <<
    133       " pz " << mom_rot[3] << G4endl;
     201    G4cout << " after rotation: px " << mom_rot.x() << " py " << mom_rot.y()
     202           << " pz " << mom_rot.z() << G4endl;
    134203  }
    135204
     
    137206}
    138207
    139 G4CascadeMomentum G4LorentzConvertor::rotate(const G4CascadeMomentum& mom1,
    140                                             const G4CascadeMomentum& mom) const {
    141 
    142   if (verboseLevel > 3) {
    143     G4cout << " >>> G4LorentzConvertor::rotate(G4CascadeMomentum,G4CascadeMomentum)" << G4endl;
    144   }
    145 
    146   const G4double small = 1.0e-10;
    147 
    148   G4CascadeMomentum mom_rot;
    149 
    150   G4double pp = 0.0;
    151 
    152   G4double pv = 0.0;
    153 
    154   for(G4int i = 0; i < 4; i++) {
    155     pp += mom1[i] * mom1[i];
    156     pv += mom1[i] * velocity[i];
     208G4LorentzVector G4LorentzConvertor::rotate(const G4LorentzVector& mom1,
     209                                           const G4LorentzVector& mom) const {
     210  if (verboseLevel > 3) {
     211    G4cout << " >>> G4LorentzConvertor::rotate(G4LorentzVector,G4LorentzVector)"
     212           << G4endl
     213           << " before rotation: px " << mom.x() << " py " << mom.y()
     214           << " pz " << mom.z() << G4endl;
     215  }
     216
     217  G4double pp = mom1.vect().mag2();
     218  G4double pv = mom1.vect().dot(velocity);
     219
     220  G4double ga1 = v2 - pv * pv / pp;
     221  if (verboseLevel > 3) {
     222    G4cout << " ga1 " << ga1 << " small? " << (ga1 <= small) << G4endl;
     223  }
     224
     225  G4LorentzVector mom_rot = mom;
     226
     227  if (ga1 > small) {
     228    ga1 = std::sqrt(ga1);
     229
     230    G4double gb1 = pv / pp;
     231
     232    pp = std::sqrt(pp);
     233
     234    G4double ga1pp = ga1 * pp;
     235
     236    if (verboseLevel > 3) {
     237      G4cout << " gb1 " << gb1 << " ga1pp " << ga1pp << G4endl;
     238    }
     239
     240    G4ThreeVector vmom1 = velocity - gb1*mom1;
     241    G4ThreeVector vxm1  = mom1.vect().cross(velocity);
     242
     243    mom_rot.setVect(mom.x()*vmom1/ga1 + mom.y()*vxm1/ga1pp +
     244                    mom.z()*mom1.vect().unit() );
    157245  };
    158246
    159   G4double ga1 = v2 - pv * pv / pp;
    160 
    161   if(ga1 < small) {
    162     mom_rot = mom;
    163   } else { 
    164     ga1 = std::sqrt(ga1);
    165 
    166     G4double gb1 = pv / pp;
    167 
    168     pp = std::sqrt(pp);
    169 
    170     G4double ga1pp = ga1 * pp;
    171 
    172     mom_rot[1] = mom[1] * (velocity[1] - gb1 * mom1[1]) / ga1 +
    173       mom[2] * (mom1[2] * velocity[3] - mom1[3] * velocity[2]) / ga1pp +
    174       mom[3] * mom1[1] / pp;
    175     mom_rot[2] = mom[1] * (velocity[2] - gb1 * mom1[2]) / ga1 +
    176       mom[2] * (mom1[3] * velocity[1] - mom1[1] * velocity[3]) / ga1pp +
    177       mom[3] * mom1[2] / pp;
    178     mom_rot[3] = mom[1] * (velocity[3] - gb1 * mom1[3]) / ga1 +
    179       mom[2] * (mom1[1] * velocity[2] - mom1[2] * velocity[1]) / ga1pp +
    180       mom[3] * mom1[3] / pp;
    181   };
     247  if (verboseLevel > 3) {
     248    G4cout << " after rotation: px " << mom_rot.x() << " py " << mom_rot.y()
     249           << " pz " << mom_rot.z() << G4endl;
     250  }
    182251
    183252  return mom_rot;
    184253}
    185254
    186 void G4LorentzConvertor::toTheTargetRestFrame() {
    187    
    188   if (verboseLevel > 3) {
    189     G4cout << " >>> G4LorentzConvertor::toTheTargetRestFrame" << G4endl;
    190   }
    191 
    192   const G4double small = 1.0e-10;
    193 
    194   gamma = target_mom[0] / target_mass;
    195   v2 = 0.0;
    196 
    197   G4double pv = 0.0;
    198 
    199   //  G4double e_sum = target_mom[0] + bullet_mom[0];
    200 
    201   velocity.resize(4);
    202   G4int i(0);
    203   for(i = 1; i < 4; i++) {
    204     velocity[i] = target_mom[i] / target_mom[0];
    205     v2 += velocity[i] * velocity[i];
    206     pv += bullet_mom[i] * velocity[i];
    207   };
    208 
    209   G4double pa = 0.0;
    210 
    211   G4double pb = 0.0;
    212 
    213   G4double xx = 0.0;
    214 
    215   if(v2 > small) xx = pv * (gamma - 1.0) / v2 - bullet_mom[0] * gamma;
    216   for(i = 1; i < 4; i++) {
    217     scm_momentum[i] = bullet_mom[i] + velocity[i] * xx;
    218 
    219     if (verboseLevel > 3) {
    220       G4cout << " rf: i " << i << " pscm(i) " << scm_momentum[i] << G4endl;
    221     }
    222     pa += scm_momentum[i] * scm_momentum[i];
    223     pb += scm_momentum[i] * velocity[i];
    224   };
    225 
    226   ga = v2 - pb * pb / pa;
    227   if(ga < small) {
    228     ga = small;
    229     degenerated = true;
    230   } else {
    231     ga = std::sqrt(ga);
    232   }; 
    233   pscm = std::sqrt(pa);
    234   plab = pscm;
    235   gb = pb / pscm;
    236   gbpp = gb / pscm;
    237   gapp = ga * pscm;   
    238 }
    239 
    240 G4CascadeMomentum G4LorentzConvertor::backToTheLab(const G4CascadeMomentum& mom) const {
    241 
    242   if (verboseLevel > 3) {
    243     G4cout << " >>> G4LorentzConvertor::backToTheLab" << G4endl;
    244   }
    245 
    246   const G4double small = 1.0e-10;
    247 
    248   if (verboseLevel > 3) {
    249     G4cout << " at rest: px " << mom[1] << " py " << mom[2] << " pz " << mom[3] <<
    250       " e " << mom[0] << G4endl;
    251     G4cout << " v2 " << v2 << G4endl;   
    252   }
    253 
    254   G4CascadeMomentum mom1;
    255 
    256   if(v2 < small) {
    257     mom1 = mom;
    258   } else {
    259     G4double pv = 0.0;
    260 
    261     G4int i(0);
    262     for(i = 1; i < 4; i++) pv += mom[i] * velocity[i];
    263 
    264     G4double xx = pv * (gamma - 1.0) / v2 + mom[0] * gamma;
    265 
    266     for(i = 1; i < 4; i++) mom1[i] = mom[i] + velocity[i] * xx;
    267   };
    268 
    269   if (verboseLevel > 3) {
    270     G4cout << " at lab: px " << mom1[1] << " py " << mom1[2] << " pz " << mom1[3] << G4endl;
    271   }
    272 
    273   return mom1;
    274 }
    275 
    276255G4bool G4LorentzConvertor::reflectionNeeded() const {
    277 
    278   if (verboseLevel > 3) {
    279     G4cout << " >>> G4LorentzConvertor::reflectionNeeded" << G4endl;
    280   }
    281 
    282   const G4double small = 1.0e-10;
    283 
    284   if(v2 < small) {
    285     return false;
    286   }  else {   
    287     if(degenerated) return (scm_momentum[3] < 0.0);
    288     else
    289     {
    290       throw G4HadronicException(__FILE__, __LINE__, "G4LorentzConvertor::reflectionNeeded - return value undefined");
    291       return false;
    292     }
    293   };
    294 }
    295 
    296 
    297 
    298 
    299 
    300 
    301 
     256  if (verboseLevel > 3) {
     257    G4cout << " >>> G4LorentzConvertor::reflectionNeeded: v2 = " << v2
     258           << " SCM z = " << scm_momentum.z() << " degenerated? "
     259           << degenerated << G4endl;
     260  }
     261
     262  if (v2 < small && !degenerated)
     263    throw G4HadronicException(__FILE__, __LINE__, "G4LorentzConvertor::reflectionNeeded - return value undefined");
     264
     265  return (v2>=small && (!degenerated || scm_momentum.z() < 0.0));
     266}
     267
     268
     269
     270
     271
     272
     273
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4NonEquilibriumEvaporator.cc

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4NonEquilibriumEvaporator.cc,v 1.29 2010/05/21 17:56:34 mkelsey Exp $
     26// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100114  M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
     29// 20100309  M. Kelsey -- Use new generateWithRandomAngles for theta,phi stuff;
     30//              eliminate some unnecessary std::pow()
     31// 20100412  M. Kelsey -- Pass G4CollisionOutput by ref to ::collide()
     32// 20100413  M. Kelsey -- Pass buffers to paraMaker[Truncated]
     33// 20100517  M. Kelsey -- Inherit from common base class
     34
    2635#define RUN
    2736
    2837#include <cmath>
    2938#include "G4NonEquilibriumEvaporator.hh"
     39#include "G4CollisionOutput.hh"
    3040#include "G4InuclElementaryParticle.hh"
    3141#include "G4InuclNuclei.hh"
     42#include "G4InuclSpecialFunctions.hh"
    3243#include "G4LorentzConvertor.hh"
     44#include "G4NucleiProperties.hh"
     45#include "G4HadTmpUtil.hh"
     46
     47using namespace G4InuclSpecialFunctions;
     48
    3349
    3450G4NonEquilibriumEvaporator::G4NonEquilibriumEvaporator()
    35   : verboseLevel(1) {
    36 
    37   if (verboseLevel > 3) {
    38     G4cout << " >>> G4NonEquilibriumEvaporator::G4NonEquilibriumEvaporator" << G4endl;
    39   }
    40 }
    41 
    42 G4CollisionOutput G4NonEquilibriumEvaporator::collide(G4InuclParticle* /*bullet*/,
    43                                                       G4InuclParticle* target) {
     51  : G4VCascadeCollider("G4NonEquilibriumEvaporator") {}
     52
     53
     54void G4NonEquilibriumEvaporator::collide(G4InuclParticle* /*bullet*/,
     55                                         G4InuclParticle* target,
     56                                         G4CollisionOutput& output) {
    4457
    4558  if (verboseLevel > 3) {
     
    4760  }
    4861
    49   const G4double one_third = 1.0/3.0;
     62  // Sanity check
     63  G4InuclNuclei* nuclei_target = dynamic_cast<G4InuclNuclei*>(target);
     64  if (!nuclei_target) {
     65    G4cerr << " NonEquilibriumEvaporator -> target is not nuclei " << G4endl;   
     66    return;
     67  }
     68
    5069  const G4double a_cut = 5.0;
    5170  const G4double z_cut = 3.0;
     
    6180  const G4double small_ekin = 1.0e-6;
    6281  const G4double width_cut = 0.005;
    63   G4CollisionOutput output;
    64 
    65   if (G4InuclNuclei* nuclei_target = dynamic_cast<G4InuclNuclei*>(target)) {
    66     //  initialization
     82
    6783    G4double A = nuclei_target->getA();
    6884    G4double Z = nuclei_target->getZ();
    69     G4CascadeMomentum PEX = nuclei_target->getMomentum();
    70     G4CascadeMomentum pin = PEX;
     85    G4LorentzVector PEX = nuclei_target->getMomentum();
     86    G4LorentzVector pin = PEX;
    7187    G4double EEXS = nuclei_target->getExitationEnergy();
    72     pin[0] += 0.001 * EEXS;
     88    pin.setE(pin.e() + 0.001 * EEXS);
    7389    G4InuclNuclei dummy_nuc;
    7490    G4ExitonConfiguration config = nuclei_target->getExitonConfiguration(); 
     
    88104    G4LorentzConvertor toTheExitonSystemRestFrame;
    89105
    90     toTheExitonSystemRestFrame.setBullet(dummy.getMomentum(), dummy.getMass());
     106    toTheExitonSystemRestFrame.setBullet(dummy);
    91107
    92108    G4double EFN = FermiEnergy(A, Z, 0);
     
    96112    G4double ZR = Z - QPP; 
    97113    G4int NEX = G4int(QEX + 0.5);
    98     G4CascadeMomentum ppout;
    99     G4bool try_again = NEX > 0 ? true : false;
     114    G4LorentzVector ppout;
     115    G4bool try_again = (NEX > 0);
    100116 
     117    // Buffer for parameter sets
     118    std::pair<G4double, G4double> parms;
     119
    101120    while (try_again) {
    102121
     
    109128        // update exiton system
    110129        G4double nuc_mass = dummy_nuc.getNucleiMass(A, Z);
    111         PEX[0] = std::sqrt(PEX[1] * PEX[1] + PEX[2] * PEX[2] + PEX[3] * PEX[3] +
    112                       nuc_mass * nuc_mass);     
     130        PEX.setVectM(PEX.vect(), nuc_mass);
    113131        toTheExitonSystemRestFrame.setTarget(PEX, nuc_mass);
    114132        toTheExitonSystemRestFrame.toTheTargetRestFrame();
     
    121139        if (QEX < std::sqrt(2.0 * EG)) { // ok
    122140
    123           std::pair<G4double, G4double> parms = paraMakerTruncated(Z);
    124 
    125           G4double AK1 = parms.first;
    126           G4double CPA1 = parms.second;
    127           G4double VP = coul_coeff * Z * AK1 / (std::pow(A - 1.0, one_third) + 1.0) /
     141          paraMakerTruncated(Z, parms);
     142          const G4double& AK1 = parms.first;
     143          const G4double& CPA1 = parms.second;
     144
     145          G4double VP = coul_coeff * Z * AK1 / (G4cbrt(A - 1.0) + 1.0) /
    128146            (1.0 + EEXS / E0);
    129           G4double DM1 = bindingEnergy(A, Z);
    130           G4double BN = DM1 - bindingEnergy(A - 1.0, Z);
    131           G4double BP = DM1 - bindingEnergy(A - 1.0, Z - 1.0);
     147          //      G4double DM1 = bindingEnergy(A, Z);
     148          //      G4double BN = DM1 - bindingEnergy(A - 1.0, Z);
     149          //      G4double BP = DM1 - bindingEnergy(A - 1.0, Z - 1.0);
     150          G4double DM1 = G4NucleiProperties::GetBindingEnergy(G4lrint(A), G4lrint(Z));
     151          G4double BN = DM1 - G4NucleiProperties::GetBindingEnergy(G4lrint(A-1.0), G4lrint(Z));
     152          G4double BP = DM1 - G4NucleiProperties::GetBindingEnergy(G4lrint(A-1.0), G4lrint(Z-1.0));
    132153          G4double EMN = EEXS - BN;
    133154          G4double EMP = EEXS - BP - VP * A / (A - 1.0);
     
    141162              G4double APH1 = APH + 0.5 * (QP + QH);
    142163              ESP = EEXS / QEX;
    143               G4double MELE = MEL / ESP / std::pow(A, 3);
     164              G4double MELE = MEL / ESP / (A*A*A);
    144165
    145166              if (ESP > 15.0) {
     
    164185
    165186                  if (NEX >= 2) {
    166                     D[1] = 0.0462 / parlev / std::pow(A, one_third) * QP * EEXS / QEX;
     187                    D[1] = 0.0462 / parlev / G4cbrt(A) * QP * EEXS / QEX;
    167188
    168189                    if (EMP > eexs_cut)
     
    293314                          // generate particle momentum
    294315                          G4double pmod = std::sqrt(EPART * (2.0 * mass + EPART));
    295                           G4CascadeMomentum mom;
    296                           std::pair<G4double, G4double> COS_SIN = randomCOS_SIN();
    297                           G4double FI = randomPHI();
    298                           G4double P1 = pmod * COS_SIN.second;
    299                           mom[1] = P1 * std::cos(FI);
    300                           mom[2] = P1 * std::sin(FI);
    301                           mom[3] = pmod * COS_SIN.first;
    302                           G4CascadeMomentum mom_at_rest;
    303 
    304                           for (G4int i = 1; i < 4; i++) mom_at_rest[i] = -mom[i];
     316                          G4LorentzVector mom = generateWithRandomAngles(pmod,mass);
     317                          G4LorentzVector mom_at_rest;
    305318
    306319                          G4double QPP_new = QPP;
     
    319332                          G4double new_exiton_mass =
    320333                            dummy_nuc.getNucleiMass(A_new, Z_new);
    321                           mom_at_rest[0] = std::sqrt(mom_at_rest[1] * mom_at_rest[1] +
    322                                                 mom_at_rest[2] * mom_at_rest[2] +
    323                                                 mom_at_rest[3] * mom_at_rest[3] +
    324                                                 new_exiton_mass * new_exiton_mass);
    325                           mom[0] = std::sqrt(mom[1] * mom[1] + mom[2] * mom[2] +
    326                                         mom[3] * mom[3] + mass * mass);
    327 
    328                           G4CascadeMomentum part_mom =
     334                          mom_at_rest.setVectM(-mom.vect(), new_exiton_mass);
     335
     336                          G4LorentzVector part_mom =
    329337                            toTheExitonSystemRestFrame.backToTheLab(mom);
    330 
    331                           part_mom[0] = std::sqrt(part_mom[1] * part_mom[1] +
    332                                              part_mom[2] * part_mom[2] + part_mom[3] * part_mom[3] +
    333                                              mass * mass);
    334 
    335                           G4CascadeMomentum ex_mom =
     338                          part_mom.setVectM(part_mom.vect(), mass);
     339
     340                          G4LorentzVector ex_mom =
    336341                            toTheExitonSystemRestFrame.backToTheLab(mom_at_rest);
    337 
    338                           ex_mom[0] = std::sqrt(ex_mom[1] * ex_mom[1] + ex_mom[2] * ex_mom[2]
    339                                            + ex_mom[3] * ex_mom[3] + new_exiton_mass * new_exiton_mass);   
     342                          ex_mom.setVectM(ex_mom.vect(), new_exiton_mass);   
     343
    340344                          //             check energy conservation and set new exitation energy
    341                           EEXS_new = 1000.0 * (PEX[0] + 0.001 * EEXS -
    342                                                part_mom[0] - ex_mom[0]);
     345                          EEXS_new = 1000.0 * (PEX.e() + 0.001 * EEXS -
     346                                               part_mom.e() - ex_mom.e());
    343347
    344348                          if (EEXS_new > 0.0) { // everything ok
    345349                            particle.setMomentum(part_mom);
    346350                            output.addOutgoingParticle(particle);
    347 
    348                             for (G4int i = 0; i < 4; i++) ppout[i] += part_mom[i];
     351                            ppout += part_mom;
     352
    349353                            A = A_new;
    350354                            Z = Z_new;
     
    423427    // conservation
    424428
    425     G4CascadeMomentum pnuc;
    426 
    427     for (G4int i = 1; i < 4; i++) pnuc[i] = pin[i] - ppout[i];
     429    G4LorentzVector pnuc = pin - ppout;
    428430    G4InuclNuclei nuclei(pnuc, A, Z);
    429431
     
    432434
    433435    pnuc = nuclei.getMomentum();
    434     G4double eout = pnuc[0] + ppout[0]
    435     G4double eex_real = 1000.0 * (pin[0] - eout);       
     436    G4double eout = pnuc.e() + ppout.e()
     437    G4double eex_real = 1000.0 * (pin.e() - eout);       
    436438
    437439    nuclei.setExitationEnergy(eex_real);
    438440    output.addTargetFragment(nuclei);
    439441
    440   } else {
    441     G4cout << " NonEquilibriumEvaporator -> target is not nuclei " << G4endl;   
    442 
    443   };
    444 
    445   return output;
     442  return;
    446443}
    447444
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4NucleiModel.cc

    r1228 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4NucleiModel.cc,v 1.48 2010/05/26 18:29:28 dennis Exp $
     26// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100112  M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
     29// 20100114  M. Kelsey -- Use G4ThreeVector for position
     30// 20100309  M. Kelsey -- Use new generateWithRandomAngles for theta,phi stuff;
     31//              eliminate some unnecessary std::pow(), move ctor here
     32// 20100407  M. Kelsey -- Replace std::vector<>::resize(0) with ::clear().
     33//              Move output vectors from generateParticleFate() and
     34//              ::generateInteractionPartners() to be data members; return via
     35//              const-ref instead of by value.
     36// 20100413  M. Kelsey -- Pass G4CollisionOutput by ref to ::collide()
     37// 20100418  M. Kelsey -- Reference output particle lists via const-ref
     38// 20100421  M. Kelsey -- Replace hardwired p/n masses with G4PartDef's
     39// 20100517  M. Kelsey -- Use G4CascadeINterpolator for cross-section
     40//              calculations.  use G4Cascade*Channel for total xsec in pi-N
     41//              N-N channels.  Move absorptionCrossSection() from SpecialFunc.
     42
    2643//#define CHC_CHECK
    2744
    2845#include "G4NucleiModel.hh"
     46#include "G4CascadeInterpolator.hh"
     47#include "G4CascadeNNChannel.hh"
     48#include "G4CascadeNPChannel.hh"
     49#include "G4CascadePPChannel.hh"
     50#include "G4CascadePiMinusNChannel.hh"
     51#include "G4CascadePiMinusPChannel.hh"
     52#include "G4CascadePiPlusNChannel.hh"
     53#include "G4CascadePiPlusPChannel.hh"
     54#include "G4CascadePiZeroNChannel.hh"
     55#include "G4CascadePiZeroPChannel.hh"
     56#include "G4CollisionOutput.hh"
     57#include "G4ElementaryParticleCollider.hh"
     58#include "G4HadTmpUtil.hh"
     59#include "G4InuclNuclei.hh"
     60#include "G4InuclParticleNames.hh"
     61#include "G4InuclSpecialFunctions.hh"
    2962#include "G4LorentzConvertor.hh"
    30 #include "G4CollisionOutput.hh"
     63#include "G4Neutron.hh"
     64#include "G4NucleiProperties.hh"
     65#include "G4Proton.hh"
     66
     67using namespace G4InuclParticleNames;
     68using namespace G4InuclSpecialFunctions;
    3169
    3270
    3371typedef std::vector<G4InuclElementaryParticle>::iterator particleIterator;
    3472
    35 G4NucleiModel::G4NucleiModel()
    36   : verboseLevel(2) {
    37 
     73G4NucleiModel::G4NucleiModel() : verboseLevel(0) {
    3874  if (verboseLevel > 3) {
    3975    G4cout << " >>> G4NucleiModel::G4NucleiModel" << G4endl;
     
    4177}
    4278
     79G4NucleiModel::G4NucleiModel(G4InuclNuclei* nuclei) : verboseLevel(0) {
     80  generateModel(nuclei->getA(), nuclei->getZ());
     81}
     82
     83
    4384void
    4485G4NucleiModel::generateModel(G4double a, G4double z) {
    45 
    46   verboseLevel = 2;
    4786  if (verboseLevel > 3) {
    4887    G4cout << " >>> G4NucleiModel::generateModel" << G4endl;
    4988  }
    5089
    51   initTotalCrossSections();
    52 
    5390  const G4double AU = 1.7234;
    54   const G4double cuu = 3.3836;
    55   const G4double one_third = 1.0 / 3.0;
    56   const G4double oneBypiTimes4 = 0.0795775; // 1 / 4 Pi
     91  const G4double cuu = 3.3836;
     92  //  const G4double convertToFermis = 2.8197;
    5793  const G4double pf_coeff = 1.932;
    5894  const G4double pion_vp = 0.007; // in GeV
     
    6096  const G4double radForSmall = 8.0; // fermi
    6197  const G4double piTimes4thirds = 4.189; // 4 Pi/3
    62   const G4double mproton = 0.93827;
    63   const G4double mneutron = 0.93957;
     98  const G4double mproton = G4Proton::Definition()->GetPDGMass() / GeV;
     99  const G4double mneutron = G4Neutron::Definition()->GetPDGMass() / GeV;
    64100  const G4double alfa3[3] = { 0.7, 0.3, 0.01 }; // listing zone radius
    65   //  const G4double alfa6[6] = { 0.9, 0.6, 0.4, 0.2, 0.1, 0.05 };
     101  const G4double alfa6[6] = { 0.9, 0.6, 0.4, 0.2, 0.1, 0.05 };
    66102
    67103  A = a;
     
    73109
    74110// Set binding energies
    75   G4double dm = bindingEnergy(a, z);
    76 
    77   binding_energies.push_back(0.001 * std::fabs(bindingEnergy(a - 1, z - 1) - dm)); // for P
    78   binding_energies.push_back(0.001 * std::fabs(bindingEnergy(a - 1, z    ) - dm)); // for N
    79 
    80   G4double CU = cuu * std::pow(a, one_third);
    81   G4double D1 = CU / AU;
    82   G4double D = std::exp(-D1);
     111//  G4double dm = bindingEnergy(a, z);
     112  G4double dm = G4NucleiProperties::GetBindingEnergy(G4lrint(a), G4lrint(z));
     113
     114  binding_energies.push_back(0.001 * std::fabs(G4NucleiProperties::GetBindingEnergy(G4lrint(a-1), G4lrint(z-1)) - dm)); // for P
     115  binding_energies.push_back(0.001 * std::fabs(G4NucleiProperties::GetBindingEnergy(G4lrint(a-1), G4lrint(z)) - dm)); // for N
     116
     117  G4double CU = cuu*G4cbrt(a); // half-density radius * 2.8197
     118  G4double D1 = CU/AU;
     119  G4double D = std::exp(-D1);   
    83120  G4double CU2 = 0.0;
    84121
    85   if (a > 3.5) { // a > 3
     122  if (a > 4.5) {
    86123    std::vector<G4double> ur;
    87 
    88124    G4int icase = 0;
    89125
    90     if (a > 11.5) { // a > 11
    91       // number_of_zones = 6;
     126    if (a > 99.5) {
     127      number_of_zones = 6;
     128      ur.push_back(-D1);
     129
     130      for (G4int i = 0; i < number_of_zones; i++) {
     131        G4double y = std::log((1.0 + D) / alfa6[i] - 1.0);
     132        zone_radii.push_back(CU + AU * y);
     133        ur.push_back(y);
     134      }
     135
     136    } else if (a > 11.5) {
    92137      number_of_zones = 3;
    93138      ur.push_back(-D1);
    94139
    95140      for (G4int i = 0; i < number_of_zones; i++) {
    96         // G4double y = std::log((1.0 + D) / alfa6[i] - 1.0);
    97141        G4double y = std::log((1.0 + D)/alfa3[i] - 1.0);
    98142        zone_radii.push_back(CU + AU * y);
    99143        ur.push_back(y);
    100       };
     144      }
    101145
    102146    } else {
     
    112156        zone_radii.push_back(CU2 * y);
    113157        ur.push_back(y);
    114       };
    115     };
     158      }
     159    }
    116160
    117161    G4double tot_vol = 0.0;
     
    132176      v.push_back(v0);
    133177      tot_vol += v0;
    134       v0 = (i == 0 ? std::pow(zone_radii[i], G4double(3)) : std::pow(zone_radii[i], G4double(3)) -
    135             std::pow(zone_radii[i - 1], G4double(3)));
     178
     179      v0 = zone_radii[i]*zone_radii[i]*zone_radii[i];
     180      if (i > 0) v0 -= zone_radii[i-1]*zone_radii[i-1]*zone_radii[i-1];
     181
    136182      v1.push_back(v0);
    137183    }
    138184
    139     // proton
    140     G4double dd0 = 3.0 * z * oneBypiTimes4 / tot_vol;
    141 
     185    // Protons
     186    G4double dd0 = z/tot_vol/piTimes4thirds;
    142187    std::vector<G4double> rod;
    143188    std::vector<G4double> pf;
     
    147192      G4double rd = dd0 * v[i] / v1[i];
    148193      rod.push_back(rd);
    149       G4double pff = pf_coeff * std::pow(rd, one_third);
     194      G4double pff = pf_coeff * G4cbrt(rd);
    150195      pf.push_back(pff);
    151196      vz.push_back(0.5 * pff * pff / mproton + binding_energies[0]);
     
    155200    zone_potentials.push_back(vz);
    156201    fermi_momenta.push_back(pf);
    157     //  neutron stuff
    158     dd0 = 3.0 * (a - z) * oneBypiTimes4 / tot_vol;
    159     rod.resize(0);
    160     pf.resize(0);
    161     vz.resize(0);
     202
     203    // Neutrons
     204    dd0 = (a - z)/tot_vol/piTimes4thirds;
     205    rod.clear();
     206    pf.clear();
     207    vz.clear();
    162208
    163209    for (i = 0; i < number_of_zones; i++) {
    164210      G4double rd = dd0 * v[i] / v1[i];
    165211      rod.push_back(rd);
    166       G4double pff = pf_coeff * std::pow(rd, one_third);
     212      G4double pff = pf_coeff * G4cbrt(rd);
    167213      pf.push_back(pff);
    168214      vz.push_back(0.5 * pff * pff / mneutron + binding_energies[1]);
     
    185231    zone_potentials.push_back(hp);
    186232
    187   } else { // a < 4
     233  } else { // a < 5
    188234    number_of_zones = 1;
    189     zone_radii.push_back(radForSmall);
    190     G4double vol = 1.0 / piTimes4thirds / std::pow(zone_radii[0], G4double(3));
     235    G4double smallRad = radForSmall;
     236    if (a == 4) smallRad *= 0.7;
     237    zone_radii.push_back(smallRad);
     238    G4double vol = 1.0 / piTimes4thirds / (zone_radii[0]*zone_radii[0]*zone_radii[0]);
     239
     240    // proton
    191241    std::vector<G4double> rod;
    192242    std::vector<G4double> pf;
    193243    std::vector<G4double> vz;
    194 
    195     G4int i(0);
    196 
    197     for (i = 0; i < number_of_zones; i++) {
    198       G4double rd = vol;
     244    for (G4int i = 0; i < number_of_zones; i++) {
     245      G4double rd = vol*z;
    199246      rod.push_back(rd);
    200       G4double pff = pf_coeff * std::pow(rd, one_third);
     247      G4double pff = pf_coeff * G4cbrt(rd);
    201248      pf.push_back(pff);
    202249      vz.push_back(0.5 * pff * pff / mproton + binding_energies[0]);
    203     };
     250    }
    204251
    205252    nucleon_densities.push_back(rod);
     
    208255
    209256    // neutron
    210     rod.resize(0);
    211     pf.resize(0);
    212     vz.resize(0);
    213 
    214     for (i = 0; i < number_of_zones; i++) {
    215       G4double rd = vol;
     257    rod.clear();
     258    pf.clear();
     259    vz.clear();
     260    for (G4int i = 0; i < number_of_zones; i++) {
     261      G4double rd = vol*(a-z);
    216262      rod.push_back(rd);
    217       G4double pff = pf_coeff * std::pow(rd, one_third);
     263      G4double pff = pf_coeff * G4cbrt(rd);
    218264      pf.push_back(pff);
    219265      vz.push_back(0.5 * pff * pff / mneutron + binding_energies[1]);
    220     };
     266    }
    221267
    222268    nucleon_densities.push_back(rod);
     
    235281    std::vector<G4double> hp(number_of_zones, 0.03);
    236282    zone_potentials.push_back(hp);
    237 
    238   };
     283  }
     284
    239285  nuclei_radius = zone_radii[zone_radii.size() - 1];
    240286
     287  /*
     288  // Print nuclear radii and densities
     289  G4cout << " For A = " << a << " zone radii = ";
     290  for (G4int i = 0; i < number_of_zones; i++) G4cout << zone_radii[i] << "  ";
     291  G4cout << "  " << G4endl;
     292
     293  G4cout << " proton densities: ";
     294  for (G4int i = 0; i < number_of_zones; i++)
     295     G4cout << nucleon_densities[0][i] << "  ";
     296  G4cout << G4endl;
     297
     298  G4cout << " neutron densities: ";
     299  for (G4int i = 0; i < number_of_zones; i++)
     300     G4cout << nucleon_densities[1][i] << "  ";
     301  G4cout << G4endl;
     302
     303  G4cout << " protons per shell " ;
     304  G4double rinner = 0.0;
     305  G4double router = 0.0;
     306  G4double shellVolume = 0.0;
     307  for (G4int i = 0; i < number_of_zones; i++) {  // loop over zones
     308    router = zone_radii[i];
     309    shellVolume = piTimes4thirds*(router*router*router - rinner*rinner*rinner);
     310    G4cout << G4lrint(shellVolume*nucleon_densities[0][i]) << "  ";
     311    rinner = router;
     312  }
     313  G4cout << G4endl;
     314
     315  G4cout << " neutrons per shell " ;
     316  rinner = 0.0;
     317  router = 0.0;
     318  shellVolume = 0.0;
     319  for (G4int i = 0; i < number_of_zones; i++) {  // loop over zones
     320    router = zone_radii[i];
     321    shellVolume = piTimes4thirds*(router*router*router - rinner*rinner*rinner);
     322    G4cout << G4lrint(shellVolume*nucleon_densities[1][i]) << "  ";
     323    rinner = router;
     324  }
     325  G4cout << G4endl;
     326  */
     327}
     328
     329
     330G4double G4NucleiModel::getFermiKinetic(G4int ip, G4int izone) const {
     331  G4double ekin = 0.0;
     332 
     333  if (ip < 3 && izone < number_of_zones) {      // ip for proton/neutron only
     334    G4double pf = fermi_momenta[ip - 1][izone];
     335    G4double mass = G4InuclElementaryParticle::getParticleMass(ip);
     336   
     337    ekin = std::sqrt(pf * pf + mass * mass) - mass;
     338  } 
     339  return ekin;
    241340}
    242341
     
    342441  }
    343442
    344   return std::pow(cu2, G4double(3)) * fun;
     443  return cu2*cu2*cu2 * fun;
    345444}
    346445
     
    369468
    370469
     470G4LorentzVector
     471G4NucleiModel::generateNucleonMomentum(G4int type, G4int zone) const {
     472  G4double pmod = getFermiMomentum(type, zone) * G4cbrt(inuclRndm());
     473  G4double mass = G4InuclElementaryParticle::getParticleMass(type);
     474
     475  return generateWithRandomAngles(pmod, mass);
     476}
     477
     478
    371479G4InuclElementaryParticle
    372480G4NucleiModel::generateNucleon(G4int type, G4int zone) const {
    373 
    374481  if (verboseLevel > 3) {
    375482    G4cout << " >>> G4NucleiModel::generateNucleon" << G4endl;
    376483  }
    377484
    378   const G4double one_third = 1.0 / 3.0;
    379 
    380 //G4double pmod = getFermiMomentum(type, zone) * std::pow(inuclRndm(), one_third);
    381 
    382   G4double pmod = fermi_momenta[type - 1][zone] * std::pow(inuclRndm(), one_third);
    383 
    384   G4CascadeMomentum mom;
    385   std::pair<G4double, G4double> COS_SIN = randomCOS_SIN();
    386   G4double FI = randomPHI();
    387   G4double pt = pmod * COS_SIN.second;
    388 
    389   mom[1] = pt * std::cos(FI);
    390   mom[2] = pt * std::sin(FI);
    391   mom[3] = pmod * COS_SIN.first;
    392 
     485  G4LorentzVector mom = generateNucleonMomentum(type, zone);
    393486  return G4InuclElementaryParticle(mom, type);
    394487}
     
    403496  }
    404497
    405   G4CascadeMomentum mom = generateNucleon(type1, zone).getMomentum();
    406   G4CascadeMomentum mom1 = generateNucleon(type2, zone).getMomentum();
    407   G4CascadeMomentum dmom;
    408 
    409   for (G4int i = 1; i < 4; i++) dmom[i] = mom[i] + mom1[i];
     498  // Quasideuteron consists of an unbound but associated nucleon pair
     499 
     500  // FIXME:  Why generate two separate nucleon momenta (randomly!) and
     501  //         add them, instead of just throwing a net momentum for the
     502  //         dinulceon state?  And why do I have to capture the two
     503  //         return values into local variables?
     504  G4LorentzVector mom1 = generateNucleonMomentum(type1, zone);
     505  G4LorentzVector mom2 = generateNucleonMomentum(type2, zone);
     506  G4LorentzVector dmom = mom1+mom2;
    410507
    411508  G4int dtype = 0;
    412 
    413   if (type1 * type2 == 1) {
    414     dtype = 111;
    415 
    416   } else if (type1 * type2 == 2) {
    417     dtype = 112;
    418 
    419   } else if (type1 * type2 == 4) {
    420     dtype = 122;
    421   };
     509       if (type1*type2 == pro*pro) dtype = 111;
     510  else if (type1*type2 == pro*neu) dtype = 112;
     511  else if (type1*type2 == neu*neu) dtype = 122;
    422512
    423513  return G4InuclElementaryParticle(dmom, dtype);
     
    425515
    426516
    427 partners
    428 G4NucleiModel::generateInteractionPartners(G4CascadParticle& cparticle) const {
    429 
     517void
     518G4NucleiModel::generateInteractionPartners(G4CascadParticle& cparticle) {
    430519  if (verboseLevel > 3) {
    431520    G4cout << " >>> G4NucleiModel::generateInteractionPartners" << G4endl;
     
    446535  //const G4double young_cut = 0.0;
    447536
    448   partners thePartners;
     537  thePartners.clear();          // Reset buffer for next cycle
    449538
    450539  G4int ptype = cparticle.getParticle().type();
    451540  G4int zone = cparticle.getCurrentZone();
    452541  G4double pmass = cparticle.getParticle().getMass();
    453   const G4CascadeMomentum& pmom = cparticle.getParticle().getMomentum();
     542  G4LorentzVector pmom = cparticle.getParticle().getMomentum();
    454543  G4double r_in;
    455544  G4double r_out;
     
    475564
    476565  if (path < -small) { // something wrong
    477     return thePartners;
     566    return;
    478567
    479568  } else if (std::fabs(path) < small) { // just on the boundary
    480569    path = 0.0;
    481570
    482     G4InuclElementaryParticle particle;
    483 
     571    G4InuclElementaryParticle particle; // Dummy -- no type or momentum
    484572    thePartners.push_back(partner(particle, path));
    485573
    486574  } else { // normal case 
    487     std::vector<G4InuclElementaryParticle> particles;
    488575    G4LorentzConvertor dummy_convertor;
    489 
    490576    dummy_convertor.setBullet(pmom, pmass);
    491577 
     
    494580      dummy_convertor.setTarget(particle.getMomentum(), particle.getMass());
    495581      G4double ekin = dummy_convertor.getKinEnergyInTheTRS();
     582
     583      // Total cross section converted from mb to fm**2
    496584      G4double csec = totalCrossSection(ekin, ptype * ip);
    497585
     
    530618
    531619    if (cparticle.getParticle().pion()) { // absorption possible
    532 
    533       std::vector<G4InuclElementaryParticle> qdeutrons;
    534       std::vector<G4double> acsecs;
     620      if (verboseLevel > 2) {
     621        G4cout << " trying quasi-deuterons with bullet: ";
     622        cparticle.getParticle().printParticle();
     623      }
     624
     625      std::vector<G4InuclElementaryParticle> qdeutrons(3);
     626      std::vector<G4double> acsecs(3);
    535627
    536628      G4double tot_abs_csec = 0.0;
    537629      G4double abs_sec;
    538       G4double vol = std::pow(zone_radii[zone], G4double(3));
    539 
    540       if (zone > 0) vol -= std::pow(zone_radii[zone - 1], G4double(3));
     630      G4double vol = zone_radii[zone]*zone_radii[zone]*zone_radii[zone];
     631
     632      if (zone > 0) vol -= zone_radii[zone-1]*zone_radii[zone-1]*zone_radii[zone-1];
    541633      vol *= pi4by3;
    542634
     
    551643        G4double ekin = dummy_convertor.getKinEnergyInTheTRS();
    552644
    553         abs_sec = absorptionCrosSection(ekin, ptype);
     645        if (verboseLevel > 2) {
     646          G4cout << " ptype=" << ptype << " using pp target" << G4endl;
     647          ppd.printParticle();
     648        }
     649
     650        abs_sec = absorptionCrossSection(ekin, ptype);
    554651        abs_sec *= nucleon_densities[0][zone] * nucleon_densities[0][zone]*
    555652          rat * rat * vol;
     
    570667      G4double ekin = dummy_convertor.getKinEnergyInTheTRS();
    571668
    572       abs_sec = absorptionCrosSection(ekin, ptype);
     669      if (verboseLevel > 2) {
     670        G4cout << " using np target" << G4endl;
     671        npd.printParticle();
     672      }
     673
     674      abs_sec = absorptionCrossSection(ekin, ptype);
    573675      abs_sec *= pn_spec * nucleon_densities[0][zone] * nucleon_densities[1][zone] *
    574676        rat * rat1 * vol;
     
    584686        G4double ekin = dummy_convertor.getKinEnergyInTheTRS();
    585687
    586         abs_sec = absorptionCrosSection(ekin, ptype);
     688        if (verboseLevel > 2) {
     689          G4cout << " ptype=" << ptype << " using nn target" << G4endl;
     690          nnd.printParticle();
     691        }
     692
     693        abs_sec = absorptionCrossSection(ekin, ptype);
    587694        abs_sec *= nucleon_densities[1][zone] * nucleon_densities[1][zone] *
    588695          rat1 * rat1 * vol;
     
    651758    }
    652759 
    653     if (thePartners.size() > 1) { // sort partners
     760    if (thePartners.size() > 1) {               // Sort list by path length
     761      std::sort(thePartners.begin(), thePartners.end(), sortPartners);
     762    }
     763
     764    G4InuclElementaryParticle particle;         // Dummy for end of list
     765    thePartners.push_back(partner(particle, path));
     766  }
    654767 
    655       for (G4int i = 0; i < G4int(thePartners.size()) - 1; i++) {
    656 
    657         for (G4int j = i + 1; j < G4int(thePartners.size()); j++) {
    658 
    659           if (thePartners[i].second > thePartners[j].second) {
    660 
    661             G4InuclElementaryParticle particle = thePartners[i].first;
    662             G4double pathi = thePartners[i].second;
    663             thePartners[i] = partner(thePartners[j].first, thePartners[j].second);
    664             thePartners[j] = partner(particle, pathi);
    665           };
    666         };
    667       };
    668     };
    669 
    670     G4InuclElementaryParticle particle;
    671 
    672     thePartners.push_back(partner(particle, path));
    673   };
    674  
    675   return thePartners;
    676 }
    677 
    678 
    679 std::vector<G4CascadParticle>
     768  return;
     769}
     770
     771
     772const std::vector<G4CascadParticle>&
    680773G4NucleiModel::generateParticleFate(G4CascadParticle& cparticle,
    681774                                    G4ElementaryParticleCollider* theElementaryParticleCollider) {
    682 
    683   if (verboseLevel > 3) G4cout << " >>> G4NucleiModel::generateParticleFate" << G4endl;
    684 
    685   std::vector<G4CascadParticle> outgouing_cparticles;
    686 
    687   partners thePartners = generateInteractionPartners(cparticle);
    688 
    689   if(thePartners.empty()) { // smth. is wrong -> needs special treatment
    690 
     775  if (verboseLevel > 3)
     776    G4cout << " >>> G4NucleiModel::generateParticleFate" << G4endl;
     777
     778  outgoing_cparticles.clear();          // Clear return buffer for this event
     779
     780  generateInteractionPartners(cparticle);       // Fills "thePartners" data
     781
     782  if (thePartners.empty()) { // smth. is wrong -> needs special treatment
    691783    G4cout << " generateParticleFate-> can not be here " << G4endl;
    692 
    693   } else {
    694     G4int npart = thePartners.size();
    695 
    696     if (npart == 1) { // cparticle is on the next zone entry
    697       // need to go here if particle outside nucleus ?
    698       //
    699       cparticle.propagateAlongThePath(thePartners[0].second);
    700       cparticle.incrementCurrentPath(thePartners[0].second);
     784    return outgoing_cparticles;
     785  }
     786
     787  G4int npart = thePartners.size();
     788
     789  if (npart == 1) { // cparticle is on the next zone entry
     790    // need to go here if particle outside nucleus ?
     791    //
     792    cparticle.propagateAlongThePath(thePartners[0].second);
     793    cparticle.incrementCurrentPath(thePartners[0].second);
     794    boundaryTransition(cparticle);
     795    outgoing_cparticles.push_back(cparticle);
     796   
     797    if (verboseLevel > 2){
     798      G4cout << " next zone " << G4endl;
     799      cparticle.print();
     800    }
     801   
     802  } else { // there are possible interactions
     803   
     804    G4ThreeVector old_position = cparticle.getPosition();
     805   
     806    G4InuclElementaryParticle bullet = cparticle.getParticle();
     807   
     808    G4bool no_interaction = true;
     809   
     810    G4int zone = cparticle.getCurrentZone();
     811   
     812    G4CollisionOutput output;
     813
     814    for (G4int i = 0; i < npart - 1; i++) {
     815      if (i > 0) cparticle.updatePosition(old_position);
     816     
     817      G4InuclElementaryParticle target = thePartners[i].first;
     818     
     819      if (verboseLevel > 2){
     820        if (target.quasi_deutron())
     821          G4cout << " try absorption: target " << target.type() << " bullet " <<
     822            bullet.type() << G4endl;
     823      }
     824
     825      output.reset();
     826      theElementaryParticleCollider->collide(&bullet, &target, output);
     827     
     828      if (verboseLevel > 2) output.printCollisionOutput();
     829
     830      // Don't need to copy list, as "output" isn't changed again below
     831      const std::vector<G4InuclElementaryParticle>& outgoing_particles =
     832        output.getOutgoingParticles();
     833     
     834      if (passFermi(outgoing_particles, zone)) { // interaction
     835        cparticle.propagateAlongThePath(thePartners[i].second);
     836        G4ThreeVector new_position = cparticle.getPosition();
     837       
     838        for (G4int ip = 0; ip < G4int(outgoing_particles.size()); ip++) {
     839          G4CascadParticle temp(outgoing_particles[ip], new_position, zone, 0.0, 0);
     840          outgoing_cparticles.push_back(temp);
     841        }
     842       
     843        no_interaction = false;
     844        current_nucl1 = 0;
     845        current_nucl2 = 0;
     846#ifdef CHC_CHECK
     847        G4double out_charge = 0.0;
     848       
     849        for (G4int ip = 0; ip < G4int(outgoing_particles.size()); ip++)
     850          out_charge += outgoing_particles[ip].getCharge();
     851       
     852        G4cout << " multiplicity " << outgoing_particles.size() <<
     853          " bul type " << bullet.type() << " targ type " << target.type() <<
     854          G4endl << " initial charge " << bullet.getCharge() + target.getCharge()
     855               << " out charge " << out_charge << G4endl; 
     856#endif
     857       
     858        if (verboseLevel > 2){
     859          G4cout << " partner type " << target.type() << G4endl;
     860        }
     861       
     862        if (target.nucleon()) {
     863          current_nucl1 = target.type();
     864         
     865        } else {
     866          if (verboseLevel > 2) G4cout << " good absorption " << G4endl;
     867         
     868          current_nucl1 = (target.type() - 100) / 10;
     869          current_nucl2 = target.type() - 100 - 10 * current_nucl1;
     870        }   
     871       
     872        if (current_nucl1 == 1) {
     873          protonNumberCurrent -= 1.0;
     874         
     875        } else {
     876          neutronNumberCurrent -= 1.0;
     877        };
     878       
     879        if (current_nucl2 == 1) {
     880          protonNumberCurrent -= 1.0;
     881         
     882        } else if(current_nucl2 == 2) {
     883          neutronNumberCurrent -= 1.0;
     884        };
     885       
     886        break;
     887      };
     888    }  // loop over partners
     889   
     890    if (no_interaction) { // still no interactions
     891      cparticle.updatePosition(old_position);
     892      cparticle.propagateAlongThePath(thePartners[npart - 1].second);
     893      cparticle.incrementCurrentPath(thePartners[npart - 1].second);
    701894      boundaryTransition(cparticle);
    702       outgouing_cparticles.push_back(cparticle);
    703 
    704       if (verboseLevel > 2){
    705         G4cout << " next zone " << G4endl;
    706         cparticle.print();
    707       }
    708 
    709     } else { // there are possible interactions
    710  
    711       std::vector<G4double> old_position = cparticle.getPosition();
    712 
    713       G4InuclElementaryParticle bullet = cparticle.getParticle();
    714 
    715       G4bool no_interaction = true;
    716 
    717       G4int zone = cparticle.getCurrentZone();
    718 
    719       for (G4int i = 0; i < npart - 1; i++) {
    720         if (i > 0) cparticle.updatePosition(old_position);
    721 
    722         G4InuclElementaryParticle target = thePartners[i].first;
    723 
    724         if (verboseLevel > 2){
    725           if (target.quasi_deutron())
    726             G4cout << " try absorption: target " << target.type() << " bullet " <<
    727                       bullet.type() << G4endl;
    728         }
    729 
    730         G4CollisionOutput output = theElementaryParticleCollider->collide(&bullet, &target);
    731 
    732         if (verboseLevel > 2) output.printCollisionOutput();
    733 
    734         std::vector<G4InuclElementaryParticle> outgoing_particles =
    735 
    736           output.getOutgoingParticles();
    737 
    738         if (passFermi(outgoing_particles, zone)) { // interaction
    739           cparticle.propagateAlongThePath(thePartners[i].second);
    740           std::vector<G4double> new_position = cparticle.getPosition();
    741 
    742           /*
    743           // find jet axis for new particles
    744           G4double incidentE = cparticle.getParticle().getEnergy();
    745           G4CascadeMomentum jetAxis;
    746           for (G4int i = 0; i < G4int(outgoing_particles.size()); i++) {
    747             for (G4int j = 1; j < 4; j++) jetAxis[j] += (outgoing_particles[i].getMomentum())[j];
    748           }
    749 
    750           // Find pT wrt jet axis for each secondary
    751           */
    752 
    753           for (G4int ip = 0; ip < G4int(outgoing_particles.size()); ip++) {
    754             G4CascadParticle temp(outgoing_particles[ip], new_position, zone, 0.0, 0);
    755             /*
    756             G4double pathLength = temp.getPathToTheNextZone(0, nuclei_radius);
    757 
    758             // Get jet axis
    759             G4CascadeMomentum pmom = temp.getMomentum();
    760             G4double secMass = temp.getParticle().getMass();
    761             G4double dot = 0.0;
    762             G4double pmod = 0.0;
    763             G4double jmod = 0.0;
    764             for (G4int i = 1; i < 4; i++) {
    765               dot += pmom[i]*jetAxis[i];
    766               pmod += pmom[i]*pmom[i];
    767               jmod += jetAxis[i]*jetAxis[i];
    768             }
    769 
    770             //            G4double sinTheta = std::sqrt(1.0 - dot*dot/pmod/jmod);
    771             G4double pT2 = pmod - dot*dot/jmod;
    772             // G4cout << " mass = " << secMass << " Energy = " << incidentE << " pT = " << pT << G4endl;
    773             G4double formationLength = 1.0*0.1973*incidentE/(pT2 + secMass*secMass);
    774             if(formationLength > pathLength) {
    775               //              G4cout << " formation length = " << formationLength
    776               //                     << " path length = " << pathLength << G4endl;
    777               temp.propagateAlongThePath(pathLength);
    778               temp.incrementCurrentPath(pathLength);
    779               temp.updateZone(number_of_zones-1);
    780             }
    781             */
    782             outgouing_cparticles.push_back(temp);
    783           }
    784 
    785           no_interaction = false;
    786           current_nucl1 = 0;
    787           current_nucl2 = 0;
    788 #ifdef CHC_CHECK
    789           G4double out_charge = 0.0;
    790 
    791           for (G4int ip = 0; ip < outgoing_particles.size(); ip++)
    792             out_charge += outgoing_particles[ip].getCharge();
    793 
    794           G4cout << " multiplicity " << outgoing_particles.size() <<
    795             " bul type " << bullet.type() << " targ type " << target.type() <<
    796             G4endl << " initial charge " << bullet.getCharge() + target.getCharge()
    797                  << " out charge " << out_charge << G4endl; 
    798 #endif
    799 
    800           if (verboseLevel > 2){
    801             G4cout << " partner type " << target.type() << G4endl;
    802           }
    803 
    804           if (target.nucleon()) {
    805             current_nucl1 = target.type();
    806 
    807           } else {
    808             if (verboseLevel > 2) G4cout << " good absorption " << G4endl;
    809 
    810             current_nucl1 = (target.type() - 100) / 10;
    811             current_nucl2 = target.type() - 100 - 10 * current_nucl1;
    812           }   
    813          
    814           if (current_nucl1 == 1) {
    815             protonNumberCurrent -= 1.0;
    816 
    817           } else {
    818             neutronNumberCurrent -= 1.0;
    819           };
    820 
    821           if (current_nucl2 == 1) {
    822             protonNumberCurrent -= 1.0;
    823 
    824           } else if(current_nucl2 == 2) {
    825             neutronNumberCurrent -= 1.0;
    826           };
    827  
    828           break;
    829         };
    830       }  // loop over partners
    831 
    832       if (no_interaction) { // still no interactions
    833         cparticle.updatePosition(old_position);
    834         cparticle.propagateAlongThePath(thePartners[npart - 1].second);
    835         cparticle.incrementCurrentPath(thePartners[npart - 1].second);
    836         boundaryTransition(cparticle);
    837         outgouing_cparticles.push_back(cparticle);
    838       };
    839     };
     895      outgoing_cparticles.push_back(cparticle);
     896    };
    840897  };
    841898
    842   return outgouing_cparticles;
     899  return outgoing_cparticles;
    843900}
    844901
     
    884941
    885942  } else {
    886     G4CascadeMomentum mom = cparticle.getMomentum();
    887     std::vector<G4double> pos = cparticle.getPosition();
     943    G4LorentzVector mom = cparticle.getMomentum();
     944    G4ThreeVector pos = cparticle.getPosition();
    888945
    889946    G4int type = cparticle.getParticle().type();
    890947
    891     G4double pr = 0.0;
    892 
    893     G4double r = 0.0;
    894 
    895     G4int i(0);
    896 
    897     for (i = 0; i < 3; i++) {
    898       pr += pos[i] * mom[i + 1];
    899       r += pos[i] * pos[i];
    900     };
    901 
    902     r = std::sqrt(r);
     948    G4double pr = pos.dot(mom.vect());
     949    G4double r = pos.mag();
     950
    903951    pr /= r;
    904952
     
    910958    //     << getPotential(type,next_zone) << G4endl;
    911959
    912     G4double qv = dv * dv - 2.0 * dv * mom[0] + pr * pr;
     960    G4double qv = dv * dv - 2.0 * dv * mom.e() + pr * pr;
    913961
    914962    G4double p1r;
     
    933981    G4double prr = (p1r - pr) / r; 
    934982
    935     for (i = 0; i < 3; i++) mom[i + 1] += pos[i] * prr;
    936 
     983    mom.setVect(mom.vect() + pos*prr);
    937984    cparticle.updateParticleMomentum(mom);
    938985  };
     
    9571004       getFermiKinetic(ip, zone)) worth = false;
    9581005
     1006    if (verboseLevel > 3) {
     1007      G4cout << "ekin=" << cparticle.getParticle().getKineticEnergy()
     1008             << " fermiKin=" << getFermiKinetic(ip, zone) << " : worth? "
     1009             << worth << G4endl;
     1010    }
    9591011  };
    9601012
     
    9721024
    9731025  // Calculate number of protons and neutrons in local region
    974   //  G4double Athird = std::pow(A, 0.3333);
     1026  //  G4double Athird = G4cbrt(A);
    9751027  //  G4double Nneut = Athird*(A-Z)/A;
    9761028  //  G4double Nprot = Athird*Z/A;
     
    10191071  G4double rz = nuclei_radius * s1;
    10201072
    1021   std::vector<G4double> pos(3);
    1022 
    1023   pos[0] = rz * std::cos(phi);
    1024   pos[1] = rz * std::sin(phi);
    1025   pos[2] = -nuclei_radius * std::sqrt(1.0 - s1 * s1);
     1073  G4ThreeVector pos(rz*std::cos(phi), rz*std::sin(phi),
     1074                    -nuclei_radius*std::sqrt(1.0 - s1*s1));
    10261075 
    10271076  G4CascadParticle cpart(*particle, pos, number_of_zones, large, 0);
    10281077
    1029   if (verboseLevel > 2){
    1030     cpart.print();
    1031   }
     1078  if (verboseLevel > 2) cpart.print();
    10321079
    10331080  return cpart;
    10341081}
    10351082
    1036 std::pair<std::vector<G4CascadParticle>, std::vector<G4InuclElementaryParticle> >
    1037 G4NucleiModel::initializeCascad(G4InuclNuclei* bullet,
    1038                                 G4InuclNuclei* target) {
     1083void G4NucleiModel::initializeCascad(G4InuclNuclei* bullet,
     1084                                     G4InuclNuclei* target,
     1085                                     modelLists& output) {
    10391086
    10401087  if (verboseLevel > 3) {
     
    10541101  const G4int itry_max = 100;
    10551102
    1056   std::vector<G4CascadParticle> casparticles;
    1057   std::vector<G4InuclElementaryParticle> particles;
    1058 
    1059 // first decide whether it will be cascad or compound final nuclei
    1060 
     1103  // Convenient references to input buffer contents
     1104  std::vector<G4CascadParticle>& casparticles = output.first;
     1105  std::vector<G4InuclElementaryParticle>& particles = output.second;
     1106
     1107  casparticles.clear();         // Reset input buffer to fill this event
     1108  particles.clear();
     1109
     1110  // first decide whether it will be cascad or compound final nuclei
    10611111  G4double ab = bullet->getA();
    10621112  G4double zb = bullet->getZ();
     
    10641114  G4double zt = target->getZ();
    10651115
     1116  G4double massb = bullet->getMass();   // For creating LorentzVectors below
     1117
    10661118  if (ab < max_a_for_cascad) {
    10671119
    1068     G4double benb = 0.001 * bindingEnergy(ab, zb) / ab;
    1069     G4double bent = 0.001 * bindingEnergy(at, zt) / at;
     1120    G4double benb = 0.001 * G4NucleiProperties::GetBindingEnergy(G4lrint(ab), G4lrint(zb)) / ab;
     1121    G4double bent = 0.001 * G4NucleiProperties::GetBindingEnergy(G4lrint(at), G4lrint(zt)) / at;
    10701122    G4double ben = benb < bent ? bent : benb;
    10711123
     
    10761128        itryg++;
    10771129
    1078         if(itryg > 0) particles.resize(0);
     1130        if(itryg > 0) particles.clear();
    10791131     
    10801132        //    nucleons coordinates and momenta in nuclei rest frame
    1081         std::vector<std::vector<G4double> > coordinates;
    1082         std::vector<G4CascadeMomentum> momentums;
     1133        std::vector<G4ThreeVector> coordinates;
     1134        std::vector<G4LorentzVector> momentums;
    10831135     
    10841136        if (ab < 3.0) { // deutron, simplest case
     
    10861138          G4double s = 2.0 * inuclRndm() - 1.0;
    10871139          G4double r1 = r * std::sqrt(1.0 - s * s);
    1088           std::vector<G4double> coord1(3);
    10891140          G4double phi = randomPHI();
    1090           coord1[0] = r1 * std::cos(phi);
    1091           coord1[1] = r1 * std::sin(phi);
    1092           coord1[2] = r * s;   
     1141
     1142          G4ThreeVector coord1(r1*std::cos(phi), r1*std::sin(phi), r*s);   
    10931143          coordinates.push_back(coord1);
    1094           G4int i(0);
    1095 
    1096           for (i = 0; i < 3; i++) coord1[i] *= -1;
     1144
     1145          coord1 *= -1.;
    10971146          coordinates.push_back(coord1);
     1147
    10981148          G4double p = 0.0;
    10991149          G4bool bad = true;
     
    11181168            G4cout << " p nuc " << p << G4endl;
    11191169          }
    1120           G4CascadeMomentum mom;
    1121           std::pair<G4double, G4double> COS_SIN = randomCOS_SIN();
    1122           G4double FI = randomPHI();
    1123           G4double P1 = p * COS_SIN.second;
    1124           mom[1] = P1 * std::cos(FI);
    1125           mom[2] = P1 * std::sin(FI);
    1126           mom[3] = p * COS_SIN.first;
     1170
     1171          G4LorentzVector mom = generateWithRandomAngles(p, massb);
     1172
    11271173          momentums.push_back(mom);
    1128 
    1129           for (i = 1; i < 4; i++) mom[i] *= -1;
    1130           momentums.push_back(mom);
    1131 
     1174          mom.setVect(-mom.vect());
     1175          momentums.push_back(-mom);
    11321176        } else {
    11331177          G4int ia = int(ab + 0.5);
    11341178
    1135           std::vector<G4double> coord1(3);
     1179          G4ThreeVector coord1;
    11361180
    11371181          G4bool badco = true;
     
    11411185          if (ab < 4.0) { // a == 3
    11421186            while (badco && itry < itry_max) {
    1143               if (itry > 0) coordinates.resize(0);
     1187              if (itry > 0) coordinates.clear();
    11441188              itry++;   
    11451189              G4int i(0);   
     
    11471191              for (i = 0; i < 2; i++) {
    11481192                G4int itry1 = 0;
    1149                 G4double s;
    1150                 G4double u;
    1151                 G4double rho;
     1193                G4double s, u, rho;
    11521194                G4double fmax = std::exp(-0.5) / std::sqrt(0.5);
    11531195
     
    11601202                  if (std::sqrt(s) * std::exp(-s) > u && s < s3max) {
    11611203                    s = r0forAeq3 * std::sqrt(s);
    1162                     std::pair<G4double, G4double> COS_SIN = randomCOS_SIN();
    1163                     u = s * COS_SIN.second; 
    1164                     G4double phi = randomPHI();
    1165                     coord1[0] = u * std::cos(phi);
    1166                     coord1[1] = u * std::sin(phi);
    1167                     coord1[2] = s * COS_SIN.first;   
     1204                    coord1 = generateWithRandomAngles(s).vect();
    11681205                    coordinates.push_back(coord1);
    11691206
    11701207                    if (verboseLevel > 2){
    1171                       G4cout << " i " << i << " r " << std::sqrt(coord1[0] * coord1[0] +
    1172                                                             coord1[1] * coord1[1] +
    1173                                                             coord1[2] * coord1[2]) << G4endl;
     1208                      G4cout << " i " << i << " r " << coord1.mag() << G4endl;
    11741209                    }
    11751210                    break;
     
    11781213
    11791214                if (itry1 == itry_max) { // bad case
    1180                   coord1[0] = coord1[1] = coord1[2] = 10000.;
     1215                  coord1.set(10000.,10000.,10000.);
    11811216                  coordinates.push_back(coord1);
    1182 
    11831217                  break;
    11841218                };
    11851219              };
    11861220
    1187               for (i = 0; i < 3; i++) coord1[i] = - coordinates[0][i] -
    1188                                        coordinates[1][i];
     1221              coord1 = -coordinates[0] - coordinates[1];
    11891222              if (verboseLevel > 2) {
    1190                 G4cout << " 3  r " << std::sqrt(coord1[0] * coord1[0] +
    1191                                            coord1[1] * coord1[1] +
    1192                                            coord1[2] * coord1[2]) << G4endl;
     1223                G4cout << " 3  r " << coord1.mag() << G4endl;
    11931224              }
    11941225
     
    11991230              for (i = 0; i < 2; i++) {
    12001231                for (G4int j = i+1; j < 3; j++) {
    1201                   G4double r2 = std::pow(coordinates[i][0] - coordinates[j][0], G4double(2)) +
    1202                     std::pow(coordinates[i][1] - coordinates[j][1], G4double(2)) +
    1203                     std::pow(coordinates[i][2] - coordinates[j][2], G4double(2));
     1232                  G4double r2 = (coordinates[i]-coordinates[j]).mag2();
    12041233
    12051234                  if (verboseLevel > 2) {
     
    12301259            while (badco && itry < itry_max) {
    12311260
    1232               if (itry > 0) coordinates.resize(0);
     1261              if (itry > 0) coordinates.clear();
    12331262              itry++;
    12341263              G4int i(0);
     
    12361265              for (i = 0; i < ia-1; i++) {
    12371266                G4int itry1 = 0;
    1238                 G4double s;
    1239                 G4double u;
     1267                G4double s, u;
    12401268
    12411269                while (itry1 < itry_max) {
     
    12461274                  if (std::sqrt(s) * std::exp(-s) * (1.0 + b * s) > u && s < s4max) {
    12471275                    s = r0forAeq4 * std::sqrt(s);
    1248                     std::pair<double, double> COS_SIN = randomCOS_SIN();
    1249                     u = s * COS_SIN.second; 
    1250                     G4double phi = randomPHI();
    1251                     coord1[0] = u*std::cos(phi);
    1252                     coord1[1] = u*std::sin(phi);
    1253                     coord1[2] = s*COS_SIN.first;   
     1276                    coord1 = generateWithRandomAngles(s).vect();
    12541277                    coordinates.push_back(coord1);
    12551278
    12561279                    if (verboseLevel > 2) {
    1257                       G4cout << " i " << i << " r " << std::sqrt(coord1[0]  * coord1[0] +
    1258                                                             coord1[1] * coord1[1] +
    1259                                                             coord1[2] * coord1[2]) << G4endl;
     1280                      G4cout << " i " << i << " r " << coord1.mag() << G4endl;
    12601281                    }
    12611282
     
    12651286
    12661287                if (itry1 == itry_max) { // bad case
    1267                   coord1[0] = coord1[1] = coord1[2] = 10000.0;
     1288                  coord1.set(10000.,10000.,10000.);
    12681289                  coordinates.push_back(coord1);
    1269 
    12701290                  break;
    12711291                };
    12721292              };
    12731293
    1274               for(i = 0; i < 3; i++) {
    1275                 coord1[i] = 0.0;
    1276 
    1277                 for(G4int j = 0; j < ia -1; j++) coord1[i] -= coordinates[j][i];
    1278               };
     1294              coord1 *= 0.0;    // Cheap way to reset
     1295              for(G4int j = 0; j < ia -1; j++) coord1 -= coordinates[j];
    12791296
    12801297              coordinates.push_back(coord1);   
    12811298
    12821299              if (verboseLevel > 2){
    1283                 G4cout << " last r " << std::sqrt(coord1[0] * coord1[0] +
    1284                                              coord1[1] * coord1[1] +
    1285                                              coord1[2] * coord1[2]) << G4endl;
     1300                G4cout << " last r " << coord1.mag() << G4endl;
    12861301              }
    12871302           
     
    12911306                for (G4int j = i+1; j < ia; j++) {
    12921307             
    1293                   G4double r2 = std::pow(coordinates[i][0] - coordinates[j][0], G4double(2)) +
    1294                    
    1295                     std::pow(coordinates[i][1]-coordinates[j][1], G4double(2)) +
    1296                     std::pow(coordinates[i][2] - coordinates[j][2], G4double(2));
     1308                  G4double r2 = (coordinates[i]-coordinates[j]).mag2();
    12971309
    12981310                  if (verboseLevel > 2){
     
    13151327
    13161328          if(badco) {
    1317             G4cout << " can not generate the nucleons coordinates for a " << ab <<
    1318               G4endl;   
    1319 
    1320             return std::pair<std::vector<G4CascadParticle>, std::vector<G4InuclElementaryParticle> >
    1321               (casparticles, particles);
     1329            G4cout << " can not generate the nucleons coordinates for a "
     1330                   << ab << G4endl;     
     1331
     1332            casparticles.clear();       // Return empty buffer on error
     1333            particles.clear();
     1334            return;
    13221335
    13231336          } else { // momentums
    1324             G4double p;
    1325             G4double u;
    1326             G4double x;
    1327             G4CascadeMomentum mom;
     1337            G4double p, u, x;
     1338            G4LorentzVector mom;
    13281339            //G4bool badp = True;
    13291340            G4int i(0);
     
    13391350                if(x > inuclRndm()) {
    13401351                  p = std::sqrt(0.01953 * u);
    1341                   std::pair<G4double, G4double> COS_SIN = randomCOS_SIN();
    1342                   G4double pt = p * COS_SIN.second; 
    1343                   G4double phi = randomPHI();
    1344                   mom[1] = pt * std::cos(phi);
    1345                   mom[2] = pt * std::sin(phi);
    1346                   mom[3] = p * COS_SIN.first;   
     1352                  mom = generateWithRandomAngles(p, massb);
    13471353                  momentums.push_back(mom);
    13481354
     
    13521358
    13531359              if(itry == itry_max) {
    1354                 G4cout << " can not generate proper momentum for a " << ab << G4endl;
    1355 
    1356                 return std::pair<std::vector<G4CascadParticle>, std::vector<G4InuclElementaryParticle> >
    1357                   (casparticles, particles);
     1360                G4cout << " can not generate proper momentum for a "
     1361                       << ab << G4endl;
     1362
     1363                casparticles.clear();   // Return empty buffer on error
     1364                particles.clear();
     1365                return;
    13581366              };
    13591367
     
    13611369            // last momentum
    13621370
    1363             for(i = 1; i < 4; i++) {
    1364               mom[i] = 0.;
    1365 
    1366               for(G4int j = 0; j < ia -1; j++) mom[i] -= momentums[j][i];
    1367             };
     1371            mom *= 0.;          // Cheap way to reset
     1372            for(G4int j=0; j< ia-1; j++) mom -= momentums[j];
    13681373
    13691374            momentums.push_back(mom);
     
    13761381
    13771382        for(i = 0; i < G4int(coordinates.size()); i++) {     
    1378           G4double rp = std::sqrt(coordinates[i][0] * coordinates[i][0] +
    1379                              coordinates[i][1] * coordinates[i][1] +
    1380                              coordinates[i][2] * coordinates[i][2]);
     1383          G4double rp = coordinates[i].mag2();
    13811384
    13821385          if(rp > rb) rb = rp;
     
    13871390        G4double phi = randomPHI();
    13881391        G4double rz = (nuclei_radius + rb) * s1;
    1389         std::vector<double> global_pos(3);
    1390         global_pos[0] = rz * std::cos(phi);
    1391         global_pos[1] = rz * std::sin(phi);
    1392         global_pos[2] = -(nuclei_radius + rb) * std::sqrt(1.0 - s1 * s1);
     1392        G4ThreeVector global_pos(rz*std::cos(phi), rz*std::sin(phi),
     1393                                 -(nuclei_radius+rb)*std::sqrt(1.0-s1*s1));
    13931394
    13941395        for (i = 0; i < G4int(coordinates.size()); i++) {
    1395           coordinates[i][0] += global_pos[0];
    1396           coordinates[i][1] += global_pos[1];
    1397           coordinates[i][2] += global_pos[2];
     1396          coordinates[i] += global_pos;
    13981397        }; 
    13991398
     
    14171416
    14181417        for (ipart = raw_particles.begin(); ipart != raw_particles.end(); ipart++) {
    1419           G4CascadeMomentum mom =
    1420             toTheBulletRestFrame.backToTheLab(ipart->getMomentum());
    1421           ipart->setMomentum(mom);
     1418          ipart->setMomentum(toTheBulletRestFrame.backToTheLab(ipart->getMomentum()));
    14221419        };
    14231420
     
    14251422
    14261423        for(G4int ip = 0; ip < G4int(raw_particles.size()); ip++) {
    1427           const G4CascadeMomentum& mom = raw_particles[ip].getMomentum();
    1428           G4double pmod = std::sqrt(mom[1] * mom[1] + mom[2] * mom[2] + mom[3] * mom[3]);
    1429           G4double t0 = -(mom[1] * coordinates[ip][0] + mom[2] * coordinates[ip][1] +
    1430                           mom[3] * coordinates[ip][2]) / pmod;
    1431           G4double det = t0 * t0 + nuclei_radius * nuclei_radius -
    1432             coordinates[ip][0] * coordinates[ip][0] -
    1433             coordinates[ip][1] * coordinates[ip][1] -
    1434             coordinates[ip][2] * coordinates[ip][2];
     1424          G4LorentzVector mom = raw_particles[ip].getMomentum();
     1425          G4double pmod = mom.rho();
     1426          G4double t0 = -mom.vect().dot(coordinates[ip]) / pmod;
     1427          G4double det = t0 * t0 + nuclei_radius * nuclei_radius
     1428                       - coordinates[ip].mag2();
    14351429          G4double tr = -1.0;
    14361430
     
    14411435            if(std::fabs(t1) <= std::fabs(t2)) {         
    14421436              if(t1 > 0.0) {
    1443                 if(coordinates[ip][2] + mom[3] * t1 / pmod <= 0.0) tr = t1;
     1437                if(coordinates[ip].z() + mom.z() * t1 / pmod <= 0.0) tr = t1;
    14441438              };
    14451439
    14461440              if(tr < 0.0 && t2 > 0.0) {
    14471441
    1448                 if(coordinates[ip][2] + mom[3] * t2 / pmod <= 0.0) tr = t2;
     1442                if(coordinates[ip].z() + mom.z() * t2 / pmod <= 0.0) tr = t2;
    14491443              };
    14501444
     
    14521446              if(t2 > 0.0) {
    14531447
    1454                 if(coordinates[ip][2] + mom[3] * t2 / pmod <= 0.0) tr = t2;
     1448                if(coordinates[ip].z() + mom.z() * t2 / pmod <= 0.0) tr = t2;
    14551449              };
    14561450
    14571451              if(tr < 0.0 && t1 > 0.0) {
    1458                 if(coordinates[ip][2] + mom[3] * t1 / pmod <= 0.0) tr = t1;
     1452                if(coordinates[ip].z() + mom.z() * t1 / pmod <= 0.0) tr = t1;
    14591453              };
    14601454            };
     
    14631457
    14641458          if(tr >= 0.0) { // cascad particle
    1465             coordinates[ip][0] += mom[1] * tr / pmod;
    1466             coordinates[ip][1] += mom[2] * tr / pmod;
    1467             coordinates[ip][2] += mom[3] * tr / pmod;
    1468             casparticles.push_back(
    1469                                    G4CascadParticle(raw_particles[ip], coordinates[ip],
     1459            coordinates[ip] += mom*tr / pmod;
     1460            casparticles.push_back(G4CascadParticle(raw_particles[ip],
     1461                                                    coordinates[ip],
    14701462                                                    number_of_zones, large, 0));
    14711463
     
    14771469
    14781470      if(casparticles.size() == 0) {
    1479         particles.resize(0);
    1480 
    1481         G4cout << " can not generate proper distribution for " << itry_max << " steps " << G4endl;
    1482 
     1471        particles.clear();
     1472
     1473        G4cout << " can not generate proper distribution for " << itry_max
     1474               << " steps " << G4endl;
    14831475      };   
    14841476    };
     
    14861478
    14871479  if(verboseLevel > 2){
     1480    G4int ip(0);
     1481
    14881482    G4cout << " cascad particles: " << casparticles.size() << G4endl;
    1489     G4int ip(0);
    1490 
    14911483    for(ip = 0; ip < G4int(casparticles.size()); ip++) casparticles[ip].print();
     1484
    14921485    G4cout << " outgoing particles: " << particles.size() << G4endl;
    1493 
    1494     for(ip = 0; ip < G4int(particles.size()); ip++) particles[ip].printParticle();
    1495   }
    1496 
    1497   return std::pair<std::vector<G4CascadParticle>, std::vector<G4InuclElementaryParticle> >
    1498     (casparticles, particles);
    1499 }
    1500 
     1486    for(ip = 0; ip < G4int(particles.size()); ip++)
     1487      particles[ip].printParticle();
     1488  }
     1489
     1490  return;       // Buffer has been filled
     1491}
     1492
     1493
     1494G4double G4NucleiModel::absorptionCrossSection(G4double ke, G4int type) const {
     1495  if (type != pionPlus && type != pionMinus && type != pionZero) {
     1496    G4cerr << " absorptionCrossSection only valid for incident pions" << G4endl;
     1497    return 0.;
     1498  }
     1499
     1500  // was 0.2 since the beginning, then changed to 1.0
     1501  // now 0.1 to convert from mb to fm**2
     1502  const G4double corr_fac = 1.0;
     1503  G4double csec = 0.0;
     1504 
     1505  if (ke < 0.3) {
     1506    csec = 0.1106 / std::sqrt(ke) - 0.8 + 0.08 / ((ke-0.123)*(ke-0.123) + 0.0056);
     1507
     1508  } else if (ke < 1.0) {
     1509    csec = 3.6735 * (1.0-ke)*(1.0-ke);     
     1510  };
     1511
     1512  if (csec < 0.0) csec = 0.0;
     1513
     1514  if (verboseLevel > 2) {
     1515    G4cout << " ekin " << ke << " abs. csec " << corr_fac * csec << G4endl;   
     1516  }
     1517
     1518  csec *= corr_fac;
     1519
     1520  return csec;
     1521}
    15011522
    15021523G4double G4NucleiModel::totalCrossSection(G4double ke, G4int rtype) const
    15031524{
    1504   const G4double keScale[30] = {
     1525  static const G4double keScale[] = {
    15051526    0.0,  0.01, 0.013, 0.018, 0.024, 0.032, 0.042, 0.056, 0.075, 0.1,
    15061527    0.13, 0.18, 0.24,  0.32,  0.42,  0.56,  0.75,  1.0,   1.3,   1.8,
    15071528    2.4,  3.2,  4.2,   5.6,   7.5,  10.0,  13.0,  18.0,  24.0,  32.0};
    1508 
    1509   G4int ik = 29;
    1510   G4double sk = 1.0;
    1511   for (G4int i = 1; i < 30; i++) {
    1512     if (ke <= keScale[i]) {
    1513       ik = i;
    1514       sk = (ke - keScale[ik - 1]) / (keScale[ik] - keScale[ik - 1]);
    1515       break;
    1516     }
    1517   }
    1518 
    1519   G4double csec = 0.0;
    1520 
    1521   // pp, nn
    1522   if (rtype == 1 || rtype == 4) {
    1523     csec = PPtot[ik - 1] + sk * (PPtot[ik] - PPtot[ik - 1]);
    1524 
    1525   // np
    1526   } else if (rtype == 2) {
    1527     csec = NPtot[ik - 1] + sk * (NPtot[ik] - NPtot[ik - 1]);
    1528 
    1529   // pi+p, pi-n 
    1530   } else if (rtype == 3 || rtype == 10) {
    1531     csec = pipPtot[ik - 1] + sk * (pipPtot[ik] - pipPtot[ik - 1]);
    1532 
    1533   // pi-p, pi+n
    1534   } else if (rtype == 5 || rtype == 6) {
    1535     csec = pimPtot[ik - 1] + sk * (pimPtot[ik] - pimPtot[ik - 1]);
    1536 
    1537   // pi0p, pi0n
    1538   } else if (rtype == 7 || rtype == 14) {
    1539     csec = pizPtot[ik - 1] + sk * (pizPtot[ik] - pizPtot[ik - 1]);
    1540 
    1541     // k+ p, k0 n
    1542   } else if (rtype == 11 || rtype == 30) {
    1543     csec = kpPtot[ik - 1] + sk * (kpPtot[ik] - kpPtot[ik - 1]);
    1544 
    1545   // k- p, k0b n
    1546   } else if (rtype == 13 || rtype == 34) {
    1547     csec = kmPtot[ik - 1] + sk * (kmPtot[ik] - kmPtot[ik - 1]);
    1548 
    1549   // k+ n, k0 p
    1550   } else if (rtype == 22 || rtype == 15) {
    1551     csec = kpNtot[ik - 1] + sk * (kpNtot[ik] - kpNtot[ik - 1]);
    1552 
    1553   // k- n, k0b p
    1554   } else if (rtype == 26 || rtype == 17) {
    1555     csec = kmNtot[ik - 1] + sk * (kmNtot[ik] - kmNtot[ik - 1]);
    1556 
    1557   // L p, L n, S0 p, S0 n
    1558   } else if (rtype == 21 || rtype == 25 || rtype == 42 || rtype == 50) {
    1559     csec = lPtot[ik - 1] + sk * (lPtot[ik] - lPtot[ik - 1]);
    1560 
    1561   // Sp p, Sm n
    1562   } else if (rtype == 23 || rtype == 54) {
    1563     csec = spPtot[ik - 1] + sk * (spPtot[ik] - spPtot[ik - 1]);
    1564 
    1565   // Sm p, Sp n
    1566   } else if (rtype == 27 || rtype == 46) {
    1567     csec = smPtot[ik - 1] + sk * (smPtot[ik] - smPtot[ik - 1]);
    1568 
    1569   // Xi0 p, Xi- n
    1570   } else if (rtype == 29 || rtype == 62) {
    1571     csec = xi0Ptot[ik - 1] + sk * (xi0Ptot[ik] - xi0Ptot[ik - 1]);
    1572 
    1573   // Xi- p, Xi0 n
    1574   } else if (rtype == 31 || rtype == 58) {
    1575     csec = ximPtot[ik - 1] + sk * (ximPtot[ik] - ximPtot[ik - 1]);
    1576 
    1577   } else {
     1529  static const G4int NBINS = sizeof(keScale)/sizeof(G4double);
     1530
     1531  static G4CascadeInterpolator<NBINS> interp(keScale);
     1532
     1533  // Pion and nucleon scattering cross-sections are available elsewhere
     1534  switch (rtype) {
     1535  case pro*pro: return G4CascadePPChannel::getCrossSection(ke); break;
     1536  case pro*neu: return G4CascadeNPChannel::getCrossSection(ke); break;
     1537  case pip*pro: return G4CascadePiPlusPChannel::getCrossSection(ke); break;
     1538  case neu*neu: return G4CascadeNNChannel::getCrossSection(ke); break;
     1539  case pim*pro: return G4CascadePiMinusPChannel::getCrossSection(ke); break;
     1540  case pip*neu: return G4CascadePiPlusNChannel::getCrossSection(ke); break;
     1541  case pi0*pro: return G4CascadePiZeroPChannel::getCrossSection(ke); break;
     1542  case pim*neu: return G4CascadePiMinusNChannel::getCrossSection(ke); break;
     1543  case pi0*neu: return G4CascadePiZeroNChannel::getCrossSection(ke); break;
     1544    // Remaining channels are handled locally until arrays are moved
     1545  case kpl*pro:                     
     1546  case k0*neu:  return interp.interpolate(ke, kpPtot); break;
     1547  case kmi*pro:                     
     1548  case k0b*neu: return interp.interpolate(ke, kmPtot); break;
     1549  case kpl*neu:                     
     1550  case k0*pro:  return interp.interpolate(ke, kpNtot); break;
     1551  case kmi*neu:                     
     1552  case k0b*pro: return interp.interpolate(ke, kmNtot); break;
     1553  case lam*pro:                     
     1554  case lam*neu:                     
     1555  case s0*pro:                       
     1556  case s0*neu:  return interp.interpolate(ke, lPtot); break;
     1557  case sp*pro:                       
     1558  case sm*neu:  return interp.interpolate(ke, spPtot); break;
     1559  case sm*pro:                       
     1560  case sp*neu:  return interp.interpolate(ke, smPtot); break;
     1561  case xi0*pro:                     
     1562  case xim*neu: return interp.interpolate(ke, xi0Ptot); break;
     1563  case xim*pro:                     
     1564  case xi0*neu: return interp.interpolate(ke, ximPtot); break;
     1565  default:
    15781566    G4cout << " unknown collison type = " << rtype << G4endl;
    15791567  }
    15801568
    1581   return csec;
    1582 }
    1583 
    1584 
    1585 void G4NucleiModel::initTotalCrossSections()
    1586 {
    1587   const G4double PPtotData[30] = {
    1588   17613.0, 302.9, 257.1, 180.6, 128.4,  90.5,  66.1,  49.4,  36.9, 29.6,
    1589      26.0,  23.1,  22.6,  23.0,  27.0,  32.0,  44.0,  47.04, 44.86, 46.03,
    1590      44.09, 41.81, 41.17, 40.65, 40.15, 40.18, 39.26, 38.36, 38.39, 38.41};
    1591 
    1592   const G4double NPtotData[30] = {
    1593   20357.0, 912.6, 788.6, 582.1, 415.0, 272.0, 198.8, 145.0, 100.4,  71.1,
    1594      58.8,  45.7,  38.9,  34.4,  34.0,  35.0,  37.5,  39.02, 40.29, 40.72,
    1595      42.36, 41.19, 42.04, 41.67, 40.96, 39.48, 39.79, 39.39, 39.36, 39.34};
    1596 
    1597   const G4double pipPtotData[30] = {
    1598     0.0,   1.2,   2.5,   3.8,   5.0,  7.0,   9.0,  15.0, 30.0,  64.0,
    1599   130.0, 190.0, 130.0,  56.0,  28.0, 17.14, 19.28, 27.4, 40.05, 32.52,
    1600    30.46, 29.0,  27.26, 25.84, 25.5, 24.5,  24.0,  23.5, 23.0,  23.0};
    1601 
    1602   const G4double pimPtotData[30] = {
    1603     6.13,  6.4,   6.67,  6.94,  7.22,  7.5,  8.3,  12.0,  14.4,  24.0,
    1604    46.0,  72.04, 43.02, 27.19, 27.32, 43.8, 37.08, 51.37, 34.21, 34.79,
    1605    32.08, 31.19, 30.32, 28.5,  27.0,  25.9, 25.5,  25.2,  25.0,  24.8};
    1606 
    1607   //  const G4double pizPtotData[30] = {
    1608   //    0.0,   3.55,  4.65,  5.9,   7.75, 10.1,  11.8,  18.0,  27.7, 52.5,
    1609   //  102.0, 150.0, 102.64, 51.03, 34.94, 34.52, 32.45, 44.05, 40.2, 34.93,
    1610   //   32.0,  30.0,  28.29, 26.91, 26.25, 25.25, 24.75, 24.35, 24.0, 23.9};
    1611 
    1612   // New test
    1613   const G4double pizPtotData[30] = {
    1614     6.43,  7.18,  7.54,  8.01,  8.52,  9.13, 10.22, 14.37, 20.96, 34.73,
    1615    61.07, 98.23, 61.97, 32.62, 28.07, 31.37, 35.15, 40.17, 37.27, 33.49,
    1616    31.06, 29.52, 28.29, 26.91, 26.25, 25.25, 24.75, 24.35, 24.0,  23.9};
    1617 
    1618   const G4double kpPtotData[30] = {
     1569  return 0.;            // Failure
     1570}
     1571
     1572// Initialize cross-section interpolation tables
     1573
     1574const G4double G4NucleiModel::kpPtot[30] = {
    16191575   10.0,  10.34, 10.44, 10.61, 10.82, 11.09, 11.43, 11.71, 11.75, 11.8,
    16201576   11.98, 12.28, 12.56, 12.48, 12.67, 14.48, 15.92, 17.83, 17.93, 17.88,
    16211577   17.46, 17.3,  17.3,  17.4,  17.4,  17.4,  17.4,  17.5,  17.7,  17.8};
    16221578
    1623   const G4double kpNtotData[30] = {
     1579const G4double G4NucleiModel::kpNtot[30] = {
    16241580    6.64,  6.99,  7.09,  7.27,  7.48,  7.75,  8.1,  8.49,  8.84, 9.31,
    16251581    9.8,  10.62, 11.64, 13.08, 14.88, 16.60, 17.5, 18.68, 18.68, 18.29,
    16261582   17.81, 17.6,  17.6,  17.6,  17.6,  17.6,  17.7, 17.8,  17.9,  18.0};
    16271583
    1628   const G4double kmPtotData[30] = {
     1584const G4double G4NucleiModel::kmPtot[30] = {
    16291585 1997.0, 1681.41, 1586.74, 1428.95, 1239.59, 987.12, 671.54, 377.85, 247.30, 75.54,
    16301586    71.08, 54.74,   44.08,   44.38,   45.45,  45.07,  41.04,  35.75,  33.22, 30.08,
    16311587    27.61, 26.5,    25.2,    24.0,    23.4,   22.8,   22.0,   21.3,   21.0,  20.9};
    16321588
    1633   const G4double kmNtotData[30] = {
     1589const G4double G4NucleiModel::kmNtot[30] = {
    16341590    6.15,  6.93,  7.16,  7.55,  8.02,  8.65,  9.43, 10.36, 11.34, 12.64,
    16351591   14.01, 16.45, 19.32, 23.0,  27.6,  30.92, 29.78, 28.28, 25.62, 23.1,
    16361592   22.31, 21.9,  21.73, 21.94, 21.23, 20.5,  20.4,  20.2,  20.1,  20.0};
    16371593
    1638   const G4double lPtotData[30] = {
     1594const G4double G4NucleiModel::lPtot[30] = {
    16391595  300.0, 249.07, 233.8, 208.33, 177.78, 137.04, 86.11, 41.41, 28.86, 12.35,
    16401596   13.82, 16.76, 20.68,  25.9,   30.37,  31.56, 32.83, 34.5,  34.91, 35.11,
    16411597   35.03, 36.06, 35.13,  35.01,  35.0,   35.0,  35.0,  35.0,  35.0,  35.0};
    16421598
    1643   const G4double spPtotData[30] = {
     1599const G4double G4NucleiModel::spPtot[30] = {
    16441600  150.0, 146.0, 144.8, 142.8, 140.4, 137.2, 133.2, 127.6, 120.0, 110.0,
    16451601   98.06, 84.16, 72.28, 56.58, 43.22, 40.44, 36.14, 30.48, 31.53, 31.92,
    16461602   29.25, 28.37, 29.81, 33.15, 33.95, 34.0,  34.0,  34.0,  34.0,  34.0};
    16471603
    1648   const G4double smPtotData[30] = {
     1604const G4double G4NucleiModel::smPtot[30] = {
    16491605  937.0, 788.14, 743.48, 669.05, 579.74, 460.65, 311.79, 183.33, 153.65, 114.6,
    16501606  105.18, 89.54,  70.58,  45.5,   32.17,  32.54,  32.95,  33.49,  33.55,  33.87,
    16511607   34.02, 34.29,  33.93,  33.88,  34.0,   34.0,   34.0,   34.0,   34.0,   34.0};
    16521608
    1653   const G4double xi0PtotData[30] = {
     1609const G4double G4NucleiModel::xi0Ptot[30] = {
    16541610  16.0,  14.72, 14.34, 13.7,  12.93, 11.9,  10.62, 9.29, 8.3,   7.0,
    16551611   7.96,  9.56, 11.48, 14.04, 19.22, 25.29, 29.4, 34.8, 34.32, 33.33,
    16561612  31.89, 29.55, 27.89, 21.43, 17.0,  16.0,  16.0, 16.0, 16.0,  16.0};
    16571613
    1658   const G4double ximPtotData[30] = {
     1614const G4double G4NucleiModel::ximPtot[30] = {
    16591615  33.0,  32.5,  32.35, 32.1,  31.8,  31.4,  30.9, 30.2, 29.25, 28.0,
    16601616  26.5,  24.6,  22.8,  20.78, 18.22, 19.95, 21.7, 24.0, 24.74, 25.95,
    16611617  27.59, 27.54, 23.16, 17.43, 12.94, 12.0,  12.0, 12.0, 12.0,  12.0};
    1662 
    1663   for (G4int i = 0; i < 30; i++) {
    1664     PPtot[i] = PPtotData[i];
    1665     NPtot[i] = NPtotData[i];
    1666     pipPtot[i] = pipPtotData[i];
    1667     pimPtot[i] = pimPtotData[i];
    1668     pizPtot[i] = pizPtotData[i];
    1669     kpPtot[i] = kpPtotData[i];
    1670     kpNtot[i] = kpNtotData[i];
    1671     kmPtot[i] = kmPtotData[i];
    1672     kmNtot[i] = kmNtotData[i];
    1673     lPtot[i] = lPtotData[i];
    1674     spPtot[i] = spPtotData[i];
    1675     smPtot[i] = smPtotData[i];
    1676     xi0Ptot[i] = xi0PtotData[i];
    1677     ximPtot[i] = ximPtotData[i];
    1678   }
    1679 
    1680 }
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4PreCompoundCascadeInterface.cc

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4PreCompoundCascadeInterface.cc,v 1.13 2010/05/21 18:07:30 mkelsey Exp $
     26// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100114  M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
     29// 20100413  M. Kelsey -- Pass G4CollisionOutput by ref to ::collide()
     30// 20100414  M. Kelsey -- Check for K0L/K0S before using G4InuclElemPart::type
     31// 20100419  M. Kelsey -- Access G4CollisionOutput lists by const-ref, and
     32//              const_iterator
     33// 20100428  M. Kelsey -- Use G4InuclParticleNames enum
     34// 20100429  M. Kelsey -- Change "case gamma:" to "case photon:"
     35// 20100517  M. Kelsey -- Follow new ctors for G4*Collider family.
     36// 20100520  M. Kelsey -- Add missing name string to ctor, follow code changes
     37//              from G4CascadeInterface.
    2638
    2739#include "G4PreCompoundCascadeInterface.hh"
    2840#include "globals.hh"
    29 #include "G4DynamicParticleVector.hh"
    30 #include "G4IonTable.hh"
    31 #include "G4PreCompoundInuclCollider.hh"
    32 #include "G4IntraNucleiCascader.hh"
    33 #include "G4ElementaryParticleCollider.hh"
    34 #include "G4NonEquilibriumEvaporator.hh"
    35 #include "G4BigBanger.hh"
     41#include "G4CollisionOutput.hh"
     42#include "G4DynamicParticle.hh"
    3643#include "G4InuclElementaryParticle.hh"
    3744#include "G4InuclNuclei.hh"
    3845#include "G4InuclParticle.hh"
    39 #include "G4CollisionOutput.hh"
     46#include "G4InuclParticleNames.hh"
     47#include "G4KaonZeroShort.hh"
     48#include "G4KaonZeroLong.hh"
     49#include "G4LorentzRotation.hh"
     50#include "G4Nucleus.hh"
     51#include "G4ParticleDefinition.hh"
     52#include "G4PreCompoundInuclCollider.hh"
     53#include "G4Track.hh"
    4054#include "G4V3DNucleus.hh"
    41 #include "G4Track.hh"
    42 #include "G4Nucleus.hh"
    43 #include "G4NucleiModel.hh"
    44 #include "G4LorentzRotation.hh"
    45 
    46 
    47 typedef std::vector<G4InuclElementaryParticle>::iterator particleIterator;
    48 typedef std::vector<G4InuclNuclei>::iterator nucleiIterator;
    49 
    50 G4PreCompoundCascadeInterface::G4PreCompoundCascadeInterface()
    51   :verboseLevel(0)  {
     55
     56using namespace G4InuclParticleNames;
     57
     58
     59typedef std::vector<G4InuclElementaryParticle>::const_iterator particleIterator;
     60typedef std::vector<G4InuclNuclei>::const_iterator nucleiIterator;
     61
     62G4PreCompoundCascadeInterface::G4PreCompoundCascadeInterface(const G4String& nam)
     63  :G4VIntraNuclearTransportModel(nam), verboseLevel(0)  {
    5264
    5365  if (verboseLevel > 3) {
     
    8597  // NOTE: Geant4 units are MeV = 1 and GeV = 1000. Cascade code by default use GeV = 1.
    8698
    87   enum particleType { nuclei      = 0,  proton     = 1,  neutron   = 2,  pionPlus = 3,
    88                       pionMinus   = 5,  pionZero   = 7,  photon    = 10,
    89                       kaonPlus    = 11, kaonMinus  = 13, kaonZero  = 15,
    90                       kaonZeroBar = 17, lambda     = 21, sigmaPlus = 23,
    91                       sigmaZero   = 25, sigmaMinus = 27, xiZero    = 29, xiMinus  = 31 };
    92 
    93   G4int bulletType = 0;
    94 
    95   // Coding particles
    96   if (aTrack.GetDefinition() == G4Proton::Proton()         ) bulletType = proton;
    97   if (aTrack.GetDefinition() == G4Neutron::Neutron()       ) bulletType = neutron;
    98   if (aTrack.GetDefinition() == G4PionPlus::PionPlus()     ) bulletType = pionPlus;
    99   if (aTrack.GetDefinition() == G4PionMinus::PionMinus()   ) bulletType = pionMinus;
    100   if (aTrack.GetDefinition() == G4PionZero::PionZero()     ) bulletType = pionZero;
    101   if (aTrack.GetDefinition() == G4Gamma::Gamma()           ) bulletType = photon;
    102   if (aTrack.GetDefinition() == G4KaonPlus::KaonPlus()     ) bulletType = kaonPlus;
    103   if (aTrack.GetDefinition() == G4KaonMinus::KaonMinus()   ) bulletType = kaonMinus;
    104   if (aTrack.GetDefinition() == G4Lambda::Lambda()         ) bulletType = lambda;
    105   if (aTrack.GetDefinition() == G4SigmaPlus::SigmaPlus()   ) bulletType = sigmaPlus;
    106   if (aTrack.GetDefinition() == G4SigmaZero::SigmaZero()   ) bulletType = sigmaZero;
    107   if (aTrack.GetDefinition() == G4SigmaMinus::SigmaMinus() ) bulletType = sigmaMinus;
    108   if (aTrack.GetDefinition() == G4XiZero::XiZero()         ) bulletType = xiZero;
    109   if (aTrack.GetDefinition() == G4XiMinus::XiMinus()       ) bulletType = xiMinus; 
    110 
     99  G4int bulletType;
    111100  if (aTrack.GetDefinition() == G4KaonZeroLong::KaonZeroLong() ||
    112       aTrack.GetDefinition() == G4KaonZeroShort::KaonZeroShort() ) {
    113     if (G4UniformRand() > 0.5) {
    114       bulletType = kaonZero;
    115     } else {
    116       bulletType = kaonZeroBar;
    117     }
    118   }
     101      aTrack.GetDefinition() == G4KaonZeroShort::KaonZeroShort() )
     102    bulletType = (G4UniformRand() > 0.5) ? kaonZero : kaonZeroBar;
     103  else
     104    bulletType = G4InuclElementaryParticle::type(aTrack.GetDefinition());
    119105
    120106  // Code momentum and energy.
    121   G4double px,py,pz;
    122   px=aTrack.Get4Momentum().px() / GeV;
    123   py=aTrack.Get4Momentum().py() / GeV;
    124   pz=aTrack.Get4Momentum().pz() / GeV;
    125 
    126107  G4LorentzVector projectileMomentum = aTrack.Get4Momentum();
    127108  G4LorentzRotation toZ;
     
    130111  G4LorentzRotation toLabFrame = toZ.inverse();
    131112
    132   G4CascadeMomentum momentumBullet;
    133   momentumBullet[0] =0.;
    134   momentumBullet[1] =0;
    135   momentumBullet[2] =0;
    136   momentumBullet[3] =std::sqrt(px*px+py*py+pz*pz);
    137 
    138   G4InuclElementaryParticle *  bullet = new G4InuclElementaryParticle(momentumBullet, bulletType);
     113  G4LorentzVector momentumBullet(0., 0., aTrack.GetTotalMomentum()/GeV,
     114                                 aTrack.GetTotalEnergy()/GeV);
     115
     116  G4InuclElementaryParticle *  bullet =
     117    new G4InuclElementaryParticle(momentumBullet, bulletType);
    139118
    140119  sumEnergy = bullet->getKineticEnergy(); // In GeV
    141 
    142   if (bulletType == proton || bulletType == neutron || bulletType == lambda ||
    143       bulletType == sigmaPlus || bulletType == sigmaZero || bulletType == sigmaMinus ||
    144       bulletType == xiZero || bulletType == xiMinus) {
    145 
    146     sumBaryon += 1;
    147   }
     120  sumBaryon += bullet->baryon();
    148121
    149122  // Set target
    150123  G4InuclNuclei*   target  = 0;
    151124  G4InuclParticle* targetH = 0;
    152   // and outcoming particles
    153   G4DynamicParticle* cascadeParticle = 0;
    154 
    155   G4CascadeMomentum targetMomentum;
    156125
    157126  G4double theNucleusA = theNucleus.GetN();
    158127
    159128  if ( !(G4int(theNucleusA) == 1) ) {
    160     target  = new G4InuclNuclei(targetMomentum,
    161                                 theNucleusA,
    162                                 theNucleus.GetZ());
    163     target->setEnergy();
    164 
    165     const G4CascadeMomentum& bmom = bullet->getMomentum();
    166     eInit = std::sqrt(bmom[0] * bmom[0]);
    167     const G4CascadeMomentum& tmom = target->getMomentum();
    168     eInit += std::sqrt(tmom[0] * tmom[0]);
     129    target  = new G4InuclNuclei(theNucleusA, theNucleus.GetZ());
     130    eInit = bullet->getEnergy() + target->getEnergy();
    169131
    170132    sumBaryon += theNucleusA;
     
    183145
    184146  // Colliders initialisation
    185   G4ElementaryParticleCollider*   colep = new G4ElementaryParticleCollider;
    186 
    187   G4IntraNucleiCascader*            inc = new G4IntraNucleiCascader; // the actual cascade
    188   inc->setInteractionCase(1); // Interaction type is particle with nuclei.
    189 
    190   G4NonEquilibriumEvaporator*     noneq = new G4NonEquilibriumEvaporator;
    191   G4BigBanger*                     bigb = new G4BigBanger;
    192   G4PreCompoundInuclCollider*  collider = new G4PreCompoundInuclCollider(colep, inc, noneq, bigb);
     147  G4PreCompoundInuclCollider*  collider = new G4PreCompoundInuclCollider;
    193148
    194149  G4int  maxTries = 10; // maximum tries for inelastic collision to avoid infinite loop
     
    197152  if (G4int(theNucleusA) == 1) { // special treatment for target H(1,1) (proton)
    198153
    199     targetH = new G4InuclElementaryParticle(targetMomentum, 1);
     154    targetH = new G4InuclElementaryParticle(1);
    200155
    201156    G4float cutElastic[32];
     
    214169    cutElastic[kaonPlus ]   = 0.5; // 0.5 GeV
    215170    cutElastic[kaonMinus]   = 0.5;
    216     cutElastic[kaonMinus]   = 0.5;
    217171    cutElastic[kaonZero]    = 0.5;
    218172    cutElastic[kaonZeroBar] = 0.5;
     
    222176
    223177
    224     if (momentumBullet[3] > cutElastic[bulletType]) { // inelastic collision possible
     178    if (momentumBullet.z() > cutElastic[bulletType]) { // inelastic collision possible
    225179
    226180      do {   // we try to create inelastic interaction
    227         output = collider->collide(bullet, targetH);
     181        output.reset();
     182        collider->collide(bullet, targetH, output);
    228183        nTries++;
    229184      } while(
     
    235190
    236191    } else { // only elastic collision is energetically possible
    237       output = collider->collide(bullet, targetH);
     192      collider->collide(bullet, targetH, output);
    238193    }
    239194
    240195    sumBaryon += 1;
    241196
    242     const G4CascadeMomentum& bmom = bullet->getMomentum();
    243     eInit = std::sqrt(bmom[0] * bmom[0]);
    244     const G4CascadeMomentum& tmom = targetH->getMomentum();
    245     eInit += std::sqrt(tmom[0] * tmom[0]);
     197    eInit = bullet->getEnergy() + target->getEnergy();
    246198
    247199    if (verboseLevel > 2) {
     
    254206    do  // we try to create inelastic interaction
    255207      {
    256         output = collider->collide(bullet, target );
     208        output.reset();
     209        collider->collide(bullet, target, output);
    257210        nTries++;
    258211      } while (
    259                //             (nTries < maxTries)                                                               &&
    260                //(output.getOutgoingParticles().size() + output.getNucleiFragments().size() < 2.5) &&
    261                //(output.getOutgoingParticles().size()!=0)                                         &&
    262                //(output.getOutgoingParticles().begin()->type()==bullet->type())
    263                //);
    264 
    265212               (nTries < maxTries) &&
    266213               output.getOutgoingParticles().size() == 1 &&     // we retry when elastic collision happened
     
    272219  }
    273220 
    274   if (verboseLevel > 1)
    275     {
     221  if (verboseLevel > 1) {
    276222      G4cout << " Cascade output: " << G4endl;
    277223      output.printCollisionOutput();
    278     }
     224  }
    279225 
     226  // Rotate event to put Z axis along original projectile direction
     227  output.rotateEvent(toLabFrame);
     228
    280229  // Convert cascade data to use hadronics interface
    281   std::vector<G4InuclNuclei>            nucleiFragments = output.getNucleiFragments();
    282   std::vector<G4InuclElementaryParticle> particles =      output.getOutgoingParticles();
     230  const std::vector<G4InuclNuclei>& nucleiFragments = output.getNucleiFragments();
     231  const std::vector<G4InuclElementaryParticle>& particles = output.getOutgoingParticles();
    283232
    284233  theResult.SetStatusChange(stopAndKill);
    285234
     235  // Get outcoming particles
     236  G4DynamicParticle* cascadeParticle = 0;
    286237  if (!particles.empty()) {
    287     particleIterator ipart;
    288     G4int outgoingParticle;
    289 
    290     for (ipart = particles.begin(); ipart != particles.end(); ipart++) {
    291       outgoingParticle = ipart->type();
    292       const G4CascadeMomentum& mom = ipart->getMomentum();
    293       eTot   += std::sqrt(mom[0] * mom[0]);
    294 
    295       G4double ekin = ipart->getKineticEnergy() * GeV;
    296       G4ThreeVector aMom(mom[1], mom[2], mom[3]);
    297       aMom = aMom.unit();
    298 
    299       if (ipart->baryon() ) {
    300         sumBaryon -= 1;
     238    particleIterator ipart = particles.begin();
     239    for (; ipart != particles.end(); ipart++) {
     240      G4int outgoingType = ipart->type();
     241
     242      eTot += ipart->getEnergy();
     243      sumBaryon -= ipart->baryon();
     244      sumEnergy -= ipart->getKineticEnergy();
     245
     246      if (!ipart->valid() || ipart->quasi_deutron()) {
     247        G4cerr << " ERROR: G4PreCompoundCascadeInterface::Propagate incompatible"
     248               << " particle type " << ipart->type() << G4endl;
     249        continue;
    301250      }
    302251
    303       sumEnergy -= ekin / GeV;
    304 
    305       switch(outgoingParticle) {
    306 
    307       case proton:
    308 #ifdef debug_G4PreCompoundCascadeInterface
    309         G4cerr << "proton " << counter << " " << aMom << " " << ekin << G4endl;
    310 #endif
    311         cascadeParticle = new G4DynamicParticle(G4Proton::ProtonDefinition(), aMom, ekin);
    312         break;
    313 
    314       case neutron:
    315 
    316 #ifdef debug_G4PreCompoundCascadeInterface
    317         G4cerr << "neutron "<< counter<<" "<<aMom<<" "<<  ekin<<G4endl;
    318 #endif
    319         cascadeParticle = new G4DynamicParticle(G4Neutron::NeutronDefinition(), aMom, ekin);
    320         break;
    321 
    322       case pionPlus:
    323         cascadeParticle = new G4DynamicParticle(G4PionPlus::PionPlusDefinition(), aMom, ekin);
    324 
    325 #ifdef debug_G4PreCompoundCascadeInterface
    326         G4cerr << "pionPlus "<< counter<<" "<<aMom<<" "<<  ekin<<G4endl;
    327 #endif
    328         break;
    329 
    330       case pionMinus:
    331         cascadeParticle = new G4DynamicParticle(G4PionMinus::PionMinusDefinition(), aMom, ekin);
    332 
    333 #ifdef debug_G4PreCompoundCascadeInterface
    334         G4cerr << "pionMinus "<< counter<<" "<<aMom<<" "<<  ekin<<G4endl;
    335 #endif
    336         break;
    337 
    338       case pionZero:
    339         cascadeParticle = new G4DynamicParticle(G4PionZero::PionZeroDefinition(), aMom, ekin);
    340 
    341 #ifdef debug_G4PreCompoundCascadeInterface
    342         G4cerr << "pionZero "<< counter<<" "<<aMom<<" "<<  ekin<<G4endl;
    343 #endif
    344         break;
    345 
    346       case photon:
    347         cascadeParticle = new G4DynamicParticle(G4Gamma::Gamma(), aMom, ekin);
    348 
    349 #ifdef debug_G4PreCompoundCascadeInterface
    350         G4cerr << "photon "<< counter<<" "<<aMom<<" "<<  ekin<<G4endl;
    351 #endif
    352         break;
    353 
    354 
    355       case kaonPlus:
    356         cascadeParticle = new G4DynamicParticle(G4KaonPlus::KaonPlusDefinition(), aMom, ekin);
    357         break;
    358 
    359       case kaonMinus:
    360         cascadeParticle = new G4DynamicParticle(G4KaonMinus::KaonMinusDefinition(), aMom, ekin);
    361         break;
    362 
    363       case kaonZero:
    364         if (G4UniformRand() > 0.5) {
    365           cascadeParticle = new G4DynamicParticle(G4KaonZeroLong::KaonZeroLongDefinition(), aMom, ekin);
    366         } else {
    367           cascadeParticle = new G4DynamicParticle(G4KaonZeroShort::KaonZeroShortDefinition(), aMom, ekin);
    368         }
    369         break;
    370 
    371       case kaonZeroBar:
    372         if (G4UniformRand() > 0.5) {
    373           cascadeParticle = new G4DynamicParticle(G4KaonZeroLong::KaonZeroLongDefinition(), aMom, ekin);
    374         } else {
    375           cascadeParticle = new G4DynamicParticle(G4KaonZeroShort::KaonZeroShortDefinition(), aMom, ekin);
    376         }
    377         break;
    378 
    379       case lambda:
    380         cascadeParticle = new G4DynamicParticle(G4Lambda::LambdaDefinition(), aMom, ekin);
    381         break;
    382 
    383       case sigmaPlus:
    384         cascadeParticle = new G4DynamicParticle(G4SigmaPlus::SigmaPlusDefinition(), aMom, ekin);
    385         break;
    386 
    387       case sigmaZero:
    388         cascadeParticle = new G4DynamicParticle(G4SigmaZero::SigmaZeroDefinition(), aMom, ekin);
    389         break;
    390 
    391       case sigmaMinus:
    392         cascadeParticle = new G4DynamicParticle(G4SigmaMinus::SigmaMinusDefinition(), aMom, ekin);
    393         break;
    394 
    395       case xiZero:
    396         cascadeParticle = new G4DynamicParticle(G4XiZero::XiZeroDefinition(), aMom, ekin);
    397         break;
    398 
    399       case xiMinus:
    400         cascadeParticle = new G4DynamicParticle(G4XiMinus::XiMinusDefinition(), aMom, ekin);
    401         break;
    402 
    403       default:
    404         G4cout << " ERROR: G4PreCompoundCascadeInterface::Propagate undefined particle type" << G4endl;
     252      // Copy local G4DynPart to public output (handle kaon mixing specially)
     253      if (outgoingType == kaonZero || outgoingType == kaonZeroBar) {
     254        G4ThreeVector momDir = ipart->getMomentum().vect().unit();
     255        G4double ekin = ipart->getKineticEnergy();
     256
     257        G4ParticleDefinition* pd = G4KaonZeroShort::Definition();
     258        if (G4UniformRand() > 0.5) pd = G4KaonZeroLong::Definition();
     259
     260        cascadeParticle = new G4DynamicParticle(pd, momDir, ekin);
     261      } else {
     262        cascadeParticle = new G4DynamicParticle(ipart->getDynamicParticle());
    405263      }
    406 
    407       cascadeParticle->Set4Momentum(cascadeParticle->Get4Momentum()*=toLabFrame);
     264 
    408265      theResult.AddSecondary(cascadeParticle);
    409266    }
     
    412269  // get nuclei fragments
    413270  G4DynamicParticle * aFragment = 0;
    414   G4ParticleDefinition * aIonDef = 0;
    415   G4ParticleTable *theTableOfParticles = G4ParticleTable::GetParticleTable();
    416 
    417271  if (!nucleiFragments.empty()) {
    418     nucleiIterator ifrag;
    419 
    420     for (ifrag = nucleiFragments.begin(); ifrag != nucleiFragments.end(); ifrag++)
    421       {
    422         G4double eKin = ifrag->getKineticEnergy() * GeV;
    423         const G4CascadeMomentum& mom = ifrag->getMomentum();
    424         eTot   += std::sqrt(mom[0] * mom[0]);
    425 
    426         G4ThreeVector aMom(mom[1], mom[2], mom[3]);
    427         aMom = aMom.unit();
    428 
    429         // hpw @@@ ==> Should be zero: G4double fragmentExitation = ifrag->getExitationEnergyInGeV();
    430 
    431         if (verboseLevel > 2) {
    432           G4cout << " Nuclei fragment: " << G4endl;
    433           ifrag->printParticle();
    434         }
    435 
    436         G4int A = G4int(ifrag->getA());
    437         G4int Z = G4int(ifrag->getZ());
    438         aIonDef = theTableOfParticles->FindIon(Z, A, 0, Z);
    439      
    440         aFragment =  new G4DynamicParticle(aIonDef, aMom, eKin);
    441 
    442         sumBaryon -= A;
    443         sumEnergy -= eKin / GeV;
    444 
    445         aFragment->Set4Momentum(aFragment->Get4Momentum()*=toLabFrame);
    446         theResult.AddSecondary(aFragment);
     272    nucleiIterator ifrag = nucleiFragments.begin();
     273    for (; ifrag != nucleiFragments.end(); ifrag++) {
     274      eTot += ifrag->getEnergy();
     275      sumBaryon -= ifrag->getA();
     276      sumEnergy -= ifrag->getKineticEnergy();
     277
     278      if (verboseLevel > 2) {
     279        G4cout << " Nuclei fragment: " << G4endl;
     280        ifrag->printParticle();
    447281      }
    448   }
    449 
     282
     283      // Copy local G4DynPart to public output
     284      aFragment =  new G4DynamicParticle(ifrag->getDynamicParticle());
     285      theResult.AddSecondary(aFragment);
     286    }
     287  }
     288
     289  // Report violations of energy, baryon conservation
    450290  if (verboseLevel > 2) {
    451291    if (sumBaryon != 0) {
    452       G4cout << "ERROR: no baryon number conservation, sum of baryons = " << sumBaryon << G4endl;
     292      G4cout << "ERROR: no baryon number conservation, sum of baryons = "
     293             << sumBaryon << G4endl;
    453294    }
    454295
    455296    if (sumEnergy > 0.01 ) {
    456       G4cout << "Kinetic energy conservation violated by " << sumEnergy << " GeV" << G4endl;
     297      G4cout << "Kinetic energy conservation violated by "
     298             << sumEnergy << " GeV" << G4endl;
    457299    }
    458300     
    459     G4cout << "Total energy conservation at level ~" << (eInit - eTot) * GeV << " MeV" << G4endl;
     301    G4cout << "Total energy conservation at level ~"
     302           << (eInit - eTot) * GeV << " MeV" << G4endl;
    460303   
    461304    if (sumEnergy < -5.0e-5 ) { // 0.05 MeV
    462       G4cout << "FATAL ERROR: energy created  " << sumEnergy * GeV << " MeV" << G4endl;
     305      G4cout << "FATAL ERROR: energy created  "
     306             << sumEnergy * GeV << " MeV" << G4endl;
    463307    }
    464308  }
    465309
    466310  delete bullet;
    467   delete colep;
    468   delete inc;
    469   delete noneq;
    470   delete bigb;
    471311  delete collider;
    472312
    473313  if(target != 0) delete target;
    474314  if(targetH != 0) delete targetH;
    475   // if(cascadeParticle != 0) delete cascadeParticle;
    476   // if(aFragment != 0) delete aFragment;
    477315
    478316  return &theResult;
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4PreCompoundInuclCollider.cc

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4PreCompoundInuclCollider.cc,v 1.9 2010/05/21 17:56:34 mkelsey Exp $
     26// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100114  M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
     29// 20100309  M. Kelsey -- Eliminate some unnecessary std::pow()
     30// 20100413  M. Kelsey -- Pass G4CollisionOutput by ref to ::collide()
     31// 20100429  M. Kelsey -- Change "photon()" to "isPhoton()"
     32// 20100517  M. Kelsey -- Inherit from common base class, make other colliders
     33//              simple data members, consolidate code
     34
    2635#include "G4PreCompoundInuclCollider.hh"
     36#include "G4BigBanger.hh"
     37#include "G4CollisionOutput.hh"
     38#include "G4ElementaryParticleCollider.hh"
     39#include "G4IntraNucleiCascader.hh"
    2740#include "G4InuclElementaryParticle.hh"
    2841#include "G4LorentzConvertor.hh"
    29 #include "G4ParticleLargerEkin.hh"
    30 #include <algorithm>
    31 
    32 typedef std::vector<G4InuclElementaryParticle>::iterator particleIterator;
    33 typedef std::vector<G4InuclNuclei>::iterator nucleiIterator;
     42#include "G4NonEquilibriumEvaporator.hh"
     43
    3444         
    3545G4PreCompoundInuclCollider::G4PreCompoundInuclCollider()
    36   : verboseLevel(0) {
    37 
    38   if (verboseLevel > 3) {
    39     G4cout << " >>> G4PreCompoundInuclCollider::G4PreCompoundInuclCollider" << G4endl;
    40   }
     46  : G4VCascadeCollider("G4PreCompoundInuclCollider"),
     47    theElementaryParticleCollider(new G4ElementaryParticleCollider),
     48    theIntraNucleiCascader(new G4IntraNucleiCascader),
     49    theNonEquilibriumEvaporator(new G4NonEquilibriumEvaporator),
     50    theBigBanger(new G4BigBanger) {}
     51
     52G4PreCompoundInuclCollider::~G4PreCompoundInuclCollider() {
     53  delete theElementaryParticleCollider;
     54  delete theIntraNucleiCascader;
     55  delete theNonEquilibriumEvaporator;
     56  delete theBigBanger;
    4157}
    4258
    43 G4CollisionOutput G4PreCompoundInuclCollider::collide(G4InuclParticle* bullet,
    44                                            G4InuclParticle* target) {
    45 
    46   verboseLevel = 0;
     59
     60void G4PreCompoundInuclCollider::collide(G4InuclParticle* bullet,
     61                                         G4InuclParticle* target,
     62                                         G4CollisionOutput& globalOutput) {
    4763  if (verboseLevel > 3) {
    4864    G4cout << " >>> G4PreCompoundInuclCollider::collide" << G4endl;
     
    5167  const G4int itry_max = 1000;
    5268                     
    53   G4CollisionOutput globalOutput;
    54   G4InuclElementaryParticle* particle1 =
    55     dynamic_cast<G4InuclElementaryParticle*>(bullet);
    56   G4InuclElementaryParticle* particle2 =
    57     dynamic_cast<G4InuclElementaryParticle*>(target);
    58  
    59   if (particle1 && particle2) { // particle + particle (NOTE: also the h + H(1,1) treated here)
     69  if (useEPCollider(bullet,target)) {
    6070    if (verboseLevel > 2) {
    61       particle1->printParticle();
    62       particle2->printParticle();
     71      bullet->printParticle();
     72      target->printParticle();
    6373    }
    6474
    65     globalOutput = theElementaryParticleCollider->collide(bullet, target);
    66 
     75    theElementaryParticleCollider->collide(bullet, target, globalOutput);
    6776  } else { // needs to call all machinery       
    6877    G4LorentzConvertor convertToTargetRestFrame;
    69     G4InteractionCase interCase = bulletTargetSetter(bullet, target);
    70     G4int intcase = interCase.getInterCase();
     78
     79    interCase.set(bullet, target);
    7180     
    72     if (intcase > 0) { // ok
     81    if (interCase.valid()) { // ok
    7382      G4InuclNuclei* ntarget =
    7483        dynamic_cast<G4InuclNuclei*>(interCase.getTarget());
    7584
    76       convertToTargetRestFrame.setTarget(ntarget->getMomentum(),
    77                                          ntarget->getMass());
     85      convertToTargetRestFrame.setTarget(ntarget);
    7886      G4int btype = 0;
    7987      G4double ab = 0.0;
     
    8290      G4double zt = ntarget->getZ();
    8391       
    84       if (intcase == 1) { // particle with nuclei
     92      if (interCase.hadNucleus()) { // particle with nuclei
    8593        G4InuclElementaryParticle* pbullet =
    8694          dynamic_cast<G4InuclElementaryParticle*>(interCase.getBullet());
    8795         
    88         if (pbullet->photon()) {
     96        if (pbullet->isPhoton()) {
    8997          G4cout << " InuclCollider -> can not collide with photon " << G4endl;
    9098
    9199          globalOutput.trivialise(bullet, target);
    92 
    93           return globalOutput;
     100          return;
    94101        } else {
    95           convertToTargetRestFrame.setBullet(pbullet->getMomentum(),
    96                                              pbullet->getMass());   
     102          convertToTargetRestFrame.setBullet(pbullet);   
    97103          btype = pbullet->type();
    98104        };
     
    102108          dynamic_cast<G4InuclNuclei*>(interCase.getBullet());
    103109
    104         convertToTargetRestFrame.setBullet(nbullet->getMomentum(),
    105                                            nbullet->getMass());   
     110        convertToTargetRestFrame.setBullet(nbullet);   
    106111        ab = nbullet->getA();
    107112        zb = nbullet->getZ();
     
    121126        }
    122127
    123         G4CascadeMomentum bmom;
    124 
    125         bmom[3] = convertToTargetRestFrame.getTRSMomentum();
    126 
    127         G4InuclNuclei ntarget(at, zt);
    128         G4CascadeMomentum tmom;
    129 
    130         ntarget.setMomentum(tmom);
    131         ntarget.setEnergy();
    132         theIntraNucleiCascader->setInteractionCase(intcase);
     128        G4LorentzVector bmom;
     129        bmom.setZ(convertToTargetRestFrame.getTRSMomentum());
     130
     131        G4InuclNuclei ntarget(at, zt);          // Default is at rest
     132
     133        theIntraNucleiCascader->setInteractionCase(interCase.code());
    133134         
    134135        G4bool bad = true;
    135136        G4int itry = 0;
    136137         
     138        G4CollisionOutput TRFoutput;
     139        G4CollisionOutput output;
    137140        while (bad && itry < itry_max) {
    138           G4CollisionOutput TRFoutput;
    139           G4CollisionOutput output;
    140 
    141141          itry++;
    142           if (intcase == 1) {
     142
     143          output.reset();       // Clear buffers for this attempt
     144          TRFoutput.reset();
     145
     146          if (interCase.hadNucleus()) {
    143147            G4InuclElementaryParticle pbullet(bmom, btype);
    144148
    145             output = theIntraNucleiCascader->collide(&pbullet, &ntarget);
     149            theIntraNucleiCascader->collide(&pbullet, &ntarget, output);
    146150          } else {
    147             G4InuclNuclei nbullet(ab, zb);
    148             nbullet.setMomentum(bmom);
    149             nbullet.setEnergy();
    150             output = theIntraNucleiCascader->collide(&nbullet, &ntarget);
     151            G4InuclNuclei nbullet(bmom, ab, zb);
     152            theIntraNucleiCascader->collide(&nbullet, &ntarget, output);
    151153          };   
    152154
    153155          if (verboseLevel > 3) {
    154156            G4cout << " After Cascade " << G4endl;
    155 
    156157            output.printCollisionOutput();
    157158          }
     
    160161          TRFoutput.addOutgoingParticles(output.getOutgoingParticles());
    161162
    162           if (output.numberOfNucleiFragments() == 1) { // there is smth. after     
     163          if (output.numberOfNucleiFragments() == 1) { // there is smth. after
    163164            G4InuclNuclei cascad_rec_nuclei = output.getNucleiFragments()[0];
    164165            if (explosion(&cascad_rec_nuclei)) {
     
    167168              };
    168169
    169               output = theBigBanger->collide(0,&cascad_rec_nuclei);
    170               TRFoutput.addOutgoingParticles(output.getOutgoingParticles());
     170              theBigBanger->collide(0,&cascad_rec_nuclei, TRFoutput);
    171171            } else {
    172               output = theNonEquilibriumEvaporator->collide(0, &cascad_rec_nuclei);
     172              output.reset();
     173              theNonEquilibriumEvaporator->collide(0, &cascad_rec_nuclei, output);
    173174
    174175              if (verboseLevel > 3) {
     
    178179
    179180              TRFoutput.addOutgoingParticles(output.getOutgoingParticles()); 
    180               TRFoutput.addTargetFragments(output.getNucleiFragments());         
     181              TRFoutput.addTargetFragments(output.getNucleiFragments());
    181182            };
    182183          };
    183184         
    184185          // convert to the LAB       
    185           G4bool withReflection = convertToTargetRestFrame.reflectionNeeded();       
    186           std::vector<G4InuclElementaryParticle> particles =
    187             TRFoutput.getOutgoingParticles();
    188 
    189           if (!particles.empty()) {
    190             particleIterator ipart;
    191             for(ipart = particles.begin(); ipart != particles.end(); ipart++) {
    192               G4CascadeMomentum mom = ipart->getMomentum();
    193 
    194               if (withReflection) mom[3] = -mom[3];
    195               mom = convertToTargetRestFrame.rotate(mom);
    196               ipart->setMomentum(mom);
    197               mom = convertToTargetRestFrame.backToTheLab(ipart->getMomentum());
    198               ipart->setMomentum(mom);
    199             };
    200             std::sort(particles.begin(), particles.end(), G4ParticleLargerEkin());
    201           };
    202            
    203           std::vector<G4InuclNuclei> nucleus = TRFoutput.getNucleiFragments();
    204 
    205           if (!nucleus.empty()) {
    206             nucleiIterator inuc;
    207 
    208             for (inuc = nucleus.begin(); inuc != nucleus.end(); inuc++) {
    209               G4CascadeMomentum mom = inuc->getMomentum();
    210 
    211               if (withReflection) mom[3] = -mom[3];
    212               mom = convertToTargetRestFrame.rotate(mom);
    213               inuc->setMomentum(mom);
    214               inuc->setEnergy();
    215               mom = convertToTargetRestFrame.backToTheLab(inuc->getMomentum());
    216               inuc->setMomentum(mom);
    217               inuc->setEnergy();
    218             };
    219           };
    220           globalOutput.addOutgoingParticles(particles);
    221           globalOutput.addTargetFragments(nucleus);
     186          TRFoutput.boostToLabFrame(convertToTargetRestFrame);
     187
     188          globalOutput.addOutgoingParticles(TRFoutput.getOutgoingParticles());
     189          globalOutput.addTargetFragments(TRFoutput.getNucleiFragments());
    222190          globalOutput.setOnShell(bullet, target);
    223           if(globalOutput.acceptable()) {
    224 
    225             return globalOutput;
    226           } else {
    227             globalOutput.reset();
    228           };
     191          if (globalOutput.acceptable()) return;
     192
     193          globalOutput.reset();         // Clear and try again
    229194        };
    230195
     
    233198                 << itry_max << " attempts " << G4endl;
    234199        }
    235 
    236         globalOutput.trivialise(bullet, target);
    237 
    238         return globalOutput;       
    239200      } else {
    240 
    241201        if (verboseLevel > 3) {
    242202          G4cout << " InuclCollider -> inelastic interaction is impossible " << G4endl
    243203                 << " due to the coulomb barirer " << G4endl;
    244204        }
    245 
    246         globalOutput.trivialise(bullet, target);
    247 
    248         return globalOutput;
    249       };
     205      }
    250206       
     207      globalOutput.trivialise(bullet, target);
     208      return;
    251209    } else {
    252 
    253210      if (verboseLevel > 3) {
    254         G4cout << " InuclCollider -> inter case " << intcase << G4endl;
     211        G4cout << " InuclCollider -> inter case " << interCase.code() << G4endl;
    255212      };
    256213    };       
    257214  };
    258215
    259   return globalOutput;
     216  return;
    260217}
    261                      
    262 G4bool G4PreCompoundInuclCollider::inelasticInteractionPossible(G4InuclParticle* bullet,
    263                                                      G4InuclParticle* target,
    264                                                      G4double ekin) const {
    265 
    266   if (verboseLevel > 3) {
    267     G4cout << " >>> G4PreCompoundInuclCollider::inelasticInteractionPossible" << G4endl;
    268   }
    269 
    270   const G4double coeff = 0.001 * 1.2;
    271   const G4double one_third = 1.0 / 3.0;
    272 
    273   G4bool possible = true;
    274   G4double at;
    275   G4double zt;
    276   G4double ab;
    277   G4double zb;
    278 
    279   if (G4InuclNuclei* nuclei_target = dynamic_cast<G4InuclNuclei*>(target)) {
    280     at = nuclei_target->getA();
    281     zt = nuclei_target->getZ();
    282     if (G4InuclNuclei* nuclei_bullet = dynamic_cast<G4InuclNuclei*>(bullet)) {
    283       ab = nuclei_bullet->getA();
    284       zb = nuclei_bullet->getZ();     
    285     } else {
    286       G4InuclElementaryParticle* particle =
    287         dynamic_cast<G4InuclElementaryParticle*>(bullet);
    288 
    289       ab = 1;
    290       zb = particle->getCharge();
    291     };
    292   } else {
    293     if(G4InuclNuclei* nuclei_bullet = dynamic_cast<G4InuclNuclei*>(bullet)) {
    294       ab = nuclei_bullet->getA();
    295       zb = nuclei_bullet->getZ();     
    296 
    297       G4InuclElementaryParticle* particle =
    298         dynamic_cast<G4InuclElementaryParticle*>(target);
    299 
    300       at = 1;
    301       zt = particle->getCharge();   
    302     } else {
    303 
    304       return possible;
    305     }; 
    306   };
    307 
    308   // VCOL used  for testing if elastic collision possible
    309   G4double VCOL = coeff * zt * zb / (std::pow(at, one_third) + std::pow(ab, one_third));
    310 
    311   // possible = VCOL < ekin; // NOTE: inelastic collision if not true
    312   possible = true; // we force elastic
    313 
    314   if (verboseLevel > 3) {
    315     G4cout << " >>> G4PreCompoundInuclCollider::inelasticInteractionPossible" << G4endl;
    316     G4cout << " VCOL: " << VCOL << " ekin: " << ekin << " inelastic possible: " << possible << G4endl;
    317   }
    318 
    319   return possible;
    320 
    321 }
    322        
    323 G4InteractionCase G4PreCompoundInuclCollider::bulletTargetSetter(G4InuclParticle* bullet,
    324                                                       G4InuclParticle* target) const {
    325 
    326   if (verboseLevel > 3) {
    327     G4cout << " >>> G4PreCompoundInuclCollider::bulletTargetSetter" << G4endl;
    328   }
    329 
    330   G4InteractionCase interCase;
    331 
    332   if (G4InuclNuclei* nuclei_target = dynamic_cast<G4InuclNuclei*>(target)) {     
    333     if (G4InuclNuclei* nuclei_bullet = dynamic_cast<G4InuclNuclei*>(bullet)) { // A + A         
    334       interCase.setInterCase(2);
    335       if (nuclei_target->getA() >= nuclei_bullet->getA()) {
    336         interCase.setBulletTarget(bullet, target);
    337       } else {
    338         interCase.setBulletTarget(target, bullet);
    339       };
    340     } else {
    341       interCase.setInterCase(1);
    342       interCase.setBulletTarget(bullet, target);
    343     };
    344   } else {
    345     G4InuclNuclei* nuclei_bullet = dynamic_cast<G4InuclNuclei*>(bullet);
    346     if (nuclei_bullet) {
    347       G4InuclElementaryParticle* part =
    348         dynamic_cast<G4InuclElementaryParticle*>(target);
    349       if (part) {
    350         interCase.setInterCase(1);
    351         interCase.setBulletTarget(target, bullet);
    352       };
    353     };
    354   };
    355 
    356   return interCase;
    357 }       
    358 
    359 G4bool G4PreCompoundInuclCollider::explosion(G4InuclNuclei* target) const {
    360 
    361   if (verboseLevel > 3) {
    362     G4cout << " >>> G4PreCompoundInuclCollider::explosion" << G4endl;
    363   }
    364 
    365   const G4double a_cut = 20.0;
    366   const G4double be_cut = 3.0;
    367 
    368   G4double a = target->getA();
    369   G4double z = target->getZ();
    370   G4double eexs = target->getExitationEnergy();
    371   G4bool explo = true;
    372 
    373   if (a > a_cut) {
    374     explo = false;
    375   } else {
    376     if (eexs < be_cut * bindingEnergy(a, z)) explo = false;
    377   };   
    378 
    379   return explo;
    380 }
    381  
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4RegionModel.cc

    r819 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4RegionModel.cc,v 1.16 2010/03/19 05:03:23 mkelsey Exp $
     26// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100319  M. Kelsey -- Eliminate unnecessary use of std::pow()
     29
    2630#include "G4RegionModel.hh"
    2731#include "G4HadronicException.hh"
     32#include "G4InuclSpecialFunctions.hh"
     33
     34using namespace G4InuclSpecialFunctions;
    2835
    2936const G4double G4RegionModel::radius0 = 1.0E-15;
     
    3340{
    3441  //count the radiuses, densities and fermi momenta with A and Z
    35   G4double oneThird = 1.0/3.0;
    36   G4double r = radius0*std::pow(G4double(A), G4double(oneThird));
     42  G4double r = radius0*G4cbrt(A);
    3743
    3844  if(numberOfLayers==1){
    3945    radius.push_back(r);
    4046
    41     G4double rho = G4double(A) / (4.0/3.0*pi*std::pow(r,G4double(3)));
     47    G4double vol = 4.0/3.0 * pi * r*r*r;
     48    G4double rho = G4double(A) / vol;
    4249    density.push_back(rho);
    4350
    4451    G4double protonMass = G4Proton::Proton()->GetPDGMass();
    4552    G4double neutronMass = G4Neutron::Neutron()->GetPDGMass();
    46     G4double protonDensity = G4double(Z) / (4.0/3.0*pi*std::pow(r,G4double(3)));
    47     G4double neutronDensity = G4double(A-Z) / (4.0/3.0*pi*std::pow(r,G4double(3)));
     53    G4double protonDensity = G4double(Z) / vol;
     54    G4double neutronDensity = G4double(A-Z) / vol;
    4855
    4956    protonFermiEnergy.push_back(GetFermiEnergy(protonDensity, protonMass));
     
    123130G4double G4RegionModel::GetFermiMomentum(G4double aDensity,
    124131                                         G4double aMass){
    125  
    126132  return std::sqrt(2*aMass*GetFermiEnergy(aDensity, aMass));
    127 
    128133}
    129134
    130135G4double G4RegionModel::GetFermiEnergy(G4double aDensity,
    131136                                         G4double aMass){
    132  
    133 G4double twoThirds = 2.0/3.0;
    134     return (std::pow(hbar_Planck,2)/(2.0*aMass)*std::pow((3.0*pi2*aDensity),twoThirds));
     137  G4double densFactor = G4cbrt(3.0*pi2*aDensity);               // 2/3 power
     138  densFactor *= densFactor;
     139
     140  return hbar_Planck*hbar_Planck/(2.0*aMass) * densFactor;
    135141}
    136142
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4WatcherGun.cc

    r819 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4WatcherGun.cc,v 1.13 2010/04/08 15:48:00 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100407  M. Kelsey -- Replace std::vector<>::resize(0) with ::clear(),
     29//              and create vectors pre-sized to maximum needed.
     30
    2631//#define PB
    2732
    2833#include "G4WatcherGun.hh"
     34#include "G4ios.hh"
    2935
    3036G4WatcherGun::G4WatcherGun()
    31   : verboseLevel(2) {
     37  : verboseLevel(0) {
    3238
    3339  if (verboseLevel > 3) {
     
    4248  }
    4349
    44   std::vector<G4double> as;
    45   std::vector<G4double> cs;
    46   std::vector<G4double> errs;
     50  std::vector<G4double> as(27);         // Reserve maximum number of entries
     51  std::vector<G4double> cs(27);
     52  std::vector<G4double> errs(27);
    4753
    4854  // specific stuff to monitor the difference with fortran
     
    5864
    5965  // Z = 1
    60   as.resize(0);
    61   cs.resize(0);
    62   errs.resize(0);
     66  as.clear();
     67  cs.clear();
     68  errs.clear();
    6369  as.push_back(1.0);
    6470  cs.push_back(7645.0);
     
    7682
    7783  // Z = 1
    78   as.resize(0);
    79   cs.resize(0);
    80   errs.resize(0);
     84  as.clear();
     85  cs.clear();
     86  errs.clear();
    8187  as.push_back(2.0);
    8288  cs.push_back(658.7);
     
    8894 
    8995  // Z = -1
    90   as.resize(0);
    91   cs.resize(0);
    92   errs.resize(0);
     96  as.clear();
     97  cs.clear();
     98  errs.clear();
    9399  as.push_back(0.0);
    94100  cs.push_back(198.3);
     
    97103
    98104  // Z = 2
    99   as.resize(0);
    100   cs.resize(0);
    101   errs.resize(0);
     105  as.clear();
     106  cs.clear();
     107  errs.clear();
    102108  as.push_back(3.0);
    103109  cs.push_back(28.2);
     
    111117  // Z = 22
    112118  // watchers for pb208 + 1 GeV p
    113   as.resize(0);
    114   cs.resize(0);
    115   errs.resize(0);
     119  as.clear();
     120  cs.clear();
     121  errs.clear();
    116122  as.push_back(47.0);
    117123  cs.push_back(0.2);
     
    135141
    136142  // Z = 23
    137   as.resize(0);
    138   cs.resize(0);
    139   errs.resize(0);
     143  as.clear();
     144  cs.clear();
     145  errs.clear();
    140146  as.push_back(49.0);
    141147  cs.push_back(0.182);
     
    162168
    163169  // Z = 24
    164   as.resize(0);
    165   cs.resize(0);
    166   errs.resize(0);
     170  as.clear();
     171  cs.clear();
     172  errs.clear();
    167173  as.push_back(51.0);
    168174  cs.push_back(0.215);
     
    189195
    190196  // Z = 25
    191   as.resize(0);
    192   cs.resize(0);
    193   errs.resize(0);
     197  as.clear();
     198  cs.clear();
     199  errs.clear();
    194200  as.push_back(53.0);
    195201  cs.push_back(0.181);
     
    219225
    220226  // Z = 26
    221   as.resize(0);
    222   cs.resize(0);
    223   errs.resize(0);
     227  as.clear();
     228  cs.clear();
     229  errs.clear();
    224230  as.push_back(55.0);
    225231  cs.push_back(0.129);
     
    249255
    250256  // Z = 27
    251   as.resize(0);
    252   cs.resize(0);
    253   errs.resize(0);
     257  as.clear();
     258  cs.clear();
     259  errs.clear();
    254260  as.push_back(57.0);
    255261  cs.push_back(0.0866);
     
    282288
    283289  // Z = 28
    284   as.resize(0);
    285   cs.resize(0);
    286   errs.resize(0);
     290  as.clear();
     291  cs.clear();
     292  errs.clear();
    287293  as.push_back(59.0);
    288294  cs.push_back(0.035);
     
    318324
    319325  // Z = 29
    320   as.resize(0);
    321   cs.resize(0);
    322   errs.resize(0);
     326  as.clear();
     327  cs.clear();
     328  errs.clear();
    323329  as.push_back(61.0);
    324330  cs.push_back(0.026);
     
    357363
    358364  // Z = 30
    359   as.resize(0);
    360   cs.resize(0);
    361   errs.resize(0);
     365  as.clear();
     366  cs.clear();
     367  errs.clear();
    362368  as.push_back(64.0);
    363369  cs.push_back(0.149);
     
    393399
    394400  // Z = 31
    395   as.resize(0);
    396   cs.resize(0);
    397   errs.resize(0);
     401  as.clear();
     402  cs.clear();
     403  errs.clear();
    398404  as.push_back(66.0);
    399405  cs.push_back(0.082);
     
    432438
    433439  // Z = 32
    434   as.resize(0);
    435   cs.resize(0);
    436   errs.resize(0);
     440  as.clear();
     441  cs.clear();
     442  errs.clear();
    437443  as.push_back(68.0);
    438444  cs.push_back(0.038);
     
    474480
    475481  // Z = 33
    476   as.resize(0);
    477   cs.resize(0);
    478   errs.resize(0);
     482  as.clear();
     483  cs.clear();
     484  errs.clear();
    479485  as.push_back(71.0);
    480486  cs.push_back(0.176);
     
    516522
    517523  // Z = 34
    518   as.resize(0);
    519   cs.resize(0);
    520   errs.resize(0);
     524  as.clear();
     525  cs.clear();
     526  errs.clear();
    521527  as.push_back(73.0);
    522528  cs.push_back(0.102);
     
    558564
    559565  // Z = 35
    560   as.resize(0);
    561   cs.resize(0);
    562   errs.resize(0);
     566  as.clear();
     567  cs.clear();
     568  errs.clear();
    563569  as.push_back(75.0);
    564570  cs.push_back(0.048);
     
    604610  // spallation part
    605611  // Z = 61
    606   as.resize(0);
    607   cs.resize(0);
    608   errs.resize(0);
     612  as.clear();
     613  cs.clear();
     614  errs.clear();
    609615  as.push_back(132.0);
    610616  cs.push_back(0.002);
     
    652658
    653659  // Z = 69
    654   as.resize(0);
    655   cs.resize(0);
    656   errs.resize(0);
     660  as.clear();
     661  cs.clear();
     662  errs.clear();
    657663  as.push_back(152.0);
    658664  cs.push_back(0.045);
     
    712718
    713719  // Z = 73
    714   as.resize(0);
    715   cs.resize(0);
    716   errs.resize(0);
     720  as.clear();
     721  cs.clear();
     722  errs.clear();
    717723  as.push_back(160.0);
    718724  cs.push_back(0.003);
     
    787793
    788794  // Z = 77
    789   as.resize(0);
    790   cs.resize(0);
    791   errs.resize(0);
     795  as.clear();
     796  cs.clear();
     797  errs.clear();
    792798  as.push_back(170.0);
    793799  cs.push_back(0.003);
     
    874880
    875881  // Z = 81
    876   as.resize(0);
    877   cs.resize(0);
    878   errs.resize(0);
     882  as.clear();
     883  cs.clear();
     884  errs.clear();
    879885  as.push_back(184.0);
    880886  cs.push_back(0.058);
     
    952958
    953959  // Z = 82
    954   as.resize(0);
    955   cs.resize(0);
    956   errs.resize(0);
     960  as.clear();
     961  cs.clear();
     962  errs.clear();
    957963  as.push_back(187.0);
    958964  cs.push_back(0.01);
     
    10241030  // watchers for Au197 + P, 800 MeV
    10251031  // Z = 80
    1026   as.resize(0);
    1027   cs.resize(0);
    1028   errs.resize(0);
     1032  as.clear();
     1033  cs.clear();
     1034  errs.clear();
    10291035  as.push_back(196.0);
    10301036  cs.push_back(1.54);
     
    10841090
    10851091  // Z = 77
    1086   as.resize(0);
    1087   cs.resize(0);
    1088   errs.resize(0);
     1092  as.clear();
     1093  cs.clear();
     1094  errs.clear();
    10891095  as.push_back(171.0);
    10901096  cs.push_back(0.07);
     
    11591165
    11601166  // Z = 73
    1161   as.resize(0);
    1162   cs.resize(0);
    1163   errs.resize(0);
     1167  as.clear();
     1168  cs.clear();
     1169  errs.clear();
    11641170  as.push_back(162.0);
    11651171  cs.push_back(0.31);
     
    12281234
    12291235  // Z = 61
    1230   as.resize(0);
    1231   cs.resize(0);
    1232   errs.resize(0);
     1236  as.clear();
     1237  cs.clear();
     1238  errs.clear();
    12331239  as.push_back(133.0);
    12341240  cs.push_back(0.01);
     
    12701276
    12711277  // Z = 79
    1272   as.resize(0);
    1273   cs.resize(0);
    1274   errs.resize(0);
     1278  as.clear();
     1279  cs.clear();
     1280  errs.clear();
    12751281  as.push_back(178.0);
    12761282  cs.push_back(0.12);
     
    13391345
    13401346  // Z = 78
    1341   as.resize(0);
    1342   cs.resize(0);
    1343   errs.resize(0);
     1347  as.clear();
     1348  cs.clear();
     1349  errs.clear();
    13441350  as.push_back(178.0);
    13451351  cs.push_back(3.04);
     
    14111417
    14121418  // Z = 72
    1413   as.resize(0);
    1414   cs.resize(0);
    1415   errs.resize(0);
     1419  as.clear();
     1420  cs.clear();
     1421  errs.clear();
    14161422  as.push_back(176.0);
    14171423  cs.push_back(0.13);
     
    14711477
    14721478  // Z = 66
    1473   as.resize(0);
    1474   cs.resize(0);
    1475   errs.resize(0);
     1479  as.clear();
     1480  cs.clear();
     1481  errs.clear();
    14761482  as.push_back(157.0);
    14771483  cs.push_back(0.14);
     
    15101516
    15111517  // Z = 65
    1512   as.resize(0);
    1513   cs.resize(0);
    1514   errs.resize(0);
     1518  as.clear();
     1519  cs.clear();
     1520  errs.clear();
    15151521  as.push_back(153.0);
    15161522  cs.push_back(0.21);
  • trunk/source/processes/hadronic/models/cascade/cascade/src/bindingEnergyAsymptotic.cc

    r819 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: bindingEnergyAsymptotic.cc,v 1.11 2010/04/08 15:48:00 mkelsey Exp $
     26// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100202  M. Kelsey -- Eliminate unnecessary use of std::pow()
     29
    2630#include "G4InuclSpecialFunctions.hh"
    2731
     
    3741  // using smooth liquid high energy formula 
    3842  G4double X = (1.0 - 2.0 * Z / A) * (1.0 - 2.0 * Z / A);
    39   G4double X1 = std::pow(A, 0.3333333);
     43  G4double X1 = G4cbrt(A);
    4044  G4double X2 = X1 * X1;
    4145  G4double X3 = 1.0 / X1;
     
    4650    0.779 * Z * (Z - 1.0) * X3 *
    4751    (1.0 - 1.5849 * X4 + 1.2273 / A + 1.5772 * X4 * X4) +
    48     0.4328 * std::pow(Z, 1.333333) * X3 *
     52    0.4328 * G4cbrt(Z*Z*Z*Z) * X3 *
    4953    (1.0 - 0.57811 * X3 - 0.14518 * X4 + 0.496 / A);
    5054
  • trunk/source/processes/hadronic/models/cascade/cascade/src/bindingEnergyKummel.cc

    r819 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: bindingEnergyKummel.cc,v 1.12 2010/03/19 05:03:23 mkelsey Exp $
     26// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100202  M. Kelsey -- Eliminate unnecessary use of std::pow()
     29
    2630#include "G4InuclSpecialFunctions.hh"
     31
     32using namespace G4InuclSpecialFunctions;
     33
    2734
    2835G4double G4InuclSpecialFunctions::bindingEnergyKummel(G4double A,
     
    234241  G4double TDEF = 0.0;
    235242  G4double X = Z * Z / A;
    236   G4double X1 = std::pow(A, 0.3333333);
     243  G4double X1 = G4cbrt(A);
    237244  G4double X2 = X1 * X1;
    238245
     
    251258
    252259      // G4double ALM = AL0 * (X7 + 0.143 * AL0 * X5 / X3);
    253       TDEF = -X4 * (X6 + 1.0) + DNZ + 0.038 * X2 * std::pow(AL0 * X7, 3.0) * X5;
     260      TDEF = -X4 * (X6 + 1.0) + DNZ + 0.038 * X2 * (AL0*X7 * AL0*X7 * AL0*X7) * X5;
    254261    };
    255262  };
  • trunk/source/processes/hadronic/models/cascade/cascade/src/paraMaker.cc

    r819 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: paraMaker.cc,v 1.17 2010/06/01 17:20:31 mkelsey Exp $
     26// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100412  M. Kelsey -- Modify paraMaker[Truncated] to take buffer as argument
     29// 20100517  M. Kelsey -- BUG FIX:  Must check for array boundary "if (Z>=70)"
     30// 20100517  M. Kelsey -- Use G4CascadeInterpolator, which handles boundaries
     31// 20100601  M. Kelsey -- Bug fix from Gunter Folger; resize(6,0.), not clear()
     32
    2633#include "G4InuclSpecialFunctions.hh"
     34#include "G4CascadeInterpolator.hh"
    2735
    28 std::pair<std::vector<G4double>, std::vector<G4double> > G4InuclSpecialFunctions::paraMaker(G4double Z) {
    29   G4int verboseLevel = 1;
     36void
     37G4InuclSpecialFunctions::paraMaker(G4double Z,
     38           std::pair<std::vector<G4double>, std::vector<G4double> >& parms) {
     39  G4int verboseLevel(0);
    3040
    3141  if (verboseLevel > 3) {
     
    3646  // coulumb barier, c.s. etc needed for evaporators
    3747
    38   const G4double Z1[5] = {10.0, 20.0, 30.0, 50.0, 70.0};
    39   const G4double AP[5] = {0.42, 0.58, 0.68, 0.77, 0.80};
    40   const G4double CP[5] = {0.50, 0.28, 0.20, 0.15, 0.10};
    41   const G4double AA[5] = {0.68, 0.82, 0.91, 0.97, 0.98};
    42   const G4double CA[5] = {0.10, 0.10, 0.10, 0.08, 0.06};
    43   std::vector<G4double> AK(6);
    44   std::vector<G4double> CPA(6);
     48  static const G4double Z1[5] = {10.0, 20.0, 30.0, 50.0, 70.0};
     49  static const G4double AP[5] = {0.42, 0.58, 0.68, 0.77, 0.80};
     50  static const G4double CP[5] = {0.50, 0.28, 0.20, 0.15, 0.10};
     51  static const G4double AA[5] = {0.68, 0.82, 0.91, 0.97, 0.98};
     52  static const G4double CA[5] = {0.10, 0.10, 0.10, 0.08, 0.06};
     53
     54  // Set up input buffer for results
     55  std::vector<G4double>& AK = parms.first;
     56  AK.resize(6,0.);
     57
     58  std::vector<G4double>& CPA = parms.second;
     59  CPA.resize(6,0.);
     60
    4561  AK[0] = 0.0;
    4662  CPA[0] = 0.0;
    47   G4double AK2 = 0.0;
    48   G4double CP2 = 0.0;
    49   G4double AK6 = 0.0;
    50   G4double CP6 = 0.0;
    5163
    52   if (Z < 10.0) {
    53     AK2=0.42;
    54     CP2=0.5;
    55     AK6=0.68;
    56     CP6=0.1;
     64  static G4CascadeInterpolator<5> interp(Z1, false);    // Do not extrapolate
     65  AK[1]  = interp.interpolate(Z, AP);
     66  AK[5]  = interp.interpolate(Z, AA);
     67  CPA[1] = interp.interpolate(Z, CP);
     68  CPA[5] = interp.interpolate(Z, CA);
     69 
     70  AK[2] = AK[1] + 0.06;
     71  AK[3] = AK[1] + 0.12;
     72  AK[4] = AK[5] - 0.06;
    5773
    58   } else if(Z > 70.0) {
    59     AK6=0.98;  // normal
    60     CP6=0.06;
    61     AK2=0.8;
    62     CP2=0.1;
    63     // AK6=1.1; // modified
    64     // CP6=0.0;
     74  CPA[2] = CPA[1] * 0.5;
     75  CPA[3] = CPA[1] / 3.0; 
     76  CPA[4] = 4.0 * CPA[5] / 3.0;
    6577
    66   } else {
    67 
    68     for (G4int i = 1; i < 5; i++) {
    69 
    70       if (Z <= Z1[i]) {
    71         G4double Z2 = 1.0 / (Z1[i] - Z1[i - 1]);
    72         AK2 = ((AP[i] - AP[i - 1]) * Z + AP[i - 1] * Z1[i] - AP[i] * Z1[i - 1]) * Z2;
    73         CP2 = ((CP[i] - CP[i - 1]) * Z + CP[i - 1] * Z1[i] - CP[i] * Z1[i - 1]) * Z2;
    74         AK6 = ((AA[i] - AA[i - 1]) * Z + AA[i - 1] * Z1[i] - AA[i] * Z1[i - 1]) * Z2;
    75         CP6 = ((CA[i] - CA[i - 1]) * Z + CA[i - 1] * Z1[i] - CA[i] * Z1[i - 1]) * Z2;
    76 
    77         break;
    78       };
    79     };
    80   };
    81 
    82   AK[1] = AK2;
    83   AK[5] = AK6;
    84   CPA[1] = CP2;
    85   CPA[5] = CP6;
    86   AK[2] = AK2 + 0.06;
    87   CPA[2] = CP2 * 0.5;
    88   AK[3] = AK2 + 0.12;
    89   CPA[3] = CP2 / 3.0; 
    90   AK[4] = AK6 - 0.06;
    91   CPA[4] = 4.0 * CP6 / 3.0;
    92 
    93   return std::pair<std::vector<G4double>, std::vector<G4double> >(AK, CPA);
     78  return;       // Buffer filled
    9479}
    9580
    96 std::pair<G4double, G4double> G4InuclSpecialFunctions::paraMakerTruncated(G4double Z) {
    97   G4int verboseLevel = 1;
     81void
     82G4InuclSpecialFunctions::paraMakerTruncated(G4double Z,
     83                                    std::pair<G4double,G4double>& parms) {
     84  G4int verboseLevel(0);
    9885
    9986  if (verboseLevel > 3) {
     
    10289
    10390  // truncated version of the previous one
    104   const G4double Z1[5] = {10.0, 20.0, 30.0, 50.0, 70.0};
    105   const G4double AP[5] = {0.42, 0.58, 0.68, 0.77, 0.8};
    106   const G4double CP[5] = {0.5, 0.28, 0.2, 0.15, 0.1};
    107   G4double AK2=0.;
    108   G4double CP2=0.;
     91  static const G4double Z1[5] = {10.0, 20.0, 30.0, 50.0, 70.0};
     92  static const G4double AP[5] = {0.42, 0.58, 0.68, 0.77, 0.8};
     93  static const G4double CP[5] = {0.5, 0.28, 0.2, 0.15, 0.1};
    10994
    110   if (Z < 10.0) {
    111     AK2=0.42;
    112     CP2=0.5;
     95  // Set up buffers for output
     96  G4double& AK2=parms.first;
     97  G4double& CP2=parms.second;
    11398
    114   } else if (Z > 70.0) {
    115     AK2=0.8;
    116     CP2=0.1;
     99  static G4CascadeInterpolator<5> interp(Z1, false);            // Do not extrapolate
     100  AK2 = interp.interpolate(Z, AP);
     101  CP2 = interp.interpolate(Z, CP);
    117102
    118   } else {
    119 
    120     for (G4int i = 1; i < 5; i++) {
    121 
    122       if (Z < Z1[i]) {
    123         G4double Z2 = 1.0 / (Z1[i] - Z1[i - 1]);
    124         AK2 = ((AP[i] - AP[i - 1]) * Z + AP[i - 1] * Z1[i] - AP[i] * Z1[i - 1]) * Z2;
    125         CP2 = ((CP[i] - CP[i - 1]) * Z + CP[i - 1] * Z1[i] - CP[i] * Z1[i - 1]) * Z2;
    126 
    127         break;
    128       };
    129     };
    130   };
    131 
    132   return std::pair<G4double, G4double>(AK2, CP2);
     103  return;       // Buffer filled
    133104}
Note: See TracChangeset for help on using the changeset viewer.