1 |
#include "PamG4RegionConstruction.h" |
2 |
|
3 |
#include <G4Material.hh> |
4 |
#include <G4ParticleDefinition.hh> |
5 |
#include <G4Electron.hh> |
6 |
#include <G4ProcessManager.hh> |
7 |
#include <G4ProductionCuts.hh> |
8 |
#include <G4LogicalVolume.hh> |
9 |
#include <G4VPhysicalVolume.hh> |
10 |
#include <G4Region.hh> |
11 |
#include <G4RegionStore.hh> |
12 |
#include <G4ProductionCutsTable.hh> |
13 |
#include <G4EmCalculator.hh> |
14 |
|
15 |
#include <TGeoManager.h> |
16 |
#include <TGeoVolume.h> |
17 |
#include <TObjArray.h> |
18 |
#include <TG4GeometryServices.h> |
19 |
#include <TG4Limits.h> |
20 |
PamG4RegionConstruction::PamG4RegionConstruction(const G4String& name): |
21 |
TG4VUserRegionConstruction(), fname(name) |
22 |
{ |
23 |
/// Standard constructor |
24 |
} |
25 |
|
26 |
PamG4RegionConstruction::PamG4RegionConstruction( |
27 |
G4int verboselevel, |
28 |
const G4String& name): |
29 |
TG4VUserRegionConstruction(), fname(name), fverboselevel(verboselevel) |
30 |
{ |
31 |
/// Destructor |
32 |
} |
33 |
|
34 |
|
35 |
void PamG4RegionConstruction::Construct() |
36 |
{ |
37 |
|
38 |
if (fverboselevel > 0) { |
39 |
G4cout<< "### RANGE Cuts constructed. " << G4endl; |
40 |
} |
41 |
|
42 |
G4Region* IRONreg = new G4Region("IRON_reg"); |
43 |
G4Region* TUNGAreg = new G4Region("TUNGA_reg"); |
44 |
G4Region* He3reg = new G4Region("He3_reg"); |
45 |
G4Region* ALUMINIUMreg = new G4Region("ALUMINIUM_reg"); |
46 |
G4Region* N2GASreg = new G4Region("N2GAS_reg"); |
47 |
G4Region* SCINTreg = new G4Region("SCINT_reg"); |
48 |
G4Region* SBARreg = new G4Region("SBAR_reg"); |
49 |
G4Region* PLASTreg = new G4Region("PLAST_reg"); |
50 |
G4Region* CADMIUMreg = new G4Region("CADMIUM_reg"); |
51 |
G4Region* SICALOreg = new G4Region("SICALO_reg"); |
52 |
G4Region* SITRreg = new G4Region("SITR_reg"); |
53 |
G4Region* CERAMICreg = new G4Region("CERAMIC_reg"); |
54 |
G4Region* G10Creg = new G4Region("G10C_reg"); |
55 |
G4Region* POLYSTYRENEreg = new G4Region("POLYSTYRENE_reg"); |
56 |
G4Region* MYLARreg = new G4Region("MYLAR_reg"); |
57 |
G4Region* TIALVAreg = new G4Region("TIALVA_reg"); |
58 |
G4Region* POLYETHYLENEreg = new G4Region("POLYETHYLENE_reg"); |
59 |
G4Region* AMG6Mreg = new G4Region("AMG6M_reg"); |
60 |
G4Region* NYLON6reg = new G4Region("NYLON6_reg"); |
61 |
|
62 |
|
63 |
G4ProductionCuts* IRONcuts = new G4ProductionCuts(); |
64 |
G4ProductionCuts* TUNGAcuts = new G4ProductionCuts(); |
65 |
G4ProductionCuts* He3cuts = new G4ProductionCuts(); |
66 |
G4ProductionCuts* ALUMINIUMcuts = new G4ProductionCuts(); |
67 |
G4ProductionCuts* N2GAScuts = new G4ProductionCuts(); |
68 |
G4ProductionCuts* SCINTcuts = new G4ProductionCuts(); |
69 |
G4ProductionCuts* SBARcuts = new G4ProductionCuts(); |
70 |
G4ProductionCuts* PLASTcuts = new G4ProductionCuts(); |
71 |
G4ProductionCuts* CADMIUMcuts = new G4ProductionCuts(); |
72 |
G4ProductionCuts* SICALOcuts = new G4ProductionCuts(); |
73 |
G4ProductionCuts* SITRcuts = new G4ProductionCuts(); |
74 |
G4ProductionCuts* CERAMICcuts = new G4ProductionCuts(); |
75 |
G4ProductionCuts* G10Ccuts = new G4ProductionCuts(); |
76 |
G4ProductionCuts* POLYSTYRENEcuts = new G4ProductionCuts(); |
77 |
G4ProductionCuts* MYLARcuts = new G4ProductionCuts(); |
78 |
G4ProductionCuts* TIALVAcuts = new G4ProductionCuts(); |
79 |
G4ProductionCuts* POLYETHYLENEcuts = new G4ProductionCuts(); |
80 |
G4ProductionCuts* AMG6Mcuts = new G4ProductionCuts(); |
81 |
G4ProductionCuts* NYLON6cuts = new G4ProductionCuts(); |
82 |
|
83 |
TObjArray * VolArr = gGeoManager->GetListOfVolumes(); |
84 |
TIterator *n= (TIterator *)VolArr->MakeIterator(); |
85 |
TGeoVolume *vol = 0; |
86 |
G4LogicalVolume *tmpLV; |
87 |
|
88 |
|
89 |
TString volname=""; |
90 |
TString matname=""; |
91 |
|
92 |
while((vol=(TGeoVolume*)n->Next())){ |
93 |
volname = vol->GetName(); |
94 |
matname = vol->GetMaterial()->GetName(); |
95 |
tmpLV = 0; |
96 |
tmpLV = TG4GeometryServices::Instance()->FindLogicalVolume((G4String)volname); |
97 |
LoopDaughters(tmpLV); |
98 |
} |
99 |
|
100 |
|
101 |
//++++100 keV+++// |
102 |
IRONcuts->SetProductionCut(28*mm,"gamma"); // 127.8mm = 994.863 keV 128mm = 1.03095eV |
103 |
IRONcuts->SetProductionCut(25.5*um,"e-"); // 0.737mm=988.422keV 0.739mm=1.00067MeV |
104 |
IRONcuts->SetProductionCut(26.*um,"e+"); // 0.787mm=988.422keV 0.788mm=1.00067MeV |
105 |
IRONreg->SetProductionCuts(IRONcuts); |
106 |
//++++100 keV+++// |
107 |
|
108 |
TUNGAcuts->SetProductionCut(16.1*um,"gamma"); // 16.11=10.0745 16.10=9.99505 |
109 |
TUNGAcuts->SetProductionCut(815.075*nm,"e-"); // 815.075=9.99908 815.0752=10.096 |
110 |
TUNGAcuts->SetProductionCut(819.1*nm,"e+"); // 819.100=9.92394 819.105=10.0197 |
111 |
TUNGAreg->SetProductionCuts(TUNGAcuts); |
112 |
|
113 |
He3cuts->SetProductionCut(278*m,"gamma"); // 278m=99.0295 keV 279m=109.225keV |
114 |
He3cuts->SetProductionCut(79.2*mm,"e-"); // 79.2mm=99.5054mm 79.3mm=100.12keV |
115 |
He3cuts->SetProductionCut(81*mm,"e+"); // 81mm=99.5054 81.5mm=100.12 |
116 |
He3reg->SetProductionCuts(He3cuts); |
117 |
|
118 |
//++++100 keV+++// |
119 |
ALUMINIUMcuts->SetProductionCut(12.3922*cm,"gamma"); |
120 |
ALUMINIUMcuts->SetProductionCut(64*um,"e-"); |
121 |
ALUMINIUMcuts->SetProductionCut(65.6*um,"e+"); |
122 |
ALUMINIUMreg->SetProductionCuts(ALUMINIUMcuts); |
123 |
//++++100 keV+++// |
124 |
|
125 |
//++++100 keV+++// |
126 |
N2GAScuts->SetProductionCut(277*m,"gamma"); // 278m=99.0295 keV 279m=109.225keV |
127 |
N2GAScuts->SetProductionCut(12.3*cm,"e-"); // 79.2mm=99.5054mm 79.3mm=100.12keV |
128 |
N2GAScuts->SetProductionCut(12.6*cm,"e+"); // 81mm=99.5054 81.5mm=100.12 |
129 |
N2GASreg->SetProductionCuts(N2GAScuts); |
130 |
//++++100 keV+++// |
131 |
|
132 |
//++++100 keV+++// |
133 |
SCINTcuts->SetProductionCut(33.8*cm,"gamma"); // 278m=99.0295 keV 42mm=10.0695 |
134 |
SCINTcuts->SetProductionCut(133.*um,"e-"); // .04mm=99.5054mm 79.3mm=100.12keV |
135 |
SCINTcuts->SetProductionCut(136.*um,"e+"); // 4.27 mm=9.18.046 81.5mm=100.12 |
136 |
SCINTreg->SetProductionCuts(SCINTcuts); |
137 |
//++++100 keV+++// |
138 |
|
139 |
//++++100 keV+++// |
140 |
PLASTcuts->SetProductionCut(34.2*cm,"gamma"); // 278m=99.0295 keV 42mm=10.0695 |
141 |
PLASTcuts->SetProductionCut(145.*um,"e-"); // .04mm=99.5054mm 79.3mm=100.12keV |
142 |
PLASTcuts->SetProductionCut(149.*um,"e+"); // 4.27 mm=9.18.046 81.5mm=100.12 |
143 |
PLASTreg->SetProductionCuts(PLASTcuts); |
144 |
//++++100 keV+++// |
145 |
|
146 |
//++++100 keV+++// |
147 |
CADMIUMcuts->SetProductionCut(6.79*mm,"gamma"); // 278m=99.0295 keV 42mm=10.0695 |
148 |
CADMIUMcuts->SetProductionCut(27.5*um,"e-"); // .04mm=99.5054mm 79.3mm=100.12keV |
149 |
CADMIUMcuts->SetProductionCut(28.5*um,"e+"); // 4.27 mm=9.18.046 81.5mm=100.12 |
150 |
CADMIUMreg->SetProductionCuts(CADMIUMcuts); |
151 |
//++++100 keV+++// |
152 |
|
153 |
// SICALOcuts->SetProductionCut(2.172*mm,"gamma"); // 278m=99.0295 keV 42mm=10.0695 |
154 |
// SICALOcuts->SetProductionCut(4.257*um,"e-"); // .04mm=99.5054mm 79.3mm=100.12keV |
155 |
// SICALOcuts->SetProductionCut(4.331*um,"e+"); // 4.27 mm=9.18.046 81.5mm=100.12 |
156 |
// SICALOreg->SetProductionCuts(SICALOcuts); |
157 |
|
158 |
SICALOcuts->SetProductionCut(0.02*mm,"gamma"); // 278m=99.0295 keV 42mm=10.0695 |
159 |
SICALOcuts->SetProductionCut(0.02*um,"e-"); // .04mm=99.5054mm 79.3mm=100.12keV |
160 |
SICALOcuts->SetProductionCut(0.02*um,"e+"); // 4.27 mm=9.18.046 81.5mm=100.12 |
161 |
SICALOreg->SetProductionCuts(SICALOcuts); |
162 |
|
163 |
//++++100 keV+++// |
164 |
SITRcuts->SetProductionCut(13.6*cm,"gamma"); // 278m=99.0295 keV 42mm=10.0695 |
165 |
//++++100 keV+++// |
166 |
SITRcuts->SetProductionCut(4.257*um,"e-"); // .04mm=99.5054mm 79.3mm=100.12keV |
167 |
SITRcuts->SetProductionCut(4.331*um,"e+"); // 4.27 mm=9.18.046 81.5mm=100.12 |
168 |
SITRreg->SetProductionCuts(SITRcuts); |
169 |
|
170 |
SBARcuts->SetProductionCut(2.33*cm,"gamma"); // 278m=99.0295 keV 42mm=10.0695 |
171 |
SBARcuts->SetProductionCut(5.7447*um,"e-"); // .04mm=99.5054mm 79.3mm=100.12keV |
172 |
SBARcuts->SetProductionCut(5.8314*um,"e+"); // 4.27 mm=9.18.046 81.5mm=100.12 |
173 |
SBARreg->SetProductionCuts(SBARcuts); |
174 |
|
175 |
|
176 |
CERAMICcuts->SetProductionCut(3.436*mm,"gamma"); // 278m=99.0295 keV 42mm=10.0695 |
177 |
CERAMICcuts->SetProductionCut(3.6067*um,"e-"); // .04mm=99.5054mm 79.3mm=100.12keV |
178 |
CERAMICcuts->SetProductionCut(3.6654*um,"e+"); // 4.27 mm=9.18.046 81.5mm=100.12 |
179 |
CERAMICreg->SetProductionCuts(CERAMICcuts); |
180 |
|
181 |
G10Ccuts->SetProductionCut(4.63*mm,"gamma"); // 278m=99.0295 keV 42mm=10.0695 |
182 |
G10Ccuts->SetProductionCut(5.45129*um,"e-"); // .04mm=99.5054mm 79.3mm=100.12keV |
183 |
G10Ccuts->SetProductionCut(5.5422*um,"e+"); // 4.27 mm=9.18.046 81.5mm=100.12 |
184 |
G10Creg->SetProductionCuts(G10Ccuts); |
185 |
|
186 |
//++++100 keV+++/ |
187 |
POLYSTYRENEcuts->SetProductionCut(1.239*m,"gamma"); // 278m=99.0295 keV 42mm=10.0695 |
188 |
POLYSTYRENEcuts->SetProductionCut(238.07*um,"e-"); // .04mm=99.5054mm 79.3mm=100.12keV |
189 |
POLYSTYRENEcuts->SetProductionCut(240.04*um,"e+"); // 4.27 mm=9.18.046 81.5mm=100.12 |
190 |
POLYSTYRENEreg->SetProductionCuts(POLYSTYRENEcuts); |
191 |
//++++100 keV+++/ |
192 |
|
193 |
MYLARcuts->SetProductionCut(24.94*cm,"gamma"); // 278m=99.0295 keV 42mm=10.0695 |
194 |
MYLARcuts->SetProductionCut(102.9*um,"e-"); // .04mm=99.5054mm 79.3mm=100.12keV |
195 |
MYLARcuts->SetProductionCut(105.6*um,"e+"); // 4.27 mm=9.18.046 81.5mm=100.12 |
196 |
MYLARreg->SetProductionCuts(MYLARcuts); |
197 |
|
198 |
//++++100 keV+++// |
199 |
TIALVAcuts->SetProductionCut(61.4*mm,"gamma"); // 278m=99.0295 keV 42mm=10.0695 |
200 |
TIALVAcuts->SetProductionCut(43.05*um,"e-"); // .04mm=99.5054mm 79.3mm=100.12keV |
201 |
TIALVAcuts->SetProductionCut(44.5*um,"e+"); // 4.27 mm=9.18.046 81.5mm=100.12 |
202 |
TIALVAreg->SetProductionCuts(TIALVAcuts); |
203 |
//++++100 keV+++// |
204 |
|
205 |
POLYETHYLENEcuts->SetProductionCut(37.3*cm,"gamma"); // 278m=99.0295 keV 42mm=10.0695 |
206 |
POLYETHYLENEcuts->SetProductionCut(135.05*um,"e-"); // .04mm=99.5054mm 79.3mm=100.12keV |
207 |
POLYETHYLENEcuts->SetProductionCut(138*um,"e+"); // 4.27 mm=9.18.046 81.5mm=100.12 |
208 |
POLYETHYLENEreg->SetProductionCuts(POLYETHYLENEcuts); |
209 |
|
210 |
//++++100 keV+++// |
211 |
AMG6Mcuts->SetProductionCut(12.8*cm,"gamma"); |
212 |
AMG6Mcuts->SetProductionCut(67*um,"e-"); |
213 |
AMG6Mcuts->SetProductionCut(69*um,"e+"); |
214 |
AMG6Mreg->SetProductionCuts(AMG6Mcuts); |
215 |
|
216 |
NYLON6cuts->SetProductionCut(30.378*cm,"gamma"); |
217 |
NYLON6cuts->SetProductionCut(117*um,"e-"); |
218 |
NYLON6cuts->SetProductionCut(120*um,"e+"); |
219 |
NYLON6reg->SetProductionCuts(NYLON6cuts); |
220 |
//++++100 keV+++// |
221 |
|
222 |
|
223 |
// TG4GeometryServices::Instance()->PrintLogicalVolumeStore(); //leave for check |
224 |
|
225 |
} |
226 |
|
227 |
void PamG4RegionConstruction::LoopDaughters(G4LogicalVolume * vol){ |
228 |
|
229 |
size_t noDaughters = vol->GetNoDaughters(); |
230 |
|
231 |
if(noDaughters==0) { if(vol->GetName()!="PAME") SetCuts(vol); return; } |
232 |
|
233 |
for (register size_t i=0; i<noDaughters; i++) |
234 |
{ |
235 |
G4LogicalVolume* daughterLVol = vol->GetDaughter(i)->GetLogicalVolume(); |
236 |
LoopDaughters(daughterLVol); |
237 |
} |
238 |
if(vol->GetName()!="PAME") SetCuts(vol); |
239 |
} |
240 |
|
241 |
void PamG4RegionConstruction::SetCuts(G4LogicalVolume * vol){ |
242 |
|
243 |
G4Region* tmpreg =0; |
244 |
G4String matname = vol->GetMaterial()->GetName(); |
245 |
if(matname=="IRON"){ |
246 |
tmpreg = G4RegionStore::GetInstance()->GetRegion("IRON_reg"); |
247 |
tmpreg->AddRootLogicalVolume(vol); |
248 |
} |
249 |
if(matname=="TUNGA"){ |
250 |
tmpreg = G4RegionStore::GetInstance()->GetRegion("TUNGA_reg"); |
251 |
tmpreg->AddRootLogicalVolume(vol); |
252 |
} |
253 |
if(matname=="He3"){ |
254 |
tmpreg = G4RegionStore::GetInstance()->GetRegion("He3_reg"); |
255 |
tmpreg->AddRootLogicalVolume(vol); |
256 |
} |
257 |
if(matname=="ALUMINIUM"){ |
258 |
tmpreg = G4RegionStore::GetInstance()->GetRegion("ALUMINIUM_reg"); |
259 |
tmpreg->AddRootLogicalVolume(vol); |
260 |
} |
261 |
|
262 |
if(matname=="SCINT"){ |
263 |
tmpreg = G4RegionStore::GetInstance()->GetRegion("SCINT_reg"); |
264 |
tmpreg->AddRootLogicalVolume(vol); |
265 |
} |
266 |
if(matname=="SBAR"){ |
267 |
tmpreg = G4RegionStore::GetInstance()->GetRegion("SBAR_reg"); |
268 |
tmpreg->AddRootLogicalVolume(vol); |
269 |
} |
270 |
if(matname=="N2GAS"){ |
271 |
tmpreg = G4RegionStore::GetInstance()->GetRegion("N2GAS_reg"); |
272 |
tmpreg->AddRootLogicalVolume(vol); |
273 |
} |
274 |
if(matname=="PLAST"){ |
275 |
tmpreg = G4RegionStore::GetInstance()->GetRegion("PLAST_reg"); |
276 |
tmpreg->AddRootLogicalVolume(vol); |
277 |
} |
278 |
if(matname=="CADMIUM"){ |
279 |
tmpreg = G4RegionStore::GetInstance()->GetRegion("CADMIUM_reg"); |
280 |
tmpreg->AddRootLogicalVolume(vol); |
281 |
} |
282 |
if(matname=="SILICON CA"){ |
283 |
tmpreg = G4RegionStore::GetInstance()->GetRegion("SICALO_reg"); |
284 |
tmpreg->AddRootLogicalVolume(vol); |
285 |
} |
286 |
if(matname=="SILICON TR"){ |
287 |
tmpreg = G4RegionStore::GetInstance()->GetRegion("SITR_reg"); |
288 |
tmpreg->AddRootLogicalVolume(vol); |
289 |
} |
290 |
if(matname=="CERAMIC"){ |
291 |
tmpreg = G4RegionStore::GetInstance()->GetRegion("CERAMIC_reg"); |
292 |
tmpreg->AddRootLogicalVolume(vol); |
293 |
} |
294 |
|
295 |
if(matname=="G10C"){ |
296 |
tmpreg = G4RegionStore::GetInstance()->GetRegion("G10C_reg"); |
297 |
tmpreg->AddRootLogicalVolume(vol); |
298 |
} |
299 |
if(matname=="POLYSTYRENE"){ |
300 |
tmpreg = G4RegionStore::GetInstance()->GetRegion("POLYSTYRENE_reg"); |
301 |
tmpreg->AddRootLogicalVolume(vol); |
302 |
} |
303 |
if(matname=="MYLAR"){ |
304 |
tmpreg = G4RegionStore::GetInstance()->GetRegion("MYLAR_reg"); |
305 |
tmpreg->AddRootLogicalVolume(vol); |
306 |
} |
307 |
if(matname=="TIALVA"){ |
308 |
tmpreg = G4RegionStore::GetInstance()->GetRegion("TIALVA_reg"); |
309 |
tmpreg->AddRootLogicalVolume(vol); |
310 |
} |
311 |
if(matname=="POLYETHYLENE"){ |
312 |
tmpreg = G4RegionStore::GetInstance()->GetRegion("POLYETHYLENE_reg"); |
313 |
tmpreg->AddRootLogicalVolume(vol); |
314 |
} |
315 |
if(matname=="AMG6M"){ |
316 |
tmpreg = G4RegionStore::GetInstance()->GetRegion("AMG6M_reg"); |
317 |
tmpreg->AddRootLogicalVolume(vol); |
318 |
} |
319 |
if(matname=="NYLON6"){ |
320 |
tmpreg = G4RegionStore::GetInstance()->GetRegion("NYLON6_reg"); |
321 |
tmpreg->AddRootLogicalVolume(vol); |
322 |
} |
323 |
} |
324 |
|
325 |
|
326 |
|
327 |
|