Geant4  10.03
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 //
28 //
29 // $Id: RE01DetectorConstruction.cc 101677 2016-11-21 09:26:55Z gcosmo $
30 //
31 
33 #include "RE01TrackerSD.hh"
36 #include "RE01Field.hh"
37 #include "RE01RegionInformation.hh"
38 
39 #include "G4NistManager.hh"
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 "G4Region.hh"
58 #include "G4RegionStore.hh"
59 #include "G4SystemOfUnits.hh"
60 
61 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
64 {
66 }
67 
68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
70 {;}
71 
72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
74 {
75  //-------------------------------------------------------------------------
76  // Materials
77  //-------------------------------------------------------------------------
78 
79  G4double a, iz, density;
80  G4String name, symbol;
81  G4int nel;
82 
83  a = 1.01*g/mole;
84  G4Element* elH = new G4Element(name="Hydrogen", symbol="H", iz=1., a);
85 
86  a = 12.01*g/mole;
87  G4Element* elC = new G4Element(name="Carbon", symbol="C", iz=6., a);
88 
89  // Material Information imported from NIST database.
91  G4Material* air = NISTman->FindOrBuildMaterial("G4_AIR");
92  G4Material* lead = NISTman->FindOrBuildMaterial("G4_Pb");
93  G4Material* arGas = NISTman->FindOrBuildMaterial("G4_Ar");
94  G4Material* silicon = NISTman->FindOrBuildMaterial("G4_Si");
95 
96  density = 1.032*g/cm3;
97  G4Material* scinti = new G4Material(name="Scintillator", density, nel=2);
98  scinti->AddElement(elC, 9);
99  scinti->AddElement(elH, 10);
100 
101  //-------------------------------------------------------------------------
102  // Detector geometry
103  //-------------------------------------------------------------------------
104  //------------------------------ experimental hall
105  G4Box * experimentalHall_box
106  = new G4Box("expHall_b",fExpHall_x,fExpHall_y,fExpHall_z);
107  G4LogicalVolume * experimentalHall_log
108  = new G4LogicalVolume(experimentalHall_box,air,"expHall_L",0,0,0);
109  G4VPhysicalVolume * experimentalHall_phys
110  = new G4PVPlacement(0,G4ThreeVector(),experimentalHall_log,"expHall_P",
111  0,false,0);
112  G4VisAttributes* experimentalHallVisAtt
113  = new G4VisAttributes(G4Colour(1.0,1.0,1.0));
114  experimentalHallVisAtt->SetForceWireframe(true);
115  experimentalHall_log->SetVisAttributes(experimentalHallVisAtt);
116  G4Region* defaultRegion = (*(G4RegionStore::GetInstance()))[0];
117  RE01RegionInformation* defaultRInfo = new RE01RegionInformation();
118  defaultRInfo->SetWorld();
119  defaultRInfo->Print();
120  defaultRegion->SetUserInformation(defaultRInfo);
121 
122  //------------------------------ tracker
123  G4VSolid * tracker_tubs
124  = new G4Tubs("trkTubs_tubs",fTrkTubs_rmin,fTrkTubs_rmax,fTrkTubs_dz,
126  G4LogicalVolume * tracker_log
127  = new G4LogicalVolume(tracker_tubs,arGas,"trackerT_L",0,0,0);
128  // G4VPhysicalVolume * tracker_phys =
129  new G4PVPlacement(0,G4ThreeVector(),tracker_log,"tracker_phys",
130  experimentalHall_log,false,0);
131  G4VisAttributes* tracker_logVisAtt
132  = new G4VisAttributes(G4Colour(1.0,0.0,1.0));
133  tracker_logVisAtt->SetForceWireframe(true);
134  tracker_log->SetVisAttributes(tracker_logVisAtt);
135  G4Region* trackerRegion = new G4Region("TrackerRegion");
136  RE01RegionInformation* trackerInfo = new RE01RegionInformation();
137  trackerInfo->SetTracker();
138  trackerRegion->SetUserInformation(trackerInfo);
139  tracker_log->SetRegion(trackerRegion);
140  trackerRegion->AddRootLogicalVolume(tracker_log);
141 
142  //------------------------------ tracker layers
143  // As an example for Parameterised volume
144  // dummy values for G4Tubs -- modified by parameterised volume
145  G4VSolid * trackerLayer_tubs
146  = new G4Tubs("trackerLayer_tubs",fTrkTubs_rmin,fTrkTubs_rmax,fTrkTubs_dz,
149  = new G4LogicalVolume(trackerLayer_tubs,silicon,"trackerB_L",0,0,0);
150  G4VPVParameterisation * trackerParam
152  // dummy value : kXAxis -- modified by parameterised volume
153  // G4VPhysicalVolume *trackerLayer_phys =
154  new G4PVParameterised("trackerLayer_phys",fTrackerLayer_log,tracker_log,
155  kXAxis, fNotrkLayers, trackerParam);
156  G4VisAttributes* trackerLayer_logVisAtt
157  = new G4VisAttributes(G4Colour(0.5,0.0,1.0));
158  trackerLayer_logVisAtt->SetForceWireframe(true);
159  fTrackerLayer_log->SetVisAttributes(trackerLayer_logVisAtt);
160 
161  //------------------------------ calorimeter
162  G4VSolid * calorimeter_tubs
163  = new G4Tubs("calorimeter_tubs",fCaloTubs_rmin,fCaloTubs_rmax,
166  = new G4LogicalVolume(calorimeter_tubs,scinti,"caloT_L",0,0,0);
167  // G4VPhysicalVolume * calorimeter_phys =
168  new G4PVPlacement(0,G4ThreeVector(),fCalorimeter_log,"caloM_P",
169  experimentalHall_log,false,0);
170  G4VisAttributes* calorimeter_logVisATT
171  = new G4VisAttributes(G4Colour(1.0,1.0,0.0));
172  calorimeter_logVisATT->SetForceWireframe(true);
173  fCalorimeter_log->SetVisAttributes(calorimeter_logVisATT);
174  G4Region* calorimeterRegion = new G4Region("CalorimeterRegion");
175  RE01RegionInformation* calorimeterInfo
176  = new RE01RegionInformation();
177  calorimeterInfo->SetCalorimeter();
178  calorimeterRegion->SetUserInformation(calorimeterInfo);
179  fCalorimeter_log->SetRegion(calorimeterRegion);
180  calorimeterRegion->AddRootLogicalVolume(fCalorimeter_log);
181 
182  //------------------------------- Lead layers
183  // As an example for Parameterised volume
184  // dummy values for G4Tubs -- modified by parameterised volume
185  G4VSolid * caloLayer_tubs
186  = new G4Tubs("caloLayer_tubs",fCaloRing_rmin,fCaloRing_rmax,
188  G4LogicalVolume * caloLayer_log
189  = new G4LogicalVolume(caloLayer_tubs,lead,"caloR_L",0,0,0);
190  G4VPVParameterisation * calorimeterParam
192  // dummy value : kXAxis -- modified by parameterised volume
193  // G4VPhysicalVolume * caloLayer_phys =
194  new G4PVParameterised("caloLayer_phys",caloLayer_log,fCalorimeter_log,
195  kXAxis, fNocaloLayers, calorimeterParam);
196  G4VisAttributes* caloLayer_logVisAtt
197  = new G4VisAttributes(G4Colour(0.7,1.0,0.0));
198  caloLayer_logVisAtt->SetForceWireframe(true);
199  caloLayer_log->SetVisAttributes(caloLayer_logVisAtt);
200 
201 
202  return experimentalHall_phys;
203 }
204 
205 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
207 {
208  //------------------------------------------------------------------
209  // Sensitive Detector
210  //------------------------------------------------------------------
211 
212  G4String trackerSDname = "/mydet/tracker";
213  RE01TrackerSD * trackerSD = new RE01TrackerSD(trackerSDname);
216 
217  // N.B. Calorimeter SD is defined in the parallel world.
218 
219  //-------------------------------------------------------------------------
220  // Magnetic field
221  //-------------------------------------------------------------------------
222 
223  RE01Field* myField = new RE01Field;
224  G4FieldManager* fieldMgr
226  fieldMgr->SetDetectorField(myField);
227  fieldMgr->CreateChordFinder(myField);
228 }
229 
Definition of the RE01Field class.
void SetUserInformation(G4VUserRegionInformation *ui)
virtual G4VPhysicalVolume * Construct()
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
CLHEP::Hep3Vector G4ThreeVector
void AddRootLogicalVolume(G4LogicalVolume *lv)
Definition: G4Region.cc:290
G4bool SetDetectorField(G4Field *detectorField)
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33
Definition: G4Box.hh:64
Definition: G4Tubs.hh:85
const char * name(G4int ptype)
static constexpr double g
Definition: G4SIunits.hh:183
int G4int
Definition: G4Types.hh:78
virtual void Print() const
static G4NistManager * Instance()
Definition of the RE01RegionInformation class.
static G4RegionStore * GetInstance()
void SetRegion(G4Region *reg)
void SetWorld(G4bool v=true)
void SetCalorimeter(G4bool v=true)
static constexpr double cm3
Definition: G4SIunits.hh:121
void SetSensitiveDetector(const G4String &logVolName, G4VSensitiveDetector *aSD, G4bool multi=false)
Definition of the RE01TrackerParametrisation class.
static G4TransportationManager * GetTransportationManager()
void AddNewDetector(G4VSensitiveDetector *aSD)
Definition: G4SDManager.cc:71
G4FieldManager * GetFieldManager() const
Definition of the RE01TrackerSD class.
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
Definition of the RE01CalorimeterParametrisation class.
void AddElement(G4Element *element, G4int nAtoms)
Definition: G4Material.cc:362
double G4double
Definition: G4Types.hh:76
void CreateChordFinder(G4MagneticField *detectorMagField)
Definition of the RE01DetectorConstruction class.
static constexpr double mole
Definition: G4SIunits.hh:286
void SetForceWireframe(G4bool=true)
void SetVisAttributes(const G4VisAttributes *pVA)
void SetTracker(G4bool v=true)