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

update ti head

Location:
trunk/source/processes/hadronic/models/util/include
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/processes/hadronic/models/util/include/G4DecayStrongResonances.hh

    r819 r1340  
    2828#define G4DecayStrongResonances_h 1
    2929
    30 #include "G4Fancy3DNucleus.hh"
    31 #include "G4Nucleon.hh"
    32 #include "G4Nucleus.hh"
    3330#include "G4KineticTrackVector.hh"
    34 #include "G4FragmentVector.hh"
    35 #include "G4HadFinalState.hh"
    36 #include "G4DynamicParticleVector.hh"
    37 #include "G4HadTmpUtil.hh"
     31#include "G4ReactionProductVector.hh"
    3832
    39 #include <algorithm>
     33class G4V3DNucleus;
    4034
    4135class G4DecayStrongResonances
     
    5246     
    5347public:
    54    G4ReactionProductVector* Propagate(G4KineticTrackVector* theSecondaries, G4V3DNucleus* )
    55    {
    56      // decay the strong resonances
    57      //static int call_count = 0;
    58      //if(call_count++<10)
    59      //{
    60      //  G4cout << "Security print-out: Entering G4DecayStrongResonances::Propagate";
    61      //}
    62      G4ReactionProductVector * theResult;
    63      try
    64      {
    65        theResult = new G4ReactionProductVector;
    66      }
    67      catch(...)
    68      {
    69        throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: out of memory ");
    70      }
    71      G4KineticTrackVector *result1, *secondaries, *result;
    72      if(!theSecondaries)
    73      {
    74        throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: 0x0 input vector ");
    75      }
    76      result1=theSecondaries;
    77      try
    78      {
    79        result=new G4KineticTrackVector();
    80      }
    81      catch(...)
    82      {
    83        throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: out of memory in ");
    84      }
    85          
    86      size_t aResult=0;
    87      for (aResult=0; aResult < result1->size(); aResult++)
    88      {
    89        G4ParticleDefinition * pdef;
    90        if(!result1->operator[](aResult))
    91        {
    92          throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: null pointer in input vector!!! ");
    93        }
    94        pdef=result1->operator[](aResult)->GetDefinition();
    95        if(!pdef)
    96        {
    97         throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: 0x0 particle definition ");
    98        }
    99        secondaries=NULL;
    100        if ( pdef->GetPDGWidth() > 0 && pdef->GetPDGLifeTime() < 5E-17*s )
    101        {
    102           try
    103           {
    104             secondaries = result1->operator[](aResult)->Decay();
    105           }
    106           catch(...)
    107           {
    108             throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: failing in Decay ");
    109           }
    110        }
    111        if ( secondaries == NULL )
    112        {
    113           try
    114           {
    115             result->push_back(result1->operator[](aResult));
    116           }
    117           catch(...)
    118           {
    119             throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: push_back failed - out of memory ");
    120           }
    121           result1->operator[](aResult)=NULL;    //protect for clearAndDestroy
    122        }
    123        else
    124        {
    125          for (size_t aSecondary=0; aSecondary<secondaries->size(); aSecondary++)
    126          {
    127            try
    128            {
    129              result1->push_back(secondaries->operator[](aSecondary));
    130            }
    131            catch(...)
    132            {
    133              throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: push_back  1 failed - out of mem");
    134            }
    135          }
    136          if(secondaries) delete secondaries;
    137        }
    138      }
    139      try
    140      {
    141        std::for_each(result1->begin(), result1->end(), G4Delete());
    142        delete result1;
    143      }
    144      catch(...)
    145      {
    146        throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: memory corruption.");
    147      }
    148      
    149      // translate to ReactionProducts
    150      G4ReactionProduct * it = NULL;
    151      for(aResult=0; aResult < result->size(); aResult++)
    152      {
    153        try
    154        {
    155          it = new G4ReactionProduct();
    156        }
    157        catch(...)
    158        {
    159           throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: out of memory ");
    160        }
    161        it->SetDefinition((*result)[aResult]->GetDefinition());
    162        it->SetMass((*result)[aResult]->GetDefinition()->GetPDGMass());
    163        it->SetTotalEnergy((*result)[aResult]->Get4Momentum().t());
    164        it->SetMomentum((*result)[aResult]->Get4Momentum().vect());
    165        
    166        try
    167        {
    168          theResult->push_back(it);
    169        }
    170        catch(...)
    171        {
    172           throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: push to result failed - out of mem.");
    173        }
    174      }
    175      try
    176      {
    177        std::for_each(result->begin(), result->end(), G4Delete());
    178        delete result;
    179      }
    180      catch(...)
    181      {
    182        throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: memory corruption at end.");
    183      }
    184      return theResult;
    185    }
     48   G4ReactionProductVector* Propagate(G4KineticTrackVector* theSecondaries,
     49                                      G4V3DNucleus* );
    18650};
    18751
  • trunk/source/processes/hadronic/models/util/include/G4Fancy3DNucleus.hh

    r1196 r1340  
    4545#include <vector>
    4646
     47// to test if we can drop old interface for (A,Z), comment next line..
     48//#define NON_INTEGER_A_Z 1
     49
    4750class G4Fancy3DNucleus : public G4V3DNucleus
    4851{
     
    6770
    6871  public:
     72#if defined(NON_INTEGER_A_Z)
    6973      void Init(G4double theA, G4double theZ);
     74#endif
     75      void Init(G4int theA, G4int theZ);
    7076      G4bool StartLoop();
    7177      G4Nucleon * GetNextNucleon();
  • trunk/source/processes/hadronic/models/util/include/G4FermiMomentum.hh

    r819 r1340  
    4040    ~G4FermiMomentum();
    4141   
    42     inline void Init(G4double anA, G4double aZ) {theA = anA; theZ = aZ;}
     42    inline void Init(G4int anA, G4int aZ) {theA = anA; theZ = aZ;}
    4343   
    4444    inline G4double GetFermiMomentum(G4double density)
     
    6767  private:
    6868 
    69     G4double theA;
    70     G4double theZ;
     69    G4int theA;
     70    G4int theZ;
    7171      // pmax= hbar * c * ( 3* pi**2 * rho )**(1/3) =
    7272      //       hbar * c * ( 3* pi**2 )**(1/3) * rho**(1/3)=
  • trunk/source/processes/hadronic/models/util/include/G4Fragment.hh

    r1337 r1340  
    2424// ********************************************************************
    2525//
    26 // $Id: G4Fragment.hh,v 1.11 2010/05/19 10:23:00 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     26// $Id: G4Fragment.hh,v 1.16 2010/09/28 16:09:00 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-03-ref-09 $
    2828//
    2929//---------------------------------------------------------------------
     
    4141//            method which allowing to compute this value once and use
    4242//            many times
     43// 26.09.2010 V.Ivanchenko added number of protons, neutrons, proton holes
     44//            and neutron holes as members of the class and Get/Set methods;
     45//            removed not needed 'const'; removed old debug staff and unused
     46//            private methods; add comments and reorder methods for
     47//            better reading
    4348
    4449#ifndef G4Fragment_h
    4550#define G4Fragment_h 1
    4651
    47 #include "G4ios.hh"
    48 #include <iomanip>
    4952#include <vector>
    5053
    5154#include "globals.hh"
    5255#include "G4LorentzVector.hh"
    53 //#include "G4ParticleMomentum.hh"
    5456#include "G4ThreeVector.hh"
    5557#include "G4NucleiProperties.hh"
    56 #include "G4ParticleTable.hh"
    57 #include "G4IonTable.hh"
     58//#include "G4ParticleTable.hh"
     59//#include "G4IonTable.hh"
    5860#include "Randomize.hh"
    5961#include "G4Proton.hh"
    6062#include "G4Neutron.hh"
    61 #include "G4HadronicException.hh"
    6263#include "G4HadTmpUtil.hh"
    6364
    64 
    6565class G4ParticleDefinition;
    6666
    67 class G4Fragment;     // Forward deckaration
     67class G4Fragment;     
    6868typedef std::vector<G4Fragment*> G4FragmentVector;
    6969
     
    8484
    8585  // A,Z and 4-momentum - main constructor for fragment
    86   G4Fragment(const G4int A, const G4int Z, const G4LorentzVector& aMomentum);
    87 
    88   // 4-momentum and pointer to G4particleDefinition (for gammas)
    89   G4Fragment(const G4LorentzVector& aMomentum, G4ParticleDefinition * aParticleDefinition);
     86  G4Fragment(G4int A, G4int Z, const G4LorentzVector& aMomentum);
     87
     88  // 4-momentum and pointer to G4particleDefinition (for gammas, e-)
     89  G4Fragment(const G4LorentzVector& aMomentum,
     90             G4ParticleDefinition* aParticleDefinition);
    9091
    9192  // ============= OPERATORS ==================
     
    9899  friend std::ostream& operator<<(std::ostream&, const G4Fragment&);
    99100
    100   // ============= METHODS ==================
    101 
    102   inline G4double GetA() const;
    103   inline void SetA(const G4double value);
    104  
    105   inline G4double GetZ() const;
    106   inline void SetZ(const G4double value);
     101  // ============= GENERAL METHODS ==================
    107102
    108103  inline G4int GetZ_asInt() const;
     
    111106 
    112107  inline G4double GetExcitationEnergy() const;
    113   void SetExcitationEnergy(const G4double value);
    114  
    115   inline const G4LorentzVector& GetMomentum() const;
    116   inline void SetMomentum(const G4LorentzVector& value);
    117  
    118   inline const G4ThreeVector& GetAngularMomentum() const;
    119   inline void SetAngularMomentum(const G4ThreeVector& value);
    120  
    121   inline G4int GetNumberOfExcitons() const;
    122  
    123   inline G4int GetNumberOfHoles() const;
    124   inline void SetNumberOfHoles(const G4int value);
    125  
    126   inline G4int GetNumberOfCharged() const;
    127   void SetNumberOfCharged(const G4int value);
    128 
    129   inline G4int GetNumberOfParticles() const;
    130   inline void SetNumberOfParticles(const G4int value);
    131 
    132   inline G4ParticleDefinition * GetParticleDefinition() const;
    133   inline void SetParticleDefinition(G4ParticleDefinition * aParticleDefinition);
    134 
    135   inline G4double GetCreationTime() const;
    136   inline void SetCreationTime(const G4double time);
    137108
    138109  inline G4double GetGroundStateMass() const;
    139110   
    140111  inline G4double GetBindingEnergy() const;
     112 
     113  inline const G4LorentzVector& GetMomentum() const;
     114  inline void SetMomentum(const G4LorentzVector& value);
     115 
     116  inline const G4ThreeVector& GetAngularMomentum() const;
     117  inline void SetAngularMomentum(const G4ThreeVector& value);
    141118
    142119  // computation of mass for any Z and A
    143   inline G4double ComputeGroundStateMass(const G4int Z, const G4int A) const;
    144 
    145 #ifdef PRECOMPOUND_TEST
    146   G4String GetCreatorModel() const;
    147   void SetCreatorModel(const G4String & aModel);
    148 #endif
     120  inline G4double ComputeGroundStateMass(G4int Z, G4int A) const;
     121
     122  // obsolete methods
     123  inline G4double GetZ() const;
     124  inline G4double GetA() const;
     125  inline void SetZ(G4double value);
     126  inline void SetA(G4double value);
     127 
     128  // ============= METHODS FOR PRE-COMPOUND MODEL ===============
     129
     130  inline G4int GetNumberOfExcitons() const;
     131 
     132  inline G4int GetNumberOfParticles() const;
     133  inline G4int GetNumberOfCharged() const;
     134  inline void SetNumberOfExcitedParticle(G4int valueTot, G4int valueP);
     135
     136  inline G4int GetNumberOfHoles() const;
     137  inline G4int GetNumberOfChargedHoles() const;
     138  inline void SetNumberOfHoles(G4int valueTot, G4int valueP=0);
     139 
     140  // these methods will be removed in future
     141  inline void SetNumberOfParticles(G4int value);
     142  inline void SetNumberOfCharged(G4int value);
     143
     144  // ============= METHODS FOR PHOTON EVAPORATION ===============
     145
     146  inline G4int GetNumberOfElectrons() const;
     147  inline void SetNumberOfElectrons(G4int value);
     148
     149  inline G4ParticleDefinition * GetParticleDefinition() const;
     150  inline void SetParticleDefinition(G4ParticleDefinition * p);
     151
     152  inline G4double GetCreationTime() const;
     153  inline void SetCreationTime(G4double time);
     154
     155  // ============= PRIVATE METHODS ==============================
    149156
    150157private:
    151158
    152   void ExcitationEnegryWarning();
     159  void ExcitationEnergyWarning();
     160
     161  void NumberOfExitationWarning(const G4String&);
     162
     163  inline void CalculateExcitationEnergy();
    153164
    154165  inline void CalculateGroundStateMass();
    155166
    156   inline void CalculateExcitationEnergy();
    157 
    158   G4ThreeVector IsotropicRandom3Vector(const G4double Magnitude = 1.0) const;
    159  
    160167  // ============= DATA MEMBERS ==================
    161168
     
    173180 
    174181  G4ThreeVector theAngularMomentum;
     182
     183  // Exciton model data members
    175184 
    176185  G4int numberOfParticles;
    177186 
     187  G4int numberOfCharged;
     188
    178189  G4int numberOfHoles;
    179190 
    180   G4int numberOfCharged;
    181 
    182   // Gamma evaporation requeriments
     191  G4int numberOfChargedHoles;
     192
     193  // Gamma evaporation data members
     194
     195  G4int numberOfShellElectrons;
    183196
    184197  G4ParticleDefinition * theParticleDefinition;
     
    186199  G4double theCreationTime;
    187200
    188 #ifdef PRECOMPOUND_TEST
    189   G4String theCreatorModel;
    190 #endif
    191201};
    192202
    193 // Class G4Fragment
     203// ============= INLINE METHOD IMPLEMENTATIONS ===================
     204
     205inline void G4Fragment::CalculateExcitationEnergy()
     206{
     207  theExcitationEnergy = theMomentum.mag() - theGroundStateMass;
     208  if(theExcitationEnergy < 0.0) { ExcitationEnergyWarning(); }
     209}
     210         
    194211inline void G4Fragment::CalculateGroundStateMass()
    195212{
    196213  theGroundStateMass = G4NucleiProperties::GetNuclearMass(theA, theZ);
    197 }
    198 
    199 inline G4double G4Fragment::GetA() const
    200 {
    201   return G4double(theA);
    202 }
    203 
    204 inline void G4Fragment::SetA(const G4double value)
    205 {
    206   theA = G4lrint(value);
    207   CalculateGroundStateMass();
    208 }
    209 
    210 inline G4double G4Fragment::GetZ()  const
    211 {
    212   return G4double(theZ);
    213 }
    214 
    215 inline void G4Fragment::SetZ(const G4double value)
    216 {
    217   theZ = G4lrint(value);
    218   CalculateGroundStateMass();
    219214}
    220215
     
    238233inline G4double G4Fragment::GetExcitationEnergy()  const
    239234{
    240   // temporary fix for what seems to be
    241   // a problem with rounding errors for on-shell lorentz-vectors in CLHEP.
    242   // HPW Apr 1999 @@@@@@@
    243  
    244   //VI  if(std::abs(theExcitationEnergy)<10*eV) return 0;
    245235  return theExcitationEnergy;
    246236}
    247237
    248 inline const G4LorentzVector& G4Fragment::GetMomentum()  const
    249 {
    250   return theMomentum;
    251 }
    252 
    253 inline const G4ThreeVector& G4Fragment::GetAngularMomentum()  const
    254 {
    255   return theAngularMomentum;
    256 }
    257 
    258 inline void G4Fragment::SetAngularMomentum(const G4ThreeVector& value)
    259 {
    260   theAngularMomentum = value;
    261 }
    262 
    263 inline G4int G4Fragment::GetNumberOfExcitons()  const
    264 {
    265   return numberOfParticles + numberOfHoles;
    266 }
    267 
    268 inline void G4Fragment::SetNumberOfParticles(const G4int value)
    269 {
    270   numberOfParticles = value;
    271 }
    272 
    273 inline G4int G4Fragment::GetNumberOfHoles()  const
    274 {
    275   return numberOfHoles;
    276 }
    277 
    278 inline void G4Fragment::SetNumberOfHoles(const G4int value)
    279 {
    280   numberOfHoles = value;
    281 }
    282 
    283 inline G4int G4Fragment::GetNumberOfCharged()  const
    284 {
    285   return numberOfCharged;
    286 }
    287 
    288 inline void G4Fragment::SetNumberOfCharged(const G4int value)
    289 {
    290   if (value <= numberOfParticles) { numberOfCharged = value; }
    291   else
    292   {
    293     G4String text = "G4Fragment::SetNumberOfCharged: Number of charged particles can't be greater than number of particles";
    294     throw G4HadronicException(__FILE__, __LINE__, text);
    295   }
    296 }
    297 
    298 inline G4int G4Fragment::GetNumberOfParticles()  const
    299 {
    300   return numberOfParticles;
    301 }
    302 
    303 inline G4ParticleDefinition * G4Fragment::GetParticleDefinition(void) const
    304 {
    305   return theParticleDefinition;
    306 }
    307 
    308 inline void G4Fragment::SetParticleDefinition(G4ParticleDefinition * aParticleDefinition)
    309 {
    310   theParticleDefinition = aParticleDefinition;
    311 }
    312 
    313 inline G4double G4Fragment::GetCreationTime() const
    314 {
    315   return theCreationTime;
    316 }
    317 
    318 inline void G4Fragment::SetCreationTime(const G4double time)
    319 {
    320   theCreationTime = time;
    321 }
    322 
    323238inline G4double G4Fragment::GetGroundStateMass() const
    324239{
     
    326241}
    327242
    328 inline G4double
    329 G4Fragment::ComputeGroundStateMass(const G4int Z, const G4int A) const
    330 {
    331   return G4NucleiProperties::GetNuclearMass(A, Z);
    332 }
    333 
    334 inline void G4Fragment::CalculateExcitationEnergy()
    335 {
    336   theExcitationEnergy = theMomentum.mag() - theGroundStateMass;
    337   if(theExcitationEnergy < 0.0) { ExcitationEnegryWarning(); }
    338 }
    339        
    340243inline G4double G4Fragment::GetBindingEnergy() const
    341244{
     
    344247}
    345248
     249inline const G4LorentzVector& G4Fragment::GetMomentum()  const
     250{
     251  return theMomentum;
     252}
     253
    346254inline void G4Fragment::SetMomentum(const G4LorentzVector& value)
    347255{
     
    350258}
    351259
     260inline const G4ThreeVector& G4Fragment::GetAngularMomentum()  const
     261{
     262  return theAngularMomentum;
     263}
     264
     265inline void G4Fragment::SetAngularMomentum(const G4ThreeVector& value)
     266{
     267  theAngularMomentum = value;
     268}
     269
     270inline G4double
     271G4Fragment::ComputeGroundStateMass(G4int Z, G4int A) const
     272{
     273  return G4NucleiProperties::GetNuclearMass(A, Z);
     274}
     275
     276inline G4double G4Fragment::GetZ()  const
     277{
     278  return G4double(theZ);
     279}
     280
     281inline G4double G4Fragment::GetA() const
     282{
     283  return G4double(theA);
     284}
     285
     286inline void G4Fragment::SetZ(const G4double value)
     287{
     288  theZ = G4lrint(value);
     289  CalculateGroundStateMass();
     290}
     291
     292inline void G4Fragment::SetA(const G4double value)
     293{
     294  theA = G4lrint(value);
     295  CalculateGroundStateMass();
     296}
     297
     298inline G4int G4Fragment::GetNumberOfExcitons()  const
     299{
     300  return numberOfParticles + numberOfHoles;
     301}
     302
     303inline G4int G4Fragment::GetNumberOfParticles()  const
     304{
     305  return numberOfParticles;
     306}
     307
     308inline G4int G4Fragment::GetNumberOfCharged()  const
     309{
     310  return numberOfCharged;
     311}
     312
     313inline
     314void G4Fragment::SetNumberOfExcitedParticle(G4int valueTot, G4int valueP)
     315{
     316  numberOfParticles = valueTot;
     317  numberOfCharged = valueP;
     318  if(valueTot < valueP)  {
     319    NumberOfExitationWarning("SetNumberOfExcitedParticle");
     320  }
     321}
     322
     323inline G4int G4Fragment::GetNumberOfHoles()  const
     324{
     325  return numberOfHoles;
     326}
     327
     328inline G4int G4Fragment::GetNumberOfChargedHoles()  const
     329{
     330  return numberOfChargedHoles;
     331}
     332
     333inline void G4Fragment::SetNumberOfHoles(G4int valueTot, G4int valueP)
     334{
     335  numberOfHoles = valueTot;
     336  numberOfChargedHoles = valueP;
     337  if(valueTot < valueP)  {
     338    NumberOfExitationWarning("SetNumberOfHoles");
     339  }
     340}
     341
     342inline void G4Fragment::SetNumberOfParticles(G4int value)
     343{
     344  numberOfParticles = value;
     345}
     346
     347inline void G4Fragment::SetNumberOfCharged(G4int value)
     348{
     349  numberOfCharged = value;
     350  if(value > numberOfParticles)  {
     351    NumberOfExitationWarning("SetNumberOfCharged");
     352  }
     353}
     354
     355inline G4int G4Fragment::GetNumberOfElectrons() const
     356{
     357  return numberOfShellElectrons;
     358}
     359
     360inline void G4Fragment::SetNumberOfElectrons(G4int value)
     361{
     362  numberOfShellElectrons = value;
     363}
     364
     365inline
     366G4ParticleDefinition * G4Fragment::GetParticleDefinition(void) const
     367{
     368  return theParticleDefinition;
     369}
     370
     371inline void G4Fragment::SetParticleDefinition(G4ParticleDefinition * p)
     372{
     373  theParticleDefinition = p;
     374}
     375
     376inline G4double G4Fragment::GetCreationTime() const
     377{
     378  return theCreationTime;
     379}
     380
     381inline void G4Fragment::SetCreationTime(G4double time)
     382{
     383  theCreationTime = time;
     384}
     385
    352386#endif
    353387
Note: See TracChangeset for help on using the changeset viewer.