Geant4  10.03.p03
 All Classes 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 101676 2016-11-21 09:25:51Z gcosmo $
27 //
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 
63 {
64 
65 #include "RE05DetectorParameterDef.icc"
66 
67 }
68 
69 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
70 
72 {}
73 
74 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
75 
76 void RE05DetectorConstruction::DefineMaterials()
77 {
78  //-------------------------------------------------------------------------
79  // Materials
80  //-------------------------------------------------------------------------
81 
82  G4double a, z, density;
83  G4int nel;
84 
85  G4Element* H = new G4Element("Hydrogen", "H", z=1., a= 1.01*g/mole);
86  G4Element* C = new G4Element("Carbon", "C", z=6., a= 12.01*g/mole);
87  G4Element* N = new G4Element("Nitrogen", "N", z=7., a= 14.01*g/mole);
88  G4Element* O = new G4Element("Oxygen", "O", z=8., a= 16.00*g/mole);
89 
90  fAir = new G4Material("Air", density= 1.29*mg/cm3, nel=2);
91  fAir->AddElement(N, 70.*perCent);
92  fAir->AddElement(O, 30.*perCent);
93 
94  fLead =
95  new G4Material("Lead", z=82., a= 207.19*g/mole, density= 11.35*g/cm3);
96 
97  fAr =
98  new G4Material("ArgonGas",z=18., a= 39.95*g/mole, density=1.782*mg/cm3);
99 
100  fSilicon =
101  new G4Material("Silicon", z=14., a= 28.09*g/mole, density= 2.33*g/cm3);
102 
103  fScinti = new G4Material("Scintillator", density= 1.032*g/cm3, nel=2);
104  fScinti->AddElement(C, 9);
105  fScinti->AddElement(H, 10);
106 }
107 
108 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
109 
111 {
112  DefineMaterials();
113 
114  //-------------------------------------------------------------------------
115  // Detector geometry
116  //-------------------------------------------------------------------------
117 
118  //------------------------------ experimental hall
119  G4Box * experimentalHall_box
120  = new G4Box("expHall_b",fExpHall_x,fExpHall_y,fExpHall_z);
121  G4LogicalVolume * experimentalHall_log
122  = new G4LogicalVolume(experimentalHall_box,fAir,"expHall_L",0,0,0);
123  G4VPhysicalVolume * experimentalHall_phys
124  = new G4PVPlacement(0,G4ThreeVector(),experimentalHall_log,"expHall_P",
125  0,false,0);
126  experimentalHall_log->SetVisAttributes(G4VisAttributes::GetInvisible());
127 
128  //------------------------------ tracker
129  G4VSolid * fTracker_tubs
130  = new G4Tubs("trkTubs_tubs",fTrkTubs_rmin,fTrkTubs_rmax,fTrkTubs_dz,
131  fTrkTubs_sphi,fTrkTubs_dphi);
132  G4LogicalVolume * fTracker_log
133  = new G4LogicalVolume(fTracker_tubs,fAr,"trackerT_L",0,0,0);
134  // G4VPhysicalVolume * fTracker_phys =
135  new G4PVPlacement(0,G4ThreeVector(),fTracker_log,"tracker_phys",
136  experimentalHall_log,false,0);
137  G4VisAttributes* fTracker_logVisAtt
138  = new G4VisAttributes(G4Colour(1.0,0.0,1.0));
139  fTracker_log->SetVisAttributes(fTracker_logVisAtt);
140 
141  //------------------------------ tracker layers
142  // As an example for Parameterised volume
143  // dummy values for G4Tubs -- modified by parameterised volume
144  G4VSolid * trackerLayer_tubs
145  = new G4Tubs("trackerLayer_tubs",fTrkTubs_rmin,fTrkTubs_rmax,fTrkTubs_dz,
146  fTrkTubs_sphi,fTrkTubs_dphi);
147  G4LogicalVolume * trackerLayer_log
148  = new G4LogicalVolume(trackerLayer_tubs,fSilicon,"trackerB_L",0,0,0);
149  G4VPVParameterisation * trackerParam
151  // dummy value : kXAxis -- modified by parameterised volume
152  // G4VPhysicalVolume *trackerLayer_phys =
153  new G4PVParameterised("trackerLayer_phys",trackerLayer_log,fTracker_log,
154  kXAxis, fNotrkLayers, trackerParam);
155  G4VisAttributes* trackerLayer_logVisAtt
156  = new G4VisAttributes(G4Colour(0.5,0.0,1.0));
157  trackerLayer_logVisAtt->SetForceWireframe(true);
158  trackerLayer_log->SetVisAttributes(trackerLayer_logVisAtt);
159 
160  //------------------------------ calorimeter
161  G4VSolid * calorimeter_tubs
162  = new G4Tubs("calorimeter_tubs",fCaloTubs_rmin,fCaloTubs_rmax,
163  fCaloTubs_dz,fCaloTubs_sphi,fCaloTubs_dphi);
164  G4LogicalVolume * calorimeter_log
165  = new G4LogicalVolume(calorimeter_tubs,fScinti,"caloT_L",0,0,0);
166  // G4VPhysicalVolume * calorimeter_phys =
167  new G4PVPlacement(0,G4ThreeVector(),calorimeter_log,"caloM_P",
168  experimentalHall_log,false,0);
169  G4VisAttributes* calorimeter_logVisATT
170  = new G4VisAttributes(G4Colour(1.0,1.0,0.0));
171  calorimeter_logVisATT->SetForceWireframe(true);
172  calorimeter_log->SetVisAttributes(calorimeter_logVisATT);
173 
174  //------------------------------- Lead layers
175  // As an example for Parameterised volume
176  // dummy values for G4Tubs -- modified by parameterised volume
177  G4VSolid * caloLayer_tubs
178  = new G4Tubs("caloLayer_tubs",fCaloRing_rmin,fCaloRing_rmax,
179  fCaloRing_dz,fCaloRing_sphi,fCaloRing_dphi);
180  G4LogicalVolume * caloLayer_log
181  = new G4LogicalVolume(caloLayer_tubs,fLead,"caloR_L",0,0,0);
182  G4VPVParameterisation * calorimeterParam
184  // dummy value : kXAxis -- modified by parameterised volume
185  // G4VPhysicalVolume * caloLayer_phys =
186  new G4PVParameterised("caloLayer_phys",caloLayer_log,calorimeter_log,
187  kXAxis, fNocaloLayers, calorimeterParam);
188  G4VisAttributes* caloLayer_logVisAtt
189  = new G4VisAttributes(G4Colour(0.7,1.0,0.0));
190  caloLayer_log->SetVisAttributes(caloLayer_logVisAtt);
191 
192  //------------------------------ muon counters
193  // As an example of CSG volumes with rotation
194  G4VSolid * muoncounter_box
195  = new G4Box("muoncounter_box",fMuBox_width,fMuBox_thick,
196  fMuBox_length);
197  G4LogicalVolume * muoncounter_log
198  = new G4LogicalVolume(muoncounter_box,fScinti,"mucounter_L",0,0,0);
199  for(int i=0; i<fNomucounter ; i++)
200  {
201  G4double phi, x, y, z;
202  phi = 360.*deg/fNomucounter*i;
203  x = fMuBox_radius*std::sin(phi);
204  y = fMuBox_radius*std::cos(phi);
205  z = 0.*cm;
206  G4RotationMatrix rm;
207  rm.rotateZ(phi);
209  muoncounter_log, "muoncounter_P",
210  experimentalHall_log,false,i);
211  }
212  G4VisAttributes* muoncounter_logVisAtt
213  = new G4VisAttributes(G4Colour(0.0,1.0,1.0));
214  muoncounter_logVisAtt->SetForceWireframe(true);
215  muoncounter_log->SetVisAttributes(muoncounter_logVisAtt);
216 
217  return experimentalHall_phys;
218 }
219 
220 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
221 
223 {
224  //-------------------------------------------------------------------------
225  // Magnetic field
226  //-------------------------------------------------------------------------
227  RE05Field* myField = new RE05Field;
228  G4FieldManager* fieldMgr
230  fieldMgr->SetDetectorField(myField);
231  fieldMgr->CreateChordFinder(myField);
232 
233  //------------------------------------------------------------------
234  // Sensitive Detectors
235  //------------------------------------------------------------------
236  G4String trackerSDname = "/mydet/tracker";
237  RE05TrackerSD * trackerSD = new RE05TrackerSD(trackerSDname);
239  SetSensitiveDetector("trackerB_L",trackerSD);
240 
241  G4String muonSDname = "/mydet/muon";
242  RE05MuonSD * muonSD = new RE05MuonSD(muonSDname);
244  SetSensitiveDetector("mucounter_L",muonSD);
245 }
246 
247 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
static constexpr double mg
Definition: G4SIunits.hh:184
CLHEP::Hep3Vector G4ThreeVector
G4bool SetDetectorField(G4Field *detectorField)
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33
Definition: G4Box.hh:64
static constexpr double perCent
Definition: G4SIunits.hh:332
Definition: G4Tubs.hh:85
Definition of the RE05TrackerParametrisation class.
tuple x
Definition: test.py:50
double C(double temp)
Definition of the RE05TrackerSD class.
int G4int
Definition: G4Types.hh:78
function g(Y1, Y2, PT2)
Definition: hijing1.383.f:5205
virtual G4VPhysicalVolume * Construct()
static constexpr double cm
Definition: G4SIunits.hh:119
HepGeom::Transform3D G4Transform3D
Definition of the RE05MuonSD class.
static constexpr double cm3
Definition: G4SIunits.hh:121
void SetSensitiveDetector(const G4String &logVolName, G4VSensitiveDetector *aSD, G4bool multi=false)
static G4TransportationManager * GetTransportationManager()
void AddNewDetector(G4VSensitiveDetector *aSD)
Definition: G4SDManager.cc:71
G4FieldManager * GetFieldManager() const
Definition of the RE05Field class.
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
tuple z
Definition: test.py:28
HepRotation & rotateZ(double delta)
Definition: Rotation.cc:92
Definition of the RE05CalorimeterParametrisation class.
**D E S C R I P T I O N
Definition: HEPEvtcom.cc:77
void AddElement(G4Element *element, G4int nAtoms)
Definition: G4Material.cc:362
double G4double
Definition: G4Types.hh:76
void CreateChordFinder(G4MagneticField *detectorMagField)
static constexpr double deg
Definition: G4SIunits.hh:152
Definition of the RE05DetectorConstruction class.
static constexpr double mole
Definition: G4SIunits.hh:286
static const G4VisAttributes & GetInvisible()
void SetForceWireframe(G4bool=true)
void SetVisAttributes(const G4VisAttributes *pVA)
Definition of the RE05CalorimeterSD class.