334{
336 fNumPhotons = 0;
337
340
343
347
349
351 if(!MPT)
353
354 G4int N_timeconstants = 1;
355
356
359
360 if(fEnhancedTimeConstants)
361 {
363 N_timeconstants = 3;
365 N_timeconstants = 2;
367 {
368
370 }
371 }
372 else
373 {
376 if(!Fast_Intensity && !Slow_Intensity)
378 if(Fast_Intensity && Slow_Intensity)
379 N_timeconstants = 2;
380 }
381
384
389
390 if(!fEnhancedTimeConstants)
391 {
392
393 if(fScintillationByParticleType)
394 {
396 }
397 else
398 {
399
400
401 MeanNumberOfPhotons =
403
404
405 if(fEmSaturation)
406 MeanNumberOfPhotons *=
408 else
409 MeanNumberOfPhotons *= TotalEnergyDeposit;
410 }
411 }
412
413 else
414 {
415 if(fScintillationByParticleType)
416 {
418 aTrack, aStep, yield1, yield2, yield3);
419 }
420 else
421 {
424 : 1.;
427 : 0.;
430 : 0.;
431
432
433 MeanNumberOfPhotons =
435
436
437 if(fEmSaturation)
438 MeanNumberOfPhotons *=
440 else
441 MeanNumberOfPhotons *= TotalEnergyDeposit;
442 }
443 sum_yields = yield1 + yield2 + yield3;
444 }
445
446 if(MeanNumberOfPhotons > 10.)
447 {
448 G4double sigma = ResolutionScale * std::sqrt(MeanNumberOfPhotons);
449 fNumPhotons =
G4int(G4RandGauss::shoot(MeanNumberOfPhotons, sigma) + 0.5);
450 }
451 else
452 {
454 }
455
456 if(fNumPhotons <= 0 || !fStackingFlag)
457 {
458
461 }
462
464
465 if(fTrackSecondariesFirst)
466 {
469 }
470
472
473
474
475 size_t numPhot = fNumPhotons;
480
481 for(
G4int scnt = 0; scnt < N_timeconstants; ++scnt)
482 {
483
484 if(!fEnhancedTimeConstants)
485 {
486 if(scnt == 0)
487 {
488 if(N_timeconstants == 1)
489 {
490 if(Fast_Intensity)
491 {
493 if(fFiniteRiseTime)
494 {
496 }
498 scintIntegral =
500 }
501 if(Slow_Intensity)
502 {
504 if(fFiniteRiseTime)
505 {
507 }
509 scintIntegral =
511 }
512 }
513 else
514 {
516 if(fExcitationRatio == 1.0 || fExcitationRatio == 0.0)
517 {
518 numPhot =
G4int(std::min(yieldRatio, 1.0) * fNumPhotons);
519 }
520 else
521 {
522 numPhot =
G4int(std::min(fExcitationRatio, 1.0) * fNumPhotons);
523 }
525 if(fFiniteRiseTime)
526 {
528 }
530 scintIntegral =
532 }
533 }
534 else
535 {
536 numPhot = fNumPhotons - numPhot;
538 if(fFiniteRiseTime)
539 {
541 }
543 scintIntegral =
545 }
546 }
547 else
548 {
549
550
551 if(scnt == 0)
552 {
553 if(N_timeconstants == 1)
554 {
555 numPhot = fNumPhotons;
556 }
557 else
558 {
559 numPhot = yield1 / sum_yields * fNumPhotons;
560 }
562 if(fFiniteRiseTime)
563 {
565 }
567 scintIntegral =
569 }
570 else if(scnt == 1)
571 {
572
573 if(N_timeconstants == 2)
574 {
575 numPhot = fNumPhotons - numPhot;
576 }
577 else
578 {
579 numPhot = yield2 / sum_yields * fNumPhotons;
580 }
582 if(fFiniteRiseTime)
583 {
585 }
587 scintIntegral =
589 }
590 else if(scnt == 2)
591 {
592 numPhot = yield3 / sum_yields * fNumPhotons;
594 if(fFiniteRiseTime)
595 {
597 }
599 scintIntegral =
601 }
602 }
603
604 if(!scintIntegral)
605 continue;
606
608 for(size_t i = 0; i < numPhot; ++i)
609 {
610
613
615 {
616 G4cout <<
"sampledEnergy = " << sampledEnergy <<
G4endl;
618 }
619
620
622 G4double sint = std::sqrt((1. - cost) * (1. + cost));
627
628
629 G4ThreeVector photonPolarization(cost * cosp, cost * sinp, -sint);
632 sinp = std::sin(phi);
633 cosp = std::cos(phi);
634 photonPolarization = (cosp * photonPolarization + sinp * perp).unit();
635
636
641
642
645 {
646 rand = 1.0;
647 }
648
649
652 delta /
655 2.);
656 if(riseTime == 0.0)
657 {
659 }
660 else
661 {
662 deltaTime += sample_time(riseTime, scintTime);
663 }
664
667
668 G4Track* secTrack =
new G4Track(scintPhoton, secTime, secPosition);
672 if(fScintillationTrackInfo)
676 }
677 }
678
680 {
681 G4cout <<
"\n Exiting from G4Scintillation::DoIt -- NumberOfSecondaries = "
683 }
684
686}
@ kSCINTILLATIONTIMECONSTANT1
@ kSCINTILLATIONRISETIME2
@ kSCINTILLATIONRISETIME1
@ kFASTSCINTILLATIONRISETIME
@ kSLOWSCINTILLATIONRISETIME
@ kSCINTILLATIONRISETIME3
@ kSCINTILLATIONTIMECONSTANT3
@ kSCINTILLATIONTIMECONSTANT2
G4long G4Poisson(G4double mean)
Hep3Vector cross(const Hep3Vector &) const
void SetPolarization(const G4ThreeVector &)
void SetKineticEnergy(G4double aEnergy)
G4double VisibleEnergyDepositionAtAStep(const G4Step *) const
void AddSecondary(G4Track *aSecondary)
virtual void Initialize(const G4Track &)
G4double GetEnergy(G4double aValue)
G4double GetScintillationYieldByParticleType(const G4Track &aTrack, const G4Step &aStep)
G4double GetVelocity() const
G4double GetGlobalTime() const
const G4ThreeVector & GetPosition() const
const G4TouchableHandle & GetTouchableHandle() const
G4ThreeVector GetDeltaPosition() const
G4double GetStepLength() const
void SetTouchableHandle(const G4TouchableHandle &apValue)
void SetUserInformation(G4VUserTrackInformation *aValue) const
void SetParentID(const G4int aValue)
void ProposeTrackStatus(G4TrackStatus status)
G4int GetNumberOfSecondaries() const
void SetNumberOfSecondaries(G4int totSecondaries)
G4ParticleChange aParticleChange
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)