Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4KineticTrack Class Reference

#include <G4KineticTrack.hh>

+ Inheritance diagram for G4KineticTrack:

Public Types

enum  CascadeState {
  undefined , outside , going_in , inside ,
  going_out , gone_out , captured , miss_nucleus
}
 

Public Member Functions

 G4KineticTrack ()
 
 G4KineticTrack (const G4KineticTrack &right)
 
 G4KineticTrack (const G4ParticleDefinition *aDefinition, G4double aFormationTime, const G4ThreeVector &aPosition, const G4LorentzVector &a4Momentum)
 
 G4KineticTrack (G4Nucleon *nucleon, const G4ThreeVector &aPosition, const G4LorentzVector &a4Momentum)
 
 ~G4KineticTrack ()
 
G4KineticTrackoperator= (const G4KineticTrack &right)
 
G4bool operator== (const G4KineticTrack &right) const
 
G4bool operator!= (const G4KineticTrack &right) const
 
const G4ParticleDefinitionGetDefinition () const
 
void SetDefinition (const G4ParticleDefinition *aDefinition)
 
G4double GetFormationTime () const
 
void SetFormationTime (G4double aFormationTime)
 
const G4ThreeVectorGetPosition () const
 
void SetPosition (const G4ThreeVector aPosition)
 
const G4LorentzVectorGet4Momentum () const
 
void Set4Momentum (const G4LorentzVector &a4Momentum)
 
void Update4Momentum (G4double aEnergy)
 
void Update4Momentum (const G4ThreeVector &aMomentum)
 
void SetTrackingMomentum (const G4LorentzVector &a4Momentum)
 
void UpdateTrackingMomentum (G4double aEnergy)
 
void UpdateTrackingMomentum (const G4ThreeVector &aMomentum)
 
const G4LorentzVectorGetTrackingMomentum () const
 
G4double SampleResidualLifetime ()
 
void Hit ()
 
void SetNucleon (G4Nucleon *aN)
 
G4bool IsParticipant () const
 
G4KineticTrackVectorDecay ()
 
G4doubleGetActualWidth () const
 
G4double GetActualMass () const
 
G4int GetnChannels () const
 
CascadeState SetState (const CascadeState new_state)
 
CascadeState GetState () const
 
void SetProjectilePotential (const G4double aPotential)
 
G4double GetProjectilePotential () const
 
G4double BrWig (const G4double Gamma, const G4double rmass, const G4double mass) const
 
- Public Member Functions inherited from G4VKineticNucleon
 G4VKineticNucleon ()
 
 G4VKineticNucleon (const G4VKineticNucleon &right)
 
virtual ~G4VKineticNucleon ()
 
const G4VKineticNucleonoperator= (const G4VKineticNucleon &right)
 
G4bool operator== (const G4VKineticNucleon &right) const
 
G4bool operator!= (const G4VKineticNucleon &right) const
 
virtual G4KineticTrackVectorDecay ()
 
virtual const G4LorentzVectorGet4Momentum () const =0
 
virtual const G4ParticleDefinitionGetDefinition () const =0
 
virtual const G4ThreeVectorGetPosition () const =0
 

Detailed Description

Definition at line 56 of file G4KineticTrack.hh.

Member Enumeration Documentation

◆ CascadeState

Enumerator
undefined 
outside 
going_in 
inside 
going_out 
gone_out 
captured 
miss_nucleus 

Definition at line 118 of file G4KineticTrack.hh.

Constructor & Destructor Documentation

◆ G4KineticTrack() [1/4]

G4KineticTrack::G4KineticTrack ( )

Definition at line 67 of file G4KineticTrack.cc.

67 :
68 theDefinition(0),
69 theFormationTime(0),
70 thePosition(0),
71 the4Momentum(0),
72 theFermi3Momentum(0),
73 theTotal4Momentum(0),
74 theNucleon(0),
75 nChannels(0),
76 theActualMass(0),
77 theActualWidth(0),
78 theDaughterMass(0),
79 theDaughterWidth(0),
80 theStateToNucleus(undefined),
81 theProjectilePotential(0)
82{
83////////////////
84// DEBUG //
85////////////////
86
87/*
88 G4cerr << G4endl << G4endl << G4endl;
89 G4cerr << " G4KineticTrack default constructor invoked! \n";
90 G4cerr << " =========================================== \n" << G4endl;
91*/
92}

◆ G4KineticTrack() [2/4]

G4KineticTrack::G4KineticTrack ( const G4KineticTrack right)

Definition at line 100 of file G4KineticTrack.cc.

101{
102 theDefinition = right.GetDefinition();
103 theFormationTime = right.GetFormationTime();
104 thePosition = right.GetPosition();
105 the4Momentum = right.GetTrackingMomentum();
106 theFermi3Momentum = right.theFermi3Momentum;
107 theTotal4Momentum = right.theTotal4Momentum;
108 theNucleon=right.theNucleon;
109 nChannels = right.GetnChannels();
110 theActualMass = right.GetActualMass();
111 theActualWidth = new G4double[nChannels];
112 for (G4int i = 0; i < nChannels; i++)
113 {
114 theActualWidth[i] = right.theActualWidth[i];
115 }
116 theDaughterMass = 0;
117 theDaughterWidth = 0;
118 theStateToNucleus=right.theStateToNucleus;
119 theProjectilePotential=right.theProjectilePotential;
120
121////////////////
122// DEBUG //
123////////////////
124
125/*
126 G4cerr << G4endl << G4endl << G4endl;
127 G4cerr << " G4KineticTrack copy constructor invoked! \n";
128 G4cerr << " ======================================== \n" <<G4endl;
129*/
130}
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
G4double GetFormationTime() const
G4int GetnChannels() const
const G4ThreeVector & GetPosition() const
const G4ParticleDefinition * GetDefinition() const
const G4LorentzVector & GetTrackingMomentum() const
G4double GetActualMass() const

