ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StackingAction.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file StackingAction.cc
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
28 //
29 //
30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 
33 #include "StackingAction.hh"
34 
35 #include "Run.hh"
36 #include "EventAction.hh"
37 #include "HistoManager.hh"
38 #include "StackingMessenger.hh"
39 
40 #include "G4RunManager.hh"
41 #include "G4Track.hh"
42 
43 #include "G4SystemOfUnits.hh"
44 
45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
46 
48  : G4UserStackingAction(), fEventAction(EA),
49  fKillSecondary(0),fStackMessenger(0),fPhotoGamma(-1),fComptGamma(-1),
50  fPhotoAuger(-1),fComptAuger(-1),fPixeGamma(-1),fPixeAuger(-1),
51  fElectronDNAGamma(-1),fElectronDNAAuger(-1),fProtonDNAGamma(-1),
52  fProtonDNAAuger(-1),fHydrogenDNAGamma(-1),fHydrogenDNAAuger(-1),
53  fAlphaDNAGamma(-1),fAlphaDNAAuger(-1),fAlphaPlusDNAGamma(-1),
54  fAlphaPlusDNAAuger(-1),fHeliumDNAGamma(-1),fHeliumDNAAuger(-1),
55  fGenericIonDNAGamma(-1),fGenericIonDNAAuger(-1),fIDdefined(false)
56 {
58 }
59 
60 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
61 
63 {
64  delete fStackMessenger;
65 }
66 
67 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
68 
71 {
73 
74  //keep primary particle
75  if (aTrack->GetParentID() == 0) { return fUrgent; }
76 
77  if(!fIDdefined) {
78  fIDdefined = true;
86  G4PhysicsModelCatalog::GetIndex("e-_G4DNAIonisation_fluo");
88  G4PhysicsModelCatalog::GetIndex("e-_G4DNAIonisation_auger");
90  G4PhysicsModelCatalog::GetIndex("proton_G4DNAIonisation_fluo");
92  G4PhysicsModelCatalog::GetIndex("proton_G4DNAIonisation_auger");
94  G4PhysicsModelCatalog::GetIndex("hydrogen_G4DNAIonisation_fluo");
96  G4PhysicsModelCatalog::GetIndex("hydrogen_G4DNAIonisation_auger");
98  G4PhysicsModelCatalog::GetIndex("alpha_G4DNAIonisation_fluo");
100  G4PhysicsModelCatalog::GetIndex("alpha_G4DNAIonisation_auger");
102  G4PhysicsModelCatalog::GetIndex("alpha+_G4DNAIonisation_fluo");
104  G4PhysicsModelCatalog::GetIndex("alpha+_G4DNAIonisation_auger");
105  fHeliumDNAGamma =
106  G4PhysicsModelCatalog::GetIndex("helium_G4DNAIonisation_fluo");
107  fHeliumDNAAuger =
108  G4PhysicsModelCatalog::GetIndex("helium_G4DNAIonisation_auger");
110  G4PhysicsModelCatalog::GetIndex("GenericIon_G4DNAIonisation_fluo");
112  G4PhysicsModelCatalog::GetIndex("GenericIon_G4DNAIonisation_auger");
113  }
114  G4int idx = aTrack->GetCreatorModelID();
115 
116  //count secondary particles
117 
118  Run* run = static_cast<Run*>(
120  run->CountParticles(aTrack->GetDefinition());
121  /*
122  G4cout << "###StackingAction: new "
123  << aTrack->GetDefinition()->GetParticleName()
124  << " E(MeV)= " << aTrack->GetKineticEnergy()
125  << " " << aTrack->GetMomentumDirection() << G4endl;
126  */
127  //
128  //energy spectrum of secondaries
129  //
130  G4double energy = aTrack->GetKineticEnergy();
131  G4double loge = (energy > 0.) ? std::log10(energy/CLHEP::MeV) : -100.;
132  G4double charge = aTrack->GetDefinition()->GetPDGCharge();
133 
134  if (charge != 0.) {
135  analysisManager->FillH1(2,energy);
136  analysisManager->FillH1(4,loge);
137  if(idx == fPhotoAuger || idx == fComptAuger) {
138  analysisManager->FillH1(50,energy);
139  analysisManager->FillH1(52,loge);
140  } else if(idx == fPixeAuger) {
141  analysisManager->FillH1(54,energy);
142  analysisManager->FillH1(56,loge);
143  } else if(idx == fElectronDNAAuger ||
144  idx == fProtonDNAAuger ||
145  idx == fHydrogenDNAAuger ||
146  idx == fAlphaDNAAuger ||
147  idx == fAlphaPlusDNAAuger ||
148  idx == fHeliumDNAAuger ||
149  idx == fGenericIonDNAAuger) {
150  analysisManager->FillH1(58,energy);
151  analysisManager->FillH1(60,loge);
152  }
153  }
154 
155  if (aTrack->GetDefinition() == G4Gamma::Gamma()) {
156  analysisManager->FillH1(3,energy);
157  analysisManager->FillH1(5,loge);
158  if(idx == fPhotoGamma || idx == fComptGamma) {
159  analysisManager->FillH1(51,energy);
160  analysisManager->FillH1(53,loge);
161  } else if(idx == fPixeGamma) {
162  analysisManager->FillH1(55,energy);
163  analysisManager->FillH1(57,loge);
164  } else if(idx == fElectronDNAGamma ||
165  idx == fProtonDNAGamma ||
166  idx == fHydrogenDNAGamma ||
167  idx == fAlphaDNAGamma ||
168  idx == fAlphaPlusDNAGamma ||
169  idx == fHeliumDNAGamma ||
170  idx == fGenericIonDNAGamma) {
171  analysisManager->FillH1(59,energy);
172  analysisManager->FillH1(61,loge);
173  }
174  }
175 
176  //stack or delete secondaries
178  if (fKillSecondary) {
179  if (fKillSecondary == 1) {
180  fEventAction->AddEnergy(energy);
181  status = fKill;
182  }
183  if (aTrack->GetDefinition() == G4Gamma::Gamma()) {
184  status = fKill;
185  }
186  }
187 
188  return status;
189 }
190 
191 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......