Geant4  10.01
H02DetectorConstruction.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 //
28 //
29 // $Id: H02DetectorConstruction.cc 77801 2013-11-28 13:33:20Z gcosmo $
30 
31 #include "G4Box.hh"
32 #include "G4ChordFinder.hh"
33 #include "G4Element.hh"
34 #include "G4FieldManager.hh"
35 #include "G4LogicalVolume.hh"
36 #include "G4Material.hh"
37 #include "G4PVPlacement.hh"
38 #include "G4SDManager.hh"
39 #include "G4SystemOfUnits.hh"
41 #include "G4Tubs.hh"
42 #include "G4VisAttributes.hh"
43 #include "H02Field.hh"
45 #include "H02MuonSD.hh"
46 
47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
48 // constants (detector parameters)
49 // [experimental hall]
50 static const G4double R_EXPHALL= 5.*m;
51 static const G4double DZ_EXPHALL= 10.*m;
52 
53 // [calorimeter]
54 static const G4double RIN_BARREL_CAL= 2.*m;
55 static const G4double ROUT_BARREL_CAL= 3.*m;
56 static const G4double DZ_BARREL_CAL= 5.*m;
57 
58 static const G4double RIN_ENDCAP_CAL= 1.*m;
59 static const G4double ROUT_ENDCAP_CAL= 3.*m;
60 static const G4double DZ_ENDCAP_CAL= 0.5*m;
61 
62 // [muon system]
63 static const G4double RIN_BARREL_MUON= 4.3*m;
64 static const G4double ROUT_BARREL_MUON= 4.5*m;
65 static const G4double DX_BARREL_MUON= RIN_BARREL_MUON*std::cos(67.5*deg)-5.*cm;
66 static const G4double DY_BARREL_MUON= 10.*cm;
67 static const G4double DZ_BARREL_MUON= 7.*m;
68 
69 static const G4double RIN_ENDCAP_MUON= 1.*m;
70 static const G4double ROUT_ENDCAP_MUON= 4.5*m;
71 static const G4double DZ_ENDCAP_MUON= 10.*cm;
72 
73 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
75 {
76 }
77 
78 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
80 {
81 }
82 
83 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
85 {
86  // ==============================================================
87  // Materials
88  // ==============================================================
89 
90  G4double a, iz, z, density;
92  G4int nel;
93 
94  a= 1.01*g/mole;
95  G4Element* elH= new G4Element(name="Hydrogen", symbol="H", iz=1., a);
96 
97  a= 12.01*g/mole;
98  G4Element* elC= new G4Element(name="Carbon", symbol="C", iz=6., a);
99 
100  a= 14.01*g/mole;
101  G4Element* elN= new G4Element(name="Nitrogen", symbol="N", iz=7., a);
102 
103  a = 16.00*g/mole;
104  G4Element* elO= new G4Element(name="Oxygen", symbol="O", iz=8., a);
105 
106  density= 1.29e-03*g/cm3;
107  G4Material* Air= new G4Material(name="Air", density, nel=2);
108  Air-> AddElement(elN, .7);
109  Air-> AddElement(elO, .3);
110 
111  a= 207.19*g/mole;
112  density= 11.35*g/cm3;
113  G4Material* Lead= new G4Material(name="Lead", z=82., a, density);
114 
115  a= 39.95*g/mole;
116  density= 1.782e-03*g/cm3;
117  G4Material* Ar= new G4Material(name="ArgonGas", z=18., a, density);
118 
119  density= 1.032*g/cm3;
120  G4Material* Scinti= new G4Material(name="Scintillator", density, nel=2);
121  Scinti-> AddElement(elC, 9);
122  Scinti-> AddElement(elH, 10);
123 
124 
125  // ==============================================================
126  // Experimental Hall (world)
127  // ==============================================================
128  G4Tubs* expHallSolid=
129  new G4Tubs("EXP_HALL", 0., R_EXPHALL, DZ_EXPHALL, 0., 360.*deg);
130 
131  G4LogicalVolume* expHallLV=
132  new G4LogicalVolume(expHallSolid, Air, "EXP_HALL_LV");
133 
134  // visualization attributes
135  G4VisAttributes* expHallVisAtt=
136  new G4VisAttributes(false, G4Colour(1., 1., 1.));
137  //expHallVisAtt-> SetForceWireframe(TRUE);
138  expHallLV-> SetVisAttributes(expHallVisAtt);
139 
140  G4PVPlacement* expHall= new G4PVPlacement(0, G4ThreeVector(), "EXP_HALL_PV",
141  expHallLV, 0, FALSE, 0);
142  // ... MV, MANY, copy#
143 
144  // ==============================================================
145  // each detector component
146  // ==============================================================
147  // calorimeter system
148  G4Tubs* barrelCalSolid=
149  new G4Tubs("BARREL_CAL", RIN_BARREL_CAL, ROUT_BARREL_CAL,
150  DZ_BARREL_CAL, 0., 360.*deg);
151 
152  G4Tubs* endcapCalSolid=
153  new G4Tubs("ENDCAP_CAL", RIN_ENDCAP_CAL, ROUT_ENDCAP_CAL,
154  DZ_ENDCAP_CAL, 0., 360.*deg);
155 
156  G4LogicalVolume* barrelCalLV=
157  new G4LogicalVolume(barrelCalSolid, Lead, "BARREL_CAL_LV");
158 
159  G4LogicalVolume* endcapCalLV=
160  new G4LogicalVolume(endcapCalSolid, Lead, "ENDCAP_CAL_LV");
161 
162  G4VisAttributes* calVisAtt=
163  new G4VisAttributes(true, G4Colour(0., 1., 1.));
164  barrelCalLV-> SetVisAttributes(calVisAtt);
165  endcapCalLV-> SetVisAttributes(calVisAtt);
166 
167  // G4PVPlacement* barrelCal=
168  new G4PVPlacement(0, G4ThreeVector(), "BARREL_CAL_PV",
169  barrelCalLV, expHall, FALSE, 0);
170 
171  G4ThreeVector posCal(0.,0.,6.*m);
172  // G4PVPlacement* endcapCal1=
173  new G4PVPlacement(0, posCal, "ENDCAP_CAL_PV",
174  endcapCalLV, expHall, FALSE, 0);
175 
176  //G4PVPlacement* endcapCal2=
177  new G4PVPlacement(0, -posCal, "ENDCAP_CAL_PV",
178  endcapCalLV, expHall, FALSE, 1);
179 
180  // muon system
181  G4Box* barrelMuonSolid= new G4Box("BARREL_MUON", DX_BARREL_MUON,
183  G4Tubs* endcapMuonSolid=
184  new G4Tubs("ENDCAP_MUON", RIN_ENDCAP_MUON, ROUT_ENDCAP_MUON,
185  DZ_ENDCAP_MUON, 0., 360.*deg);
186 
187  G4LogicalVolume* barrelMuonLV=
188  new G4LogicalVolume(barrelMuonSolid, Ar, "BARREL_MUON_LV");
189 
190  G4LogicalVolume* endcapMuonLV=
191  new G4LogicalVolume(endcapMuonSolid, Ar, "ENDCAP_MUON_LV");
192 
193  G4VisAttributes* muonVisAtt=
194  new G4VisAttributes(true, G4Colour(1., 1., 0.5));
195  //muonVisAtt-> SetForceWireframe(TRUE);
196  barrelMuonLV-> SetVisAttributes(muonVisAtt);
197  endcapMuonLV-> SetVisAttributes(muonVisAtt);
198 
199  const G4double dangle= 45.*deg;
202  rotM->rotateZ(90.*deg);
203 
204  for (G4int k=0; k<8; k++) {
205  G4Transform3D transformM(*rotM, posM);
206  new G4PVPlacement(transformM, "BARREL_MUON_PV",
207  barrelMuonLV, expHall, FALSE, k);
208  rotM->rotateZ(dangle);
209  posM.rotateZ(dangle);
210  }
211 
212  G4ThreeVector posMuon(0.,0.,8.*m);
213  // G4PVPlacement* endcapMuon1=
214  new G4PVPlacement(0, posMuon, "ENDCAP_MUON_PV",
215  endcapMuonLV, expHall, FALSE, 0);
216 
217  // G4PVPlacement* endcapMuon2=
218  new G4PVPlacement(0, -posMuon, "ENDCAP_MUON_PV",
219  endcapMuonLV, expHall, FALSE, 1);
220 
221 
222  // sensitive Detectors
224 
225  G4String muonSDname= "/mydet/muon";
226  H02MuonSD* muonSD= new H02MuonSD(muonSDname);
227  SDman-> AddNewDetector(muonSD);
228  barrelMuonLV-> SetSensitiveDetector(muonSD);
229  endcapMuonLV-> SetSensitiveDetector(muonSD);
230 
231  // magnetic field
232  H02Field* myfield = new H02Field;
233  G4FieldManager* fieldMgr=
235  fieldMgr-> SetDetectorField(myfield);
236  fieldMgr-> CreateChordFinder(myfield);
237 
238  return expHall;
239 }
static const double cm
Definition: G4SIunits.hh:106
G4String symbol
Definition: TRTMaterials.hh:40
static const G4double DZ_ENDCAP_CAL
G4Material * Air
Definition: TRTMaterials.hh:57
CLHEP::Hep3Vector G4ThreeVector
static const G4double RIN_BARREL_CAL
CLHEP::HepRotation G4RotationMatrix
G4double z
Definition: TRTMaterials.hh:39
Definition: G4Box.hh:64
G4String name
Definition: TRTMaterials.hh:40
Definition: G4Tubs.hh:85
G4Element * elC
Definition: TRTMaterials.hh:48
virtual G4VPhysicalVolume * Construct()
static const G4double ROUT_ENDCAP_CAL
G4double a
Definition: TRTMaterials.hh:39
Definition of the H02Field class.
int G4int
Definition: G4Types.hh:78
static const G4double RIN_ENDCAP_CAL
G4Element * elN
Definition: TRTMaterials.hh:44
G4Element * elH
Definition: TRTMaterials.hh:50
G4double density
Definition: TRTMaterials.hh:39
static const G4double R_EXPHALL
static const G4double DX_BARREL_MUON
G4Element * elO
Definition: TRTMaterials.hh:46
static const double deg
Definition: G4SIunits.hh:133
G4double iz
Definition: TRTMaterials.hh:39
#define FALSE
Definition: globals.hh:52
static const double cm3
Definition: G4SIunits.hh:108
HepGeom::Transform3D G4Transform3D
Definition of the H02DetectorConstruction class.
static const G4double DZ_BARREL_CAL
static const G4double RIN_ENDCAP_MUON
void SetSensitiveDetector(const G4String &logVolName, G4VSensitiveDetector *aSD, G4bool multi=false)
static G4TransportationManager * GetTransportationManager()
static const G4double DZ_EXPHALL
static const double g
Definition: G4SIunits.hh:162
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
static const double mole
Definition: G4SIunits.hh:265
static const double m
Definition: G4SIunits.hh:110
double G4double
Definition: G4Types.hh:76
static const G4double DY_BARREL_MUON
static const G4double ROUT_BARREL_CAL
Air AddElement(elN,.7)
static const G4double DZ_BARREL_MUON
static const G4double RIN_BARREL_MUON
static const G4double DZ_ENDCAP_MUON
G4int nel
Definition: TRTMaterials.hh:41
Definition of the H02MuonSD class.
static const G4double ROUT_ENDCAP_MUON
static const G4double ROUT_BARREL_MUON