◆ G4KineticTrack() [3/4]

G4KineticTrack::G4KineticTrack ( const G4ParticleDefinition aDefinition,
G4double  aFormationTime,
const G4ThreeVector aPosition,
const G4LorentzVector a4Momentum 
)

Definition at line 137 of file G4KineticTrack.cc.

140 :
141 theDefinition(aDefinition),
142 theFormationTime(aFormationTime),
143 thePosition(aPosition),
144 the4Momentum(a4Momentum),
145 theFermi3Momentum(0),
146 theTotal4Momentum(a4Momentum),
147 theNucleon(0),
148 theStateToNucleus(undefined),
149 theProjectilePotential(0)
150{
151 if(G4KaonZero::KaonZero() == theDefinition ||
152 G4AntiKaonZero::AntiKaonZero() == theDefinition)
153 {
154 if(G4UniformRand()<0.5)
155 {
156 theDefinition = G4KaonZeroShort::KaonZeroShort();
157 }
158 else
159 {
160 theDefinition = G4KaonZeroLong::KaonZeroLong();
161 }
162 }
163
164//
165// Get the number of decay channels
166//
167
168 G4DecayTable* theDecayTable = theDefinition->GetDecayTable();
169 if (theDecayTable != 0)
170 {
171 nChannels = theDecayTable->entries();
172
173 }
174 else
175 {
176 nChannels = 0;
177 }
178
179//
180// Get the actual mass value
181//
182
183 theActualMass = GetActualMass();
184
185//
186// Create an array to Store the actual partial widths
187// of the decay channels
188//
189
190 theDaughterMass = 0;
191 theDaughterWidth = 0;
192 theActualWidth = 0;
193 G4bool * theDaughterIsShortLived = 0;
194
195 if(nChannels!=0) theActualWidth = new G4double[nChannels];
196
197 // cout << " ****CONSTR*** ActualMass ******* " << theActualMass << G4endl;
198 G4int index;
199 for (index = nChannels - 1; index >= 0; --index)
200 {
201 G4VDecayChannel* theChannel = theDecayTable->GetDecayChannel(index);
202 G4int nDaughters = theChannel->GetNumberOfDaughters();
203 G4double theMotherWidth;
204 if (nDaughters == 2 || nDaughters == 3)
205 {
206 G4double thePoleMass = theDefinition->GetPDGMass();
207 theMotherWidth = theDefinition->GetPDGWidth();
208 G4double thePoleWidth = theChannel->GetBR()*theMotherWidth;
209 const G4ParticleDefinition* aDaughter;
210 theDaughterMass = new G4double[nDaughters];
211 theDaughterWidth = new G4double[nDaughters];
212 theDaughterIsShortLived = new G4bool[nDaughters];
213 for (G4int n = 0; n < nDaughters; ++n)
214 {
215 aDaughter = theChannel->GetDaughter(n);
216 theDaughterMass[n] = aDaughter->GetPDGMass();
217 theDaughterWidth[n] = aDaughter->GetPDGWidth();
218 theDaughterIsShortLived[n] = aDaughter->IsShortLived();
219 }
220
221//
222// Check whether both the decay products are stable
223//
224
225 G4double theActualMom = 0.0;
226 G4double thePoleMom = 0.0;
227 G4SampleResonance aSampler;
228 if (nDaughters==2)
229 {
230 if ( !theDaughterIsShortLived[0] && !theDaughterIsShortLived[1] )
231 {
232
233 // G4cout << G4endl << "Both the " << nDaughters <<
234 // " decay products are stable!";
235 // cout << " LB: Both decay products STABLE !" << G4endl;
236 // cout << " parent: " << theChannel->GetParentName() << G4endl;
237 // cout << " particle1: " << theChannel->GetDaughterName(0) << G4endl;
238 // cout << " particle2: " << theChannel->GetDaughterName(1) << G4endl;
239
240 theActualMom = EvaluateCMMomentum(theActualMass,
241 theDaughterMass);
242 thePoleMom = EvaluateCMMomentum(thePoleMass,
243 theDaughterMass);
244 // cout << G4endl;
245 // cout << " LB: ActualMass/DaughterMass " << theActualMass << " " << theDaughterMass << G4endl;
246 // cout << " LB: ActualMom " << theActualMom << G4endl;
247 // cout << " LB: PoleMom " << thePoleMom << G4endl;
248 // cout << G4endl;
249 }
250 else if ( !theDaughterIsShortLived[0] && theDaughterIsShortLived[1] )
251 {
252
253 // G4cout << G4endl << "Only the first of the " << nDaughters <<" decay products is stable!";
254 // cout << " LB: only the first decay product is STABLE !" << G4endl;
255 // cout << " parent: " << theChannel->GetParentName() << G4endl;
256 // cout << " particle1: " << theChannel->GetDaughterName(0) << G4endl;
257 // cout << " particle2: " << theChannel->GetDaughterName(1) << G4endl;
258
259// global variable definition
260 G4double lowerLimit = aSampler.GetMinimumMass(theChannel->GetDaughter(1));
261 theActualMom = IntegrateCMMomentum(lowerLimit);
262 thePoleMom = IntegrateCMMomentum(lowerLimit, thePoleMass);
263 // cout << " LB Parent Mass = " << G4KineticTrack_Gmass << G4endl;
264 // cout << " LB Actual Mass = " << theActualMass << G4endl;
265 // cout << " LB Daughter1 Mass = " << G4KineticTrack_Gmass1 << G4endl;
266 // cout << " LB Daughter2 Mass = " << G4KineticTrack_Gmass2 << G4endl;
267 // cout << " The Actual Momentum = " << theActualMom << G4endl;
268 // cout << " The Pole Momentum = " << thePoleMom << G4endl;
269 // cout << G4endl;
270
271 }
272 else if ( theDaughterIsShortLived[0] && !theDaughterIsShortLived[1] )
273 {
274
275 // G4cout << G4endl << "Only the second of the " << nDaughters <<
276 // " decay products is stable!";
277 // cout << " LB: only the second decay product is STABLE !" << G4endl;
278 // cout << " parent: " << theChannel->GetParentName() << G4endl;
279 // cout << " particle1: " << theChannel->GetDaughterName(0) << G4endl;
280 // cout << " particle2: " << theChannel->GetDaughterName(1) << G4endl;
281
282//
283// Swap the content of the theDaughterMass and theDaughterWidth arrays!!!
284//
285
286 G4SwapObj(theDaughterMass, theDaughterMass + 1);
287 G4SwapObj(theDaughterWidth, theDaughterWidth + 1);
288
289// global variable definition
290 G4double lowerLimit = aSampler.GetMinimumMass(theChannel->GetDaughter(0));
291 theActualMom = IntegrateCMMomentum(lowerLimit);
292 thePoleMom = IntegrateCMMomentum(lowerLimit, thePoleMass);
293 // cout << " LB Parent Mass = " << G4KineticTrack_Gmass << G4endl;
294 // cout << " LB Actual Mass = " << theActualMass << G4endl;
295 // cout << " LB Daughter1 Mass = " << G4KineticTrack_Gmass1 << G4endl;
296 // cout << " LB Daughter2 Mass = " << G4KineticTrack_Gmass2 << G4endl;
297 // cout << " The Actual Momentum = " << theActualMom << G4endl;
298 // cout << " The Pole Momentum = " << thePoleMom << G4endl;
299 // cout << G4endl;
300
301 }
302 else if ( theDaughterIsShortLived[0] && theDaughterIsShortLived[1] )
303 {
304
305// G4cout << G4endl << "Both the " << nDaughters <<
306// " decay products are resonances!";
307 // cout << " LB: both decay products are RESONANCES !" << G4endl;
308 // cout << " parent: " << theChannel->GetParentName() << G4endl;
309 // cout << " particle1: " << theChannel->GetDaughterName(0) << G4endl;
310 // cout << " particle2: " << theChannel->GetDaughterName(1) << G4endl;
311
312// global variable definition
313 G4KineticTrack_Gmass = theActualMass;
314 theActualMom = IntegrateCMMomentum2();
315 G4KineticTrack_Gmass = thePoleMass;
316 thePoleMom = IntegrateCMMomentum2();
317 // cout << " LB Parent Mass = " << G4KineticTrack_Gmass << G4endl;
318 // cout << " LB Daughter1 Mass = " << G4KineticTrack_Gmass1 << G4endl;
319 // cout << " LB Daughter2 Mass = " << G4KineticTrack_Gmass2 << G4endl;
320 // cout << " The Actual Momentum = " << theActualMom << G4endl;
321 // cout << " The Pole Momentum = " << thePoleMom << G4endl;
322 // cout << G4endl;
323
324 }
325 }
326 else // (nDaughter==3)
327 {
328
329 G4int nShortLived = 0;
330 if ( theDaughterIsShortLived[0] )
331 {
332 ++nShortLived;
333 }
334 if ( theDaughterIsShortLived[1] )
335 {
336 ++nShortLived;
337 G4SwapObj(theDaughterMass, theDaughterMass + 1);
338 G4SwapObj(theDaughterWidth, theDaughterWidth + 1);
339 }
340 if ( theDaughterIsShortLived[2] )
341 {
342 ++nShortLived;
343 G4SwapObj(theDaughterMass, theDaughterMass + 2);
344 G4SwapObj(theDaughterWidth, theDaughterWidth + 2);
345 }
346 if ( nShortLived == 0 )
347 {
348 theDaughterMass[1]+=theDaughterMass[2];
349 theActualMom = EvaluateCMMomentum(theActualMass,
350 theDaughterMass);
351 thePoleMom = EvaluateCMMomentum(thePoleMass,
352 theDaughterMass);
353 }
354// else if ( nShortLived == 1 )
355 else if ( nShortLived >= 1 )
356 {
357 // need the shortlived particle in slot 1! (very bad style...)
358 G4SwapObj(theDaughterMass, theDaughterMass + 1);
359 G4SwapObj(theDaughterWidth, theDaughterWidth + 1);
360 theDaughterMass[0] += theDaughterMass[2];
361 theActualMom = IntegrateCMMomentum(0.0);
362 thePoleMom = IntegrateCMMomentum(0.0, thePoleMass);
363 }
364// else
365// {
366// throw G4HadronicException(__FILE__, __LINE__, ("can't handle more than one shortlived in 3 particle output channel");
367// }
368
369 }
370
371 //if(nDaughters<3) theChannel->GetAngularMomentum();
372 G4double theMassRatio = thePoleMass / theActualMass;
373 G4double theMomRatio = theActualMom / thePoleMom;
374 // VI 11.06.2015: for l=0 one not need use pow
375 //G4double l=0;
376 //theActualWidth[index] = thePoleWidth * theMassRatio *
377 // std::pow(theMomRatio, (2 * l + 1)) *
378 // (1.2 / (1+ 0.2*std::pow(theMomRatio, (2 * l))));
379 theActualWidth[index] = thePoleWidth * theMassRatio *
380 theMomRatio;
381 delete [] theDaughterMass;
382 theDaughterMass = 0;
383 delete [] theDaughterWidth;
384 theDaughterWidth = 0;
385 delete [] theDaughterIsShortLived;
386 theDaughterIsShortLived = 0;
387 }
388
389 else // nDaughter = 1 ( e.g. K0 decays 50% to Kshort, 50% Klong
390 {
391 theMotherWidth = theDefinition->GetPDGWidth();
392 theActualWidth[index] = theChannel->GetBR()*theMotherWidth;
393 }
394 }
395
396////////////////
397// DEBUG //
398////////////////
399
400// for (G4int y = nChannels - 1; y >= 0; --y)
401// {
402// G4cout << G4endl << theActualWidth[y];
403// }
404// G4cout << G4endl << G4endl << G4endl;
405
406 /*
407 G4cerr << G4endl << G4endl << G4endl;
408 G4cerr << " G4KineticTrack by argument constructor invoked! \n";
409 G4cerr << " =============================================== \n" << G4endl;
410 */
411
412}
bool G4bool
Definition: G4Types.hh:86
#define G4UniformRand()
Definition: Randomize.hh:52
static G4AntiKaonZero * AntiKaonZero()
G4VDecayChannel * GetDecayChannel(G4int index) const
G4int entries() const
static G4KaonZeroLong * KaonZeroLong()
static G4KaonZeroShort * KaonZeroShort()
static G4KaonZero * KaonZero()
Definition: G4KaonZero.cc:103
G4double GetPDGWidth() const
G4DecayTable * GetDecayTable() const
G4double GetMinimumMass(const G4ParticleDefinition *p) const
G4double GetBR() const
G4int GetNumberOfDaughters() const
G4ParticleDefinition * GetDaughter(G4int anIndex)
void G4SwapObj(T *a, T *b)
Definition: templates.hh:112

