Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RE05DetectorConstruction.cc
Go to the documentation of this file.
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 // $Id: RE05DetectorConstruction.cc 69920 2013-05-17 13:36:37Z gcosmo $
27 //
28 /// \file RE05/src/RE05DetectorConstruction.cc
29 /// \brief Implementation of the RE05DetectorConstruction class
30 //
31 
33 #include "RE05TrackerSD.hh"
34 #include "RE05CalorimeterSD.hh"
35 #include "RE05MuonSD.hh"
38 #include "RE05Field.hh"
39 
40 #include "G4Material.hh"
41 #include "G4MaterialTable.hh"
42 #include "G4Element.hh"
43 #include "G4ElementTable.hh"
44 #include "G4Box.hh"
45 #include "G4Tubs.hh"
46 #include "G4LogicalVolume.hh"
47 #include "G4ThreeVector.hh"
48 #include "G4PVPlacement.hh"
49 #include "G4PVParameterised.hh"
50 #include "G4Transform3D.hh"
51 #include "G4RotationMatrix.hh"
52 #include "G4FieldManager.hh"
54 #include "G4SDManager.hh"
55 #include "G4VisAttributes.hh"
56 #include "G4Colour.hh"
57 #include "G4SystemOfUnits.hh"
58 
59 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
60 
62 {
63 
64 #include "RE05DetectorParameterDef.icc"
65 
66 }
67 
68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
69 
71 {
72  delete Scinti;
73  delete Silicon;
74  delete Ar;
75  delete Lead;
76  delete Air;
77 
78  delete O;
79  delete N;
80  delete C;
81  delete H;
82 }
83 
84 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
85 
86 void RE05DetectorConstruction::DefineMaterials()
87 {
88  //-------------------------------------------------------------------------
89  // Materials
90  //-------------------------------------------------------------------------
91 
92  G4double a, z, density;
93  G4int nel;
94 
95  H = new G4Element("Hydrogen", "H", z=1., a= 1.01*g/mole);
96  C = new G4Element("Carbon", "C", z=6., a= 12.01*g/mole);
97  N = new G4Element("Nitrogen", "N", z=7., a= 14.01*g/mole);
98  O = new G4Element("Oxygen", "O", z=8., a= 16.00*g/mole);
99 
100  Air = new G4Material("Air", density= 1.29*mg/cm3, nel=2);
101  Air->AddElement(N, 70.*perCent);
102  Air->AddElement(O, 30.*perCent);
103 
104  Lead =
105  new G4Material("Lead", z=82., a= 207.19*g/mole, density= 11.35*g/cm3);
106 
107  Ar =
108  new G4Material("ArgonGas",z=18., a= 39.95*g/mole, density=1.782*mg/cm3);
109 
110  Silicon =
111  new G4Material("Silicon", z=14., a= 28.09*g/mole, density= 2.33*g/cm3);
112 
113  Scinti = new G4Material("Scintillator", density= 1.032*g/cm3, nel=2);
114  Scinti->AddElement(C, 9);
115  Scinti->AddElement(H, 10);
116 }
117 
118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
119 
121 {
122  DefineMaterials();
123 
124  //-------------------------------------------------------------------------
125  // Detector geometry
126  //-------------------------------------------------------------------------
127 
128  //------------------------------ experimental hall
129  G4Box * experimentalHall_box
130  = new G4Box("expHall_b",expHall_x,expHall_y,expHall_z);
131  G4LogicalVolume * experimentalHall_log
132  = new G4LogicalVolume(experimentalHall_box,Air,"expHall_L",0,0,0);
133  G4VPhysicalVolume * experimentalHall_phys
134  = new G4PVPlacement(0,G4ThreeVector(),experimentalHall_log,"expHall_P",
135  0,false,0);
136  experimentalHall_log->SetVisAttributes(G4VisAttributes::GetInvisible());
137 
138  //------------------------------ tracker
139  G4VSolid * tracker_tubs
140  = new G4Tubs("trkTubs_tubs",trkTubs_rmin,trkTubs_rmax,trkTubs_dz,
141  trkTubs_sphi,trkTubs_dphi);
142  G4LogicalVolume * tracker_log
143  = new G4LogicalVolume(tracker_tubs,Ar,"trackerT_L",0,0,0);
144  // G4VPhysicalVolume * tracker_phys =
145  new G4PVPlacement(0,G4ThreeVector(),tracker_log,"tracker_phys",
146  experimentalHall_log,false,0);
147  G4VisAttributes* tracker_logVisAtt
148  = new G4VisAttributes(G4Colour(1.0,0.0,1.0));
149  tracker_log->SetVisAttributes(tracker_logVisAtt);
150 
151  //------------------------------ tracker layers
152  // As an example for Parameterised volume
153  // dummy values for G4Tubs -- modified by parameterised volume
154  G4VSolid * trackerLayer_tubs
155  = new G4Tubs("trackerLayer_tubs",trkTubs_rmin,trkTubs_rmax,trkTubs_dz,
156  trkTubs_sphi,trkTubs_dphi);
157  G4LogicalVolume * trackerLayer_log
158  = new G4LogicalVolume(trackerLayer_tubs,Silicon,"trackerB_L",0,0,0);
159  G4VPVParameterisation * trackerParam
161  // dummy value : kXAxis -- modified by parameterised volume
162  // G4VPhysicalVolume *trackerLayer_phys =
163  new G4PVParameterised("trackerLayer_phys",trackerLayer_log,tracker_log,
164  kXAxis, notrkLayers, trackerParam);
165  G4VisAttributes* trackerLayer_logVisAtt
166  = new G4VisAttributes(G4Colour(0.5,0.0,1.0));
167  trackerLayer_logVisAtt->SetForceWireframe(true);
168  trackerLayer_log->SetVisAttributes(trackerLayer_logVisAtt);
169 
170  //------------------------------ calorimeter
171  G4VSolid * calorimeter_tubs
172  = new G4Tubs("calorimeter_tubs",caloTubs_rmin,caloTubs_rmax,
173  caloTubs_dz,caloTubs_sphi,caloTubs_dphi);
174  G4LogicalVolume * calorimeter_log
175  = new G4LogicalVolume(calorimeter_tubs,Scinti,"caloT_L",0,0,0);
176  // G4VPhysicalVolume * calorimeter_phys =
177  new G4PVPlacement(0,G4ThreeVector(),calorimeter_log,"caloM_P",
178  experimentalHall_log,false,0);
179  G4VisAttributes* calorimeter_logVisATT
180  = new G4VisAttributes(G4Colour(1.0,1.0,0.0));
181  calorimeter_logVisATT->SetForceWireframe(true);
182  calorimeter_log->SetVisAttributes(calorimeter_logVisATT);
183 
184  //------------------------------- Lead layers
185  // As an example for Parameterised volume
186  // dummy values for G4Tubs -- modified by parameterised volume
187  G4VSolid * caloLayer_tubs
188  = new G4Tubs("caloLayer_tubs",caloRing_rmin,caloRing_rmax,
189  caloRing_dz,caloRing_sphi,caloRing_dphi);
190  G4LogicalVolume * caloLayer_log
191  = new G4LogicalVolume(caloLayer_tubs,Lead,"caloR_L",0,0,0);
192  G4VPVParameterisation * calorimeterParam
194  // dummy value : kXAxis -- modified by parameterised volume
195  // G4VPhysicalVolume * caloLayer_phys =
196  new G4PVParameterised("caloLayer_phys",caloLayer_log,calorimeter_log,
197  kXAxis, nocaloLayers, calorimeterParam);
198  G4VisAttributes* caloLayer_logVisAtt
199  = new G4VisAttributes(G4Colour(0.7,1.0,0.0));
200  caloLayer_log->SetVisAttributes(caloLayer_logVisAtt);
201 
202  //------------------------------ muon counters
203  // As an example of CSG volumes with rotation
204  G4VSolid * muoncounter_box
205  = new G4Box("muoncounter_box",muBox_width,muBox_thick,
206  muBox_length);
207  G4LogicalVolume * muoncounter_log
208  = new G4LogicalVolume(muoncounter_box,Scinti,"mucounter_L",0,0,0);
209  for(int i=0; i<nomucounter ; i++)
210  {
211  G4double phi, x, y, z;
212  phi = 360.*deg/nomucounter*i;
213  x = muBox_radius*std::sin(phi);
214  y = muBox_radius*std::cos(phi);
215  z = 0.*cm;
216  G4RotationMatrix rm;
217  rm.rotateZ(phi);
219  muoncounter_log, "muoncounter_P",
220  experimentalHall_log,false,i);
221  }
222  G4VisAttributes* muoncounter_logVisAtt
223  = new G4VisAttributes(G4Colour(0.0,1.0,1.0));
224  muoncounter_logVisAtt->SetForceWireframe(true);
225  muoncounter_log->SetVisAttributes(muoncounter_logVisAtt);
226 
227  return experimentalHall_phys;
228 }
229 
230 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
231 
233 {
234  //-------------------------------------------------------------------------
235  // Magnetic field
236  //-------------------------------------------------------------------------
237  RE05Field* myField = new RE05Field;
238  G4FieldManager* fieldMgr
240  fieldMgr->SetDetectorField(myField);
241  fieldMgr->CreateChordFinder(myField);
242 
243  //------------------------------------------------------------------
244  // Sensitive Detectors
245  //------------------------------------------------------------------
246  G4String trackerSDname = "/mydet/tracker";
247  RE05TrackerSD * trackerSD = new RE05TrackerSD(trackerSDname);
248  SetSensitiveDetector("trackerB_L",trackerSD);
249 
250  G4String muonSDname = "/mydet/muon";
251  RE05MuonSD * muonSD = new RE05MuonSD(muonSDname);
252  SetSensitiveDetector("mucounter_L",muonSD);
253 }
254 
static const G4VisAttributes & GetInvisible()
void SetForceWireframe(G4bool)
CLHEP::Hep3Vector G4ThreeVector
G4bool SetDetectorField(G4Field *detectorField)
G4double z
Definition: TRTMaterials.hh:39
Definition: G4Box.hh:63
Definition: G4Tubs.hh:84
Definition of the RE05TrackerParametrisation class.
Definition of the RE05TrackerSD class.
int G4int
Definition: G4Types.hh:78
G4double density
Definition: TRTMaterials.hh:39
function g(Y1, Y2, PT2)
Definition: hijing1.383.f:5205
virtual G4VPhysicalVolume * Construct()
HepGeom::Transform3D G4Transform3D
Definition of the RE05MuonSD class.
void SetSensitiveDetector(const G4String &logVolName, G4VSensitiveDetector *aSD, G4bool multi=false)
static G4TransportationManager * GetTransportationManager()
G4FieldManager * GetFieldManager() const
Definition of the RE05Field class.
HepRotation & rotateZ(double delta)
Definition: Rotation.cc:92
Definition of the RE05CalorimeterParametrisation class.
float perCent
Definition: hepunit.py:239
void AddElement(G4Element *element, G4int nAtoms)
Definition: G4Material.cc:345
double G4double
Definition: G4Types.hh:76
void CreateChordFinder(G4MagneticField *detectorMagField)
Definition of the RE05DetectorConstruction class.
void SetVisAttributes(const G4VisAttributes *pVA)
G4int nel
Definition: TRTMaterials.hh:41
Definition of the RE05CalorimeterSD class.