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