◆ G4KineticTrack() [4/4]

G4KineticTrack::G4KineticTrack ( G4Nucleon nucleon,
const G4ThreeVector aPosition,
const G4LorentzVector a4Momentum 
)

Definition at line 414 of file G4KineticTrack.cc.

417 : theDefinition(nucleon->GetDefinition()),
418 theFormationTime(0),
419 thePosition(aPosition),
420 the4Momentum(a4Momentum),
421 theFermi3Momentum(nucleon->GetMomentum()),
422 theNucleon(nucleon),
423 nChannels(0),
424 theActualMass(nucleon->GetDefinition()->GetPDGMass()),
425 theActualWidth(0),
426 theDaughterMass(0),
427 theDaughterWidth(0),
428 theStateToNucleus(undefined),
429 theProjectilePotential(0)
430{
431 theFermi3Momentum.setE(0);
432 Set4Momentum(a4Momentum);
433}
void Set4Momentum(const G4LorentzVector &a4Momentum)
G4bool nucleon(G4int ityp)

◆ ~G4KineticTrack()

G4KineticTrack::~G4KineticTrack ( )

Definition at line 436 of file G4KineticTrack.cc.

437{
438 if (theActualWidth != 0) delete [] theActualWidth;
439 if (theDaughterMass != 0) delete [] theDaughterMass;
440 if (theDaughterWidth != 0) delete [] theDaughterWidth;
441}

