Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VDecayChannel Class Referenceabstract

#include <G4VDecayChannel.hh>

+ Inheritance diagram for G4VDecayChannel:

Public Member Functions

 G4VDecayChannel (const G4String &aName, G4int Verbose=1)
 
 G4VDecayChannel (const G4String &aName, const G4String &theParentName, G4double theBR, G4int theNumberOfDaughters, const G4String &theDaughterName1, const G4String &theDaughterName2="", const G4String &theDaughterName3="", const G4String &theDaughterName4="", const G4String &theDaughterName5="")
 
virtual ~G4VDecayChannel ()
 
G4bool operator== (const G4VDecayChannel &r) const
 
G4bool operator!= (const G4VDecayChannel &r) const
 
G4bool operator< (const G4VDecayChannel &right) const
 
virtual G4DecayProductsDecayIt (G4double parentMass=-1.0)=0
 
const G4StringGetKinematicsName () const
 
G4double GetBR () const
 
G4int GetNumberOfDaughters () const
 
G4ParticleDefinitionGetParent ()
 
G4ParticleDefinitionGetDaughter (G4int anIndex)
 
G4int GetAngularMomentum ()
 
const G4StringGetParentName () const
 
const G4StringGetDaughterName (G4int anIndex) const
 
G4double GetParentMass () const
 
G4double GetDaughterMass (G4int anIndex) const
 
void SetParent (const G4ParticleDefinition *particle_type)
 
void SetParent (const G4String &particle_name)
 
void SetBR (G4double value)
 
void SetNumberOfDaughters (G4int value)
 
void SetDaughter (G4int anIndex, const G4ParticleDefinition *particle_type)
 
void SetDaughter (G4int anIndex, const G4String &particle_name)
 
void SetVerboseLevel (G4int value)
 
G4int GetVerboseLevel () const
 
void DumpInfo ()
 
G4double GetRangeMass () const
 
void SetRangeMass (G4double val)
 
virtual G4bool IsOKWithParentMass (G4double parentMass)
 
void SetPolarization (const G4ThreeVector &)
 
const G4ThreeVectorGetPolarization () const
 

Protected Member Functions

void ClearDaughtersName ()
 
void CheckAndFillDaughters ()
 
void CheckAndFillParent ()
 
G4double DynamicalMass (G4double massPDG, G4double width, G4double maxDev=1.0) const
 
 G4VDecayChannel ()
 
 G4VDecayChannel (const G4VDecayChannel &)
 
G4VDecayChanneloperator= (const G4VDecayChannel &)
 

Protected Attributes

G4String kinematics_name = ""
 
G4double rbranch = 0.0
 
G4Stringparent_name = nullptr
 
G4String ** daughters_name = nullptr
 
G4double rangeMass = 2.5
 
G4ThreeVector parent_polarization
 
G4ParticleTableparticletable = nullptr
 
G4ParticleDefinitionG4MT_parent = nullptr
 
G4ParticleDefinition ** G4MT_daughters = nullptr
 
G4double G4MT_parent_mass = 0.0
 
G4doubleG4MT_daughters_mass = nullptr
 
G4doubleG4MT_daughters_width = nullptr
 
G4Mutex daughtersMutex
 
G4Mutex parentMutex
 
G4int numberOfDaughters = 0
 
G4int verboseLevel = 1
 

Static Protected Attributes

static const G4String noName = " "
 

Detailed Description

Definition at line 49 of file G4VDecayChannel.hh.

Constructor & Destructor Documentation

◆ G4VDecayChannel() [1/4]

G4VDecayChannel::G4VDecayChannel ( const G4String aName,
G4int  Verbose = 1 
)

Definition at line 51 of file G4VDecayChannel.cc.

53{
54 // set pointer to G4ParticleTable (static and singleton object)
56}
static G4ParticleTable * GetParticleTable()
G4ParticleTable * particletable
G4ThreeVector parent_polarization
G4String kinematics_name

◆ G4VDecayChannel() [2/4]

G4VDecayChannel::G4VDecayChannel ( const G4String aName,
const G4String theParentName,
G4double  theBR,
G4int  theNumberOfDaughters,
const G4String theDaughterName1,
const G4String theDaughterName2 = "",
const G4String theDaughterName3 = "",
const G4String theDaughterName4 = "",
const G4String theDaughterName5 = "" 
)

