G4Fragment.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 // $Id$
00027 //
00028 //---------------------------------------------------------------------
00029 //
00030 // Geant4 header G4Fragment
00031 //
00032 // by V. Lara (May 1998)
00033 //
00034 // Modifications:
00035 // 03.05.2010 V.Ivanchenko General cleanup of inline functions: objects 
00036 //            are accessed by reference; remove double return 
00037 //            tolerance of excitation energy at modent it is computed;
00038 //            safe computation of excitation for exotic fragments
00039 // 18.05.2010 V.Ivanchenko added member theGroundStateMass and inline
00040 //            method which allowing to compute this value once and use 
00041 //            many times
00042 // 26.09.2010 V.Ivanchenko added number of protons, neutrons, proton holes
00043 //            and neutron holes as members of the class and Get/Set methods;
00044 //            removed not needed 'const'; removed old debug staff and unused
00045 //            private methods; add comments and reorder methods for 
00046 //            better reading
00047 
00048 #ifndef G4Fragment_h
00049 #define G4Fragment_h 1
00050 
00051 #include <vector>
00052 
00053 #include "globals.hh"
00054 #include "G4LorentzVector.hh"
00055 #include "G4ThreeVector.hh"
00056 #include "G4NucleiProperties.hh"
00057 #include "Randomize.hh"
00058 #include "G4Proton.hh"
00059 #include "G4Neutron.hh"
00060 #include "G4HadTmpUtil.hh"
00061 
00062 class G4ParticleDefinition;
00063 
00064 class G4Fragment;     
00065 typedef std::vector<G4Fragment*> G4FragmentVector;
00066 
00067 class G4Fragment 
00068 {
00069 public:
00070 
00071   // ============= CONSTRUCTORS ==================
00072 
00073   // Default constructor - obsolete
00074   G4Fragment();
00075 
00076   // Destructor
00077   ~G4Fragment();
00078 
00079   // Copy constructor
00080   G4Fragment(const G4Fragment &right);
00081 
00082   // A,Z and 4-momentum - main constructor for fragment
00083   G4Fragment(G4int A, G4int Z, const G4LorentzVector& aMomentum);
00084 
00085   // 4-momentum and pointer to G4particleDefinition (for gammas, e-)
00086   G4Fragment(const G4LorentzVector& aMomentum, 
00087              G4ParticleDefinition* aParticleDefinition);
00088 
00089   // ============= OPERATORS ==================
00090     
00091   G4Fragment & operator=(const G4Fragment &right);
00092   G4bool operator==(const G4Fragment &right) const;
00093   G4bool operator!=(const G4Fragment &right) const;
00094 
00095   friend std::ostream& operator<<(std::ostream&, const G4Fragment*);
00096   friend std::ostream& operator<<(std::ostream&, const G4Fragment&);
00097 
00098   // ============= GENERAL METHODS ==================
00099 
00100   inline G4int GetZ_asInt() const;
00101   inline G4int GetA_asInt() const;
00102   inline void SetZandA_asInt(G4int Znew, G4int Anew);
00103   
00104   inline G4double GetExcitationEnergy() const;
00105 
00106   inline G4double GetGroundStateMass() const;
00107    
00108   inline G4double GetBindingEnergy() const;
00109   
00110   inline const G4LorentzVector& GetMomentum() const;
00111   inline void SetMomentum(const G4LorentzVector& value);
00112   
00113   inline const G4ThreeVector& GetAngularMomentum() const;
00114   inline void SetAngularMomentum(const G4ThreeVector& value);
00115 
00116   // computation of mass for any Z and A
00117   inline G4double ComputeGroundStateMass(G4int Z, G4int A) const;
00118 
00119   // obsolete methods
00120   inline G4double GetZ() const;
00121   inline G4double GetA() const;
00122   inline void SetZ(G4double value);
00123   inline void SetA(G4double value);
00124   
00125   // ============= METHODS FOR PRE-COMPOUND MODEL ===============
00126 
00127   inline G4int GetNumberOfExcitons() const;
00128   
00129   inline G4int GetNumberOfParticles() const;
00130   inline G4int GetNumberOfCharged() const;
00131   inline void SetNumberOfExcitedParticle(G4int valueTot, G4int valueP);
00132 
00133   inline G4int GetNumberOfHoles() const;
00134   inline G4int GetNumberOfChargedHoles() const;
00135   inline void SetNumberOfHoles(G4int valueTot, G4int valueP=0);
00136   
00137   // these methods will be removed in future
00138   inline void SetNumberOfParticles(G4int value);
00139   inline void SetNumberOfCharged(G4int value);
00140 
00141   // ============= METHODS FOR PHOTON EVAPORATION ===============
00142 
00143   inline G4int GetNumberOfElectrons() const;
00144   inline void SetNumberOfElectrons(G4int value);
00145 
00146   inline G4ParticleDefinition * GetParticleDefinition() const;
00147   inline void SetParticleDefinition(G4ParticleDefinition * p);
00148 
00149   inline G4double GetCreationTime() const;
00150   inline void SetCreationTime(G4double time);
00151 
00152   inline G4bool IsStable() const;
00153   inline void SetStable(G4bool val);
00154 
00155   // ============= PRIVATE METHODS ==============================
00156 
00157 private:
00158 
00159   void ExcitationEnergyWarning();
00160 
00161   void NumberOfExitationWarning(const G4String&);
00162 
00163   inline void CalculateExcitationEnergy();
00164 
00165   inline void CalculateGroundStateMass();
00166 
00167   // ============= DATA MEMBERS ==================
00168 
00169   static G4int errCount;
00170 
00171   G4int theA;
00172   
00173   G4int theZ;
00174   
00175   G4double theExcitationEnergy;
00176 
00177   G4double theGroundStateMass;
00178 
00179   G4LorentzVector theMomentum;
00180   
00181   G4ThreeVector theAngularMomentum;
00182 
00183   // Exciton model data members
00184   
00185   G4int numberOfParticles;
00186   
00187   G4int numberOfCharged;
00188 
00189   G4int numberOfHoles;
00190   
00191   G4int numberOfChargedHoles;
00192 
00193   // Gamma evaporation data members
00194 
00195   G4int numberOfShellElectrons;
00196 
00197   G4ParticleDefinition * theParticleDefinition;
00198   
00199   G4double theCreationTime;
00200 
00201   G4bool isStable;
00202 
00203 };
00204 
00205 // ============= INLINE METHOD IMPLEMENTATIONS ===================
00206 
00207 inline void G4Fragment::CalculateExcitationEnergy()
00208 {
00209   theExcitationEnergy = theMomentum.mag() - theGroundStateMass;
00210   if(theExcitationEnergy < 0.0) { ExcitationEnergyWarning(); }
00211 }
00212          
00213 inline void G4Fragment::CalculateGroundStateMass() 
00214 {
00215   theGroundStateMass = G4NucleiProperties::GetNuclearMass(theA, theZ);
00216 }
00217 
00218 inline G4int G4Fragment::GetA_asInt() const
00219 {
00220   return theA;
00221 }
00222 
00223 inline G4int G4Fragment::GetZ_asInt()  const
00224 {
00225   return theZ;
00226 }
00227 
00228 inline void G4Fragment::SetZandA_asInt(G4int Znew, G4int Anew)
00229 {
00230   theZ = Znew;
00231   theA = Anew;
00232   CalculateGroundStateMass();
00233 }
00234 
00235 inline G4double G4Fragment::GetExcitationEnergy()  const
00236 {
00237   return theExcitationEnergy;
00238 }
00239 
00240 inline G4double G4Fragment::GetGroundStateMass() const
00241 {
00242   return theGroundStateMass; 
00243 }
00244 
00245 inline G4double G4Fragment::GetBindingEnergy() const
00246 {
00247   return (theA-theZ)*CLHEP::neutron_mass_c2 + theZ*CLHEP::proton_mass_c2 
00248     - theGroundStateMass;
00249 }
00250 
00251 inline const G4LorentzVector& G4Fragment::GetMomentum()  const
00252 {
00253   return theMomentum;
00254 }
00255 
00256 inline void G4Fragment::SetMomentum(const G4LorentzVector& value)
00257 {
00258   theMomentum = value;
00259   CalculateExcitationEnergy();
00260 }
00261 
00262 inline const G4ThreeVector& G4Fragment::GetAngularMomentum()  const
00263 {
00264   return theAngularMomentum;
00265 }
00266 
00267 inline void G4Fragment::SetAngularMomentum(const G4ThreeVector& value)
00268 {
00269   theAngularMomentum = value;
00270 }
00271 
00272 inline G4double 
00273 G4Fragment::ComputeGroundStateMass(G4int Z, G4int A) const
00274 {
00275   return G4NucleiProperties::GetNuclearMass(A, Z); 
00276 }
00277 
00278 inline G4double G4Fragment::GetZ()  const
00279 {
00280   return G4double(theZ);
00281 }
00282 
00283 inline G4double G4Fragment::GetA() const
00284 {
00285   return G4double(theA);
00286 }
00287 
00288 inline void G4Fragment::SetZ(const G4double value)
00289 {
00290   theZ = G4lrint(value);
00291   CalculateGroundStateMass();
00292 }
00293 
00294 inline void G4Fragment::SetA(const G4double value)
00295 {
00296   theA = G4lrint(value);
00297   CalculateGroundStateMass();
00298 }
00299 
00300 inline G4int G4Fragment::GetNumberOfExcitons()  const
00301 {
00302   return numberOfParticles + numberOfHoles;
00303 }
00304 
00305 inline G4int G4Fragment::GetNumberOfParticles()  const
00306 {
00307   return numberOfParticles;
00308 }
00309 
00310 inline G4int G4Fragment::GetNumberOfCharged()  const
00311 {
00312   return numberOfCharged;
00313 }
00314 
00315 inline 
00316 void G4Fragment::SetNumberOfExcitedParticle(G4int valueTot, G4int valueP)
00317 {
00318   numberOfParticles = valueTot;
00319   numberOfCharged = valueP;
00320   if(valueTot < valueP)  { 
00321     NumberOfExitationWarning("SetNumberOfExcitedParticle"); 
00322   }
00323 }
00324 
00325 inline G4int G4Fragment::GetNumberOfHoles()  const
00326 {
00327   return numberOfHoles;
00328 }
00329 
00330 inline G4int G4Fragment::GetNumberOfChargedHoles()  const
00331 {
00332   return numberOfChargedHoles;
00333 }
00334 
00335 inline void G4Fragment::SetNumberOfHoles(G4int valueTot, G4int valueP)
00336 {
00337   numberOfHoles = valueTot;
00338   numberOfChargedHoles = valueP;
00339   if(valueTot < valueP)  { 
00340     NumberOfExitationWarning("SetNumberOfHoles"); 
00341   }
00342 }
00343 
00344 inline void G4Fragment::SetNumberOfParticles(G4int value)
00345 {
00346   numberOfParticles = value;
00347 }
00348 
00349 inline void G4Fragment::SetNumberOfCharged(G4int value)
00350 {
00351   numberOfCharged = value;
00352   if(value > numberOfParticles)  { 
00353     NumberOfExitationWarning("SetNumberOfCharged"); 
00354   }
00355 }
00356 
00357 inline G4int G4Fragment::GetNumberOfElectrons() const
00358 {
00359   return numberOfShellElectrons;
00360 }
00361 
00362 inline void G4Fragment::SetNumberOfElectrons(G4int value)
00363 {
00364   numberOfShellElectrons = value;
00365 }
00366 
00367 inline 
00368 G4ParticleDefinition * G4Fragment::GetParticleDefinition(void) const
00369 {
00370   return theParticleDefinition;
00371 }
00372 
00373 inline void G4Fragment::SetParticleDefinition(G4ParticleDefinition * p)
00374 {
00375   theParticleDefinition = p;
00376 }
00377 
00378 inline G4double G4Fragment::GetCreationTime() const 
00379 {
00380   return theCreationTime;
00381 }
00382 
00383 inline void G4Fragment::SetCreationTime(G4double time)
00384 {
00385   theCreationTime = time;
00386 }
00387 
00388 inline G4bool G4Fragment::IsStable() const
00389 {
00390   return isStable;
00391 }
00392 
00393 inline void G4Fragment::SetStable(G4bool val)
00394 {
00395   isStable = val;
00396 }
00397 
00398 #endif
00399 
00400 

Generated on Mon May 27 17:48:17 2013 for Geant4 by  doxygen 1.4.7