Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4Fragment.hh
Go to the documentation of this file.
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//
27//---------------------------------------------------------------------
28//
29// Geant4 header G4Fragment
30//
31// by V. Lara (May 1998)
32//
33// Modifications:
34// 03.05.2010 V.Ivanchenko General cleanup of inline functions: objects
35// are accessed by reference; remove double return
36// tolerance of excitation energy at modent it is computed;
37// safe computation of excitation for exotic fragments
38// 18.05.2010 V.Ivanchenko added member theGroundStateMass and inline
39// method which allowing to compute this value once and use
40// many times
41// 26.09.2010 V.Ivanchenko added number of protons, neutrons, proton holes
42// and neutron holes as members of the class and Get/Set methods;
43// removed not needed 'const'; removed old debug staff and unused
44// private methods; add comments and reorder methods for
45// better reading
46
47#ifndef G4Fragment_h
48#define G4Fragment_h 1
49
50#include "globals.hh"
51#include "G4Allocator.hh"
52#include "G4LorentzVector.hh"
53#include "G4ThreeVector.hh"
55#include "G4NucleiProperties.hh"
56#include "G4Proton.hh"
57#include "G4Neutron.hh"
58#include <vector>
59
61
62class G4Fragment;
63typedef std::vector<G4Fragment*> G4FragmentVector;
64
66{
67public:
68
69 // ============= CONSTRUCTORS ==================
70
71 // Default constructor - obsolete
72 G4Fragment();
73
74 // Destructor
76
77 // Copy constructor
78 G4Fragment(const G4Fragment &right);
79
80 // A,Z and 4-momentum - main constructor for fragment
81 G4Fragment(G4int A, G4int Z, const G4LorentzVector& aMomentum, G4bool warning=true);
82
83 // 4-momentum and pointer to G4particleDefinition (for gammas, e-)
84 G4Fragment(const G4LorentzVector& aMomentum,
85 const G4ParticleDefinition* aParticleDefinition);
86
87 // ============= OPERATORS ==================
88
89 G4Fragment & operator=(const G4Fragment &right);
90 G4bool operator==(const G4Fragment &right) const;
91 G4bool operator!=(const G4Fragment &right) const;
92
93 friend std::ostream& operator<<(std::ostream&, const G4Fragment&);
94
95 // new/delete operators are overloded to use G4Allocator
96 inline void *operator new(size_t);
97 inline void operator delete(void *aFragment);
98
99 // ============= GENERAL METHODS ==================
100
101 inline G4int GetZ_asInt() const;
102 inline G4int GetA_asInt() const;
103 inline void SetZandA_asInt(G4int Znew, G4int Anew);
104
105 inline G4double GetExcitationEnergy() const;
106 inline void SetExcEnergyAndMomentum(G4double eexc, const G4LorentzVector&);
107
108 inline G4double GetGroundStateMass() const;
109
110 inline G4double GetBindingEnergy() const;
111
112 inline const G4LorentzVector& GetMomentum() const;
113 inline void SetMomentum(const G4LorentzVector& value);
114
115 // computation of mass for any Z and A
117
118 // extra methods
119 inline G4double GetSpin() const;
120 inline void SetSpin(G4double value);
121
122 inline G4int GetCreatorModelType() const;
123 inline void SetCreatorModelType(G4int value);
124
125 // obsolete methods
126
127 inline G4double GetZ() const;
128 inline G4double GetA() const;
129 inline void SetZ(G4double value);
130 inline void SetA(G4double value);
131
132 // ============= METHODS FOR PRE-COMPOUND MODEL ===============
133
134 inline G4int GetNumberOfExcitons() const;
135
136 inline G4int GetNumberOfParticles() const;
137 inline G4int GetNumberOfCharged() const;
138 inline void SetNumberOfExcitedParticle(G4int valueTot, G4int valueP);
139
140 inline G4int GetNumberOfHoles() const;
141 inline G4int GetNumberOfChargedHoles() const;
142 inline void SetNumberOfHoles(G4int valueTot, G4int valueP=0);
143
144 // these methods will be removed in future
145 inline void SetNumberOfParticles(G4int value);
146 inline void SetNumberOfCharged(G4int value);
147
148 // ============= METHODS FOR PHOTON EVAPORATION ===============
149
150 inline G4int GetNumberOfElectrons() const;
151 inline void SetNumberOfElectrons(G4int value);
152
153 inline G4int GetFloatingLevelNumber() const;
154 inline void SetFloatingLevelNumber(G4int value);
155
156 inline const G4ParticleDefinition * GetParticleDefinition() const;
157 inline void SetParticleDefinition(const G4ParticleDefinition * p);
158
159 inline G4double GetCreationTime() const;
160 inline void SetCreationTime(G4double time);
161
162 // G4Fragment class is not responsible for creation and delition of
163 // G4NuclearPolarization object
167
170
171 // ============= PRIVATE METHODS ==============================
172
173private:
174
175 void ExcitationEnergyWarning();
176
177 void NumberOfExitationWarning(const G4String&);
178
179 inline void CalculateExcitationEnergy(G4bool warning=true);
180
181 inline void CalculateGroundStateMass();
182
183 // ============= DATA MEMBERS ==================
184
185 G4int theA;
186
187 G4int theZ;
188
189 G4double theExcitationEnergy;
190
191 G4double theGroundStateMass;
192
193 G4LorentzVector theMomentum;
194
195 // Nuclear polarisation by default is nullptr
196 G4NuclearPolarization* thePolarization;
197
198 // creator model type
199 G4int creatorModel;
200
201 // Exciton model data members
202 G4int numberOfParticles;
203 G4int numberOfCharged;
204 G4int numberOfHoles;
205 G4int numberOfChargedHoles;
206
207 // Gamma evaporation data members
208 G4int numberOfShellElectrons;
209 G4int xLevel;
210
211 const G4ParticleDefinition* theParticleDefinition;
212
213 G4double spin;
214 G4double theCreationTime;
215
216 static const G4double minFragExcitation;
217};
218
219// ============= INLINE METHOD IMPLEMENTATIONS ===================
220
221#if defined G4HADRONIC_ALLOC_EXPORT
223#else
225#endif
226
227inline void * G4Fragment::operator new(size_t)
228{
230 return (void*) pFragmentAllocator()->MallocSingle();
231}
232
233inline void G4Fragment::operator delete(void * aFragment)
234{
235 pFragmentAllocator()->FreeSingle((G4Fragment *) aFragment);
236}
237
238inline void G4Fragment::CalculateExcitationEnergy(G4bool warning)
239{
240 theExcitationEnergy = theMomentum.mag() - theGroundStateMass;
241 if(theExcitationEnergy < minFragExcitation) {
242 if(theExcitationEnergy < -minFragExcitation && warning) { ExcitationEnergyWarning(); }
243 theExcitationEnergy = 0.0;
244 }
245}
246
247inline G4double
249{
251}
252
253inline void G4Fragment::CalculateGroundStateMass()
254{
255 theGroundStateMass = G4NucleiProperties::GetNuclearMass(theA, theZ);
256}
257
259{
260 return theA;
261}
262
264{
265 return theZ;
266}
267
269{
270 theZ = Znew;
271 theA = Anew;
272 CalculateGroundStateMass();
273}
274
276{
277 return theExcitationEnergy;
278}
279
281{
282 return theGroundStateMass;
283}
284
286 const G4LorentzVector& v)
287{
288 theExcitationEnergy = eexc;
289 theMomentum.set(0.0, 0.0, 0.0, theGroundStateMass + eexc);
290 theMomentum.boost(v.boostVector());
291}
292
294{
295 return (theA-theZ)*CLHEP::neutron_mass_c2 + theZ*CLHEP::proton_mass_c2
296 - theGroundStateMass;
297}
298
300{
301 return theMomentum;
302}
303
305{
306 theMomentum = value;
307 CalculateExcitationEnergy();
308}
309
311{
312 return G4double(theZ);
313}
314
316{
317 return G4double(theA);
318}
319
320inline void G4Fragment::SetZ(const G4double value)
321{
322 theZ = G4lrint(value);
323 CalculateGroundStateMass();
324}
325
326inline void G4Fragment::SetA(const G4double value)
327{
328 theA = G4lrint(value);
329 CalculateGroundStateMass();
330}
331
333{
334 return numberOfParticles + numberOfHoles;
335}
336
338{
339 return numberOfParticles;
340}
341
343{
344 return numberOfCharged;
345}
346
347inline
349{
350 numberOfParticles = valueTot;
351 numberOfCharged = valueP;
352 if(valueTot < valueP) {
353 NumberOfExitationWarning("SetNumberOfExcitedParticle");
354 }
355}
356
358{
359 return numberOfHoles;
360}
361
363{
364 return numberOfChargedHoles;
365}
366
367inline void G4Fragment::SetNumberOfHoles(G4int valueTot, G4int valueP)
368{
369 numberOfHoles = valueTot;
370 numberOfChargedHoles = valueP;
371 if(valueTot < valueP) {
372 NumberOfExitationWarning("SetNumberOfHoles");
373 }
374}
375
377{
378 numberOfParticles = value;
379}
380
382{
383 numberOfCharged = value;
384 if(value > numberOfParticles) {
385 NumberOfExitationWarning("SetNumberOfCharged");
386 }
387}
388
390{
391 return numberOfShellElectrons;
392}
393
395{
396 numberOfShellElectrons = value;
397}
398
400{
401 return creatorModel;
402}
403
405{
406 creatorModel = value;
407}
408
410{
411 return spin;
412}
413
415{
416 spin = value;
417}
418
420{
421 return xLevel;
422}
423
425{
426 xLevel = value;
427}
428
429inline
431{
432 return theParticleDefinition;
433}
434
436{
437 theParticleDefinition = p;
438}
439
441{
442 return theCreationTime;
443}
444
446{
447 theCreationTime = time;
448}
449
451{
452 return thePolarization;
453}
454
456{
457 return thePolarization;
458}
459
461{
462 thePolarization = p;
463}
464
465#endif
466
467
double A(double temperature)
G4DLLIMPORT G4Allocator< G4Fragment > *& pFragmentAllocator()
Definition: G4Fragment.cc:45
std::vector< G4Fragment * > G4FragmentVector
Definition: G4Fragment.hh:63
double G4double
Definition: G4Types.hh:83
#define G4DLLIMPORT
Definition: G4Types.hh:69
#define G4DLLEXPORT
Definition: G4Types.hh:68
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
Hep3Vector boostVector() const
HepLorentzVector & boost(double, double, double)
void set(double x, double y, double z, double t)
void SetZ(G4double value)
Definition: G4Fragment.hh:320
void SetFloatingLevelNumber(G4int value)
Definition: G4Fragment.hh:424
G4double GetGroundStateMass() const
Definition: G4Fragment.hh:280
G4int GetNumberOfParticles() const
Definition: G4Fragment.hh:337
G4int GetNumberOfHoles() const
Definition: G4Fragment.hh:357
G4NuclearPolarization * GetNuclearPolarization() const
Definition: G4Fragment.hh:455
void SetNumberOfCharged(G4int value)
Definition: G4Fragment.hh:381
friend std::ostream & operator<<(std::ostream &, const G4Fragment &)
Definition: G4Fragment.cc:181
G4int GetNumberOfChargedHoles() const
Definition: G4Fragment.hh:362
G4double GetExcitationEnergy() const
Definition: G4Fragment.hh:275
const G4LorentzVector & GetMomentum() const
Definition: G4Fragment.hh:299
G4double GetCreationTime() const
Definition: G4Fragment.hh:440
void SetNuclearPolarization(G4NuclearPolarization *)
Definition: G4Fragment.hh:460
G4double GetSpin() const
Definition: G4Fragment.hh:409
G4double GetBindingEnergy() const
Definition: G4Fragment.hh:293
G4double GetZ() const
Definition: G4Fragment.hh:310
G4bool operator!=(const G4Fragment &right) const
Definition: G4Fragment.cc:176
G4int GetZ_asInt() const
Definition: G4Fragment.hh:263
G4double GetA() const
Definition: G4Fragment.hh:315
void SetCreationTime(G4double time)
Definition: G4Fragment.hh:445
G4int GetFloatingLevelNumber() const
Definition: G4Fragment.hh:419
void SetNumberOfElectrons(G4int value)
Definition: G4Fragment.hh:394
void SetNumberOfHoles(G4int valueTot, G4int valueP=0)
Definition: G4Fragment.hh:367
G4int GetNumberOfExcitons() const
Definition: G4Fragment.hh:332
G4int GetCreatorModelType() const
Definition: G4Fragment.hh:399
G4double ComputeGroundStateMass(G4int Z, G4int A) const
Definition: G4Fragment.hh:248
G4ThreeVector GetAngularMomentum() const
Definition: G4Fragment.cc:254
const G4ParticleDefinition * GetParticleDefinition() const
Definition: G4Fragment.hh:430
void SetA(G4double value)
Definition: G4Fragment.hh:326
void SetMomentum(const G4LorentzVector &value)
Definition: G4Fragment.hh:304
void SetExcEnergyAndMomentum(G4double eexc, const G4LorentzVector &)
Definition: G4Fragment.hh:285
G4int GetNumberOfElectrons() const
Definition: G4Fragment.hh:389
void SetNumberOfExcitedParticle(G4int valueTot, G4int valueP)
Definition: G4Fragment.hh:348
G4Fragment & operator=(const G4Fragment &right)
Definition: G4Fragment.cc:148
void SetNumberOfParticles(G4int value)
Definition: G4Fragment.hh:376
void SetCreatorModelType(G4int value)
Definition: G4Fragment.hh:404
G4int GetNumberOfCharged() const
Definition: G4Fragment.hh:342
G4bool operator==(const G4Fragment &right) const
Definition: G4Fragment.cc:171
void SetAngularMomentum(const G4ThreeVector &)
Definition: G4Fragment.cc:249
void SetParticleDefinition(const G4ParticleDefinition *p)
Definition: G4Fragment.hh:435
void SetZandA_asInt(G4int Znew, G4int Anew)
Definition: G4Fragment.hh:268
G4NuclearPolarization * NuclearPolarization()
Definition: G4Fragment.hh:450
void SetSpin(G4double value)
Definition: G4Fragment.hh:414
G4int GetA_asInt() const
Definition: G4Fragment.hh:258
static G4double GetNuclearMass(const G4double A, const G4double Z)
int G4lrint(double ad)
Definition: templates.hh:134