Definition at line 59 of file G4VDecayChannel.cc.

69 numberOfDaughters(theNumberOfDaughters)
70{
71 // set pointer to G4ParticleTable (static and singleton object)
73
74 // parent name
75 parent_name = new G4String(theParentName);
76
77 // cleate array
79 for (G4int index=0; index<numberOfDaughters; ++index)
80 {
81 daughters_name[index] = nullptr;
82 }
83
84 // daughters' name
85 if (numberOfDaughters>0) daughters_name[0] = new G4String(theDaughterName1);
86 if (numberOfDaughters>1) daughters_name[1] = new G4String(theDaughterName2);
87 if (numberOfDaughters>2) daughters_name[2] = new G4String(theDaughterName3);
88 if (numberOfDaughters>3) daughters_name[3] = new G4String(theDaughterName4);
89 if (numberOfDaughters>4) daughters_name[4] = new G4String(theDaughterName5);
90
91 if (rbranch <0. ) rbranch = 0.0;
92 else if (rbranch >1.0 ) rbranch = 1.0;
93}
int G4int
Definition: G4Types.hh:85
G4String * parent_name
G4String ** daughters_name

◆ ~G4VDecayChannel()

G4VDecayChannel::~G4VDecayChannel ( )
virtual

Definition at line 169 of file G4VDecayChannel.cc.

170{
172 delete parent_name;
173 parent_name = nullptr;
174 delete [] G4MT_daughters_mass;
175 G4MT_daughters_mass = nullptr;
176 delete [] G4MT_daughters_width;
177 G4MT_daughters_width = nullptr;
180}
#define G4MUTEXDESTROY(mutex)
Definition: G4Threading.hh:90
G4double * G4MT_daughters_mass
G4double * G4MT_daughters_width

◆ G4VDecayChannel() [3/4]

G4VDecayChannel::G4VDecayChannel ( )
protected

Definition at line 43 of file G4VDecayChannel.cc.

45{
46 // set pointer to G4ParticleTable (static and singleton object)
48}

◆ G4VDecayChannel() [4/4]

G4VDecayChannel::G4VDecayChannel ( const G4VDecayChannel right)
protected

Definition at line 96 of file G4VDecayChannel.cc.

97{
100 rbranch = right.rbranch;
101 rangeMass = right.rangeMass;
102
103 // copy parent name
104 parent_name = new G4String(*right.parent_name);
105
106 // create array
108
109 daughters_name = nullptr;
110 if ( numberOfDaughters >0 )
111 {
113 // copy daughters name
114 for (G4int index=0; index<numberOfDaughters; ++index)
115 {
116 daughters_name[index] = new G4String(*right.daughters_name[index]);
117 }
118 }
119
120 // particle table
122
124
127}
#define G4MUTEXINIT(mutex)
Definition: G4Threading.hh:87

Member Function Documentation

◆ CheckAndFillDaughters()

◆ CheckAndFillParent()

◆ ClearDaughtersName()

void G4VDecayChannel::ClearDaughtersName ( )
protected

Definition at line 183 of file G4VDecayChannel.cc.

184{
186 if ( daughters_name != nullptr)
187 {
188 if (numberOfDaughters>0)
189 {
190#ifdef G4VERBOSE
191 if (verboseLevel>1)
192 {
193 G4cout << "G4VDecayChannel::ClearDaughtersName() "
194 << " for " << *parent_name << G4endl;
195 }
196#endif
197 for (G4int index=0; index<numberOfDaughters; ++index)
198 {
199 delete daughters_name[index];
200 }
201 }
202 delete [] daughters_name;
203 daughters_name = nullptr;
204 }
205
206 delete [] G4MT_daughters;
207 delete [] G4MT_daughters_mass;
208 delete [] G4MT_daughters_width;
209 G4MT_daughters_width = nullptr;
210 G4MT_daughters = nullptr;
211 G4MT_daughters_mass = nullptr;
212
214}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout

