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