/[PAMELA software]/PamVMC/PamG4RunConfiguration/src/PamG4RegionConstruction.cxx
ViewVC logotype

Annotation of /PamVMC/PamG4RunConfiguration/src/PamG4RegionConstruction.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Fri Jun 12 18:53:39 2009 UTC (15 years, 5 months ago) by pam-rm2
Branch: MAIN
CVS Tags: v1r0, HEAD
*** empty log message ***

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

  ViewVC Help
Powered by ViewVC 1.1.23