Referenced by G4DalitzDecayChannel::operator=(), G4KL3DecayChannel::operator=(), G4MuonDecayChannel::operator=(), G4MuonDecayChannelWithSpin::operator=(), G4MuonRadiativeDecayChannelWithSpin::operator=(), G4NeutronBetaDecayChannel::operator=(), G4PionRadiativeDecayChannel::operator=(), G4TauLeptonicDecayChannel::operator=(), operator=(), SetNumberOfDaughters(), and ~G4VDecayChannel().

◆ DecayIt()

◆ DumpInfo()

void G4VDecayChannel::DumpInfo ( )

Definition at line 560 of file G4VDecayChannel.cc.

561{
562 G4cout << " BR: " << rbranch << " [" << kinematics_name << "]";
563 G4cout << " : " ;
564 for (G4int index=0; index<numberOfDaughters; ++index)
565 {
566 if(daughters_name[index] != nullptr)
567 {
568 G4cout << " " << *(daughters_name[index]);
569 }
570 else
571 {
572 G4cout << " not defined ";
573 }
574 }
575 G4cout << G4endl;
576}

Referenced by G4GeneralPhaseSpaceDecay::DecayIt(), G4PhaseSpaceDecayChannel::DecayIt(), and G4KL3DecayChannel::G4KL3DecayChannel().

◆ DynamicalMass()

G4double G4VDecayChannel::DynamicalMass ( G4double  massPDG,
G4double  width,
G4double  maxDev = 1.0 
) const
protected

Definition at line 585 of file G4VDecayChannel.cc.

587{
588 if (width<=0.0) return massPDG;
589 if (maxDev >rangeMass) maxDev = rangeMass;
590 if (maxDev <=-1.*rangeMass) return massPDG; // cannot calculate
591
592 G4double x = G4UniformRand()*(maxDev+rangeMass) - rangeMass;
594 const std::size_t MAX_LOOP=10000;
595 for (std::size_t loop_counter=0; loop_counter <MAX_LOOP; ++loop_counter)
596 {
597 if ( y * (width*width*x*x + massPDG*massPDG*width*width)
598 <= massPDG*massPDG*width*width ) break;
599 x = G4UniformRand()*(maxDev+rangeMass) - rangeMass;
600 y = G4UniformRand();
601 }
602 G4double mass = massPDG + x*width;
603 return mass;
604}
double G4double
Definition: G4Types.hh:83
#define G4UniformRand()
Definition: Randomize.hh:52

◆ GetAngularMomentum()

G4int G4VDecayChannel::GetAngularMomentum ( )

Definition at line 492 of file G4VDecayChannel.cc.

493{
494 // determine angular momentum
495
496 // fill pointers to daughter particles if not yet set
498
499 const G4int PiSpin = G4MT_parent->GetPDGiSpin();
500 const G4int PParity = G4MT_parent->GetPDGiParity();
501 if (2==numberOfDaughters) // up to now we can only handle two particle decays
502 {
503 const G4int D1iSpin = G4MT_daughters[0]->GetPDGiSpin();
504 const G4int D1Parity = G4MT_daughters[0]->GetPDGiParity();
505 const G4int D2iSpin = G4MT_daughters[1]->GetPDGiSpin();
506 const G4int D2Parity = G4MT_daughters[1]->GetPDGiParity();
507 const G4int MiniSpin = std::abs (D1iSpin - D2iSpin);
508 const G4int MaxiSpin = D1iSpin + D2iSpin;
509 const G4int lMax = (PiSpin+D1iSpin+D2iSpin)/2; // l is always int
510 G4int lMin;
511#ifdef G4VERBOSE
512 if (verboseLevel>1)
513 {
514 G4cout << "iSpin: " << PiSpin << " -> " << D1iSpin
515 << " + " << D2iSpin << G4endl;
516 G4cout << "2*jmin, 2*jmax, lmax " << MiniSpin << " " << MaxiSpin
517 << " " << lMax << G4endl;
518 }
519#endif
520 for (G4int j=MiniSpin; j<=MaxiSpin; j+=2) // loop over all possible
521 { // spin couplings
522 lMin = std::abs(PiSpin-j)/2;
523#ifdef G4VERBOSE
524 if (verboseLevel>1)
525 G4cout << "-> checking 2*j=" << j << G4endl;
526#endif
527 for (G4int l=lMin; l<=lMax; ++l)
528 {
529#ifdef G4VERBOSE
530 if (verboseLevel>1)
531 G4cout << " checking l=" << l << G4endl;
532#endif
533 if (l%2==0)
534 {
535 if (PParity == D1Parity*D2Parity) // check parity for this l
536 return l;
537 }
538 else
539 {
540 if (PParity == -1*D1Parity*D2Parity) // check parity for this l
541 return l;
542 }
543 }
544 }
545 }
546 else
547 {
548 G4Exception("G4VDecayChannel::GetAngularMomentum()",
549 "PART111", JustWarning,
550 "Sorry, can't handle 3 particle decays (up to now)");
551 return 0;
552 }
553 G4Exception ("G4VDecayChannel::GetAngularMomentum()",
554 "PART111", JustWarning,
555 "Can't find angular momentum for this decay");
556 return 0;
557}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:59
void CheckAndFillDaughters()

