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