Member Function Documentation

◆ BrWig()

G4double G4KineticTrack::BrWig ( const G4double  Gamma,
const G4double  rmass,
const G4double  mass 
) const
inline

Definition at line 378 of file G4KineticTrack.hh.

379{
380 G4double Norm = CLHEP::twopi;
381 return (Gamma/((mass-rmass)*(mass-rmass)+Gamma*Gamma/4.))/Norm;
382}

◆ Decay()

G4KineticTrackVector * G4KineticTrack::Decay ( )
virtual

Reimplemented from G4VKineticNucleon.

Definition at line 481 of file G4KineticTrack.cc.

482{
483//
484// Select a possible decay channel
485//
486/*
487 G4int index1;
488 for (index1 = nChannels - 1; index1 >= 0; --index1)
489 G4cout << "DECAY Actual Width IND/ActualW " << index1 << " " << theActualWidth[index1] << G4endl;
490 G4cout << "DECAY Actual Mass " << theActualMass << G4endl;
491*/
492 const G4ParticleDefinition* thisDefinition = this->GetDefinition();
493 if(!thisDefinition)
494 {
495 G4cerr << "Error condition encountered in G4KineticTrack::Decay()"<<G4endl;
496 G4cerr << " track has no particle definition associated."<<G4endl;
497 return 0;
498 }
499 G4DecayTable* theDecayTable = thisDefinition->GetDecayTable();
500 if(!theDecayTable)
501 {
502 G4cerr << "Error condition encountered in G4KineticTrack::Decay()"<<G4endl;
503 G4cerr << " particle definition has no decay table associated."<<G4endl;
504 G4cerr << " particle was "<<thisDefinition->GetParticleName()<<G4endl;
505 return 0;
506 }
507
508 G4int chargeBalance = G4lrint(theDefinition->GetPDGCharge() );
509 G4int baryonBalance = G4lrint(theDefinition->GetBaryonNumber() );
510 G4LorentzVector energyMomentumBalance(Get4Momentum());
511 G4double theTotalActualWidth = this->EvaluateTotalActualWidth();
512 if (theTotalActualWidth !=0)
513 {
514
515 //AR-16Aug2016 : Repeat the sampling of the decay channel until is
516 // kinematically above threshold or a max number of attempts is reached
517 G4bool isChannelBelowThreshold = true;
518 const G4int maxNumberOfLoops = 10000;
519 G4int loopCounter = 0;
520
521 G4int chosench;
522 G4String theParentName;
523 G4double theParentMass;
524 G4double theBR;
525 G4int theNumberOfDaughters;
526 G4String theDaughtersName1;
527 G4String theDaughtersName2;
528 G4String theDaughtersName3;
529 G4String theDaughtersName4;
530 G4double masses[4]={0.,0.,0.,0.};
531
532 do {
533
534 G4double theSumActualWidth = 0.0;
535 G4double* theCumActualWidth = new G4double[nChannels]{};
536 for (G4int index = nChannels - 1; index >= 0; --index)
537 {
538 theSumActualWidth += theActualWidth[index];
539 theCumActualWidth[index] = theSumActualWidth;
540 // cout << "DECAY Cum. Width " << index << " " << theCumActualWidth[index] << G4endl;
541 }
542 // cout << "DECAY Total Width " << theSumActualWidth << G4endl;
543 // cout << "DECAY Total Width " << theTotalActualWidth << G4endl;
544 G4double r = theTotalActualWidth * G4UniformRand();
545 G4VDecayChannel* theDecayChannel(0);
546 chosench=-1;
547 for (G4int index = nChannels - 1; index >= 0; --index)
548 {
549 if (r < theCumActualWidth[index])
550 {
551 theDecayChannel = theDecayTable->GetDecayChannel(index);
552 // cout << "DECAY SELECTED CHANNEL" << index << G4endl;
553 chosench=index;
554 break;
555 }
556 }
557
558 delete [] theCumActualWidth;
559
560 if(!theDecayChannel)
561 {
562 G4cerr << "Error condition encountered in G4KineticTrack::Decay()"<<G4endl;
563 G4cerr << " decay channel has 0x0 channel associated."<<G4endl;
564 G4cerr << " particle was "<<thisDefinition->GetParticleName()<<G4endl;
565 G4cerr << " channel index "<< chosench << "of "<<nChannels<<"channels"<<G4endl;
566 return 0;
567 }
568 theParentName = theDecayChannel->GetParentName();
569 theParentMass = this->GetActualMass();
570 theBR = theActualWidth[chosench];
571 // cout << "**BR*** DECAYNEW " << theBR << G4endl;
572 theNumberOfDaughters = theDecayChannel->GetNumberOfDaughters();
573 theDaughtersName1 = "";
574 theDaughtersName2 = "";
575 theDaughtersName3 = "";
576 theDaughtersName4 = "";
577
578 for (G4int i=0; i < 4; ++i) masses[i]=0.;
579 G4int shortlivedDaughters[4];
580 G4int numberOfShortliveds(0);
581 G4double SumLongLivedMass(0);
582 for (G4int aD=0; aD < theNumberOfDaughters ; ++aD)
583 {
584 const G4ParticleDefinition* aDaughter = theDecayChannel->GetDaughter(aD);
585 masses[aD] = aDaughter->GetPDGMass();
586 if ( aDaughter->IsShortLived() )
587 {
588 shortlivedDaughters[numberOfShortliveds]=aD;
589 ++numberOfShortliveds;
590 } else {
591 SumLongLivedMass += aDaughter->GetPDGMass();
592 }
593
594 }
595 switch (theNumberOfDaughters)
596 {
597 case 0:
598 break;
599 case 1:
600 theDaughtersName1 = theDecayChannel->GetDaughterName(0);
601 theDaughtersName2 = "";
602 theDaughtersName3 = "";
603 theDaughtersName4 = "";
604 break;
605 case 2:
606 theDaughtersName1 = theDecayChannel->GetDaughterName(0);
607 theDaughtersName2 = theDecayChannel->GetDaughterName(1);
608 theDaughtersName3 = "";
609 theDaughtersName4 = "";
610 if ( numberOfShortliveds == 1)
611 { G4SampleResonance aSampler;
612 G4double massmax=theParentMass - SumLongLivedMass;
613 const G4ParticleDefinition * aDaughter=theDecayChannel->GetDaughter(shortlivedDaughters[0]);
614 masses[shortlivedDaughters[0]]= aSampler.SampleMass(aDaughter,massmax);
615 } else if ( numberOfShortliveds == 2) {
616 // choose masses one after the other, start with randomly choosen
617 G4int zero= (G4UniformRand() > 0.5) ? 0 : 1;
618 G4int one = 1-zero;
619 G4SampleResonance aSampler;
620 G4double massmax=theParentMass - aSampler.GetMinimumMass(theDecayChannel->GetDaughter(shortlivedDaughters[one]));
621 const G4ParticleDefinition * aDaughter=theDecayChannel->GetDaughter(shortlivedDaughters[zero]);
622 masses[shortlivedDaughters[zero]]=aSampler.SampleMass(aDaughter,massmax);
623 massmax=theParentMass - masses[shortlivedDaughters[zero]];
624 aDaughter=theDecayChannel->GetDaughter(shortlivedDaughters[one]);
625 masses[shortlivedDaughters[one]]=aSampler.SampleMass(aDaughter,massmax);
626 }
627 break;
628 case 3:
629 theDaughtersName1 = theDecayChannel->GetDaughterName(0);
630 theDaughtersName2 = theDecayChannel->GetDaughterName(1);
631 theDaughtersName3 = theDecayChannel->GetDaughterName(2);
632 theDaughtersName4 = "";
633 if ( numberOfShortliveds == 1)
634 { G4SampleResonance aSampler;
635 G4double massmax=theParentMass - SumLongLivedMass;
636 const G4ParticleDefinition * aDaughter=theDecayChannel->GetDaughter(shortlivedDaughters[0]);
637 masses[shortlivedDaughters[0]]= aSampler.SampleMass(aDaughter,massmax);
638 }
639 break;
640 default:
641 theDaughtersName1 = theDecayChannel->GetDaughterName(0);
642 theDaughtersName2 = theDecayChannel->GetDaughterName(1);
643 theDaughtersName3 = theDecayChannel->GetDaughterName(2);
644 theDaughtersName4 = theDecayChannel->GetDaughterName(3);
645 if ( numberOfShortliveds == 1)
646 { G4SampleResonance aSampler;
647 G4double massmax=theParentMass - SumLongLivedMass;
648 const G4ParticleDefinition * aDaughter=theDecayChannel->GetDaughter(shortlivedDaughters[0]);
649 masses[shortlivedDaughters[0]]= aSampler.SampleMass(aDaughter,massmax);
650 }
651 if ( theNumberOfDaughters > 4 ) {
653 ed << "More than 4 decay daughters: kept only the first 4" << G4endl;
654 G4Exception( "G4KineticTrack::Decay()", "KINTRK5", JustWarning, ed );
655 }
656 break;
657 }
658
659 //AR-16Aug2016 : Check whether the sum of the masses of the daughters is smaller than the parent mass.
660 // If this is still not the case, but the max number of attempts has been reached,
661 // then the subsequent call thePhaseSpaceDecayChannel.DecayIt() will throw an exception.
662 G4double sumDaughterMasses = 0.0;
663 for (G4int i=0; i < 4; ++i) sumDaughterMasses += masses[i];
664 if ( theParentMass - sumDaughterMasses > 0.0 ) isChannelBelowThreshold = false;
665
666 } while ( isChannelBelowThreshold && ++loopCounter < maxNumberOfLoops ); /* Loop checking, 16.08.2016, A.Ribon */
667
668//
669// Get the decay products List
670//
671
672 G4GeneralPhaseSpaceDecay thePhaseSpaceDecayChannel(theParentName,
673 theParentMass,
674 theBR,
675 theNumberOfDaughters,
676 theDaughtersName1,
677 theDaughtersName2,
678 theDaughtersName3,
679 theDaughtersName4,
680 masses);
681 G4DecayProducts* theDecayProducts = thePhaseSpaceDecayChannel.DecayIt();
682 if(!theDecayProducts)
683 {
685 ed << "Error condition encountered: phase-space decay failed." << G4endl
686 << "\t the decaying particle is: " << thisDefinition->GetParticleName() << G4endl
687 << "\t the channel index is: "<< chosench << " of "<< nChannels << "channels" << G4endl
688 << "\t " << theNumberOfDaughters << " daughter particles: "
689 << theDaughtersName1 << " " << theDaughtersName2 << " " << theDaughtersName3 << " "
690 << theDaughtersName4 << G4endl;
691 G4Exception( "G4KineticTrack::Decay ", "HAD_KINTRACK_001", JustWarning, ed );
692 return 0;
693 }
694
695//
696// Create the kinetic track List associated to the decay products
697//
698 G4LorentzRotation toMoving(Get4Momentum().boostVector());
699 G4DynamicParticle* theDynamicParticle;
700 G4double formationTime = 0.0;
702 G4LorentzVector momentum;
703 G4LorentzVector momentumBalanceCMS(0);
704 G4KineticTrackVector* theDecayProductList = new G4KineticTrackVector;
705 G4int dEntries = theDecayProducts->entries();
706 const G4ParticleDefinition * aProduct = 0;
707 for (G4int i=dEntries; i > 0; --i)
708 {
709 theDynamicParticle = theDecayProducts->PopProducts();
710 aProduct = theDynamicParticle->GetDefinition();
711 chargeBalance -= G4lrint(aProduct->GetPDGCharge() );
712 baryonBalance -= G4lrint(aProduct->GetBaryonNumber() );
713 momentumBalanceCMS += theDynamicParticle->Get4Momentum();
714 momentum = toMoving*theDynamicParticle->Get4Momentum();
715 energyMomentumBalance -= momentum;
716 theDecayProductList->push_back(new G4KineticTrack (aProduct,
717 formationTime,
718 position,
719 momentum));
720 delete theDynamicParticle;
721 }
722 delete theDecayProducts;
723 if(std::getenv("DecayEnergyBalanceCheck"))
724 std::cout << "DEBUGGING energy balance in cms and lab, charge baryon balance : "
725 << momentumBalanceCMS << " "
726 <<energyMomentumBalance << " "
727 <<chargeBalance<<" "
728 <<baryonBalance<<" "
729 <<G4endl;
730 return theDecayProductList;
731 }
732 else
733 {
734 return 0;
735 }
736}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
G4int entries() const
G4DynamicParticle * PopProducts()
G4ParticleDefinition * GetDefinition() const
G4LorentzVector Get4Momentum() const
const G4LorentzVector & Get4Momentum() const
G4double GetPDGCharge() const
const G4String & GetParticleName() const
G4double SampleMass(const G4double poleMass, const G4double gamma, const G4double minMass, const G4double maxMass) const
int G4lrint(double ad)
Definition: templates.hh:134