◆ GetBR()

◆ GetDaughter()

G4ParticleDefinition * G4VDecayChannel::GetDaughter ( G4int  anIndex)
inline

Definition at line 201 of file G4VDecayChannel.hh.

202{
203 // pointers to daughter particles are filled, if they are not set yet
205
206 // get the pointer to a daughter particle
207 if ( (anIndex>=0) && (anIndex<numberOfDaughters) )
208 {
209 return G4MT_daughters[anIndex];
210 }
211 else
212 {
213 if (verboseLevel>0)
214 G4cout << "G4VDecayChannel::GetDaughter index out of range "
215 << anIndex << G4endl;
216 return nullptr;
217 }
218}

Referenced by G4IonTable::CreateIon(), G4KineticTrack::Decay(), G4KineticTrack::G4KineticTrack(), G4TextPPReporter::GeneratePropertyTable(), G4NuclearDecay::GetDaughterNucleus(), G4MTRunManagerKernel::SetUpDecayChannels(), and G4TaskRunManagerKernel::SetUpDecayChannels().

◆ GetDaughterMass()

G4double G4VDecayChannel::GetDaughterMass ( G4int  anIndex) const
inline

Definition at line 239 of file G4VDecayChannel.hh.

240{
241 if ( (anIndex>=0) && (anIndex<numberOfDaughters) )
242 {
243 return G4MT_daughters_mass[anIndex];
244 }
245 else
246 {
247 if (verboseLevel>0)
248 {
249 G4cout << "G4VDecayChannel::GetDaughterMass ";
250 G4cout << "index out of range " << anIndex << G4endl;
251 }
252 return 0.0;
253 }
254}

◆ GetDaughterName()

const G4String & G4VDecayChannel::GetDaughterName ( G4int  anIndex) const
inline

Definition at line 221 of file G4VDecayChannel.hh.

222{
223 if ( (anIndex>=0) && (anIndex<numberOfDaughters) )
224 {
225 return *daughters_name[anIndex];
226 }
227 else
228 {
229 if (verboseLevel>0)
230 {
231 G4cout << "G4VDecayChannel::GetDaughterName ";
232 G4cout << "index out of range " << anIndex << G4endl;
233 }
234 return GetNoName();
235 }
236}

Referenced by G4KineticTrack::Decay(), G4Decay::DecayIt(), G4AlphaDecay::DumpNuclearInfo(), G4BetaMinusDecay::DumpNuclearInfo(), G4BetaPlusDecay::DumpNuclearInfo(), G4ECDecay::DumpNuclearInfo(), G4ITDecay::DumpNuclearInfo(), G4NeutronDecay::DumpNuclearInfo(), G4ProtonDecay::DumpNuclearInfo(), and G4TritonDecay::DumpNuclearInfo().

◆ GetKinematicsName()

const G4String & G4VDecayChannel::GetKinematicsName ( ) const
inline

Definition at line 292 of file G4VDecayChannel.hh.

293{
294 return kinematics_name;
295}

Referenced by G4TextPPReporter::GeneratePropertyTable().

◆ GetNumberOfDaughters()

◆ GetParent()

G4ParticleDefinition * G4VDecayChannel::GetParent ( )
inline

