Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
parallel/TopC/ParN04/src/ExN04DetectorConstruction.cc
이 파일의 문서화 페이지로 가기
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: ExN04DetectorConstruction.cc 78055 2013-12-03 08:27:48Z gcosmo $
27 //
30 //
31 
32 #include "ExN04DetectorConstruction.hh"
33 #include "ExN04TrackerSD.hh"
34 #include "ExN04CalorimeterSD.hh"
35 #include "ExN04CalorimeterROGeometry.hh"
36 #include "ExN04MuonSD.hh"
37 #include "ExN04TrackerParametrisation.hh"
38 #include "ExN04CalorimeterParametrisation.hh"
39 #include "ExN04Field.hh"
40 
41 #include "G4Material.hh"
42 #include "G4MaterialTable.hh"
43 #include "G4Element.hh"
44 #include "G4ElementTable.hh"
45 #include "G4Box.hh"
46 #include "G4Tubs.hh"
47 #include "G4LogicalVolume.hh"
48 #include "G4ThreeVector.hh"
49 #include "G4PVPlacement.hh"
50 #include "G4PVParameterised.hh"
51 #include "G4Transform3D.hh"
52 #include "G4RotationMatrix.hh"
53 #include "G4FieldManager.hh"
55 #include "G4SDManager.hh"
56 #include "G4VisAttributes.hh"
57 #include "G4Colour.hh"
58 #include "G4SystemOfUnits.hh"
59 
61 {
62 
63 #include "ExN04DetectorParameterDef.icc"
65 
66 }
67 
69 {
70  delete Scinti;
71  delete Silicon;
72  delete Ar;
73  delete Lead;
74  delete Air;
75 
76  delete O;
77  delete N;
78  delete C;
79  delete H;
80 }
81 
83 {
84  //-------------------------------------------------------------------------
85  // Materials
86  //-------------------------------------------------------------------------
87 
88  G4double a, z, density;
89  G4int nel;
90 
91  H = new G4Element("Hydrogen", "H", z=1., a= 1.01*g/mole);
92  C = new G4Element("Carbon", "C", z=6., a= 12.01*g/mole);
93  N = new G4Element("Nitrogen", "N", z=7., a= 14.01*g/mole);
94  O = new G4Element("Oxygen", "O", z=8., a= 16.00*g/mole);
95 
96  Air = new G4Material("Air", density= 1.29*mg/cm3, nel=2);
97  Air->AddElement(N, 70.*perCent);
98  Air->AddElement(O, 30.*perCent);
99 
100  Lead =
101  new G4Material("Lead", z=82., a= 207.19*g/mole, density= 11.35*g/cm3);
102 
103  Ar =
104  new G4Material("ArgonGas",z=18., a= 39.95*g/mole, density=1.782*mg/cm3);
105 
106  Silicon =
107  new G4Material("Silicon", z=14., a= 28.09*g/mole, density= 2.33*g/cm3);
108 
109  Scinti = new G4Material("Scintillator", density= 1.032*g/cm3, nel=2);
110  Scinti->AddElement(C, 9);
111  Scinti->AddElement(H, 10);
112 }
113 
115 {
116  //-------------------------------------------------------------------------
117  // Magnetic field
118  //-------------------------------------------------------------------------
119 
120  static G4bool fieldIsInitialized = false;
121  if(!fieldIsInitialized)
122  {
123  ExN04Field* myField = new ExN04Field;
124  G4FieldManager* fieldMgr
126  ->GetFieldManager();
127  fieldMgr->SetDetectorField(myField);
128  fieldMgr->CreateChordFinder(myField);
129  fieldIsInitialized = true;
130  }
131 
132 
133  //-------------------------------------------------------------------------
134  // Detector geometry
135  //-------------------------------------------------------------------------
136 
137  //------------------------------ experimental hall
138  G4Box * experimentalHall_box
139  = new G4Box("expHall_b",expHall_x,expHall_y,expHall_z);
140  G4LogicalVolume * experimentalHall_log
141  = new G4LogicalVolume(experimentalHall_box,Air,"expHall_L",0,0,0);
142  G4VPhysicalVolume * experimentalHall_phys
143  = new G4PVPlacement(0,G4ThreeVector(),experimentalHall_log,"expHall_P",
144  0,false,0);
145  experimentalHall_log->SetVisAttributes(G4VisAttributes::GetInvisible());
146 
147  //------------------------------ tracker
148  G4VSolid * tracker_tubs
149  = new G4Tubs("trkTubs_tubs",trkTubs_rmin,trkTubs_rmax,trkTubs_dz,
151  G4LogicalVolume * tracker_log
152  = new G4LogicalVolume(tracker_tubs,Ar,"trackerT_L",0,0,0);
153  // G4VPhysicalVolume * tracker_phys =
154  new G4PVPlacement(0,G4ThreeVector(),tracker_log,"tracker_phys",
155  experimentalHall_log,false,0);
156  G4VisAttributes* tracker_logVisAtt
157  = new G4VisAttributes(G4Colour(1.0,0.0,1.0));
158  tracker_log->SetVisAttributes(tracker_logVisAtt);
159 
160  //------------------------------ tracker layers
161  // As an example for Parameterised volume
162  // dummy values for G4Tubs -- modified by parameterised volume
163  G4VSolid * trackerLayer_tubs
164  = new G4Tubs("trackerLayer_tubs",trkTubs_rmin,trkTubs_rmax,trkTubs_dz,
166  G4LogicalVolume * trackerLayer_log
167  = new G4LogicalVolume(trackerLayer_tubs,Silicon,"trackerB_L",0,0,0);
168  G4VPVParameterisation * trackerParam
170  // dummy value : kXAxis -- modified by parameterised volume
171  // G4VPhysicalVolume *trackerLayer_phys =
172  new G4PVParameterised("trackerLayer_phys",trackerLayer_log,tracker_log,
173  kXAxis, notrkLayers, trackerParam);
174  G4VisAttributes* trackerLayer_logVisAtt
175  = new G4VisAttributes(G4Colour(0.5,0.0,1.0));
176  trackerLayer_logVisAtt->SetForceWireframe(true);
177  trackerLayer_log->SetVisAttributes(trackerLayer_logVisAtt);
178 
179  //------------------------------ calorimeter
180  G4VSolid * calorimeter_tubs
181  = new G4Tubs("calorimeter_tubs",caloTubs_rmin,caloTubs_rmax,
183  G4LogicalVolume * calorimeter_log
184  = new G4LogicalVolume(calorimeter_tubs,Scinti,"caloT_L",0,0,0);
185  // G4VPhysicalVolume * calorimeter_phys =
186  new G4PVPlacement(0,G4ThreeVector(),calorimeter_log,"caloM_P",
187  experimentalHall_log,false,0);
188  G4VisAttributes* calorimeter_logVisATT
189  = new G4VisAttributes(G4Colour(1.0,1.0,0.0));
190  calorimeter_logVisATT->SetForceWireframe(true);
191  calorimeter_log->SetVisAttributes(calorimeter_logVisATT);
192 
193  //------------------------------- Lead layers
194  // As an example for Parameterised volume
195  // dummy values for G4Tubs -- modified by parameterised volume
196  G4VSolid * caloLayer_tubs
197  = new G4Tubs("caloLayer_tubs",caloRing_rmin,caloRing_rmax,
199  G4LogicalVolume * caloLayer_log
200  = new G4LogicalVolume(caloLayer_tubs,Lead,"caloR_L",0,0,0);
201  G4VPVParameterisation * calorimeterParam
203  // dummy value : kXAxis -- modified by parameterised volume
204  // G4VPhysicalVolume * caloLayer_phys =
205  new G4PVParameterised("caloLayer_phys",caloLayer_log,calorimeter_log,
206  kXAxis, nocaloLayers, calorimeterParam);
207  G4VisAttributes* caloLayer_logVisAtt
208  = new G4VisAttributes(G4Colour(0.7,1.0,0.0));
209  caloLayer_log->SetVisAttributes(caloLayer_logVisAtt);
210 
211  //------------------------------ muon counters
212  // As an example of CSG volumes with rotation
213  G4VSolid * muoncounter_box
214  = new G4Box("muoncounter_box",muBox_width,muBox_thick,
215  muBox_length);
216  G4LogicalVolume * muoncounter_log
217  = new G4LogicalVolume(muoncounter_box,Scinti,"mucounter_L",0,0,0);
218  for(int i=0; i<nomucounter ; i++)
219  {
220  G4double phi, x, y, z;
221  phi = 360.*deg/nomucounter*i;
222  x = muBox_radius*std::sin(phi);
223  y = muBox_radius*std::cos(phi);
224  z = 0.*cm;
225  G4RotationMatrix rm;
226  rm.rotateZ(phi);
228  muoncounter_log, "muoncounter_P",
229  experimentalHall_log,false,i);
230  }
231  G4VisAttributes* muoncounter_logVisAtt
232  = new G4VisAttributes(G4Colour(0.0,1.0,1.0));
233  muoncounter_logVisAtt->SetForceWireframe(true);
234  muoncounter_log->SetVisAttributes(muoncounter_logVisAtt);
235 
236  //------------------------------------------------------------------
237  // Sensitive Detector
238  //------------------------------------------------------------------
239 
241 
242  G4String trackerSDname = "/mydet/tracker";
243  ExN04TrackerSD * trackerSD = new ExN04TrackerSD(trackerSDname);
244  SDman->AddNewDetector(trackerSD);
245  trackerLayer_log->SetSensitiveDetector(trackerSD);
246 
247  G4String calorimeterSDname = "/mydet/calorimeter";
248  ExN04CalorimeterSD * calorimeterSD = new ExN04CalorimeterSD(calorimeterSDname);
249  G4String ROgeometryName = "CalorimeterROGeom";
250  G4VReadOutGeometry* calRO = new ExN04CalorimeterROGeometry(ROgeometryName);
251  calRO->BuildROGeometry();
252  calRO->SetName(ROgeometryName);
253  calorimeterSD->SetROgeometry(calRO);
254  SDman->AddNewDetector(calorimeterSD);
255  calorimeter_log->SetSensitiveDetector(calorimeterSD);
256 
257  G4String muonSDname = "/mydet/muon";
258  ExN04MuonSD * muonSD = new ExN04MuonSD(muonSDname);
259  SDman->AddNewDetector(muonSD);
260  muoncounter_log->SetSensitiveDetector(muonSD);
261 
262  //------------------------------------------------------------------
263  // Digitizer modules
264  //------------------------------------------------------------------
265 
266  return experimentalHall_phys;
267 }
268 
Float_t x
Definition: compare.C:6
CLHEP::Hep3Vector G4ThreeVector
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33
HepGeom::Transform3D G4Transform3D
Definition: G4Tubs.hh:85
void AddNewDetector(G4VSensitiveDetector *aSD)
Definition: G4SDManager.cc:71
Float_t y
Definition: compare.C:6
void SetROgeometry(G4VReadOutGeometry *value)
Double_t z
static constexpr double perCent
Definition: G4SIunits.hh:332
void SetName(G4String value)
static const G4VisAttributes & GetInvisible()
G4bool SetDetectorField(G4Field *detectorField, int failMode=0)
void CreateChordFinder(G4MagneticField *detectorMagField)
static constexpr double g
Definition: G4SIunits.hh:183
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
G4FieldManager * GetFieldManager() const
static constexpr double deg
Definition: G4SIunits.hh:152
static constexpr double mg
Definition: G4SIunits.hh:184
Definition: G4Box.hh:64
void SetVisAttributes(const G4VisAttributes *pVA)
static G4TransportationManager * GetTransportationManager()
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
int G4int
Definition: G4Types.hh:78
void AddElement(G4Element *element, G4int nAtoms)
Definition: G4Material.cc:368
HepRotation & rotateZ(double delta)
Definition: Rotation.cc:92
static constexpr double cm
Definition: G4SIunits.hh:119
void SetForceWireframe(G4bool=true)
static constexpr double mole
Definition: G4SIunits.hh:286
static constexpr double cm3
Definition: G4SIunits.hh:121
void SetSensitiveDetector(G4VSensitiveDetector *pSDetector)