Referenced by G4LMsdGenerator::ApplyYourself(), G4QMDCollision::CalKinematicsOfBinaryCollisions(), G4DecayKineticTracks::Decay(), G4NeutrinoNucleusModel::FinalBarion(), G4NeutrinoNucleusModel::FinalMeson(), and G4BCDecay::GetFinalState().

◆ Get4Momentum()

const G4LorentzVector & G4KineticTrack::Get4Momentum ( ) const
inlinevirtual

◆ GetActualMass()

G4double G4KineticTrack::GetActualMass ( ) const
inline

◆ GetActualWidth()

G4double * G4KineticTrack::GetActualWidth ( ) const
inline

Definition at line 333 of file G4KineticTrack.hh.

334{
335 return theActualWidth;
336}

◆ GetDefinition()

const G4ParticleDefinition * G4KineticTrack::GetDefinition ( ) const
inlinevirtual

Implements G4VKineticNucleon.

Definition at line 209 of file G4KineticTrack.hh.

210{
211 return theDefinition;
212}

Referenced by G4CollisionManager::AddCollision(), G4KineticTrackVector::BoostBeam(), G4CollisionComposite::CrossSection(), G4CollisionNN::CrossSection(), G4XAnnihilationChannel::CrossSection(), G4XAqmTotal::CrossSection(), G4XnpElasticLowE::CrossSection(), G4XnpTotalLowE::CrossSection(), G4XPDGElastic::CrossSection(), G4XPDGTotal::CrossSection(), G4XResonance::CrossSection(), Decay(), G4DecayKineticTracks::Decay(), G4VXResonance::DegeneracyFactor(), G4VXResonance::DetailedBalance(), G4VElasticCollision::FinalState(), G4VScatteringCollision::FinalState(), G4Absorber::FindAbsorbers(), G4VCrossSectionSource::FindKeyParticle(), G4VCrossSectionSource::FindLightParticle(), G4Absorber::FindProducts(), G4QGSMFragmentation::FragmentString(), G4ExcitedStringDecay::FragmentStrings(), G4KineticTrack(), G4BCDecay::GetCollisions(), G4MesonAbsorption::GetFinalState(), G4ParticleTypeConverter::GetGenericType(), G4ConcreteMesonBaryonToResonance::GetOutgoingParticle(), G4Scatterer::GetTimeToInteraction(), G4CollisionMesonBaryonElastic::IsInCharge(), G4CollisionNNElastic::IsInCharge(), G4CollisionnpElastic::IsInCharge(), G4ConcreteNNTwoBodyResonance::IsInCharge(), G4GeneralNNCollision::IsInCharge(), G4VXResonance::IsospinCorrection(), G4GeneratorPrecompoundInterface::MakeCoalescence(), operator=(), G4CollisionManager::Print(), G4CollisionInitialState::Print(), G4IntraNucleiCascader::processSecondary(), G4DecayStrongResonances::Propagate(), G4CascadeInterface::Propagate(), G4IntraNucleiCascader::releaseSecondary(), G4Scatterer::Scatter(), G4RKPropagation::Transport(), and G4Absorber::WillBeAbsorbed().