Definition at line 257 of file G4VDecayChannel.hh.

258{
259 // the pointer to the parent particle is filled, if it is not set yet
261 // get the pointer to the parent particle
262 return G4MT_parent;
263}

Referenced by G4DecayTable::Insert().

◆ GetParentMass()

G4double G4VDecayChannel::GetParentMass ( ) const
inline

Definition at line 272 of file G4VDecayChannel.hh.

273{
274 return G4MT_parent_mass;
275}
G4double G4MT_parent_mass

◆ GetParentName()

◆ GetPolarization()

const G4ThreeVector & G4VDecayChannel::GetPolarization ( ) const
inline

Definition at line 331 of file G4VDecayChannel.hh.

332{
333 return parent_polarization;
334}

◆ GetRangeMass()

G4double G4VDecayChannel::GetRangeMass ( ) const
inline

Definition at line 316 of file G4VDecayChannel.hh.

317{
318 return rangeMass;
319}

◆ GetVerboseLevel()

◆ IsOKWithParentMass()

G4bool G4VDecayChannel::IsOKWithParentMass ( G4double  parentMass)
virtual

Reimplemented in G4PhaseSpaceDecayChannel.

Definition at line 607 of file G4VDecayChannel.cc.

608{
609 G4double sumOfDaughterMassMin = 0.0;
612 // skip one body decay
613 if (numberOfDaughters==1) return true;
614
615 for (G4int index=0; index<numberOfDaughters; ++index)
616 {
617 sumOfDaughterMassMin +=
619 }
620 return (parentMass >= sumOfDaughterMassMin);
621}

Referenced by G4Decay::DecayIt(), and G4PhaseSpaceDecayChannel::IsOKWithParentMass().

◆ operator!=()

G4bool G4VDecayChannel::operator!= ( const G4VDecayChannel r) const
inline

Definition at line 69 of file G4VDecayChannel.hh.

69{ return (this != &r); }

◆ operator<()

G4bool G4VDecayChannel::operator< ( const G4VDecayChannel right) const
inline

Definition at line 195 of file G4VDecayChannel.hh.

196{
197 return (this->rbranch < right.rbranch);
198}

◆ operator=()

G4VDecayChannel & G4VDecayChannel::operator= ( const G4VDecayChannel right)
protected

Definition at line 130 of file G4VDecayChannel.cc.

131{
132 if (this != &right)
133 {
136 rbranch = right.rbranch;
137 rangeMass = right.rangeMass;
139 // copy parent name
140 delete parent_name;
141 parent_name = new G4String(*right.parent_name);
142
143 // clear daughters_name array
145
146 // recreate array
148 if ( numberOfDaughters >0 )
149 {
151 // copy daughters name
152 for (G4int index=0; index<numberOfDaughters; ++index)
153 {
154 daughters_name[index] = new G4String(*right.daughters_name[index]);
155 }
156 }
157 }
158
159 // particle table
161
164
165 return *this;
166}

◆ operator==()

G4bool G4VDecayChannel::operator== ( const G4VDecayChannel r) const
inline

Definition at line 68 of file G4VDecayChannel.hh.

68{ return (this == &r); }

◆ SetBR()

◆ SetDaughter() [1/2]

◆ SetDaughter() [2/2]

void G4VDecayChannel::SetDaughter ( G4int  anIndex,
const G4String particle_name 
)

Definition at line 234 of file G4VDecayChannel.cc.

