Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4Fragment.cc
이 파일의 문서화 페이지로 가기
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // $Id: G4Fragment.cc 110267 2018-05-17 14:34:00Z gcosmo $
27 //
28 //---------------------------------------------------------------------
29 //
30 // Geant4 class G4Fragment
31 //
32 // Hadronic Process: Nuclear De-excitations
33 // by V. Lara (May 1998)
34 //
35 // Modifications:
36 // 03.05.2010 V.Ivanchenko General cleanup; moved obsolete methods from
37 // inline to source
38 // 25.09.2010 M. Kelsey -- Change "setprecision" to "setwidth" in printout,
39 // add null pointer check.
40 
41 #include "G4Fragment.hh"
42 #include "G4HadronicException.hh"
43 #include "G4ios.hh"
44 #include <iomanip>
45 
47 {
48  G4ThreadLocalStatic G4Allocator<G4Fragment>* _instance = nullptr;
49  return _instance;
50 }
51 
53 
54 // Default constructor
56  theA(0),
57  theZ(0),
58  theExcitationEnergy(0.0),
59  theGroundStateMass(0.0),
60  theMomentum(G4LorentzVector(0,0,0,0)),
61  thePolarization(nullptr),
62  creatorModel(-1),
64  numberOfCharged(0),
65  numberOfHoles(0),
66  numberOfChargedHoles(0),
67  numberOfShellElectrons(0),
68  xLevel(0),
69  theParticleDefinition(nullptr),
70  spin(0.0),
71  theCreationTime(0.0)
72 {}
73 
74 // Copy Constructor
76  theA(right.theA),
77  theZ(right.theZ),
78  theExcitationEnergy(right.theExcitationEnergy),
79  theGroundStateMass(right.theGroundStateMass),
80  theMomentum(right.theMomentum),
81  thePolarization(right.thePolarization),
82  creatorModel(right.creatorModel),
84  numberOfCharged(right.numberOfCharged),
85  numberOfHoles(right.numberOfHoles),
86  numberOfChargedHoles(right.numberOfChargedHoles),
87  numberOfShellElectrons(right.numberOfShellElectrons),
88  xLevel(right.xLevel),
89  theParticleDefinition(right.theParticleDefinition),
90  spin(right.spin),
91  theCreationTime(right.theCreationTime)
92 {}
93 
95 {}
96 
98  theA(A),
99  theZ(Z),
100  theExcitationEnergy(0.0),
101  theGroundStateMass(0.0),
102  theMomentum(aMomentum),
103  thePolarization(nullptr),
104  creatorModel(-1),
106  numberOfCharged(0),
107  numberOfHoles(0),
108  numberOfChargedHoles(0),
109  numberOfShellElectrons(0),
110  xLevel(0),
111  theParticleDefinition(nullptr),
112  spin(0.0),
113  theCreationTime(0.0)
114 {
115  if(theA > 0) {
118  }
119 }
120 
121 // This constructor is for initialize photons or electrons
123  const G4ParticleDefinition * aParticleDefinition) :
124  theA(0),
125  theZ(0),
126  theExcitationEnergy(0.0),
127  theMomentum(aMomentum),
128  thePolarization(nullptr),
129  creatorModel(-1),
131  numberOfCharged(0),
132  numberOfHoles(0),
133  numberOfChargedHoles(0),
134  numberOfShellElectrons(0),
135  xLevel(0),
136  theParticleDefinition(aParticleDefinition),
137  spin(0.0),
138  theCreationTime(0.0)
139 {
140  if(aParticleDefinition->GetPDGEncoding() != 22 &&
141  aParticleDefinition->GetPDGEncoding() != 11) {
142  G4String text = "G4Fragment::G4Fragment constructor for gamma used for "
143  + aParticleDefinition->GetParticleName();
144  throw G4HadronicException(__FILE__, __LINE__, text);
145  }
146  theGroundStateMass = aParticleDefinition->GetPDGMass();
147 }
148 
150 {
151  if (this != &right) {
152  theA = right.theA;
153  theZ = right.theZ;
156  theMomentum = right.theMomentum;
158  creatorModel = right.creatorModel;
164  xLevel = right.xLevel;
166  spin = right.spin;
168  }
169  return *this;
170 }
171 
173 {
174  return (this == (G4Fragment *) &right);
175 }
176 
178 {
179  return (this != (G4Fragment *) &right);
180 }
181 
182 std::ostream& operator << (std::ostream &out, const G4Fragment &theFragment)
183 {
184  std::ios::fmtflags old_floatfield = out.flags();
185  out.setf(std::ios::floatfield);
186 
187  out << "Fragment: A = " << std::setw(3) << theFragment.theA
188  << ", Z = " << std::setw(3) << theFragment.theZ ;
189  out.setf(std::ios::scientific,std::ios::floatfield);
190 
191  // Store user's precision setting and reset to (3) here: back-compatibility
192  std::streamsize floatPrec = out.precision();
193 
194  out << std::setprecision(3)
195  << ", U = " << theFragment.GetExcitationEnergy()/CLHEP::MeV
196  << " MeV ";
197  if(theFragment.GetCreatorModelType() >= 0) {
198  out << " creatorModelType= " << theFragment.GetCreatorModelType();
199  }
200  if(theFragment.GetCreationTime() > 0.0) {
201  out << " Time= " << theFragment.GetCreationTime()/CLHEP::ns << " ns";
202  }
203  out << G4endl
204  << " P = ("
205  << theFragment.GetMomentum().x()/CLHEP::MeV << ","
206  << theFragment.GetMomentum().y()/CLHEP::MeV << ","
207  << theFragment.GetMomentum().z()/CLHEP::MeV
208  << ") MeV E = "
209  << theFragment.GetMomentum().t()/CLHEP::MeV << " MeV"
210  << G4endl;
211 
212  out << " #spin= " << theFragment.GetSpin()
213  << " #floatLevelNo= " << theFragment.GetFloatingLevelNumber() << " ";
214 
215  if (theFragment.GetNumberOfExcitons() != 0) {
216  out << " "
217  << "#Particles= " << theFragment.GetNumberOfParticles()
218  << ", #Charged= " << theFragment.GetNumberOfCharged()
219  << ", #Holes= " << theFragment.GetNumberOfHoles()
220  << ", #ChargedHoles= " << theFragment.GetNumberOfChargedHoles();
221  }
222  out << G4endl;
223  if(theFragment.GetNuclearPolarization()) {
224  out << *(theFragment.GetNuclearPolarization());
225  }
226  //out << G4endl;
227  out.setf(old_floatfield,std::ios::floatfield);
228  out.precision(floatPrec);
229 
230  return out;
231 }
232 
234 {
235 #ifdef G4VERBOSE
236  G4cout << "G4Fragment::CalculateExcitationEnergy(): WARNING "<<G4endl;
237  G4cout << *this << G4endl;
238 #endif
239 }
240 
242 {
243  G4cout << "G4Fragment::"<< value << " ERROR "
244  << G4endl;
245  G4cout << this << G4endl;
246  G4String text = "G4Fragment::G4Fragment wrong exciton number ";
247  throw G4HadronicException(__FILE__, __LINE__, text);
248 }
249 
251 {
252  spin = v.mag();
253 }
254 
256 {
257  G4ThreeVector v(0.0,0.0,spin);
258  return v;
259 }
G4double GetCreationTime() const
Definition: G4Fragment.hh:441
static const G4double minFragExcitation
Definition: G4Fragment.hh:217
const G4LorentzVector & GetMomentum() const
Definition: G4Fragment.hh:300
G4double theExcitationEnergy
Definition: G4Fragment.hh:190
G4LorentzVector theMomentum
Definition: G4Fragment.hh:194
std::ostream & operator<<(std::ostream &, const BasicVector3D< float > &)
G4int numberOfParticles
Definition: G4Fragment.hh:203
G4NuclearPolarization * GetNuclearPolarization() const
Definition: G4Fragment.hh:456
#define G4endl
Definition: G4ios.hh:61
G4int GetCreatorModelType() const
Definition: G4Fragment.hh:400
G4double GetSpin() const
Definition: G4Fragment.hh:410
const G4String & GetParticleName() const
G4int GetNumberOfHoles() const
Definition: G4Fragment.hh:358
static constexpr double ns
G4int theA
Definition: G4Fragment.hh:186
G4int GetNumberOfParticles() const
Definition: G4Fragment.hh:338
G4int numberOfChargedHoles
Definition: G4Fragment.hh:206
#define G4ThreadLocalStatic
Definition: tls.hh:68
void NumberOfExitationWarning(const G4String &)
Definition: G4Fragment.cc:241
G4int theZ
Definition: G4Fragment.hh:188
G4double GetPDGMass() const
void CalculateExcitationEnergy()
Definition: G4Fragment.hh:239
G4double theCreationTime
Definition: G4Fragment.hh:215
Float_t Z
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
G4NuclearPolarization * thePolarization
Definition: G4Fragment.hh:197
const XML_Char int const XML_Char * value
Definition: expat.h:331
G4double spin
Definition: G4Fragment.hh:214
G4int GetNumberOfCharged() const
Definition: G4Fragment.hh:343
G4int numberOfHoles
Definition: G4Fragment.hh:205
void CalculateGroundStateMass()
Definition: G4Fragment.hh:254
static constexpr double MeV
G4Fragment & operator=(const G4Fragment &right)
Definition: G4Fragment.cc:149
double A(double temperature)
G4int creatorModel
Definition: G4Fragment.hh:200
static constexpr double eV
G4DLLIMPORT G4Allocator< G4Fragment > *& pFragmentAllocator()
Definition: G4Fragment.cc:46
void ExcitationEnergyWarning()
Definition: G4Fragment.cc:233
double mag() const
int G4int
Definition: G4Types.hh:78
G4int numberOfShellElectrons
Definition: G4Fragment.hh:209
const G4ParticleDefinition * theParticleDefinition
Definition: G4Fragment.hh:212
G4GLOB_DLL std::ostream G4cout
G4int xLevel
Definition: G4Fragment.hh:210
G4bool operator==(const G4Fragment &right) const
Definition: G4Fragment.cc:172
static int numberOfParticles
G4int GetFloatingLevelNumber() const
Definition: G4Fragment.hh:420
G4int GetNumberOfChargedHoles() const
Definition: G4Fragment.hh:363
G4int GetNumberOfExcitons() const
Definition: G4Fragment.hh:333
G4double theGroundStateMass
Definition: G4Fragment.hh:192
void SetAngularMomentum(const G4ThreeVector &)
Definition: G4Fragment.cc:250
G4double GetExcitationEnergy() const
Definition: G4Fragment.hh:276
G4ThreeVector GetAngularMomentum() const
Definition: G4Fragment.cc:255
G4int numberOfCharged
Definition: G4Fragment.hh:204
G4bool operator!=(const G4Fragment &right) const
Definition: G4Fragment.cc:177