ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
G4VDecayChannel.hh
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4VDecayChannel.hh
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
// ------------------------------------------------------------
30
// GEANT 4 class header file
31
//
32
// History: first implementation, based on object model of
33
// 27 July 1996 H.Kurashige
34
// 30 May 1997 H.Kurashige
35
// 23 Mar. 2000 H.Weber : add GetAngularMomentum()
36
// ------------------------------------------------------------
37
#ifndef G4VDecayChannel_h
38
#define G4VDecayChannel_h 1
39
40
#include <cmath>
41
42
#include "
G4ios.hh
"
43
#include "
globals.hh
"
44
#include "
G4ThreeVector.hh
"
45
#include "
G4Threading.hh
"
46
#include "
G4AutoLock.hh
"
47
48
class
G4ParticleDefinition
;
49
class
G4DecayProducts
;
50
class
G4ParticleTable
;
51
52
class
G4VDecayChannel
53
{
54
// Class Description:
55
//
56
// Abstract class to describe decay kinematics
57
58
public
:
// with description
59
60
// Constructors
61
G4VDecayChannel
(
const
G4String
&aName,
G4int
Verbose = 1);
62
G4VDecayChannel
(
const
G4String
&aName,
63
const
G4String
& theParentName,
64
G4double
theBR,
65
G4int
theNumberOfDaughters,
66
const
G4String
& theDaughterName1,
67
const
G4String
& theDaughterName2 =
""
,
68
const
G4String
& theDaughterName3 =
""
,
69
const
G4String
& theDaughterName4 =
""
);
70
71
// Destructor
72
virtual
~G4VDecayChannel
();
73
74
// equality operators
75
G4bool
operator==
(
const
G4VDecayChannel
&
right
)
const
{
return
(
this
== &right);}
76
G4bool
operator!=
(
const
G4VDecayChannel
&
right
)
const
{
return
(
this
!= &right);}
77
78
// less-than operator is defined for G4DecayTable
79
G4bool
operator<
(
const
G4VDecayChannel
&
right
)
const
;
80
81
virtual
G4DecayProducts
*
DecayIt
(
G4double
parentMass = -1.0) = 0;
82
83
// get kinematics name
84
const
G4String
&
GetKinematicsName
()
const
;
85
// get branching ratio
86
G4double
GetBR
()
const
;
87
// get number of daughter particles
88
G4int
GetNumberOfDaughters
()
const
;
89
90
// get the pointer to the parent particle
91
G4ParticleDefinition
*
GetParent
();
92
// get the pointer to a daughter particle
93
G4ParticleDefinition
*
GetDaughter
(
G4int
anIndex);
94
95
// get the angular momentum of the decay
96
G4int
GetAngularMomentum
();
97
// get the name of the parent particle
98
const
G4String
&
GetParentName
()
const
;
99
//get the name of a daughter particle
100
const
G4String
&
GetDaughterName
(
G4int
anIndex)
const
;
101
102
// get mass of parent
103
G4double
GetParentMass
()
const
;
104
G4double
GetDaughterMass
(
G4int
anIndex)
const
;
105
106
// set the parent particle (by name or by pointer)
107
void
SetParent
(
const
G4ParticleDefinition
* particle_type);
108
void
SetParent
(
const
G4String
&particle_name);
109
// set branching ratio
110
void
SetBR
(
G4double
value
);
111
// set number of daughter particles
112
void
SetNumberOfDaughters
(
G4int
value
);
113
// set a daughter particle (by name or by pointer)
114
void
SetDaughter
(
G4int
anIndex,
115
const
G4ParticleDefinition
* particle_type);
116
void
SetDaughter
(
G4int
anIndex,
117
const
G4String
&particle_name);
118
119
void
SetVerboseLevel
(
G4int
value
);
120
G4int
GetVerboseLevel
()
const
;
121
void
DumpInfo
();
122
123
G4double
GetRangeMass
()
const
;
124
void
SetRangeMass
(
G4double
val);
125
virtual
G4bool
IsOKWithParentMass
(
G4double
parentMass);
126
127
void
SetPolarization
(
const
G4ThreeVector
&);
128
const
G4ThreeVector
&
GetPolarization
()
const
;
129
130
protected
:
// with description
131
132
// clear daughters array
133
void
ClearDaughtersName
();
134
135
protected
:
136
inline
void
CheckAndFillDaughters
();
137
inline
void
CheckAndFillParent
();
138
139
private
:
140
// fill daughters array
141
void
FillDaughters
();
142
// fill parent
143
void
FillParent
();
144
145
protected
:
// without description
146
147
// default constructor
148
G4VDecayChannel
();
149
150
// copy constructor and assignment operator
151
G4VDecayChannel
(
const
G4VDecayChannel
&);
152
G4VDecayChannel
&
operator=
(
const
G4VDecayChannel
&);
153
154
private
:
155
156
const
G4String
&
GetNoName
()
const
;
157
158
protected
:
159
G4double
DynamicalMass
(
G4double
massPDG,
G4double
width,
G4double
maxDev = +1.)
const
;
160
161
protected
:
162
163
// kinematics name
164
G4String
kinematics_name
;
165
// branching ratio [0.0 - 1.0]
166
G4double
rbranch
;
167
// number of daughters
168
G4int
numberOfDaughters
;
169
// parent particle
170
G4String
*
parent_name
;
171
// daughter particles
172
G4String
**
daughters_name
;
173
174
// range of mass allowed in decay
175
G4double
rangeMass
;
176
177
// polarization of the parent particle
178
G4ThreeVector
parent_polarization
;
179
180
// pointer to particle table
181
G4ParticleTable
*
particletable
;
182
183
// control flag for output message
184
G4int
verboseLevel
;
185
// 0: Silent
186
// 1: Warning message
187
// 2: More
188
189
static
const
G4String
noName
;
190
191
G4ParticleDefinition
*
G4MT_parent
;
192
G4ParticleDefinition
**
G4MT_daughters
;
193
G4double
G4MT_parent_mass
;
194
G4double
*
G4MT_daughters_mass
;
195
G4double
*
G4MT_daughters_width
;
196
G4Mutex
daughtersMutex
;
197
G4Mutex
parentMutex
;
198
};
199
200
// ------------------------------------------------------------
201
// Inline methods
202
// ------------------------------------------------------------
203
204
inline
205
G4bool
G4VDecayChannel::operator<
(
const
G4VDecayChannel
&
right
)
const
206
{
207
return
(this->
rbranch
< right.
rbranch
);
208
}
209
210
inline
211
G4ParticleDefinition
*
G4VDecayChannel::GetDaughter
(
G4int
anIndex)
212
{
213
// pointers to daughter particles are filled, if they are not set yet
214
CheckAndFillDaughters
();
215
216
// get the pointer to a daughter particle
217
if
( (anIndex>=0) && (anIndex<
numberOfDaughters
) ) {
218
return
G4MT_daughters
[anIndex];
219
}
else
{
220
if
(
verboseLevel
>0)
221
G4cout
<<
"G4VDecayChannel::GetDaughter index out of range "
<<anIndex<<
G4endl
;
222
return
0;
223
}
224
}
225
226
inline
227
const
G4String
&
G4VDecayChannel::GetDaughterName
(
G4int
anIndex)
const
228
{
229
if
( (anIndex>=0) && (anIndex<
numberOfDaughters
) ) {
230
return
*
daughters_name
[anIndex];
231
}
else
{
232
if
(
verboseLevel
>0){
233
G4cout
<<
"G4VDecayChannel::GetDaughterName "
;
234
G4cout
<<
"index out of range "
<< anIndex <<
G4endl
;
235
}
236
return
GetNoName
();
237
}
238
}
239
240
inline
241
G4double
G4VDecayChannel::GetDaughterMass
(
G4int
anIndex)
const
242
{
243
if
( (anIndex>=0) && (anIndex<
numberOfDaughters
) ) {
244
return
G4MT_daughters_mass
[anIndex];
245
}
else
{
246
if
(
verboseLevel
>0){
247
G4cout
<<
"G4VDecayChannel::GetDaughterMass "
;
248
G4cout
<<
"index out of range "
<< anIndex <<
G4endl
;
249
}
250
return
0.0;
251
}
252
}
253
254
inline
255
G4ParticleDefinition
*
G4VDecayChannel::GetParent
()
256
{
257
// the pointer to the parent particle is filled, if it is not set yet
258
CheckAndFillParent
();
259
// get the pointer to the parent particle
260
return
G4MT_parent
;
261
}
262
263
inline
264
const
G4String
&
G4VDecayChannel::GetParentName
()
const
265
{
266
return
*
parent_name
;
267
}
268
269
inline
270
G4double
G4VDecayChannel::GetParentMass
()
const
271
{
272
return
G4MT_parent_mass
;
273
}
274
275
inline
276
void
G4VDecayChannel::SetParent
(
const
G4String
&particle_name)
277
{
278
if
(
parent_name
!= 0)
delete
parent_name
;
279
parent_name
=
new
G4String
(particle_name);
280
G4MT_parent
= 0;
281
}
282
283
inline
284
G4int
G4VDecayChannel::GetNumberOfDaughters
()
const
285
{
286
return
numberOfDaughters
;
287
}
288
289
inline
290
const
G4String
&
G4VDecayChannel::GetKinematicsName
()
const
{
return
kinematics_name
; }
291
292
inline
293
G4double
G4VDecayChannel::GetBR
()
const
{
return
rbranch
; }
294
295
inline
296
void
G4VDecayChannel::SetVerboseLevel
(
G4int
value
){
verboseLevel
=
value
; }
297
298
inline
299
G4int
G4VDecayChannel::GetVerboseLevel
()
const
{
return
verboseLevel
; }
300
301
inline
302
G4double
G4VDecayChannel::GetRangeMass
()
const
{
return
rangeMass
; }
303
304
inline
305
void
G4VDecayChannel::SetRangeMass
(
G4double
val){
if
(val>=0.)
rangeMass
=val; }
306
307
inline
308
void
G4VDecayChannel::SetPolarization
(
const
G4ThreeVector
& polar)
309
{
310
parent_polarization
= polar;
311
}
312
313
inline
314
const
G4ThreeVector
&
G4VDecayChannel::GetPolarization
()
const
315
{
316
return
parent_polarization
;
317
}
318
319
inline
320
void
G4VDecayChannel::CheckAndFillDaughters
() {
321
G4AutoLock
l(&
daughtersMutex
);
322
if
(
G4MT_daughters
==0 ) {
323
l.
unlock
();
324
FillDaughters
();
325
}
326
}
327
328
inline
void
G4VDecayChannel::CheckAndFillParent
() {
329
G4AutoLock
l(&
parentMutex
);
330
if
(
G4MT_parent
== 0 ) {
331
l.
unlock
();
332
FillParent
();
333
}
334
}
335
#endif
geant4
tree
geant4-10.6-release
source
particles
management
include
G4VDecayChannel.hh
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:24
using
1.8.2 with
ECCE GitHub integration