235{
236 // check numberOfDaughters is positive
237 if (numberOfDaughters<=0)
238 {
239#ifdef G4VERBOSE
240 if (verboseLevel>0)
241 {
242 G4cout << "G4VDecayChannel::SetDaughter() - "
243 << "Number of daughters is not defined" << G4endl;
244 }
245#endif
246 return;
247 }
248
249 // An analysis of this code, shows that this method is called
250 // only in the constructor of derived classes.
251 // The general idea of this method is probably to support
252 // the possibility to re-define daughters on the fly, however
253 // this design is extremely problematic for MT mode, we thus
254 // require (as practically happens) that the method is called only
255 // at construction, i.e. when G4MT_daughters == 0
256 // moreover this method can be called only after SetNumberOfDaugthers()
257 // has been called (see previous if), in such a case daughters_name != nullptr
258 //
259 if ( daughters_name == nullptr )
260 {
261 G4Exception("G4VDecayChannel::SetDaughter()", "PART112", FatalException,
262 "Trying to add a daughter without specifying number of secondaries!");
263 return;
264 }
265 if ( G4MT_daughters != nullptr )
266 {
267 G4Exception("G4VDecayChannel::SetDaughter()", "PART111", FatalException,
268 "Trying to modify a daughter of a decay channel, \
269 but decay channel already has daughters.");
270 return;
271 }
272
273 // check an index
274 if ( (anIndex<0) || (anIndex>=numberOfDaughters) )
275 {
276#ifdef G4VERBOSE
277 if (verboseLevel>0)
278 {
279 G4cout << "G4VDecayChannel::SetDaughter() - "
280 << "index out of range " << anIndex << G4endl;
281 }
282#endif
283 }
284 else
285 {
286 // fill the name
287 daughters_name[anIndex] = new G4String(particle_name);
288#ifdef G4VERBOSE
289 if (verboseLevel>1)
290 {
291 G4cout << "G4VDecayChannel::SetDaughter[" << anIndex <<"] :";
292 G4cout << daughters_name[anIndex] << ":"
293 << *daughters_name[anIndex]<<G4endl;
294 }
295#endif
296 }
297}
@ FatalException

◆ SetNumberOfDaughters()

◆ SetParent() [1/2]

◆ SetParent() [2/2]

void G4VDecayChannel::SetParent ( const G4String particle_name)
inline

Definition at line 278 of file G4VDecayChannel.hh.

279{
280 if (parent_name != nullptr) delete parent_name;
281 parent_name = new G4String(particle_name);
282 G4MT_parent = nullptr;
283}

◆ SetPolarization()

void G4VDecayChannel::SetPolarization ( const G4ThreeVector polar)
inline

Definition at line 325 of file G4VDecayChannel.hh.

326{
327 parent_polarization = polar;
328}

Referenced by G4DecayWithSpin::AtRestDoIt(), and G4DecayWithSpin::PostStepDoIt().

◆ SetRangeMass()

void G4VDecayChannel::SetRangeMass ( G4double  val)
inline

Definition at line 322 of file G4VDecayChannel.hh.

322{ if(val>=0.) rangeMass=val; }

◆ SetVerboseLevel()

void G4VDecayChannel::SetVerboseLevel ( G4int  value)
inline

Definition at line 304 of file G4VDecayChannel.hh.

305{
306 verboseLevel = value;
307}

Referenced by G4Decay::DecayIt().

Member Data Documentation

◆ daughters_name

◆ daughtersMutex

G4Mutex G4VDecayChannel::daughtersMutex
protected

◆ G4MT_daughters

◆ G4MT_daughters_mass

G4double* G4VDecayChannel::G4MT_daughters_mass = nullptr
protected

◆ G4MT_daughters_width

G4double* G4VDecayChannel::G4MT_daughters_width = nullptr
protected

Definition at line 176 of file G4VDecayChannel.hh.

Referenced by ClearDaughtersName(), IsOKWithParentMass(), and ~G4VDecayChannel().

◆ G4MT_parent

◆ G4MT_parent_mass

G4double G4VDecayChannel::G4MT_parent_mass = 0.0
protected

Definition at line 174 of file G4VDecayChannel.hh.

Referenced by G4PhaseSpaceDecayChannel::DecayIt(), and GetParentMass().

◆ kinematics_name

◆ noName

const G4String G4VDecayChannel::noName = " "
staticprotected

Definition at line 170 of file G4VDecayChannel.hh.

◆ numberOfDaughters

◆ parent_name

◆ parent_polarization

◆ parentMutex

G4Mutex G4VDecayChannel::parentMutex
protected

◆ particletable

G4ParticleTable* G4VDecayChannel::particletable = nullptr
protected

Definition at line 167 of file G4VDecayChannel.hh.

Referenced by G4VDecayChannel(), and operator=().

◆ rangeMass

G4double G4VDecayChannel::rangeMass = 2.5
protected

◆ rbranch

◆ verboseLevel


The documentation for this class was generated from the following files: