Geant4 10.7.0
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="")
 
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 = "" 
)

Definition at line 59 of file G4VDecayChannel.cc.

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

◆ ~G4VDecayChannel()

G4VDecayChannel::~G4VDecayChannel ( )
virtual

Definition at line 167 of file G4VDecayChannel.cc.

168{
170 delete parent_name;
171 parent_name = nullptr;
172 delete [] G4MT_daughters_mass;
173 G4MT_daughters_mass = nullptr;
174 delete [] G4MT_daughters_width;
175 G4MT_daughters_width = nullptr;
178}
#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 94 of file G4VDecayChannel.cc.

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

Member Function Documentation

◆ CheckAndFillDaughters()

◆ CheckAndFillParent()

◆ ClearDaughtersName()

void G4VDecayChannel::ClearDaughtersName ( )
protected

Definition at line 181 of file G4VDecayChannel.cc.

182{
184 if ( daughters_name != nullptr)
185 {
186 if (numberOfDaughters>0)
187 {
188#ifdef G4VERBOSE
189 if (verboseLevel>1)
190 {
191 G4cout << "G4VDecayChannel::ClearDaughtersName() "
192 << " for " << *parent_name << G4endl;
193 }
194#endif
195 for (G4int index=0; index<numberOfDaughters; ++index)
196 {
197 delete daughters_name[index];
198 }
199 }
200 delete [] daughters_name;
201 daughters_name = nullptr;
202 }
203
204 delete [] G4MT_daughters;
205 delete [] G4MT_daughters_mass;
206 delete [] G4MT_daughters_width;
207 G4MT_daughters_width = nullptr;
208 G4MT_daughters = nullptr;
209 G4MT_daughters_mass = nullptr;
210
212}
#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 558 of file G4VDecayChannel.cc.

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

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 583 of file G4VDecayChannel.cc.

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

◆ GetAngularMomentum()

G4int G4VDecayChannel::GetAngularMomentum ( )

Definition at line 490 of file G4VDecayChannel.cc.

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

◆ GetBR()

◆ GetDaughter()

G4ParticleDefinition * G4VDecayChannel::GetDaughter ( G4int  anIndex)
inline

Definition at line 200 of file G4VDecayChannel.hh.

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

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 238 of file G4VDecayChannel.hh.

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

◆ GetDaughterName()

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

Definition at line 220 of file G4VDecayChannel.hh.

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

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 291 of file G4VDecayChannel.hh.

292{
293 return kinematics_name;
294}

Referenced by G4TextPPReporter::GeneratePropertyTable().

◆ GetNumberOfDaughters()

◆ GetParent()

G4ParticleDefinition * G4VDecayChannel::GetParent ( )
inline

Definition at line 256 of file G4VDecayChannel.hh.

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

Referenced by G4DecayTable::Insert().

◆ GetParentMass()

G4double G4VDecayChannel::GetParentMass ( ) const
inline

Definition at line 271 of file G4VDecayChannel.hh.

272{
273 return G4MT_parent_mass;
274}
G4double G4MT_parent_mass

◆ GetParentName()

◆ GetPolarization()

const G4ThreeVector & G4VDecayChannel::GetPolarization ( ) const
inline

Definition at line 330 of file G4VDecayChannel.hh.

331{
332 return parent_polarization;
333}

◆ GetRangeMass()

G4double G4VDecayChannel::GetRangeMass ( ) const
inline

Definition at line 315 of file G4VDecayChannel.hh.

316{
317 return rangeMass;
318}

◆ GetVerboseLevel()

◆ IsOKWithParentMass()

G4bool G4VDecayChannel::IsOKWithParentMass ( G4double  parentMass)
virtual

Reimplemented in G4PhaseSpaceDecayChannel.

Definition at line 605 of file G4VDecayChannel.cc.

606{
607 G4double sumOfDaughterMassMin = 0.0;
610 // skip one body decay
611 if (numberOfDaughters==1) return true;
612
613 for (G4int index=0; index<numberOfDaughters; ++index)
614 {
615 sumOfDaughterMassMin +=
617 }
618 return (parentMass >= sumOfDaughterMassMin);
619}

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

◆ operator!=()

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

Definition at line 68 of file G4VDecayChannel.hh.

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

◆ operator<()

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

Definition at line 194 of file G4VDecayChannel.hh.

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

◆ operator=()

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

Definition at line 128 of file G4VDecayChannel.cc.

129{
130 if (this != &right)
131 {
134 rbranch = right.rbranch;
135 rangeMass = right.rangeMass;
137 // copy parent name
138 delete parent_name;
139 parent_name = new G4String(*right.parent_name);
140
141 // clear daughters_name array
143
144 // recreate array
146 if ( numberOfDaughters >0 )
147 {
149 // copy daughters name
150 for (G4int index=0; index<numberOfDaughters; ++index)
151 {
152 daughters_name[index] = new G4String(*right.daughters_name[index]);
153 }
154 }
155 }
156
157 // particle table
159
162
163 return *this;
164}

◆ operator==()

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

Definition at line 67 of file G4VDecayChannel.hh.

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

◆ SetBR()

◆ SetDaughter() [1/2]

◆ SetDaughter() [2/2]

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

Definition at line 232 of file G4VDecayChannel.cc.

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

◆ SetNumberOfDaughters()

◆ SetParent() [1/2]

◆ SetParent() [2/2]

void G4VDecayChannel::SetParent ( const G4String particle_name)
inline

Definition at line 277 of file G4VDecayChannel.hh.

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

◆ SetPolarization()

void G4VDecayChannel::SetPolarization ( const G4ThreeVector polar)
inline

Definition at line 324 of file G4VDecayChannel.hh.

325{
326 parent_polarization = polar;
327}

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

◆ SetRangeMass()

void G4VDecayChannel::SetRangeMass ( G4double  val)
inline

Definition at line 321 of file G4VDecayChannel.hh.

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

◆ SetVerboseLevel()

void G4VDecayChannel::SetVerboseLevel ( G4int  value)
inline

Definition at line 303 of file G4VDecayChannel.hh.

304{
305 verboseLevel = value;
306}

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 175 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 173 of file G4VDecayChannel.hh.

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

◆ kinematics_name

◆ noName

const G4String G4VDecayChannel::noName = " "
staticprotected

Definition at line 169 of file G4VDecayChannel.hh.

◆ numberOfDaughters

◆ parent_name

◆ parent_polarization

◆ parentMutex

G4Mutex G4VDecayChannel::parentMutex
protected

◆ particletable

G4ParticleTable* G4VDecayChannel::particletable = nullptr
protected

Definition at line 166 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: