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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/processes/hadronic/models/util/src/G4Fragment.cc

    r819 r1315  
    2424// ********************************************************************
    2525//
    26 //
     26// $Id: G4Fragment.cc,v 1.16 2010/05/18 18:52:07 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-04-beta-cand-01 $
     28//
     29//---------------------------------------------------------------------
     30//
     31// Geant4 class G4Fragment
    2732//
    2833// Hadronic Process: Nuclear De-excitations
    2934// by V. Lara (May 1998)
     35//
     36// Modifications:
     37// 03.05.2010 V.Ivanchenko General cleanup; moved obsolete methods from
     38//            inline to source
     39//
    3040
    3141#include "G4Fragment.hh"
    3242#include "G4HadronicException.hh"
    3343#include "G4HadTmpUtil.hh"
    34 
     44#include "G4Gamma.hh"
     45#include "G4Electron.hh"
     46
     47G4int G4Fragment::errCount = 0;
    3548
    3649// Default constructor
     
    3952  theZ(0),
    4053  theExcitationEnergy(0.0),
     54  theGroundStateMass(0.0),
    4155  theMomentum(0),
    4256  theAngularMomentum(0),
     
    5771   theZ = right.theZ;
    5872   theExcitationEnergy = right.theExcitationEnergy;
     73   theGroundStateMass = right.theGroundStateMass;
    5974   theMomentum  = right.theMomentum;
    6075   theAngularMomentum = right.theAngularMomentum;
     
    6984}
    7085
    71 
    7286G4Fragment::~G4Fragment()
    73 {
    74 }
    75 
    76 
    77 G4Fragment::G4Fragment(const G4int A, const G4int Z, const G4LorentzVector aMomentum) :
     87{}
     88
     89G4Fragment::G4Fragment(const G4int A, const G4int Z, const G4LorentzVector& aMomentum) :
    7890  theA(A),
    7991  theZ(Z),
     
    89101#endif
    90102{
     103  theExcitationEnergy = 0.0;
     104  theGroundStateMass = 0.0;
     105  if(theA > 0) {
     106    CalculateGroundStateMass();
     107    CalculateExcitationEnergy();
     108  }
     109  /*
    91110  theExcitationEnergy = theMomentum.mag() -
    92111                        G4ParticleTable::GetParticleTable()->GetIonTable()
     
    102121    }
    103122  }
    104 }
    105 
    106 
    107 // This constructor is for initialize photons
    108 G4Fragment::G4Fragment(const G4LorentzVector aMomentum, G4ParticleDefinition * aParticleDefinition) :
     123  */
     124}
     125
     126
     127// This constructor is for initialize photons or electrons
     128G4Fragment::G4Fragment(const G4LorentzVector& aMomentum,
     129                       G4ParticleDefinition * aParticleDefinition) :
    109130  theA(0),
    110131  theZ(0),
     
    120141#endif
    121142{
    122   theExcitationEnergy = CalculateExcitationEnergy(aMomentum);
    123 }
    124 
    125 
     143  theExcitationEnergy = 0.0;
     144  if(aParticleDefinition != G4Gamma::Gamma() &&
     145     aParticleDefinition != G4Electron::Electron()) {
     146    G4String text = "G4Fragment::G4Fragment constructor for gamma used for "
     147      + aParticleDefinition->GetParticleName(); 
     148    throw G4HadronicException(__FILE__, __LINE__, text);
     149  }
     150  theGroundStateMass = aParticleDefinition->GetPDGMass();
     151}
    126152
    127153const G4Fragment & G4Fragment::operator=(const G4Fragment &right)
     
    131157    theZ = right.theZ;
    132158    theExcitationEnergy = right.theExcitationEnergy;
     159    theGroundStateMass = right.theGroundStateMass;
    133160    theMomentum  = right.theMomentum;
    134161    theAngularMomentum = right.theAngularMomentum;
     
    145172}
    146173
    147 
    148174G4bool G4Fragment::operator==(const G4Fragment &right) const
    149175{
     
    155181  return (this != (G4Fragment *) &right);
    156182}
    157 
    158183
    159184std::ostream& operator << (std::ostream &out, const G4Fragment *theFragment)
     
    197222}
    198223
    199 
    200 
    201 G4double G4Fragment::CalculateExcitationEnergy(const G4LorentzVector value) const
    202 {
    203   static G4int errCount(0);
    204   G4double theMaxGroundStateMass = theZ*G4Proton::Proton()->GetPDGMass()+
    205                                (theA-theZ)*G4Neutron::Neutron()->GetPDGMass();
    206   G4double U = value.m() - std::min(theMaxGroundStateMass, GetGroundStateMass());
    207   if( U < 0.0 ) {
    208      if( U > -10.0 * eV || 0==G4lrint(theA)){
    209         U = 0.0;
    210      } else {
    211         if ( errCount < 10 ) {
    212             G4cerr << "G4Fragment::CalculateExcitationEnergy(): Excitation Energy ="
    213                <<U << " for A = "<<theA<<" and Z= "<<theZ<<G4endl
    214                << ", mass= " << GetGroundStateMass() << " maxMass= "<<theMaxGroundStateMass<<G4endl; ;
    215             errCount++;
    216             if (errCount == 10 ) G4cerr << "G4Fragment::CalculateExcitationEnergy():"
    217                                 << " further warnings on negative excitation will be supressed" << G4endl;
    218         }
    219         U=0.0;
    220      }
    221   }
    222   return U;
     224void G4Fragment::ExcitationEnegryWarning()
     225{
     226  if (theExcitationEnergy < -10.0 * eV) {
     227    ++errCount;
     228    if ( errCount <= 10 ) {
     229      G4cout << "G4Fragment::CalculateExcitationEnergy(): Excitation Energy = "
     230             << theExcitationEnergy/MeV << " MeV for A = "
     231             <<theA << " and Z= " << theZ << G4endl;
     232      if( errCount == 10 ) {
     233        G4String text = "G4Fragment::G4Fragment Excitation Energy < 0.0!";
     234        throw G4HadronicException(__FILE__, __LINE__, text);
     235      }
     236    }
     237  }
     238  theExcitationEnergy = 0.0;
    223239}
    224240
     
    226242  // Create a unit vector with a random direction isotropically distributed
    227243{
    228 
    229244  G4double CosTheta = 1.0 - 2.0*G4UniformRand();
    230245  G4double SinTheta = std::sqrt(1.0 - CosTheta*CosTheta);
     
    234249                       Magnitude*CosTheta);
    235250
    236   return Vector;
    237                
    238 }
     251  return Vector;               
     252}
     253
     254void G4Fragment::SetExcitationEnergy(const G4double )
     255{
     256  //   theExcitationEnergy = value;
     257  G4cout << "Warning: G4Fragment::SetExcitationEnergy() is a dummy method. Please, avoid to use it." << G4endl;
     258}
     259
     260#ifdef PRECOMPOUND_TEST
     261G4String G4Fragment::GetCreatorModel() const
     262{
     263  return theCreatorModel;
     264}
     265
     266void G4Fragment::SetCreatorModel(const G4String & aModel)
     267{
     268  theCreatorModel = aModel;
     269}
     270#endif
Note: See TracChangeset for help on using the changeset viewer.