◆ GetFormationTime()

◆ GetnChannels()

G4int G4KineticTrack::GetnChannels ( ) const
inline

Definition at line 323 of file G4KineticTrack.hh.

324{
325 return nChannels;
326}

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

◆ GetPosition()

◆ GetProjectilePotential()

G4double G4KineticTrack::GetProjectilePotential ( ) const
inline

Definition at line 420 of file G4KineticTrack.hh.

421{
422 return theProjectilePotential;
423}

Referenced by G4RKPropagation::Transport().

◆ GetState()

G4KineticTrack::CascadeState G4KineticTrack::GetState ( ) const
inline

Definition at line 401 of file G4KineticTrack.hh.

402{
403 return theStateToNucleus;
404}

Referenced by G4RKPropagation::Transport().

◆ GetTrackingMomentum()

const G4LorentzVector & G4KineticTrack::GetTrackingMomentum ( ) const
inline

◆ Hit()

void G4KineticTrack::Hit ( )
inline

Definition at line 385 of file G4KineticTrack.hh.

386{
387 if(theNucleon)
388 {
389 theNucleon->Hit(1);
390 }
391}
void Hit(G4VSplitableHadron *aHit)
Definition: G4Nucleon.hh:89

◆ IsParticipant()

G4bool G4KineticTrack::IsParticipant ( ) const
inline

