Ignore:
Timestamp:
Nov 5, 2010, 3:45:55 PM (14 years ago)
Author:
garnier
Message:

update ti head

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/processes/hadronic/models/de_excitation/photon_evaporation/src/G4NuclearLevel.cc

    r819 r1340  
    2424// ********************************************************************
    2525//
    26 //
     26// $Id: G4NuclearLevel.cc,v 1.5 2010/10/10 23:01:39 mkelsey Exp $
    2727// -------------------------------------------------------------------
    2828//      GEANT 4 class file
     
    3939//
    4040//      Modifications:
     41//        06 Oct 2010, M. Kelsey (kelsey@slac.stanford.edu)
     42//              Add friendship for G4NuclearLevelManager; define private
     43//              constructors without vectors.
    4144//
    4245//        09 Sep. 2002, Fan Lei  (flei@space.qinetiq.com)
     
    6366  instanceCount+=aF;
    6467  return instanceCount;
     68}
     69
     70G4NuclearLevel::G4NuclearLevel()
     71  : _energy(0.), _halfLife(0.), _angularMomentum(0.), _nGammas(0) {
     72  // G4cout << "####### Incrementing "<<Increment(1)<<G4endl;
     73}
     74
     75G4NuclearLevel::G4NuclearLevel(const G4double energy, const G4double halfLife,
     76                               const G4double angularMomentum)
     77  : _energy(energy), _halfLife(halfLife), _angularMomentum(angularMomentum),
     78    _nGammas(0) {
     79  // G4cout << "####### Incrementing "<<Increment(1)<<G4endl;
    6580}
    6681
     
    7792                               const std::vector<double>& totalCC)
    7893
    79 {
    80   _energy = energy;
    81   _halfLife = halfLife;
    82   _angularMomentum = angularMomentum;
    83   unsigned int i;
    84   for (i=0; i<eGamma.size(); i++)
    85     {
    86       _energies.push_back(eGamma[i]);
    87       _weights.push_back(wGamma[i]);
    88       _polarities.push_back(polarities[i]);
    89       _kCC.push_back( kCC[i]);
    90       _l1CC.push_back( l1CC[i]);
    91       _l2CC.push_back( l2CC[i]);
    92       _l3CC.push_back( l3CC[i]);
    93       _m1CC.push_back( m1CC[i]);
    94       _m2CC.push_back( m2CC[i]);
    95       _m3CC.push_back( m3CC[i]);
    96       _m4CC.push_back( m4CC[i]);
    97       _m5CC.push_back( m5CC[i]);
    98       _nPlusCC.push_back( nPlusCC[i]);
    99       _totalCC.push_back( totalCC[i]);
    100     }
    101   _nGammas = _energies.size();
    102   MakeProbabilities();
    103   MakeCumProb();
    104  // G4cout << "####### Incrementing "<<Increment(1)<<G4endl;
     94  : _energies(eGamma), _weights(wGamma), _polarities(polarities),
     95     _kCC(kCC), _l1CC(l1CC), _l2CC(l2CC), _l3CC(l3CC),
     96    _m1CC(m1CC), _m2CC(m2CC), _m3CC(m3CC), _m4CC(m4CC), _m5CC(m5CC),
     97    _nPlusCC(nPlusCC), _totalCC(totalCC),
     98    _energy(energy), _halfLife(halfLife), _angularMomentum(angularMomentum)
     99{
     100  Finalize();
     101  // G4cout << "####### Incrementing "<<Increment(1)<<G4endl;
    105102}
    106103
     
    255252  return;
    256253}
    257  
     254
     255
     256void G4NuclearLevel::Finalize() {
     257  _nGammas = _energies.size();
     258  MakeProbabilities();
     259  MakeCumProb();
     260}
     261
    258262
    259263void G4NuclearLevel::MakeProbabilities()
     
    261265  G4double sum = 0.;
    262266  G4int i = 0;
    263   for (i=0; i<_nGammas; i++)
    264     {
    265       sum += _weights[i]*(1+_totalCC[i]);
     267  for (i=0; i<_nGammas; i++) {
     268    sum += _weights[i]*(1.+_totalCC[i]);
     269  }
     270
     271  if (sum <= 0.) _prob.resize(_nGammas, 1./_nGammas);   // Fast fill
     272  else {
     273    _prob.reserve(_nGammas);
     274    for (i=0; i<_nGammas; i++) {
     275      _prob.push_back(_weights[i]*(1.+_totalCC[i])/sum);
    266276    }
    267 
    268   for (i=0; i<_nGammas; i++)
    269     {
    270       if (sum > 0.) { _prob.push_back(_weights[i]*(1+_totalCC[i])/ sum); }
    271       else { _prob.push_back(1./_nGammas); }
    272     }
    273   return;
     277  }
    274278}
    275279
     
    277281void G4NuclearLevel::MakeCumProb()
    278282{
    279   if (_nGammas > 0)
    280     {
    281       G4double sum = _prob[0];
    282       _cumProb.push_back(sum);
    283      
    284       G4int i = 0;
    285       for (i=1; i<_nGammas; i++)
    286         {
    287           sum += _prob[i];
    288           _cumProb.push_back(sum);
    289         }
    290     }
    291   return;
    292 }
    293 
    294 
    295 
     283  if (_nGammas <= 0) return;
     284
     285  _cumProb.reserve(_nGammas);
     286
     287  G4double sum = _prob[0];
     288  _cumProb.push_back(sum);
     289 
     290  for (G4int i=1; i<_nGammas; i++) {
     291    sum += _prob[i];
     292    _cumProb.push_back(sum);
     293  }
     294}
     295
     296
     297
Note: See TracChangeset for help on using the changeset viewer.