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 | // |
---|
26 | |
---|
27 | //#define debug |
---|
28 | //#define errors |
---|
29 | |
---|
30 | #include "PhotInStackingAction.hh" |
---|
31 | |
---|
32 | // Can be moved to the PhotInConstants.hh |
---|
33 | G4int PhotInStackingAction::PhotInNGamma [PhotInDiNSections] = {0,0,0,0,0,0}; |
---|
34 | G4int PhotInStackingAction::PhotInNElectron [PhotInDiNSections] = {0,0,0,0,0,0}; |
---|
35 | G4int PhotInStackingAction::PhotInNPositron [PhotInDiNSections] = {0,0,0,0,0,0}; |
---|
36 | G4int PhotInStackingAction::PhotInNNeutrons [PhotInDiNSections] = {0,0,0,0,0,0}; |
---|
37 | G4int PhotInStackingAction::PhotInNProtons [PhotInDiNSections] = {0,0,0,0,0,0}; |
---|
38 | G4int PhotInStackingAction::PhotInNDeuterons [PhotInDiNSections] = {0,0,0,0,0,0}; |
---|
39 | G4int PhotInStackingAction::PhotInNTritons [PhotInDiNSections] = {0,0,0,0,0,0}; |
---|
40 | G4int PhotInStackingAction::PhotInNHe3s [PhotInDiNSections] = {0,0,0,0,0,0}; |
---|
41 | G4int PhotInStackingAction::PhotInNAlphas [PhotInDiNSections] = {0,0,0,0,0,0}; |
---|
42 | G4int PhotInStackingAction::PhotInNLambdas [PhotInDiNSections] = {0,0,0,0,0,0}; |
---|
43 | G4int PhotInStackingAction::PhotInNHeavyFrags[PhotInDiNSections] = {0,0,0,0,0,0}; |
---|
44 | G4int PhotInStackingAction::PhotInNMesons [PhotInDiNSections] = {0,0,0,0,0,0}; |
---|
45 | G4double PhotInStackingAction::PhotInEMinGamma [PhotInDiNSections] = {DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX}; |
---|
46 | G4double PhotInStackingAction::PhotInEMinElectron [PhotInDiNSections] = {DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX}; |
---|
47 | G4double PhotInStackingAction::PhotInEMinPositron [PhotInDiNSections] = {DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX}; |
---|
48 | G4double PhotInStackingAction::PhotInEMinNeutrons [PhotInDiNSections] = {DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX}; |
---|
49 | G4double PhotInStackingAction::PhotInEMinProtons [PhotInDiNSections] = {DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX}; |
---|
50 | G4double PhotInStackingAction::PhotInEMinDeuterons [PhotInDiNSections] = {DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX}; |
---|
51 | G4double PhotInStackingAction::PhotInEMinTritons [PhotInDiNSections] = {DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX}; |
---|
52 | G4double PhotInStackingAction::PhotInEMinHe3s [PhotInDiNSections] = {DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX}; |
---|
53 | G4double PhotInStackingAction::PhotInEMinAlphas [PhotInDiNSections] = {DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX}; |
---|
54 | G4double PhotInStackingAction::PhotInEMinLambdas [PhotInDiNSections] = {DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX}; |
---|
55 | G4double PhotInStackingAction::PhotInEMinHeavyFrags[PhotInDiNSections] = {DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX}; |
---|
56 | G4double PhotInStackingAction::PhotInEMinMesons [PhotInDiNSections] = {DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX}; |
---|
57 | G4double PhotInStackingAction::PhotInEMaxGamma [PhotInDiNSections]={0.,0.,0.,0.,0.,0.}; |
---|
58 | G4double PhotInStackingAction::PhotInEMaxElectron [PhotInDiNSections]={0.,0.,0.,0.,0.,0.}; |
---|
59 | G4double PhotInStackingAction::PhotInEMaxPositron [PhotInDiNSections]={0.,0.,0.,0.,0.,0.}; |
---|
60 | G4double PhotInStackingAction::PhotInEMaxNeutrons [PhotInDiNSections]={0.,0.,0.,0.,0.,0.}; |
---|
61 | G4double PhotInStackingAction::PhotInEMaxProtons [PhotInDiNSections]={0.,0.,0.,0.,0.,0.}; |
---|
62 | G4double PhotInStackingAction::PhotInEMaxDeuterons [PhotInDiNSections]={0.,0.,0.,0.,0.,0.}; |
---|
63 | G4double PhotInStackingAction::PhotInEMaxTritons [PhotInDiNSections]={0.,0.,0.,0.,0.,0.}; |
---|
64 | G4double PhotInStackingAction::PhotInEMaxHe3s [PhotInDiNSections]={0.,0.,0.,0.,0.,0.}; |
---|
65 | G4double PhotInStackingAction::PhotInEMaxAlphas [PhotInDiNSections]={0.,0.,0.,0.,0.,0.}; |
---|
66 | G4double PhotInStackingAction::PhotInEMaxLambdas [PhotInDiNSections]={0.,0.,0.,0.,0.,0.}; |
---|
67 | G4double PhotInStackingAction::PhotInEMaxHeavyFrags[PhotInDiNSections]={0.,0.,0.,0.,0.,0.}; |
---|
68 | G4double PhotInStackingAction::PhotInEMaxMesons [PhotInDiNSections]={0.,0.,0.,0.,0.,0.}; |
---|
69 | |
---|
70 | PhotInStackingAction::PhotInStackingAction() {} |
---|
71 | |
---|
72 | PhotInStackingAction::~PhotInStackingAction(){} |
---|
73 | |
---|
74 | G4ClassificationOfNewTrack PhotInStackingAction::ClassifyNewTrack(const G4Track* aTrack) |
---|
75 | { |
---|
76 | G4TouchableHistory* theTouchable = (G4TouchableHistory*)(aTrack->GetTouchable()); |
---|
77 | G4int depth=0; // Depth of geometrical hierarchy of volumes |
---|
78 | if(theTouchable)depth=theTouchable->GetHistoryDepth(); |
---|
79 | #ifdef debug |
---|
80 | G4cout<<"PhotInStackingAction::ClassifyNewTrack: --------->>>>>>> depth="<<depth<<G4endl; |
---|
81 | #endif |
---|
82 | #ifdef debug |
---|
83 | G4cout<<"PhotInStackingAction::ClassifyNewTrack: XYZ="<<aTrack->GetPosition()<<G4endl; |
---|
84 | #endif |
---|
85 | if(depth>1) // It is in one of the Sections, not in the Mother volume |
---|
86 | { |
---|
87 | G4VPhysicalVolume* calPhys = theTouchable->GetVolume(depth-1);// PhysVolume of Sections |
---|
88 | if(calPhys) |
---|
89 | { |
---|
90 | G4String sectName=calPhys->GetName(); |
---|
91 | #ifdef debug |
---|
92 | G4cout<<"PhotInStackingAction::ClassifyNewTrack: SectionName="<<sectName<<G4endl; |
---|
93 | #endif |
---|
94 | G4int i = -1; // 2 * Section_number |
---|
95 | if (sectName==PhotInCalName[0]) { i = 0; } |
---|
96 | else if(sectName==PhotInCalName[1]) { i = 2; } |
---|
97 | else if(sectName==PhotInCalName[2]) { i = 4; } |
---|
98 | #ifdef errors |
---|
99 | if(i<0) G4cerr<<"*PhotInStackingAction::ClassifyNewTrack: sensitive i="<<i<<G4endl; |
---|
100 | #endif |
---|
101 | #ifdef debug |
---|
102 | G4int layerNumber=theTouchable->GetReplicaNumber(depth-2);//WhatIfLayers notFill Sect |
---|
103 | G4cout<<"PhotInStackingAction::ClassifyNewTrack: Layer#"<<layerNumber<<G4endl; |
---|
104 | #endif |
---|
105 | G4int slabNumber=-1; // Prototype of the slab number (-1 means absorber) |
---|
106 | if(depth>2) slabNumber=theTouchable->GetReplicaNumber(depth-3); |
---|
107 | else i++; // Collect information in the absorber |
---|
108 | #ifdef debug |
---|
109 | G4cout<<"PhotInStackingAction::ClassifyNewTrack:Slab#"<<slabNumber<<",i="<<i<<G4endl; |
---|
110 | #endif |
---|
111 | G4ParticleDefinition* particleType = aTrack->GetDefinition(); |
---|
112 | if(particleType==G4Gamma::GammaDefinition()) |
---|
113 | { |
---|
114 | PhotInNGamma[i]++; |
---|
115 | if(PhotInEMinGamma[i]>aTrack->GetKineticEnergy()) |
---|
116 | PhotInEMinGamma[i]=aTrack->GetKineticEnergy(); |
---|
117 | if(PhotInEMaxGamma[i]<aTrack->GetKineticEnergy()) |
---|
118 | PhotInEMaxGamma[i]=aTrack->GetKineticEnergy(); |
---|
119 | } |
---|
120 | else if(particleType==G4Electron::ElectronDefinition()) |
---|
121 | { |
---|
122 | PhotInNElectron[i]++; |
---|
123 | if(PhotInEMinElectron[i]>aTrack->GetKineticEnergy()) |
---|
124 | PhotInEMinElectron[i]=aTrack->GetKineticEnergy(); |
---|
125 | if(PhotInEMaxElectron[i]<aTrack->GetKineticEnergy()) |
---|
126 | PhotInEMaxElectron[i]=aTrack->GetKineticEnergy(); |
---|
127 | } |
---|
128 | else if(particleType==G4Positron::PositronDefinition()) |
---|
129 | { |
---|
130 | PhotInNPositron[i]++; |
---|
131 | if(PhotInEMinPositron[i]>aTrack->GetKineticEnergy()) |
---|
132 | PhotInEMinPositron[i]=aTrack->GetKineticEnergy(); |
---|
133 | if(PhotInEMaxPositron[i]<aTrack->GetKineticEnergy()) |
---|
134 | PhotInEMaxPositron[i]=aTrack->GetKineticEnergy(); |
---|
135 | } |
---|
136 | else if(particleType==G4Neutron::NeutronDefinition()) |
---|
137 | { |
---|
138 | PhotInNNeutrons[i]++; |
---|
139 | if(PhotInEMinNeutrons[i]>aTrack->GetKineticEnergy()) |
---|
140 | PhotInEMinNeutrons[i]=aTrack->GetKineticEnergy(); |
---|
141 | if(PhotInEMaxNeutrons[i]<aTrack->GetKineticEnergy()) |
---|
142 | PhotInEMaxNeutrons[i]=aTrack->GetKineticEnergy(); |
---|
143 | } |
---|
144 | else if(particleType==G4Proton::ProtonDefinition()) |
---|
145 | { |
---|
146 | PhotInNProtons[i]++; |
---|
147 | if(PhotInEMinProtons[i]>aTrack->GetKineticEnergy()) |
---|
148 | PhotInEMinProtons[i]=aTrack->GetKineticEnergy(); |
---|
149 | if(PhotInEMaxProtons[i]<aTrack->GetKineticEnergy()) |
---|
150 | PhotInEMaxProtons[i]=aTrack->GetKineticEnergy(); |
---|
151 | } |
---|
152 | else if(particleType==G4Deuteron::DeuteronDefinition()) |
---|
153 | { |
---|
154 | PhotInNDeuterons[i]++; |
---|
155 | if(PhotInEMinDeuterons[i]>aTrack->GetKineticEnergy()) |
---|
156 | PhotInEMinDeuterons[i]=aTrack->GetKineticEnergy(); |
---|
157 | if(PhotInEMaxDeuterons[i]<aTrack->GetKineticEnergy()) |
---|
158 | PhotInEMaxDeuterons[i]=aTrack->GetKineticEnergy(); |
---|
159 | } |
---|
160 | else if(particleType==G4Triton::TritonDefinition()) |
---|
161 | { |
---|
162 | PhotInNTritons[i]++; |
---|
163 | if(PhotInEMinTritons[i]>aTrack->GetKineticEnergy()) |
---|
164 | PhotInEMinTritons[i]=aTrack->GetKineticEnergy(); |
---|
165 | if(PhotInEMaxTritons[i]<aTrack->GetKineticEnergy()) |
---|
166 | PhotInEMaxTritons[i]=aTrack->GetKineticEnergy(); |
---|
167 | } |
---|
168 | else if(particleType==G4He3::He3Definition()) |
---|
169 | { |
---|
170 | PhotInNHe3s[i]++; |
---|
171 | if(PhotInEMinHe3s[i]>aTrack->GetKineticEnergy()) |
---|
172 | PhotInEMinHe3s[i]=aTrack->GetKineticEnergy(); |
---|
173 | if(PhotInEMaxHe3s[i]<aTrack->GetKineticEnergy()) |
---|
174 | PhotInEMaxHe3s[i]=aTrack->GetKineticEnergy(); |
---|
175 | } |
---|
176 | else if(particleType==G4Alpha::AlphaDefinition()) |
---|
177 | { |
---|
178 | PhotInNAlphas[i]++; |
---|
179 | if(PhotInEMinAlphas[i]>aTrack->GetKineticEnergy()) |
---|
180 | PhotInEMinAlphas[i]=aTrack->GetKineticEnergy(); |
---|
181 | if(PhotInEMaxAlphas[i]<aTrack->GetKineticEnergy()) |
---|
182 | PhotInEMaxAlphas[i]=aTrack->GetKineticEnergy(); |
---|
183 | } |
---|
184 | else if(particleType==G4Lambda::LambdaDefinition()) |
---|
185 | { |
---|
186 | PhotInNLambdas[i]++; |
---|
187 | if(PhotInEMinLambdas[i]>aTrack->GetKineticEnergy()) |
---|
188 | PhotInEMinLambdas[i]=aTrack->GetKineticEnergy(); |
---|
189 | if(PhotInEMaxLambdas[i]<aTrack->GetKineticEnergy()) |
---|
190 | PhotInEMaxLambdas[i]=aTrack->GetKineticEnergy(); |
---|
191 | } |
---|
192 | else if(particleType->GetBaryonNumber()>4) |
---|
193 | { |
---|
194 | PhotInNHeavyFrags[i]++; |
---|
195 | if(PhotInEMinHeavyFrags[i]>aTrack->GetKineticEnergy()) |
---|
196 | PhotInEMinHeavyFrags[i]=aTrack->GetKineticEnergy(); |
---|
197 | if(PhotInEMaxHeavyFrags[i]<aTrack->GetKineticEnergy()) |
---|
198 | PhotInEMaxHeavyFrags[i]=aTrack->GetKineticEnergy(); |
---|
199 | } |
---|
200 | else if(!particleType->GetBaryonNumber()) |
---|
201 | { |
---|
202 | PhotInNMesons[i]++; |
---|
203 | if(PhotInEMinMesons[i]>aTrack->GetKineticEnergy()) |
---|
204 | PhotInEMinMesons[i]=aTrack->GetKineticEnergy(); |
---|
205 | if(PhotInEMaxMesons[i]<aTrack->GetKineticEnergy()) |
---|
206 | PhotInEMaxMesons[i]=aTrack->GetKineticEnergy(); |
---|
207 | } |
---|
208 | } |
---|
209 | } |
---|
210 | return fUrgent; |
---|
211 | } |
---|
212 | |
---|
213 | void PhotInStackingAction::PrepareNewEvent() |
---|
214 | { |
---|
215 | for(int i=0; i<PhotInDiNSections ;i++) |
---|
216 | { |
---|
217 | PhotInNGamma [i] = 0; |
---|
218 | PhotInNElectron [i] = 0; |
---|
219 | PhotInNPositron [i] = 0; |
---|
220 | PhotInNNeutrons [i] = 0; |
---|
221 | PhotInNProtons [i] = 0; |
---|
222 | PhotInNDeuterons [i] = 0; |
---|
223 | PhotInNTritons [i] = 0; |
---|
224 | PhotInNHe3s [i] = 0; |
---|
225 | PhotInNAlphas [i] = 0; |
---|
226 | PhotInNLambdas [i] = 0; |
---|
227 | PhotInNHeavyFrags[i] = 0; |
---|
228 | PhotInNMesons [i] = 0; |
---|
229 | |
---|
230 | PhotInEMinGamma [i] = DBL_MAX; |
---|
231 | PhotInEMinElectron [i] = DBL_MAX; |
---|
232 | PhotInEMinPositron [i] = DBL_MAX; |
---|
233 | PhotInEMinNeutrons [i] = DBL_MAX; |
---|
234 | PhotInEMinProtons [i] = DBL_MAX; |
---|
235 | PhotInEMinDeuterons [i] = DBL_MAX; |
---|
236 | PhotInEMinTritons [i] = DBL_MAX; |
---|
237 | PhotInEMinHe3s [i] = DBL_MAX; |
---|
238 | PhotInEMinAlphas [i] = DBL_MAX; |
---|
239 | PhotInEMinLambdas [i] = DBL_MAX; |
---|
240 | PhotInEMinHeavyFrags[i] = DBL_MAX; |
---|
241 | PhotInEMinMesons [i] = DBL_MAX; |
---|
242 | |
---|
243 | PhotInEMaxGamma [i] = 0.; |
---|
244 | PhotInEMaxElectron [i] = 0.; |
---|
245 | PhotInEMaxPositron [i] = 0.; |
---|
246 | PhotInEMaxNeutrons [i] = 0.; |
---|
247 | PhotInEMaxProtons [i] = 0.; |
---|
248 | PhotInEMaxDeuterons [i] = 0.; |
---|
249 | PhotInEMaxTritons [i] = 0.; |
---|
250 | PhotInEMaxHe3s [i] = 0.; |
---|
251 | PhotInEMaxAlphas [i] = 0.; |
---|
252 | PhotInEMaxLambdas [i] = 0.; |
---|
253 | PhotInEMaxHeavyFrags[i] = 0.; |
---|
254 | PhotInEMaxMesons [i] = 0.; |
---|
255 | } |
---|
256 | } |
---|
257 | |
---|
258 | |
---|