File indexing completed on 2026-09-18 08:31:31
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 #include "StackingAction.hh"
0030
0031 #include "EventAction.hh"
0032 #include "HistoManager.hh"
0033 #include "Run.hh"
0034 #include "StackingMessenger.hh"
0035
0036 #include "G4EmSecondaryParticleType.hh"
0037 #include "G4RunManager.hh"
0038 #include "G4Track.hh"
0039
0040
0041
0042 StackingAction::StackingAction(EventAction* event) : fEventAction(event)
0043 {
0044 fStackMessenger = new StackingMessenger(this);
0045 }
0046
0047
0048
0049 StackingAction::~StackingAction()
0050 {
0051 delete fStackMessenger;
0052 }
0053
0054
0055
0056 G4ClassificationOfNewTrack StackingAction::ClassifyNewTrack(const G4Track* aTrack)
0057 {
0058 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
0059
0060
0061 if (aTrack->GetParentID() == 0) {
0062 return fUrgent;
0063 }
0064
0065 G4int procID = aTrack->GetCreatorProcess()->GetProcessSubType();
0066 G4int modelID = aTrack->GetCreatorModelID();
0067
0068
0069 Run* run = static_cast<Run*>(G4RunManager::GetRunManager()->GetNonConstCurrentRun());
0070 run->CountParticles(aTrack->GetDefinition());
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080 G4double energy = aTrack->GetKineticEnergy();
0081 G4double charge = aTrack->GetDefinition()->GetPDGCharge();
0082
0083 if (charge != 0.) {
0084 analysisManager->FillH1(2, energy);
0085 analysisManager->FillH1(4, energy);
0086 if (procID >= 51 && procID <= 65) {
0087 analysisManager->FillH1(58, energy);
0088 analysisManager->FillH1(60, energy);
0089 }
0090 else if (_AugerElectron == modelID) {
0091 analysisManager->FillH1(50, energy);
0092 analysisManager->FillH1(52, energy);
0093 }
0094 else if (_ePIXE == modelID) {
0095 analysisManager->FillH1(54, energy);
0096 analysisManager->FillH1(56, energy);
0097 }
0098 }
0099
0100 if (aTrack->GetDefinition() == G4Gamma::Gamma()) {
0101 analysisManager->FillH1(3, energy);
0102 analysisManager->FillH1(5, energy);
0103 if (procID >= 51 && procID <= 65) {
0104 analysisManager->FillH1(59, energy);
0105 analysisManager->FillH1(61, energy);
0106 }
0107 else if (_Fluorescence == modelID) {
0108 analysisManager->FillH1(51, energy);
0109 analysisManager->FillH1(53, energy);
0110 }
0111 else if (_GammaPIXE == modelID) {
0112 analysisManager->FillH1(55, energy);
0113 analysisManager->FillH1(57, energy);
0114 }
0115 }
0116
0117
0118 G4ClassificationOfNewTrack status = fUrgent;
0119 if (0 < fKillSecondary) {
0120 if (fKillSecondary == 1) {
0121 fEventAction->AddEnergy(energy);
0122 }
0123 status = fKill;
0124 }
0125
0126 return status;
0127 }
0128
0129