Definition at line 394 of file G4KineticTrack.hh.

395{
396 if(!theNucleon) return true;
397 return theNucleon->AreYouHit();
398}
G4bool AreYouHit() const
Definition: G4Nucleon.hh:96

◆ operator!=()

G4bool G4KineticTrack::operator!= ( const G4KineticTrack right) const

Definition at line 474 of file G4KineticTrack.cc.

475{
476 return (this != & right);
477}

◆ operator=()

G4KineticTrack & G4KineticTrack::operator= ( const G4KineticTrack right)

Definition at line 445 of file G4KineticTrack.cc.

446{
447 if (this != &right)
448 {
449 theDefinition = right.GetDefinition();
450 theFormationTime = right.GetFormationTime();
451 the4Momentum = right.the4Momentum;
452 the4Momentum = right.GetTrackingMomentum();
453 theFermi3Momentum = right.theFermi3Momentum;
454 theTotal4Momentum = right.theTotal4Momentum;
455 theNucleon=right.theNucleon;
456 theStateToNucleus=right.theStateToNucleus;
457 if (theActualWidth != 0) delete [] theActualWidth;
458 nChannels = right.GetnChannels();
459 theActualWidth = new G4double[nChannels];
460 for (G4int i = 0; i < nChannels; ++i) theActualWidth[i] = right.theActualWidth[i];
461 }
462 return *this;
463}

◆ operator==()

G4bool G4KineticTrack::operator== ( const G4KineticTrack right) const

Definition at line 467 of file G4KineticTrack.cc.

468{
469 return (this == & right);
470}

◆ SampleResidualLifetime()

G4double G4KineticTrack::SampleResidualLifetime ( )
inline

Definition at line 356 of file G4KineticTrack.hh.

357{
358 G4double theTotalActualWidth = this->EvaluateTotalActualWidth();
359 G4double tau = CLHEP::hbar_Planck * (-1.0 / theTotalActualWidth);
360 G4double theResidualLifetime = tau * G4Log(G4UniformRand());
361 return theResidualLifetime*the4Momentum.gamma();
362}
G4double G4Log(G4double x)
Definition: G4Log.hh:226

Referenced by G4BCDecay::GetCollisions().

◆ Set4Momentum()

void G4KineticTrack::Set4Momentum ( const G4LorentzVector a4Momentum)
inline

Definition at line 249 of file G4KineticTrack.hh.

250{
251// set the4Momentum and update theTotal4Momentum
252
253 theTotal4Momentum=a4Momentum;
254 the4Momentum = theTotal4Momentum;
255 theFermi3Momentum=G4LorentzVector(0);
256}
CLHEP::HepLorentzVector G4LorentzVector

