353{
355 fNumPhotons = 0;
356
359
362
366
368
370 if(!MPT)
372
373 G4int N_timeconstants = 1;
374
376 N_timeconstants = 3;
378 N_timeconstants = 2;
380 {
381
383 }
384
387
395
396 if(fScintillationByParticleType)
397 {
399 aTrack, aStep, yield1, yield2, yield3, timeconstant1, timeconstant2,
400 timeconstant3);
401 }
402 else
403 {
406 : 1.;
409 : 0.;
412 : 0.;
413
414
416
417
418 if(fEmSaturation)
419 MeanNumberOfPhotons *=
421 else
422 MeanNumberOfPhotons *= TotalEnergyDeposit;
423 }
424 sum_yields = yield1 + yield2 + yield3;
425
426 if(MeanNumberOfPhotons > 10.)
427 {
428 G4double sigma = ResolutionScale * std::sqrt(MeanNumberOfPhotons);
429 fNumPhotons =
G4int(G4RandGauss::shoot(MeanNumberOfPhotons, sigma) + 0.5);
430 }
431 else
432 {
434 }
435
436 if(fNumPhotons <= 0 || !fStackingFlag)
437 {
438
441 }
442
444
445 if(fTrackSecondariesFirst)
446 {
449 }
450
452
453
454
455 std::size_t numPhot = fNumPhotons;
460
461 for(
G4int scnt = 0; scnt < N_timeconstants; ++scnt)
462 {
463
464 if(scnt == 0)
465 {
466 if(N_timeconstants == 1)
467 {
468 numPhot = fNumPhotons;
469 }
470 else
471 {
472 numPhot = yield1 / sum_yields * fNumPhotons;
473 }
474 if(fScintillationByParticleType)
475 {
476 scintTime = timeconstant1;
477 }
478 else
479 {
481 }
482 if(fFiniteRiseTime)
483 {
485 }
487 scintIntegral =
489 }
490 else if(scnt == 1)
491 {
492
493 if(N_timeconstants == 2)
494 {
495 numPhot = fNumPhotons - numPhot;
496 }
497 else
498 {
499 numPhot = yield2 / sum_yields * fNumPhotons;
500 }
501 if(fScintillationByParticleType)
502 {
503 scintTime = timeconstant2;
504 }
505 else
506 {
508 }
509 if(fFiniteRiseTime)
510 {
512 }
514 scintIntegral =
516 }
517 else if(scnt == 2)
518 {
519 numPhot = yield3 / sum_yields * fNumPhotons;
520 if(fScintillationByParticleType)
521 {
522 scintTime = timeconstant3;
523 }
524 else
525 {
527 }
528 if(fFiniteRiseTime)
529 {
531 }
533 scintIntegral =
535 }
536
537 if(!scintIntegral)
538 continue;
539
541 for(std::size_t i = 0; i < numPhot; ++i)
542 {
543
546
548 {
549 G4cout <<
"sampledEnergy = " << sampledEnergy <<
G4endl;
551 }
552
553
555 G4double sint = std::sqrt((1. - cost) * (1. + cost));
560
561
562 G4ThreeVector photonPolarization(cost * cosp, cost * sinp, -sint);
565 sinp = std::sin(phi);
566 cosp = std::cos(phi);
567 photonPolarization = (cosp * photonPolarization + sinp * perp).unit();
568
569
571 scintPhoton->SetPolarization(photonPolarization);
572 scintPhoton->SetKineticEnergy(sampledEnergy);
573
574
577 {
578 rand = 1.0;
579 }
580
581
584 delta /
587 2.);
588 if(riseTime == 0.0)
589 {
591 }
592 else
593 {
594 deltaTime += sample_time(riseTime, scintTime);
595 }
596
599
600 G4Track* secTrack =
new G4Track(scintPhoton, secTime, secPosition);
605 if(fScintillationTrackInfo)
609 }
610 }
611
613 {
614 G4cout <<
"\n Exiting from G4Scintillation::DoIt -- NumberOfSecondaries = "
616 }
617
619}
@ kSCINTILLATIONRISETIME2
@ kSCINTILLATIONRISETIME1
@ kSCINTILLATIONRISETIME3
G4long G4Poisson(G4double mean)
Hep3Vector cross(const Hep3Vector &) const
G4double VisibleEnergyDepositionAtAStep(const G4Step *) const
std::size_t GetIndex() const
void AddSecondary(G4Track *aSecondary)
void Initialize(const G4Track &) override
G4double GetPDGCharge() const
G4double GetEnergy(const G4double value) const
G4double GetScintillationYieldByParticleType(const G4Track &aTrack, const G4Step &aStep, G4double &yield1, G4double &yield2, G4double &yield3, G4double &timeconstant1, G4double &timeconstant2, G4double &timeconstant3)
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 SetCreatorModelID(const G4int id)
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 &)