Loading...
Searching...
No Matches
RE01DetectorConstruction.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/// \file runAndEvent/RE01/src/RE01DetectorConstruction.cc
27/// \brief Implementation of the RE01DetectorConstruction class
28//
29//
30
32#include "RE01TrackerSD.hh"
35#include "RE01Field.hh"
37
38#include "G4NistManager.hh"
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"
52#include "G4TransportationManager.hh"
53#include "G4SDManager.hh"
54#include "G4VisAttributes.hh"
55#include "G4Colour.hh"
56#include "G4Region.hh"
57#include "G4RegionStore.hh"
58#include "G4SystemOfUnits.hh"
59
60//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
66
67//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
70
71//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
73{
74 //-------------------------------------------------------------------------
75 // Materials
76 //-------------------------------------------------------------------------
77
78 G4double a, iz, density;
79 G4String name, symbol;
80 G4int nel;
81
82 a = 1.01*g/mole;
83 G4Element* elH = new G4Element(name="Hydrogen", symbol="H", iz=1., a);
84
85 a = 12.01*g/mole;
86 G4Element* elC = new G4Element(name="Carbon", symbol="C", iz=6., a);
87
88 // Material Information imported from NIST database.
89 G4NistManager* NISTman = G4NistManager::Instance();
90 G4Material* air = NISTman->FindOrBuildMaterial("G4_AIR");
91 G4Material* lead = NISTman->FindOrBuildMaterial("G4_Pb");
92 G4Material* arGas = NISTman->FindOrBuildMaterial("G4_Ar");
93 G4Material* silicon = NISTman->FindOrBuildMaterial("G4_Si");
94
95 density = 1.032*g/cm3;
96 G4Material* scinti = new G4Material(name="Scintillator", density, nel=2);
97 scinti->AddElement(elC, 9);
98 scinti->AddElement(elH, 10);
99
100 //-------------------------------------------------------------------------
101 // Detector geometry
102 //-------------------------------------------------------------------------
103 //------------------------------ experimental hall
104 G4Box * experimentalHall_box
105 = new G4Box("expHall_b",fExpHall_x,fExpHall_y,fExpHall_z);
106 G4LogicalVolume * experimentalHall_log
107 = new G4LogicalVolume(experimentalHall_box,air,"expHall_L",0,0,0);
108 G4VPhysicalVolume * experimentalHall_phys
109 = new G4PVPlacement(0,G4ThreeVector(),experimentalHall_log,"expHall_P",
110 0,false,0);
111 G4VisAttributes* experimentalHallVisAtt
112 = new G4VisAttributes(G4Colour(1.0,1.0,1.0));
113 experimentalHallVisAtt->SetForceWireframe(true);
114 experimentalHall_log->SetVisAttributes(experimentalHallVisAtt);
115 G4Region* defaultRegion = (*(G4RegionStore::GetInstance()))[0];
116 RE01RegionInformation* defaultRInfo = new RE01RegionInformation();
117 defaultRInfo->SetWorld();
118 defaultRInfo->Print();
119 defaultRegion->SetUserInformation(defaultRInfo);
120
121 //------------------------------ tracker
122 G4VSolid * tracker_tubs
123 = new G4Tubs("trkTubs_tubs",fTrkTubs_rmin,fTrkTubs_rmax,fTrkTubs_dz,
125 G4LogicalVolume * tracker_log
126 = new G4LogicalVolume(tracker_tubs,arGas,"trackerT_L",0,0,0);
127 // G4VPhysicalVolume * tracker_phys =
128 new G4PVPlacement(0,G4ThreeVector(),tracker_log,"tracker_phys",
129 experimentalHall_log,false,0);
130 G4VisAttributes* tracker_logVisAtt
131 = new G4VisAttributes(G4Colour(1.0,0.0,1.0));
132 tracker_logVisAtt->SetForceWireframe(true);
133 tracker_log->SetVisAttributes(tracker_logVisAtt);
134 G4Region* trackerRegion = new G4Region("TrackerRegion");
135 RE01RegionInformation* trackerInfo = new RE01RegionInformation();
136 trackerInfo->SetTracker();
137 trackerRegion->SetUserInformation(trackerInfo);
138 tracker_log->SetRegion(trackerRegion);
139 trackerRegion->AddRootLogicalVolume(tracker_log);
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,
148 = new G4LogicalVolume(trackerLayer_tubs,silicon,"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",fTrackerLayer_log,tracker_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 fTrackerLayer_log->SetVisAttributes(trackerLayer_logVisAtt);
159
160 //------------------------------ calorimeter
161 G4VSolid * calorimeter_tubs
162 = new G4Tubs("calorimeter_tubs",fCaloTubs_rmin,fCaloTubs_rmax,
165 = new G4LogicalVolume(calorimeter_tubs,scinti,"caloT_L",0,0,0);
166 // G4VPhysicalVolume * calorimeter_phys =
167 new G4PVPlacement(0,G4ThreeVector(),fCalorimeter_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 fCalorimeter_log->SetVisAttributes(calorimeter_logVisATT);
173 G4Region* calorimeterRegion = new G4Region("CalorimeterRegion");
174 RE01RegionInformation* calorimeterInfo
175 = new RE01RegionInformation();
176 calorimeterInfo->SetCalorimeter();
177 calorimeterRegion->SetUserInformation(calorimeterInfo);
178 fCalorimeter_log->SetRegion(calorimeterRegion);
179 calorimeterRegion->AddRootLogicalVolume(fCalorimeter_log);
180
181 //------------------------------- Lead layers
182 // As an example for Parameterised volume
183 // dummy values for G4Tubs -- modified by parameterised volume
184 G4VSolid * caloLayer_tubs
185 = new G4Tubs("caloLayer_tubs",fCaloRing_rmin,fCaloRing_rmax,
187 G4LogicalVolume * caloLayer_log
188 = new G4LogicalVolume(caloLayer_tubs,lead,"caloR_L",0,0,0);
189 G4VPVParameterisation * calorimeterParam
191 // dummy value : kXAxis -- modified by parameterised volume
192 // G4VPhysicalVolume * caloLayer_phys =
193 new G4PVParameterised("caloLayer_phys",caloLayer_log,fCalorimeter_log,
194 kXAxis, fNocaloLayers, calorimeterParam);
195 G4VisAttributes* caloLayer_logVisAtt
196 = new G4VisAttributes(G4Colour(0.7,1.0,0.0));
197 caloLayer_logVisAtt->SetForceWireframe(true);
198 caloLayer_log->SetVisAttributes(caloLayer_logVisAtt);
199
200
201 return experimentalHall_phys;
202}
203
204//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
206{
207 //------------------------------------------------------------------
208 // Sensitive Detector
209 //------------------------------------------------------------------
210
211 G4String trackerSDname = "/mydet/tracker";
212 RE01TrackerSD * trackerSD = new RE01TrackerSD(trackerSDname);
213 G4SDManager::GetSDMpointer()->AddNewDetector(trackerSD);
214 SetSensitiveDetector(fTrackerLayer_log, trackerSD);
215
216 // N.B. Calorimeter SD is defined in the parallel world.
217
218 //-------------------------------------------------------------------------
219 // Magnetic field
220 //-------------------------------------------------------------------------
221
222 RE01Field* myField = new RE01Field;
223 G4FieldManager* fieldMgr
224 = G4TransportationManager::GetTransportationManager()->GetFieldManager();
225 fieldMgr->SetDetectorField(myField);
226 fieldMgr->CreateChordFinder(myField);
227}
228
std::vector< ExP01TrackerHit * > a
Definition of the RE01CalorimeterParametrisation class.
Definition of the RE01DetectorConstruction class.
G4double fCaloTubs_dphi
G4double fExpHall_z
G4double fTrkTubs_rmax
G4double fCaloTubs_rmin
G4double fCaloRing_dphi
G4double fCaloRing_dz
G4double fCaloRing_rmin
G4int fNocaloLayers
G4double fCaloRing_sphi
G4double fTrkTubs_dphi
G4double fTrkTubs_sphi
G4double fExpHall_y
G4int fNotrkLayers
G4double fTrkTubs_rmin
G4double fCaloTubs_sphi
G4double fTrkTubs_dz
G4double fCaloTubs_rmax
G4double fCaloTubs_dz
G4double fCaloRing_rmax
G4double fExpHall_x
Definition of the RE01Field class.
Definition of the RE01RegionInformation class.
Definition of the RE01TrackerParametrisation class.
Definition of the RE01TrackerSD class.
virtual G4VPhysicalVolume * Construct()
void SetTracker(G4bool v=true)
void SetCalorimeter(G4bool v=true)
virtual void Print() const
void SetWorld(G4bool v=true)

Applications | User Support | Publications | Collaboration