Referenced by G4KineticTrackVector::Boost(), G4KineticTrackVector::BoostBeam(), G4CollisionNN::CrossSection(), G4VElasticCollision::FinalState(), G4QGSMFragmentation::FragmentString(), G4KineticTrack(), G4ExcitedString::LorentzRotate(), G4ExcitedString::TransformToCenterOfMass(), and Update4Momentum().

◆ SetDefinition()

void G4KineticTrack::SetDefinition ( const G4ParticleDefinition aDefinition)
inline

Definition at line 214 of file G4KineticTrack.hh.

215{
216 theDefinition = aDefinition;
217}

◆ SetFormationTime()

void G4KineticTrack::SetFormationTime ( G4double  aFormationTime)
inline

Definition at line 224 of file G4KineticTrack.hh.

225{
226 theFormationTime = aFormationTime;
227}

Referenced by G4QGSMFragmentation::FragmentString().

◆ SetNucleon()

void G4KineticTrack::SetNucleon ( G4Nucleon aN)
inline

Definition at line 105 of file G4KineticTrack.hh.

105{theNucleon = aN;}

◆ SetPosition()

void G4KineticTrack::SetPosition ( const G4ThreeVector  aPosition)
inline

Definition at line 234 of file G4KineticTrack.hh.

235{
236 thePosition = aPosition;
237}

Referenced by G4QGSMFragmentation::FragmentString(), G4ExcitedStringDecay::FragmentStrings(), and G4KineticTrackVector::Shift().

◆ SetProjectilePotential()

void G4KineticTrack::SetProjectilePotential ( const G4double  aPotential)
inline

Definition at line 415 of file G4KineticTrack.hh.

416{
417 theProjectilePotential = aPotential;
418}

◆ SetState()

G4KineticTrack::CascadeState G4KineticTrack::SetState ( const CascadeState  new_state)
inline

Definition at line 407 of file G4KineticTrack.hh.

408{
409 CascadeState old_state=theStateToNucleus;
410 theStateToNucleus=new_state;
411 return old_state;
412}

Referenced by G4BinaryCascade::ApplyYourself(), and G4RKPropagation::Transport().

◆ SetTrackingMomentum()

void G4KineticTrack::SetTrackingMomentum ( const G4LorentzVector a4Momentum)
inline

Definition at line 282 of file G4KineticTrack.hh.

283{
284// set the4Momentum and update theTotal4Momentum, keep the mass of aMomentum
285
286 the4Momentum = aMomentum;
287 theTotal4Momentum=the4Momentum+theFermi3Momentum;
288// keep mass of aMomentum for the total momentum
289 G4double mass2 = aMomentum.mag2();
290 G4double p2=theTotal4Momentum.vect().mag2();
291 theTotal4Momentum.setE(std::sqrt(mass2+p2));
292}
double mag2() const
Hep3Vector vect() const

Referenced by G4RKPropagation::Transport(), and UpdateTrackingMomentum().

◆ Update4Momentum() [1/2]

void G4KineticTrack::Update4Momentum ( const G4ThreeVector aMomentum)
inline

Definition at line 274 of file G4KineticTrack.hh.

275{
276// update the4Momentum with aMomentum at constant mass (the4Momentum.mag()
277// updates theTotal4Momentum as well.
278 G4double newE=std::sqrt(theTotal4Momentum.mag2() + aMomentum.mag2());
279 Set4Momentum(G4LorentzVector(aMomentum, newE));
280}

◆ Update4Momentum() [2/2]

void G4KineticTrack::Update4Momentum ( G4double  aEnergy)
inline

Definition at line 258 of file G4KineticTrack.hh.

259{
260// update the4Momentum with aEnergy at constant mass (the4Momentum.mag()
261// updates theTotal4Momentum as well.
262 G4double newP(0);
263 G4double mass2=theTotal4Momentum.mag2();
264 if ( sqr(aEnergy) > mass2 )
265 {
266 newP = std::sqrt(sqr(aEnergy) - mass2 );
267 } else
268 {
269 aEnergy=std::sqrt(mass2);
270 }
271 Set4Momentum(G4LorentzVector(newP*the4Momentum.vect().unit(), aEnergy));
272}
Hep3Vector unit() const
T sqr(const T &x)
Definition: templates.hh:128

◆ UpdateTrackingMomentum() [1/2]

void G4KineticTrack::UpdateTrackingMomentum ( const G4ThreeVector aMomentum)
inline

Definition at line 310 of file G4KineticTrack.hh.

311{
312// update the4Momentum with aMomentum at constant mass (the4Momentum.mag()
313// updates theTotal4Momentum as well.
314 G4double newE=std::sqrt(theTotal4Momentum.mag2() + aMomentum.mag2());
315 SetTrackingMomentum(G4LorentzVector(aMomentum, newE));
316}
void SetTrackingMomentum(const G4LorentzVector &a4Momentum)

◆ UpdateTrackingMomentum() [2/2]

void G4KineticTrack::UpdateTrackingMomentum ( G4double  aEnergy)
inline

Definition at line 294 of file G4KineticTrack.hh.

295{
296// update the4Momentum with aEnergy at constant mass (the4Momentum.mag()
297// updates theTotal4Momentum as well.
298 G4double newP(0);
299 G4double mass2=theTotal4Momentum.mag2();
300 if ( sqr(aEnergy) > mass2 )
301 {
302 newP = std::sqrt(sqr(aEnergy) - mass2 );
303 } else
304 {
305 aEnergy=std::sqrt(mass2);
306 }
307 SetTrackingMomentum(G4LorentzVector(newP*the4Momentum.vect().unit(), aEnergy));
308}

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