460 {
461
462 bool goodMaterial(false);
463
465
466 goodMaterial = true;
467 }
468 else {
469
470
471
472 for (
unsigned int i=0;
i<
m_config.materials.size();
i++) {
473 if (
m_config.materials[i].compare(aStep->GetTrack()->GetMaterial()->GetName()) == 0) {
474 goodMaterial = true;
475 break;
476 }
477 }
478 }
479
481
482 const std::vector<const G4Track*>* tv = aStep->GetSecondaryInCurrentStep();
483
484
485 if ( tv ) {
486
487 for (unsigned int is=0;is<tv->size();is++) {
488
489 const G4ParticleDefinition *
pd = (*tv)[is]->GetParticleDefinition ();
490 if ( pd == G4Triton::Definition() || (
pd->GetParticleTable()->GetIonTable()->IsIon(pd) && !
pd->GetPDGStable() ) ) {
491 G4String svname("unknown");
492 G4String svmaterial("unknown");
493 if ( (*tv)[is]->GetVolume() ) {
494 svname = (*tv)[is]->GetVolume()->GetName();
495 if ( (*tv)[is]->GetVolume()->GetLogicalVolume() ) {
496 if ( (*tv)[is]->GetVolume()->GetLogicalVolume()->GetMaterial() ) {
497 svmaterial = (*tv)[is]->GetVolume()->GetLogicalVolume()->GetMaterial()->GetName();
498 }
499 }
500 }
503 << " Proc.: " << (*tv)[is]->GetCreatorProcess()->GetProcessType() << " Mother: ";
505 m_activationFile << aStep->GetTrack()->GetDefinition()->GetParticleName() <<
" (x,y,z,t): (";
521 }
522 }
523 }
524 }
525
526 int pdgid = 10;
527 if (aStep->GetTrack()->GetDefinition()==G4Gamma::Definition()){
528 pdgid=0;
529 } else if (aStep->GetTrack()->GetDefinition()==G4Proton::Definition()){
530 pdgid=1;
531 } else if (aStep->GetTrack()->GetDefinition()==G4PionPlus::Definition() ||
532 aStep->GetTrack()->GetDefinition()==G4PionMinus::Definition()){
533 pdgid=2;
534 } else if(aStep->GetTrack()->GetDefinition()==G4MuonPlus::Definition() ||
535 aStep->GetTrack()->GetDefinition()==G4MuonMinus::Definition()){
536 pdgid=3;
537 } else if(aStep->GetTrack()->GetDefinition()==G4Electron::Definition() ||
538 aStep->GetTrack()->GetDefinition()==G4Positron::Definition()){
539 if (aStep->GetTrack()->GetKineticEnergy()>0.5){
540 pdgid=4;
541 } else {
542 pdgid=5;
543 }
544 } else if(aStep->GetTrack()->GetDefinition()==G4Neutron::Definition()){
545 if (aStep->GetTrack()->GetKineticEnergy()>10.){
546 pdgid=6;
547 } else {
548 pdgid=7;
549 }
550 } else if (aStep->GetTrack()->GetDefinition()==G4KaonPlus::Definition() ||
551 aStep->GetTrack()->GetDefinition()==G4KaonMinus::Definition() ||
552 aStep->GetTrack()->GetDefinition()==G4KaonZeroShort::Definition() ||
553 aStep->GetTrack()->GetDefinition()==G4KaonZeroLong::Definition() ||
554 aStep->GetTrack()->GetDefinition()==G4KaonZero::Definition() ||
555 aStep->GetTrack()->GetDefinition()==G4AntiKaonZero::Definition() ||
556 aStep->GetTrack()->GetDefinition()==G4PionZero::Definition()){
557 pdgid=8;
558
559 } else if (aStep->GetTrack()->GetDefinition()==G4AntiProton::Definition() ||
560 aStep->GetTrack()->GetDefinition()==G4AntiNeutron::Definition() ||
561 aStep->GetTrack()->GetDefinition()==G4Lambda::Definition() ||
562 aStep->GetTrack()->GetDefinition()==G4AntiLambda::Definition() ||
563 aStep->GetTrack()->GetDefinition()==G4SigmaPlus::Definition() ||
564 aStep->GetTrack()->GetDefinition()==G4AntiSigmaPlus::Definition() ||
565 aStep->GetTrack()->GetDefinition()==G4SigmaMinus::Definition() ||
566 aStep->GetTrack()->GetDefinition()==G4AntiSigmaMinus::Definition() ||
567 aStep->GetTrack()->GetDefinition()==G4SigmaZero::Definition() ||
568 aStep->GetTrack()->GetDefinition()==G4AntiSigmaZero::Definition() ||
569 aStep->GetTrack()->GetDefinition()==G4XiMinus::Definition() ||
570 aStep->GetTrack()->GetDefinition()==G4AntiXiMinus::Definition() ||
571 aStep->GetTrack()->GetDefinition()==G4XiZero::Definition() ||
572 aStep->GetTrack()->GetDefinition()==G4AntiXiZero::Definition() ||
573 aStep->GetTrack()->GetDefinition()==G4OmegaMinus::Definition() ||
574 aStep->GetTrack()->GetDefinition()==G4AntiOmegaMinus::Definition() ||
575 aStep->GetTrack()->GetDefinition()==G4Alpha::Definition() ||
576 aStep->GetTrack()->GetDefinition()==G4Deuteron::Definition() ||
577 aStep->GetTrack()->GetDefinition()==G4Triton::Definition() ||
578 aStep->GetTrack()->GetDefinition()==G4He3::Definition()){
579 pdgid=9;
580
581 } else if (aStep->GetTrack()->GetDefinition()==G4Geantino::Definition()) {
582 pdgid = 999;
583 } else if (!aStep->GetTrack()->GetDefinition()->GetPDGCharge()) return;
584
585 if ( pdgid == 10 && aStep->GetTrack()->GetKineticEnergy() > 10 ) {
586
587 if ( aStep->GetTrack()->GetDefinition()->GetAtomicNumber() > 1 ) {
588 pdgid = 9;
589 }
590 }
591
592
593
594 if ( pdgid == 0 || pdgid == 3 ||
595 pdgid == 1 || pdgid == 2 || pdgid == 4 || pdgid == 5 || pdgid == 6 || pdgid == 7 || pdgid == 8 || pdgid == 9 ||
596 aStep->GetTotalEnergyDeposit() > 0 || pdgid == 999) {
597
598 double charge = aStep->GetTrack()->GetDefinition()->GetPDGCharge();
599
600 double absq = std::fabs(
charge);
601
602 double rho = aStep->GetTrack()->GetMaterial()->GetDensity()/CLHEP::g*CLHEP::cm3;
603
604 const G4Material * theMaterial = aStep->GetTrack()->GetMaterial();
605
606
607 G4StepPoint* pre_step_point = aStep->GetPreStepPoint();
608 G4StepPoint* post_step_point = aStep->GetPostStepPoint();
609 const G4ThreeVector& startPoint = pre_step_point->GetPosition();
610 const G4ThreeVector& endPoint = post_step_point->GetPosition();
611 G4ThreeVector
p = (startPoint + endPoint) * 0.5;
612
613
614 if (
m_config.posYOnly &&
p.y() < 0 )
return;
615
616 double timeOfFlight = (pre_step_point->GetGlobalTime() +
617 post_step_point->GetGlobalTime()) * 0.5;
618
619
620 double deltatime = (timeOfFlight -
p.mag()/CLHEP::c_light)/CLHEP::s;
621
622
623
624 double logt = (deltatime<0?
m_config.logTMin-1:log10(deltatime));
625
626
627 double x0 = aStep->GetPreStepPoint()->GetPosition().x()*0.1;
628 double x1 = aStep->GetPostStepPoint()->GetPosition().x()*0.1;
629 double y0 = aStep->GetPreStepPoint()->GetPosition().y()*0.1;
630 double y1 = aStep->GetPostStepPoint()->GetPosition().y()*0.1;
631 double z0 = aStep->GetPreStepPoint()->GetPosition().z()*0.1;
632 double z1 = aStep->GetPostStepPoint()->GetPosition().z()*0.1;
633
634 double l = sqrt(
pow(x1-x0,2)+
pow(y1-y0,2)+
pow(z1-z0,2));
635
636 double dl0 = 0.5;
637 unsigned int nStep =
l/dl0+1;
638 double dx = (
x1-x0)/nStep;
639 double dy = (
y1-y0)/nStep;
640 double dz = (z1-
z0)/nStep;
642
644 double wHt = 0;
645 double eKin = aStep->GetTrack()->GetKineticEnergy();
646 double theta = aStep->GetTrack()->GetMomentumDirection().theta()*180./
M_PI;
647
648
650 double dphi = (aStep->GetTrack()->GetMomentumDirection().
phi()-
p.phi())*180./
M_PI;
651 while ( dphi > 360 ) dphi -= 360.;
652 while ( dphi < 0 ) dphi += 360.;
653
655
656 if ( pdgid == 1 || pdgid == 9 ) {
657
658 if ( pdgid == 1 ) {
659
661 }
662 else {
663
665 }
666 if ( eKin < 15 ) {
667 if ( eKin > 10 ) {
669 }
670 }
671 else {
673 }
674 }
675 else if ( pdgid == 2 || pdgid == 8 ) {
676
677
680 }
681 else {
683 }
684 if ( eKin > 15 ) {
686 }
687 }
688 else if ( pdgid == 6 || pdgid == 7 ) {
689
690
692 if ( eKin < 20 ) {
694 }
695 else if ( eKin < 800 ) {
697 }
698 else {
700 }
701 }
702 else if ( pdgid == 4 || pdgid == 5 ) {
703
704
707 }
708 else {
710 }
711 if ( eKin > 0.1 ) {
713 }
714 }
715 else if ( pdgid == 0 ) {
716
717
719 }
720 else if ( pdgid == 3 ) {
721
722
725 }
726 else {
728 }
729 }
730
731 double dE_TOT = aStep->GetTotalEnergyDeposit()/nStep;
732 double dE_NIEL = aStep->GetNonIonizingEnergyDeposit()/nStep;
733 double dE_ION = dE_TOT-dE_NIEL;
734 double dH_T = 1
e-12*wHt;
735
736 for(
unsigned int i=0;
i<nStep;
i++) {
737
738 double subpos = G4UniformRand();
739 double abszorz =
z0+dz*(
i+subpos);
740
741 if (
m_config.zMinFull >= 0 ) abszorz = std::fabs(abszorz);
742
743 double rr = sqrt(
pow(x0+dx*(i+subpos),2)+
744 pow(y0+dy*(i+subpos),2));
745 double pphi = atan2(y0+dy*(i+subpos),x0+dx*(i+subpos))*180/
M_PI;
746
747 int vBinZoom = -1;
748 int vBinFull = -1;
749 int vBin3d = -1;
750 int vBinZoomSpecn = -1;
751 int vBinFullSpecn = -1;
752 int vBinZoomSpeco = -1;
753 int vBinFullSpeco = -1;
754 int vBinZoomTime = -1;
755 int vBinFullTime = -1;
756 int vBinThetaFullSpecn = -1;
757 int vBinThetaFullSpeco = -1;
758
759
770 }
773 (pdgid == 6 || pdgid == 7)) {
776 }
779 pdgid != 6 && pdgid != 7) {
782 }
783 }
784 }
785
786
797 }
800 (pdgid == 6 || pdgid == 7)) {
806 int idph = dphi/360.*
m_config.nBinsdphi;
809 }
810 }
813 pdgid != 6 && pdgid != 7) {
819 int idph = dphi/360.*
m_config.nBinsdphi;
822 }
823 }
824 }
825 }
826
827
835
836 double phi_mapped = pphi;
837
838 if (phi_mapped < 0) {
839 phi_mapped = 360 + phi_mapped;
840 }
841
842 int iphi = phi_mapped/
m_config.phiMaxZoom;
843 phi_mapped -= iphi*
m_config.phiMaxZoom;
846 }
847 else if (
m_config.phiMinZoom < pphi &&
851 }
852 }
853 }
854
855 if ( goodMaterial && vBinZoom >=0 ) {
856 if ( pdgid == 999 ) {
859 for (
size_t ie=0;
ie<theMaterial->GetNumberOfElements();
ie++ ) {
860 const G4Element * theElement = theMaterial->GetElement (ie);
861 const double mFrac = theMaterial->GetFractionVector()[
ie];
862 const int zElem = theElement->GetZ();
866 }
867 }
868 }
869 else {
870 m_maps.m_rz_tid [vBinZoom] += dE_ION/
rho;
871 m_maps.m_rz_eion[vBinZoom] += dE_ION;
872 for (
size_t ie=0;
ie<theMaterial->GetNumberOfElements();
ie++ ) {
873 const G4Element * theElement = theMaterial->GetElement (ie);
874 const double mFrac = theMaterial->GetFractionVector()[
ie];
875 const int zElem = theElement->GetZ();
879 }
880 }
881 }
882 }
883 if ( goodMaterial && vBinZoomTime >=0 ) {
884 m_maps.m_rz_tid_time[vBinZoomTime] += dE_ION/
rho;
885 if ( dH_T > 0 ) {
886 m_maps.m_rz_ht_time[vBinZoomTime] += dH_T*
dl;
887 }
888 }
889 if ( goodMaterial && vBinFull >=0 ) {
890 if ( pdgid == 999 ) {
893 for (
size_t ie=0;
ie<theMaterial->GetNumberOfElements();
ie++ ) {
894 const G4Element * theElement = theMaterial->GetElement (ie);
895 const double mFrac = theMaterial->GetFractionVector()[
ie];
896 const int zElem = theElement->GetZ();
900 }
901 }
902 }
903 else {
904 m_maps.m_full_rz_tid [vBinFull] += dE_ION/
rho;
905 m_maps.m_full_rz_eion[vBinFull] += dE_ION;
906 for (
size_t ie=0;
ie<theMaterial->GetNumberOfElements();
ie++ ) {
907 const G4Element * theElement = theMaterial->GetElement (ie);
908 const double mFrac = theMaterial->GetFractionVector()[
ie];
909 const int zElem = theElement->GetZ();
913 }
914 }
915 }
916 }
917 if ( goodMaterial && vBinFullTime >=0 ) {
918 m_maps.m_full_rz_tid_time[vBinFullTime] += dE_ION/
rho;
919 if ( dH_T > 0 ) {
920 m_maps.m_full_rz_ht_time[vBinFullTime] += dH_T*
dl;
921 }
922 }
923 if ( goodMaterial && vBin3d >=0 ) {
924 if ( pdgid == 999 ) {
927 }
928 else {
930 m_maps.m_3d_eion[vBin3d] += dE_ION;
931 }
932 }
933
934 if ( goodMaterial && (pdgid == 1 || pdgid == 2 || pdgid == 4 || pdgid == 5 || pdgid == 6 || pdgid == 7 || pdgid == 8 || pdgid == 9 )) {
935
936 if ( weight > 0 ) {
937 if ( vBinZoom >=0 ) {
939 }
940 if ( vBinFull >=0 ) {
942 }
943 if ( vBin3d >=0 ) {
945 }
946 }
947
948 if ( eKin > 20 && (pdgid == 1 || pdgid == 2 || pdgid == 6 || pdgid == 7 || pdgid == 8 || pdgid == 9) ) {
949 if ( vBinZoom >=0 ) {
951 }
952 if ( vBinFull >=0 ) {
953 m_maps.m_full_rz_h20 [vBinFull] +=
dl;
954 }
955 if ( vBin3d >=0 ) {
957 }
958 }
959
960 if ( eKin > 0.1 && (pdgid == 6 || pdgid == 7 ) ) {
961 if ( vBinZoom >=0 ) {
963 }
964 if ( vBinFull >=0 ) {
965 m_maps.m_full_rz_neut [vBinFull] +=
dl;
966 }
967 if ( vBin3d >=0 ) {
969 }
970 }
971
972 if ( absq > 0 && (pdgid == 1 || pdgid == 2 || pdgid == 8 || pdgid == 9 ) ) {
973 if ( vBinZoom >=0 ) {
975 }
976 if ( vBinFull >=0 ) {
977 m_maps.m_full_rz_chad [vBinFull] +=
dl;
978 }
979 if ( vBin3d >=0 ) {
981 }
982 }
983
984 if ( pdgid == 6 || pdgid == 7 ) {
985 if ( vBinZoomSpecn >=0 ) {
986 m_maps.m_rz_neut_spec [vBinZoomSpecn] +=
dl;
987 }
988 if ( vBinFullSpecn >=0 ) {
989 m_maps.m_full_rz_neut_spec [vBinFullSpecn] +=
dl;
990 }
991 if ( vBinThetaFullSpecn >=0 ) {
992 m_maps.m_theta_full_rz_neut_spec [vBinThetaFullSpecn] +=
dl;
993 }
994 }
995 }
996
997 if ( goodMaterial && (pdgid < 6 || pdgid > 7 )){
998
999 if ( vBinZoomSpeco >=0 ) {
1000 if ( pdgid == 0 ) {
1001 m_maps.m_rz_gamm_spec [vBinZoomSpeco] +=
dl;
1002 }
1003 else if ( pdgid == 1 ) {
1004 m_maps.m_rz_prot_spec [vBinZoomSpeco] +=
dl;
1005 }
1006 else if ( pdgid == 2 ) {
1007 m_maps.m_rz_pion_spec [vBinZoomSpeco] +=
dl;
1008 }
1009 else if ( pdgid == 3 ) {
1010 m_maps.m_rz_muon_spec [vBinZoomSpeco] +=
dl;
1011 }
1012 else if ( pdgid == 4 || pdgid == 5 ) {
1013 m_maps.m_rz_elec_spec [vBinZoomSpeco] +=
dl;
1014 }
1015 else {
1016 m_maps.m_rz_rest_spec [vBinZoomSpeco] +=
dl;
1017 }
1018 }
1019 if ( vBinFullSpeco >=0 ) {
1020 if ( pdgid == 0 ) {
1021 m_maps.m_full_rz_gamm_spec [vBinFullSpeco] +=
dl;
1022 }
1023 else if ( pdgid == 1 ) {
1024 m_maps.m_full_rz_prot_spec [vBinFullSpeco] +=
dl;
1025 }
1026 else if ( pdgid == 2 ) {
1027 m_maps.m_full_rz_pion_spec [vBinFullSpeco] +=
dl;
1028 }
1029 else if ( pdgid == 3 ) {
1030 m_maps.m_full_rz_muon_spec [vBinFullSpeco] +=
dl;
1031 }
1032 else if ( pdgid == 4 || pdgid == 5 ) {
1033 m_maps.m_full_rz_elec_spec [vBinFullSpeco] +=
dl;
1034 }
1035 else {
1036 m_maps.m_full_rz_rest_spec [vBinFullSpeco] +=
dl;
1037 }
1038 }
1039 if ( vBinThetaFullSpeco >=0 ) {
1040 if ( pdgid == 0 ) {
1041 m_maps.m_theta_full_rz_gamm_spec [vBinThetaFullSpeco] +=
dl;
1042 }
1043 else if ( pdgid == 1 ) {
1044 m_maps.m_theta_full_rz_prot_spec [vBinThetaFullSpeco] +=
dl;
1045 }
1046 else if ( pdgid == 2 ) {
1047 m_maps.m_theta_full_rz_pion_spec [vBinThetaFullSpeco] +=
dl;
1048 }
1049 else if ( pdgid == 3 ) {
1050 m_maps.m_theta_full_rz_muon_spec [vBinThetaFullSpeco] +=
dl;
1051 }
1052 else if ( pdgid == 4 || pdgid == 5 ) {
1053 m_maps.m_theta_full_rz_elec_spec [vBinThetaFullSpeco] +=
dl;
1054 }
1055 else {
1056 if ( absq > 0 ) {
1057 m_maps.m_theta_full_rz_rchgd_spec [vBinThetaFullSpeco] +=
dl;
1058 }
1059 else {
1060 m_maps.m_theta_full_rz_rneut_spec [vBinThetaFullSpeco] +=
dl;
1061 }
1062 }
1063 }
1064 }
1065
1067
1068 if ( (eKin > 1 && (pdgid == 6 || pdgid == 7)) || pdgid == 999) {
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082 if ( vBinZoom >=0 ) {
1084 }
1085 if ( vBinFull >=0 ) {
1087 }
1088 if ( vBin3d >=0 ) {
1090 }
1091 if ( goodMaterial ) {
1092
1093
1094
1095 if ( vBinZoom >=0 ) {
1097 }
1098 if ( vBinFull >=0 ) {
1100 }
1101 if ( vBin3d >=0 ) {
1103 }
1104 }
1105 }
1106 }
1107 }
1108 }
1109 }
const boost::regex rr(r_r)
Scalar phi() const
phi method
Scalar theta() const
theta method
double charge(const T &p)
constexpr int pow(int base, int exp) noexcept
int ir
counter of the current depth
l
Printing final latex table to .tex output file.