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
392
393 if(fScintillationByParticleType)
394 {
396 aTrack, aStep, yield1, yield2, yield3);
397 }
398 else
399 {
402 : 1.;
405 : 0.;
408 : 0.;
409
410
412
413
414 if(fEmSaturation)
415 MeanNumberOfPhotons *=
417 else
418 MeanNumberOfPhotons *= TotalEnergyDeposit;
419 }
420 sum_yields = yield1 + yield2 + yield3;
421
422 if(MeanNumberOfPhotons > 10.)
423 {
424 G4double sigma = ResolutionScale * std::sqrt(MeanNumberOfPhotons);
425 fNumPhotons =
G4int(G4RandGauss::shoot(MeanNumberOfPhotons, sigma) + 0.5);
426 }
427 else
428 {
430 }
431
432 if(fNumPhotons <= 0 || !fStackingFlag)
433 {
434
437 }
438
440
441 if(fTrackSecondariesFirst)
442 {
445 }
446
448
449
450
451 std::size_t numPhot = fNumPhotons;
456
457 for(
G4int scnt = 0; scnt < N_timeconstants; ++scnt)
458 {
459
460 if(scnt == 0)
461 {
462 if(N_timeconstants == 1)
463 {
464 numPhot = fNumPhotons;
465 }
466 else
467 {
468 numPhot = yield1 / sum_yields * fNumPhotons;
469 }
471 if(fFiniteRiseTime)
472 {
474 }
476 scintIntegral =
478 }
479 else if(scnt == 1)
480 {
481
482 if(N_timeconstants == 2)
483 {
484 numPhot = fNumPhotons - numPhot;
485 }
486 else
487 {
488 numPhot = yield2 / sum_yields * fNumPhotons;
489 }
491 if(fFiniteRiseTime)
492 {
494 }
496 scintIntegral =
498 }
499 else if(scnt == 2)
500 {
501 numPhot = yield3 / sum_yields * fNumPhotons;
503 if(fFiniteRiseTime)
504 {
506 }
508 scintIntegral =
510 }
511
512 if(!scintIntegral)
513 continue;
514
516 for(std::size_t i = 0; i < numPhot; ++i)
517 {
518
521
523 {
524 G4cout <<
"sampledEnergy = " << sampledEnergy <<
G4endl;
526 }
527
528
530 G4double sint = std::sqrt((1. - cost) * (1. + cost));
535
536
537 G4ThreeVector photonPolarization(cost * cosp, cost * sinp, -sint);
540 sinp = std::sin(phi);
541 cosp = std::cos(phi);
542 photonPolarization = (cosp * photonPolarization + sinp * perp).unit();
543
544
546 scintPhoton->SetPolarization(photonPolarization);
547 scintPhoton->SetKineticEnergy(sampledEnergy);
548
549
552 {
553 rand = 1.0;
554 }
555
556
559 delta /
562 2.);
563 if(riseTime == 0.0)
564 {
566 }
567 else
568 {
569 deltaTime += sample_time(riseTime, scintTime);
570 }
571
574
575 G4Track* secTrack =
new G4Track(scintPhoton, secTime, secPosition);
580 if(fScintillationTrackInfo)
584 }
585 }
586
588 {
589 G4cout <<
"\n Exiting from G4Scintillation::DoIt -- NumberOfSecondaries = "
591 }
592
594}
@ kSCINTILLATIONTIMECONSTANT1
@ kSCINTILLATIONRISETIME2
@ kSCINTILLATIONRISETIME1
@ kSCINTILLATIONRISETIME3
@ kSCINTILLATIONTIMECONSTANT3
@ kSCINTILLATIONTIMECONSTANT2
G4long G4Poisson(G4double mean)
Hep3Vector cross(const Hep3Vector &) const
G4double VisibleEnergyDepositionAtAStep(const G4Step *) 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 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 &)