ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RE05DetectorConstruction.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file RE05DetectorConstruction.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 //
29 //
30 
32 #include "RE05TrackerSD.hh"
33 #include "RE05CalorimeterSD.hh"
34 #include "RE05MuonSD.hh"
37 #include "RE05Field.hh"
38 
39 #include "G4Material.hh"
40 #include "G4MaterialTable.hh"
41 #include "G4Element.hh"
42 #include "G4ElementTable.hh"
43 #include "G4Box.hh"
44 #include "G4Tubs.hh"
45 #include "G4LogicalVolume.hh"
46 #include "G4ThreeVector.hh"
47 #include "G4PVPlacement.hh"
48 #include "G4PVParameterised.hh"
49 #include "G4Transform3D.hh"
50 #include "G4RotationMatrix.hh"
51 #include "G4FieldManager.hh"
53 #include "G4SDManager.hh"
54 #include "G4VisAttributes.hh"
55 #include "G4Colour.hh"
56 #include "G4SystemOfUnits.hh"
57 
58 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
59 
62 {
63 
64 #include "RE05DetectorParameterDef.icc"
65 
66 }
67 
68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
69 
71 {}
72 
73 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
74 
76 {
77  //-------------------------------------------------------------------------
78  // Materials
79  //-------------------------------------------------------------------------
80 
81  G4double a, z, density;
82  G4int nel;
83 
84  G4Element* H = new G4Element("Hydrogen", "H", z=1., a= 1.01*g/mole);
85  G4Element* C = new G4Element("Carbon", "C", z=6., a= 12.01*g/mole);
86  G4Element* N = new G4Element("Nitrogen", "N", z=7., a= 14.01*g/mole);
87  G4Element* O = new G4Element("Oxygen", "O", z=8., a= 16.00*g/mole);
88 
89  fAir = new G4Material("Air", density= 1.29*mg/cm3, nel=2);
90  fAir->AddElement(N, 70.*perCent);
91  fAir->AddElement(O, 30.*perCent);
92 
93  fLead =
94  new G4Material("Lead", z=82., a= 207.19*g/mole, density= 11.35*g/cm3);
95 
96  fAr =
97  new G4Material("ArgonGas",z=18., a= 39.95*g/mole, density=1.782*mg/cm3);
98 
99  fSilicon =
100  new G4Material("Silicon", z=14., a= 28.09*g/mole, density= 2.33*g/cm3);
101 
102  fScinti = new G4Material("Scintillator", density= 1.032*g/cm3, nel=2);
103  fScinti->AddElement(C, 9);
104  fScinti->AddElement(H, 10);
105 }
106 
107 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
108 
110 {
111  DefineMaterials();
112 
113  //-------------------------------------------------------------------------
114  // Detector geometry
115  //-------------------------------------------------------------------------
116 
117  //------------------------------ experimental hall
118  G4Box * experimentalHall_box
119  = new G4Box("expHall_b",fExpHall_x,fExpHall_y,fExpHall_z);
120  G4LogicalVolume * experimentalHall_log
121  = new G4LogicalVolume(experimentalHall_box,fAir,"expHall_L",0,0,0);
122  G4VPhysicalVolume * experimentalHall_phys
123  = new G4PVPlacement(0,G4ThreeVector(),experimentalHall_log,"expHall_P",
124  0,false,0);
125  experimentalHall_log->SetVisAttributes(G4VisAttributes::GetInvisible());
126 
127  //------------------------------ tracker
128  G4VSolid * fTracker_tubs
129  = new G4Tubs("trkTubs_tubs",fTrkTubs_rmin,fTrkTubs_rmax,fTrkTubs_dz,
131  G4LogicalVolume * fTracker_log
132  = new G4LogicalVolume(fTracker_tubs,fAr,"trackerT_L",0,0,0);
133  // G4VPhysicalVolume * fTracker_phys =
134  new G4PVPlacement(0,G4ThreeVector(),fTracker_log,"tracker_phys",
135  experimentalHall_log,false,0);
136  G4VisAttributes* fTracker_logVisAtt
137  = new G4VisAttributes(G4Colour(1.0,0.0,1.0));
138  fTracker_log->SetVisAttributes(fTracker_logVisAtt);
139 
140  //------------------------------ tracker layers
141  // As an example for Parameterised volume
142  // dummy values for G4Tubs -- modified by parameterised volume
143  G4VSolid * trackerLayer_tubs
144  = new G4Tubs("trackerLayer_tubs",fTrkTubs_rmin,fTrkTubs_rmax,fTrkTubs_dz,
146  G4LogicalVolume * trackerLayer_log
147  = new G4LogicalVolume(trackerLayer_tubs,fSilicon,"trackerB_L",0,0,0);
148  G4VPVParameterisation * trackerParam
150  // dummy value : kXAxis -- modified by parameterised volume
151  // G4VPhysicalVolume *trackerLayer_phys =
152  new G4PVParameterised("trackerLayer_phys",trackerLayer_log,fTracker_log,
153  kXAxis, fNotrkLayers, trackerParam);
154  G4VisAttributes* trackerLayer_logVisAtt
155  = new G4VisAttributes(G4Colour(0.5,0.0,1.0));
156  trackerLayer_logVisAtt->SetForceWireframe(true);
157  trackerLayer_log->SetVisAttributes(trackerLayer_logVisAtt);
158 
159  //------------------------------ calorimeter
160  G4VSolid * calorimeter_tubs
161  = new G4Tubs("calorimeter_tubs",fCaloTubs_rmin,fCaloTubs_rmax,
163  G4LogicalVolume * calorimeter_log
164  = new G4LogicalVolume(calorimeter_tubs,fScinti,"caloT_L",0,0,0);
165  // G4VPhysicalVolume * calorimeter_phys =
166  new G4PVPlacement(0,G4ThreeVector(),calorimeter_log,"caloM_P",
167  experimentalHall_log,false,0);
168  G4VisAttributes* calorimeter_logVisATT
169  = new G4VisAttributes(G4Colour(1.0,1.0,0.0));
170  calorimeter_logVisATT->SetForceWireframe(true);
171  calorimeter_log->SetVisAttributes(calorimeter_logVisATT);
172 
173  //------------------------------- Lead layers
174  // As an example for Parameterised volume
175  // dummy values for G4Tubs -- modified by parameterised volume
176  G4VSolid * caloLayer_tubs
177  = new G4Tubs("caloLayer_tubs",fCaloRing_rmin,fCaloRing_rmax,
179  G4LogicalVolume * caloLayer_log
180  = new G4LogicalVolume(caloLayer_tubs,fLead,"caloR_L",0,0,0);
181  G4VPVParameterisation * calorimeterParam
183  // dummy value : kXAxis -- modified by parameterised volume
184  // G4VPhysicalVolume * caloLayer_phys =
185  new G4PVParameterised("caloLayer_phys",caloLayer_log,calorimeter_log,
186  kXAxis, fNocaloLayers, calorimeterParam);
187  G4VisAttributes* caloLayer_logVisAtt
188  = new G4VisAttributes(G4Colour(0.7,1.0,0.0));
189  caloLayer_log->SetVisAttributes(caloLayer_logVisAtt);
190 
191  //------------------------------ muon counters
192  // As an example of CSG volumes with rotation
193  G4VSolid * muoncounter_box
194  = new G4Box("muoncounter_box",fMuBox_width,fMuBox_thick,
195  fMuBox_length);
196  G4LogicalVolume * muoncounter_log
197  = new G4LogicalVolume(muoncounter_box,fScinti,"mucounter_L",0,0,0);
198  for(int i=0; i<fNomucounter ; i++)
199  {
200  G4double phi, x, y, z;
201  phi = 360.*deg/fNomucounter*i;
202  x = fMuBox_radius*std::sin(phi);
203  y = fMuBox_radius*std::cos(phi);
204  z = 0.*cm;
205  G4RotationMatrix rm;
206  rm.rotateZ(phi);
208  muoncounter_log, "muoncounter_P",
209  experimentalHall_log,false,i);
210  }
211  G4VisAttributes* muoncounter_logVisAtt
212  = new G4VisAttributes(G4Colour(0.0,1.0,1.0));
213  muoncounter_logVisAtt->SetForceWireframe(true);
214  muoncounter_log->SetVisAttributes(muoncounter_logVisAtt);
215 
216  return experimentalHall_phys;
217 }
218 
219 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
220 
222 {
223  //-------------------------------------------------------------------------
224  // Magnetic field
225  //-------------------------------------------------------------------------
226  RE05Field* myField = new RE05Field;
227  G4FieldManager* fieldMgr
229  fieldMgr->SetDetectorField(myField);
230  fieldMgr->CreateChordFinder(myField);
231 
232  //------------------------------------------------------------------
233  // Sensitive Detectors
234  //------------------------------------------------------------------
235  G4String trackerSDname = "/mydet/tracker";
236  RE05TrackerSD * trackerSD = new RE05TrackerSD(trackerSDname);
238  SetSensitiveDetector("trackerB_L",trackerSD);
239 
240  G4String muonSDname = "/mydet/muon";
241  RE05MuonSD * muonSD = new RE05MuonSD(muonSDname);
243  SetSensitiveDetector("mucounter_L",muonSD);
244 }
245 
246 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......