source: trunk/examples/advanced/lAr_calorimeter/src/FCALTestbeamSetup.cc@ 1307

Last change on this file since 1307 was 807, checked in by garnier, 17 years ago

update

File size: 17.2 KB
Line 
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// Author: Mathieu Fontaine Rachid Mazini
27// fontaine@lps.umontreal.ca Rachid.Mazini@cern.ch
28// Language: C++
29// Tested on: g++
30// Prerequisites: None
31// Purpose: Header file for FCALFrontVolume.cc, which defines
32// the volumes in the testbeam front.
33// Developped: 10-March-2000 M.F.
34//
35//----------------------------------------------------------------------------
36
37
38#include "FCALTestbeamSetup.hh"
39
40#include "FCALMaterialConsultant.hh"
41#include "FCALCryostatVolumes.hh"
42//#include "FCALEMModule.hh"
43//#include "FCALHadModule.hh"
44
45#include "FCALTestbeamSetupSD.hh"
46
47#include "G4Box.hh"
48#include "G4Tubs.hh"
49#include "G4SubtractionSolid.hh"
50#include "G4Material.hh"
51#include "G4LogicalVolume.hh"
52#include "G4VPhysicalVolume.hh"
53#include "G4PVPlacement.hh"
54#include "G4ThreeVector.hh"
55#include "G4RotationMatrix.hh"
56
57#include "G4SDManager.hh"
58#include "G4RunManager.hh"
59
60#include "G4VisAttributes.hh"
61#include "G4Colour.hh"
62
63#include "G4ios.hh"
64
65
66FCALTestbeamSetup::FCALTestbeamSetup() : FCALTBSetupSD(0) {
67#include "FCALTestbeamSetupParameters.input"
68}
69
70FCALTestbeamSetup::~FCALTestbeamSetup() {}
71
72G4VPhysicalVolume * FCALTestbeamSetup::Construct()
73{
74 G4int i;
75
76 //-----------------------------
77 // construction of materials
78 //-----------------------------
79
80 FCALMaterialConsultant * FCALMaterials = new FCALMaterialConsultant();
81 FCALMaterials->construct();
82
83 //-------------------
84 // Experimental Hall
85 //-------------------
86 G4Box * SolidMother = new G4Box("Mother",MotherSizeX,MotherSizeY,MotherSizeZ);
87 G4LogicalVolume * LogicalMother =
88 new G4LogicalVolume(SolidMother,FCALMaterials->Material("Air"),"Mother");
89 G4VPhysicalVolume * PhysicalMother =
90 new G4PVPlacement(0, G4ThreeVector(),"Mother", LogicalMother, NULL, 0,0);
91
92 LogicalMother->SetVisAttributes(G4VisAttributes::Invisible);
93
94
95 //-------------------------------
96 // Scintillators S1, S2 and S3
97 //-------------------------------
98 G4Box * SolidScintS1andS3 =
99 new G4Box("ScintS1andS3Solid",ScintS1andS3SizeX, ScintS1andS3SizeY, ScintS1andS3SizeZ);
100 G4Box * SolidScintS2 =
101 new G4Box("ScintS2Solid", ScintS2SizeX, ScintS2SizeY, ScintS2SizeZ);
102
103 G4LogicalVolume * LogicalScintS1andS3 =
104 new G4LogicalVolume(SolidScintS1andS3,FCALMaterials->Material("Polystyrene"),
105 "ScintS1andS3Logical");
106 G4LogicalVolume * LogicalScintS2 =
107 new G4LogicalVolume(SolidScintS2, FCALMaterials->Material("Polystyrene"),
108 "ScintS2Logical");
109
110 // G4VPhysicalVolume * PhysicalScintS1 =
111 new G4PVPlacement(0, G4ThreeVector(ScintS1_S3PosX, ScintS1_S3PosY, ScintS1PosZ),
112 "ScintS1Physical",LogicalScintS1andS3,PhysicalMother,0,0);
113 // G4VPhysicalVolume * PhysicalScintS3 =
114 new G4PVPlacement(0, G4ThreeVector(ScintS1_S3PosX, ScintS1_S3PosY, ScintS3PosZ),
115 "ScintS3Physical",LogicalScintS1andS3,PhysicalMother,0,0);
116 // G4VPhysicalVolume * PhysicalScintS2 =
117 new G4PVPlacement(0, G4ThreeVector(ScintS1_S3PosX, ScintS1_S3PosY, ScintS2PosZ),
118 "ScintS2Physical", LogicalScintS2, PhysicalMother,0,0);
119
120 G4VisAttributes * ColorOfScintillator = new G4VisAttributes(G4Colour(0.,0.8,0.));
121 LogicalScintS1andS3->SetVisAttributes(ColorOfScintillator);
122 LogicalScintS2->SetVisAttributes(ColorOfScintillator);
123
124
125 //-------------------
126 // MWPC's
127 //-------------------
128 G4Box* SolidMWPC = new G4Box("MWPCSolid",MWPCSizeX,MWPCSizeY,MWPCSizeZ);
129 G4LogicalVolume * LogicalMWPC =
130 new G4LogicalVolume(SolidMWPC,FCALMaterials->Material("MWPCArCO2"),"MWPCLogical");
131 for(i=0; i<5; i++)
132 {
133 // G4VPhysicalVolume * PhysicalMWPC =
134 new G4PVPlacement(0,G4ThreeVector(MWPCPosX,MWPCPosY,MWPCPosZ[i]),
135 "MWPCPhysical", LogicalMWPC, PhysicalMother,0,i+1);
136 }
137 G4VisAttributes * ColorOfMWPC = new G4VisAttributes(G4Colour(0.,0.,0.5));
138 LogicalMWPC->SetVisAttributes(ColorOfMWPC);
139
140 //---------------------------------------
141 // Hole Counter (scintillator + Pb + Al
142 //---------------------------------------
143 // Scintillator Counter
144 G4Box * SolidHoleCntrScint =
145 new G4Box("ScintSolid", HoleCntrSizeX, HoleCntrSizeY, HoleCntrScintSizeZ);
146 G4LogicalVolume * LogicalHoleCntrScint =
147 new G4LogicalVolume(SolidHoleCntrScint, FCALMaterials->Material("Polystyrene"),
148 "HoleCntrScintLogical");
149 // Hole in scintillator Counter
150 G4Tubs * SolidHole =
151 new G4Tubs("HoleSolid", ScintHoleRmin, ScintHoleRmax, ScintHoleLenght,
152 HoleStartPhi, HoleDPhi);
153 G4LogicalVolume * LogicalHole =
154 new G4LogicalVolume(SolidHole, FCALMaterials->Material("Air"), "HoleLogical");
155 // G4VPhysicalVolume * PhysicalHoleScint =
156 new G4PVPlacement(0, G4ThreeVector(HolePosX, HolePosY, HolePosZ), LogicalHole,
157 "HolePhysicalScint", LogicalHoleCntrScint, 0, 0);
158 // Scintillator Hole counter placement
159 // G4VPhysicalVolume * PhysicalHoleCntrScint =
160 new G4PVPlacement(0,
161 G4ThreeVector(HoleCntrScintPosX, HoleCntrScintPosY, HoleCntrScintPosZ),
162 "HoleCntrScintPhysical", LogicalHoleCntrScint, PhysicalMother, 0, 0);
163
164 // Absorber Lead
165 G4Box * SolidHoleCntrAbsrb =
166 new G4Box("AbsrbSolid", HoleCntrSizeX, HoleCntrSizeY, HoleCntrAbsrbSizeZ);
167 G4LogicalVolume * LogicalHoleCntrPb =
168 new G4LogicalVolume(SolidHoleCntrAbsrb, FCALMaterials->Material("Lead"),
169 "HoleCntrPbLoghical");
170
171 //hole in ABsorber, both Lead and Al.
172 G4Tubs * SolidHoleAbs =
173 new G4Tubs("HoleSolidAbs", AbsrbHoleRmin, AbsrbHoleRmax, AbsrbHoleLenght,
174 HoleStartPhi, HoleDPhi);
175 G4LogicalVolume * LogicalHoleAbs =
176 new G4LogicalVolume(SolidHoleAbs, FCALMaterials->Material("Air"),"HoleAbsLogical");
177 // G4VPhysicalVolume * PhysicalHolePb =
178 new G4PVPlacement(0, G4ThreeVector(HolePosX, HolePosY, HolePosZ), LogicalHoleAbs,
179 "HolePbPhysical", LogicalHoleCntrPb, 0, 0);
180
181 // Lead Placement
182 // G4VPhysicalVolume * PhysicalHoleCntrPb =
183 new G4PVPlacement(0, G4ThreeVector(HoleCntrPbPosX, HoleCntrPbPosY, HoleCntrPbPosZ),
184 "HoleCntrPbPhysical", LogicalHoleCntrPb, PhysicalMother, 0, 0);
185
186 // Absorber Al.
187 G4LogicalVolume * LogicalHoleCntrAl =
188 new G4LogicalVolume(SolidHoleCntrAbsrb, FCALMaterials->Material("Aluminium"),
189 "HoleCntrAlLoghical");
190 // G4VPhysicalVolume * PhysicalHoleAl =
191 new G4PVPlacement(0, G4ThreeVector(HolePosX, HolePosY, HolePosZ), LogicalHoleAbs,
192 "HoleAlPhysical", LogicalHoleCntrAl, 0, 0);
193 // G4VPhysicalVolume * PhysicalHoleCntrAl =
194 new G4PVPlacement(0, G4ThreeVector(HoleCntrAlPosX, HoleCntrAlPosY, HoleCntrAlPosZ),
195 "HoleCntrAlPhysical", LogicalHoleCntrAl, PhysicalMother, 0, 0);
196
197 LogicalHoleCntrScint->SetVisAttributes(ColorOfScintillator);
198
199 G4VisAttributes * ColorOfLead = new G4VisAttributes(G4Colour(0.5,0.5,0.8));
200 G4VisAttributes * ColorOfAlu = new G4VisAttributes(G4Colour(0.5,0.5,0.3));
201 LogicalHoleCntrPb->SetVisAttributes(ColorOfLead);
202 LogicalHoleCntrAl->SetVisAttributes(ColorOfAlu);
203
204 G4VisAttributes * ColorOfAir = new G4VisAttributes(G4Colour(1.,1.,1.));
205 LogicalHole->SetVisAttributes(ColorOfAir);
206 LogicalHoleAbs->SetVisAttributes(ColorOfAir);
207
208
209 //-------------------
210 // Lead Wall
211 //-------------------
212 G4Box * SolidLeadWall =
213 new G4Box("LeadWallSolid", LeadWallSizeX, LeadWallSizeY, LeadWallSizeZ);
214 G4LogicalVolume * LogicalLeadWall =
215 new G4LogicalVolume(SolidLeadWall, FCALMaterials->Material("Lead"),
216 "LeadWallLogical");
217
218 G4Box * SolidSlitPb = new G4Box("SlitPb", LeadWallSlitSizeX, LeadWallSlitSizeY,
219 LeadWallSlitSizeZ);
220 G4LogicalVolume * LogicalSlitPb =
221 new G4LogicalVolume(SolidSlitPb, FCALMaterials->Material("Air"), "SlitPbLogical");
222 // G4VPhysicalVolume * PhysicalSlitPb =
223 new G4PVPlacement(0, 0, LogicalSlitPb, "SlitPbPhysical", LogicalLeadWall, 0, 0);
224
225 // G4VPhysicalVolume * PhysicalLeadWall =
226 new G4PVPlacement(0, G4ThreeVector(LeadWallPosX,LeadWallPosY,LeadWallPosZ),
227 "LeadWallPhysical", LogicalLeadWall, PhysicalMother, 0, 0);
228
229 LogicalLeadWall->SetVisAttributes(ColorOfLead);
230 LogicalSlitPb->SetVisAttributes(ColorOfAir);
231
232
233 //-------------------
234 // Iron Wall
235 //-------------------
236 G4Box * SolidIronWall =
237 new G4Box("IronWallSolid", IronWallSizeX, IronWallSizeY, IronWallSizeZ);
238 G4LogicalVolume * LogicalIronWall =
239 new G4LogicalVolume(SolidIronWall, FCALMaterials->Material("Iron"),
240 "IronWallLogical");
241
242 G4Box * SolidSlitFe = new G4Box("SlitFe", IronWallSlitSizeX, IronWallSlitSizeY,
243 IronWallSlitSizeZ);
244 G4LogicalVolume * LogicalSlitFe =
245 new G4LogicalVolume(SolidSlitFe, FCALMaterials->Material("Air"), "SlitFeLogical");
246 // G4VPhysicalVolume * PhysicalSlitFe =
247 new G4PVPlacement(0, 0, LogicalSlitFe, "SlitFePhysical", LogicalIronWall, 0, 0);
248
249 // G4VPhysicalVolume * PhysicalIronWall =
250 new G4PVPlacement(0, G4ThreeVector(IronWallPosX,IronWallPosY,IronWallPosZ),
251 "IronWallPhysical", LogicalIronWall, PhysicalMother, 0, 0);
252
253 G4VisAttributes * ColorOfIron = new G4VisAttributes(G4Colour(0.2,0.2,0.2));
254 LogicalIronWall->SetVisAttributes(ColorOfIron);
255 LogicalSlitFe->SetVisAttributes(ColorOfAir);
256
257 //----------------
258 // Tail Catcher
259 //----------------
260 G4Box * SolidBigScint =
261 new G4Box("BigSolidScint",BigScintSizeX, BigScintSizeY, ScintSizeZ);
262 G4LogicalVolume * LogicalBigScint =
263 new G4LogicalVolume(SolidBigScint, FCALMaterials->Material("Polystyrene"),
264 "BigScintLogical");
265
266 G4Box * SolidSmallScint =
267 new G4Box("SmallSolidScint",SmallScintSizeX, SmallScintSizeY, ScintSizeZ);
268 G4LogicalVolume * LogicalSmallScint =
269 new G4LogicalVolume(SolidSmallScint, FCALMaterials->Material("Polystyrene"),
270 "SmallScintLogical");
271
272 for( i=0; i<(NBigScint+NSmallScint); i++)
273 {
274 if(i<NBigScint)
275 { // G4VPhysicalVolume * PhysicalBigScint =
276 new G4PVPlacement(0, G4ThreeVector(ScintPosX, ScintPosY, ScintPosZ[i]),
277 "BigScintPhysical", LogicalBigScint, PhysicalMother,
278 0, i+1);
279 }
280 else
281 { // G4VPhysicalVolume * PhysicalSmallScint =
282 new G4PVPlacement(0, G4ThreeVector(ScintPosX, ScintPosY, ScintPosZ[i]),
283 "SmallScintPhysical", LogicalSmallScint, PhysicalMother,
284 0, i+1);
285 }
286 }
287 LogicalBigScint->SetVisAttributes(ColorOfScintillator);
288 LogicalSmallScint->SetVisAttributes(ColorOfScintillator);
289
290
291 G4Box * SolidBigIron =
292 new G4Box("BigSolidIron",BigIronSizeX, BigIronSizeY, IronSizeZ);
293 G4LogicalVolume * LogicalBigIron =
294 new G4LogicalVolume(SolidBigIron, FCALMaterials->Material("Polystyrene"),
295 "BigIronLogical");
296
297 G4Box * SolidSmallIron =
298 new G4Box("SmallSolidIron",SmallIronSizeX, SmallIronSizeY, IronSizeZ);
299 G4LogicalVolume * LogicalSmallIron =
300 new G4LogicalVolume(SolidSmallIron, FCALMaterials->Material("Iron"),
301 "SmallIronLogical");
302
303 for( i=0; i<(NBigIron+NSmallIron); i++)
304 {
305 if(i<NBigIron)
306 { // G4VPhysicalVolume * PhysicalBigIron =
307 new G4PVPlacement(0, G4ThreeVector(IronPosX, IronPosY, IronPosZ[i]),
308 "BigIronPhysical", LogicalBigIron, PhysicalMother,
309 0, i+1);
310 }
311 else
312 { // G4VPhysicalVolume * PhysicalSmallIron =
313 new G4PVPlacement(0, G4ThreeVector(IronPosX, IronPosY, IronPosZ[i]),
314 "SmallIronPhysical", LogicalSmallIron, PhysicalMother,
315 0, i+1);
316 }
317 }
318 LogicalBigIron->SetVisAttributes(ColorOfIron);
319 LogicalSmallIron->SetVisAttributes(ColorOfIron);
320
321 //-------------------------
322 // Concrete Walls A and B
323 //-------------------------
324 G4Box * SolidConcWall =
325 new G4Box("ConcWallSolid", ConcWallSizeX, ConcWallSizeY, ConcWallSizeZ);
326 G4LogicalVolume * LogicalConcWallA =
327 new G4LogicalVolume(SolidConcWall, FCALMaterials->Material("ShieldingConcrete"),
328 "ConcWallALogical");
329 G4VPhysicalVolume * PhysicalConcWallA =
330 new G4PVPlacement(0, G4ThreeVector(ConcWallPosX, ConcWallPosY, ConcWallAPosZ),
331 "ConcWallAPhysical", LogicalConcWallA, PhysicalMother, 0, 0);
332
333 G4LogicalVolume * LogicalConcWallB =
334 new G4LogicalVolume(SolidConcWall, FCALMaterials->Material("ShieldingConcrete"),
335 "ConcWallBLogical");
336 // G4VPhysicalVolume * PhysicalConcWallB =
337 new G4PVPlacement(0, G4ThreeVector(ConcWallPosX, ConcWallPosY, ConcWallBPosZ),
338 "ConcWallBPhysical", LogicalConcWallB, PhysicalMother, 0, 0);
339
340 G4Box * SolidConcWallIns =
341 new G4Box("ConcWallInsSolid", ConcWallInsSizeX,ConcWallInsSizeY,ConcWallInsSizeZ);
342 G4LogicalVolume * LogicalConcWallIns =
343 new G4LogicalVolume(SolidConcWallIns, FCALMaterials->Material("Iron"),
344 "LogicalConcWallIns");
345 // G4VPhysicalVolume * PhysicalConcWallIns =
346 new G4PVPlacement(0, 0, "ConcWallInsPhysical", LogicalConcWallIns, PhysicalConcWallA, 0, 0);
347
348 G4VisAttributes * ColorOfConcrete = new G4VisAttributes(G4Colour(0.,0.,0.));
349 LogicalConcWallA->SetVisAttributes(ColorOfConcrete);
350 LogicalConcWallB->SetVisAttributes(ColorOfConcrete);
351 LogicalConcWallIns->SetVisAttributes(ColorOfIron);
352
353 //------------------
354 // Muon Counter
355 //-------------------
356 G4Box * SolidMuContr =
357 new G4Box("MuContrSolid", MuCntrSIzeX, MuCntrSIzeY, MuCntrSIzeZ);
358 G4LogicalVolume * LogicalMuContr =
359 new G4LogicalVolume(SolidMuContr, FCALMaterials->Material("Polystyrene"),
360 "MuContrLogical");
361 // G4VPhysicalVolume * PhysicalMuContr =
362 new G4PVPlacement(0, G4ThreeVector(MuCntrPosX, MuCntrPosY, MuCntrPosZ),
363 "MuContrPhyiscal", LogicalMuContr, PhysicalMother, 0, 0);
364
365 LogicalMuContr->SetVisAttributes(ColorOfScintillator);
366
367 //-----------------
368 // cryostat
369 //-----------------
370
371
372 G4RotationMatrix* CryostatRotationMatrix =
373 new G4RotationMatrix();
374
375 // new G4RotationMatrix(1.,0.,0.,0.,0.,-1.,0.,1.,0.);
376
377 // Theta(...) 90.0000 180.0000 90.0000
378 // Phi(...) 0.0000 0.0000 90.0000
379 //
380 // Matrix(...) | 1.0000 0.0000 0.0000 |
381 // | 0.0000 0.0000 -1.0000 |
382 // | 0.0000 1.0000 0.0000 |
383 //
384 // How to input?
385
386 CryostatRotationMatrix->rotateX(90*deg);
387
388 FCALCryostatVolumes * CryostatVolumes = new FCALCryostatVolumes();
389
390 G4LogicalVolume * theCryostatVolumes = CryostatVolumes->Construct();
391
392 // G4VPhysicalVolume * PhysiCryostatVolumes =
393 new G4PVPlacement(CryostatRotationMatrix,
394 G4ThreeVector(CryostatPosX,CryostatPosY,CryostatPosZ),"CryostatVolumes"
395 , theCryostatVolumes, PhysicalMother, 0,0);
396
397
398 //-----------------------
399 // Senstive detectors
400 //-----------------------
401 G4SDManager* SDman = G4SDManager::GetSDMpointer();
402
403 if(!FCALTBSetupSD)
404 {
405 FCALTBSetupSD = new FCALTestbeamSetupSD("FCALTB/TBSetupSD");
406 SDman->AddNewDetector(FCALTBSetupSD);
407 }
408 LogicalScintS1andS3->SetSensitiveDetector(FCALTBSetupSD);
409 LogicalScintS2->SetSensitiveDetector(FCALTBSetupSD);
410 LogicalMWPC->SetSensitiveDetector(FCALTBSetupSD);
411 LogicalHoleCntrScint->SetSensitiveDetector(FCALTBSetupSD);
412 LogicalHoleCntrPb->SetSensitiveDetector(FCALTBSetupSD);
413 LogicalHoleCntrAl->SetSensitiveDetector(FCALTBSetupSD);
414
415
416 // theCryostatVolumes->SetSensitiveDetector(FCALTBSetupSD);
417
418 LogicalLeadWall->SetSensitiveDetector(FCALTBSetupSD);
419 LogicalIronWall->SetSensitiveDetector(FCALTBSetupSD);
420 LogicalBigScint->SetSensitiveDetector(FCALTBSetupSD);
421 LogicalSmallScint->SetSensitiveDetector(FCALTBSetupSD);
422
423 LogicalBigIron->SetSensitiveDetector(FCALTBSetupSD);
424 LogicalSmallIron->SetSensitiveDetector(FCALTBSetupSD);
425 LogicalConcWallA->SetSensitiveDetector(FCALTBSetupSD);
426 LogicalConcWallB->SetSensitiveDetector(FCALTBSetupSD);
427 LogicalConcWallIns->SetSensitiveDetector(FCALTBSetupSD);
428
429 LogicalMuContr->SetSensitiveDetector(FCALTBSetupSD);
430
431
432
433 return PhysicalMother;
434
435}
Note: See TracBrowser for help on using the repository browser.