ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
ExGflashDetectorConstruction.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file ExGflashDetectorConstruction.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
//
29
//
30
31
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33
34
// User Classes
35
#include "
ExGflashDetectorConstruction.hh
"
36
#include "
ExGflashSensitiveDetector.hh
"
37
#include "
ExGflashMessenger.hh
"
38
#include "
ExGflashHomoShowerTuning.hh
"
39
40
// G4 Classes
41
#include "
G4RunManager.hh
"
42
#include "
G4NistManager.hh
"
43
#include "
G4Material.hh
"
44
#include "
G4ThreeVector.hh
"
45
#include "
G4PVPlacement.hh
"
46
#include "
G4VPhysicalVolume.hh
"
47
#include "
G4LogicalVolume.hh
"
48
#include "
G4Box.hh
"
49
#include "
G4SDManager.hh
"
50
#include "
G4VisAttributes.hh
"
51
#include "
G4Colour.hh
"
52
#include "
G4SystemOfUnits.hh
"
53
#include "
G4AutoDelete.hh
"
54
#include "
globals.hh
"
55
56
//fast simulation
57
#include "
GFlashHomoShowerParameterisation.hh
"
58
#include "
G4FastSimulationManager.hh
"
59
#include "
GFlashShowerModel.hh
"
60
#include "
GFlashHitMaker.hh
"
61
#include "
GFlashParticleBounds.hh
"
62
63
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
64
65
G4ThreadLocal
GFlashShowerModel
*
ExGflashDetectorConstruction::fFastShowerModel
= 0;
66
G4ThreadLocal
67
GFlashHomoShowerParameterisation
*
ExGflashDetectorConstruction::fParameterisation
= 0;
68
G4ThreadLocal
GFlashParticleBounds
*
ExGflashDetectorConstruction::fParticleBounds
= 0;
69
G4ThreadLocal
GFlashHitMaker
*
ExGflashDetectorConstruction::fHitMaker
= 0;
70
71
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
72
73
const
G4int
kMaxBin
= 500;
74
//const G4int kMaxRowCol = 50;
75
76
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
77
78
ExGflashDetectorConstruction::ExGflashDetectorConstruction
()
79
:
G4VUserDetectorConstruction
(),fNbOfCrystals(10),
80
fCrystal_log(0),fDetMat(0),
fRegion
(0),
81
fVerbose(0),fNLtot(40),fNRtot(50),fDLradl(0.5),fDRradl(0.1)
82
{
83
G4cout
<<
"ExGflashDetectorConstruction::Detector constructor"
<<
G4endl
;
84
fGflashMessenger
=
new
ExGflashMessenger
(
this
);
85
86
// Crystall
87
fCrystalWidth
= 3*
cm
;
88
fCrystalLength
= 24*
cm
;
89
}
90
91
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
92
93
ExGflashDetectorConstruction::~ExGflashDetectorConstruction
()
94
{
95
delete
fGflashMessenger
;
96
delete
fFastShowerModel
;
97
delete
fParameterisation
;
98
delete
fParticleBounds
;
99
delete
fHitMaker
;
100
}
101
102
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
103
104
G4VPhysicalVolume
*
ExGflashDetectorConstruction::Construct
()
105
{
106
//--------- Definitions of Solids, Logical Volumes, Physical Volumes ---------
107
G4cout
<<
"Defining the materials"
<<
G4endl
;
108
// Get nist material manager
109
G4NistManager
* nistManager =
G4NistManager::Instance
();
110
// Build materials
111
G4Material
* air = nistManager->
FindOrBuildMaterial
(
"G4_AIR"
);
112
G4Material
* pbWO4 = nistManager->
FindOrBuildMaterial
(
"G4_PbWO4"
);
113
114
fDetMat
= pbWO4;
115
116
//------------------------------
117
// Calorimeter segments
118
//------------------------------
119
// Simplified `CMS-like` PbWO4 crystal calorimeter
120
121
122
// Simplified `CMS-like` PbWO4 crystal calorimeter
123
124
// Calorimeter
125
G4double
calo_xside = (
fCrystalWidth
*
fNbOfCrystals
);
126
G4double
calo_yside = (
fCrystalWidth
*
fNbOfCrystals
);
127
G4double
calo_zside =
fCrystalLength
;
128
129
//The Experimental Hall
130
G4double
experimentalHall_x=calo_xside * 4;
131
G4double
experimentalHall_y=calo_yside * 4;
132
G4double
experimentalHall_z=calo_zside * 4;
133
134
G4VSolid
* experimentalHall_box
135
=
new
G4Box
(
"expHall_box"
,
// World Volume
136
experimentalHall_x,
// x size
137
experimentalHall_y,
// y size
138
experimentalHall_z);
// z size
139
140
G4LogicalVolume
* experimentalHall_log
141
=
new
G4LogicalVolume
(experimentalHall_box,
142
air,
143
"expHall_log"
,
144
0,
//opt: fieldManager
145
0,
//opt: SensitiveDetector
146
0);
//opt: UserLimits
147
G4VPhysicalVolume
* experimentalHall_phys
148
=
new
G4PVPlacement
(0,
149
G4ThreeVector
(),
//at (0,0,0)
150
"expHall"
,
151
experimentalHall_log,
152
0,
153
false
,
154
0);
155
156
G4Box
* calo_box=
new
G4Box
(
"Calorimeter"
,
// its name
157
calo_xside/2.,
// size
158
calo_yside/2.,
159
calo_zside/2.);
160
G4LogicalVolume
* calo_log
161
=
new
G4LogicalVolume
(calo_box,
// its solid
162
air,
// its material
163
"calo_log"
,
// its name
164
0,
// opt: fieldManager
165
0,
// opt: SensitiveDetector
166
0);
// opt: UserLimit
167
168
G4double
xpos = 0.0;
169
G4double
ypos = 0.0;
170
G4double
zpos
= calo_zside/2.;
// face @ z= 0.0
171
172
new
G4PVPlacement
(0,
173
G4ThreeVector
(xpos, ypos, zpos),
174
calo_log,
175
"calorimeter"
,
176
experimentalHall_log,
177
false
,
178
1);
179
180
// Crystals
181
G4VSolid
* crystal_box
182
=
new
G4Box
(
"Crystal"
,
// its name
183
fCrystalWidth
/2,
184
fCrystalWidth
/2,
185
fCrystalLength
/2);
186
// size
187
fCrystal_log
188
=
new
G4LogicalVolume
(crystal_box,
// its solid
189
fDetMat
,
// its material
190
"Crystal_log"
);
// its name
191
192
for
(
G4int
i=0; i<
fNbOfCrystals
; i++)
193
{
194
195
for
(
G4int
j=0; j<
fNbOfCrystals
; j++)
196
{
197
G4int
n
= i*10+j;
198
G4ThreeVector
crystalPos((i*
fCrystalWidth
)-(calo_xside-fCrystalWidth)/2.,
199
(j*fCrystalWidth)-(calo_yside-fCrystalWidth)/2.,0 );
200
new
G4PVPlacement
(0,
// no rotation
201
crystalPos,
// translation
202
fCrystal_log
,
203
"crystal"
,
// its name
204
calo_log,
205
false
,
206
n);
207
}
208
}
209
G4cout
<<
"There are "
<< fNbOfCrystals <<
210
" crystals per row in the calorimeter, so in total "
<<
211
fNbOfCrystals*fNbOfCrystals <<
" crystals"
<<
G4endl
;
212
G4cout
<<
"Total Calorimeter size"
<< calo_xside /
cm
<<
" cm x "
213
<< calo_yside /
cm
<<
" cm x "
214
<< calo_zside /
cm
<<
" cm"
<<
G4endl
;
215
G4cout
<<
"They have width of "
<<
fCrystalWidth
/
cm
<<
216
" cm and a length of "
<<
fCrystalLength
/
cm
217
<<
" cm. The Material is "
<<
fDetMat
218
<<
" Total: "
<<
fCrystalLength
/
fDetMat
->
GetRadlen
()
219
<<
" X0"
<<
G4endl
;
220
221
222
experimentalHall_log->
SetVisAttributes
(
G4VisAttributes::GetInvisible
());
223
G4VisAttributes
* caloVisAtt =
new
G4VisAttributes
(
G4Colour
(1.0,1.0,1.0));
224
G4VisAttributes
* crystalVisAtt =
new
G4VisAttributes
(
G4Colour
(1.0,1.0,0.0));
225
calo_log->
SetVisAttributes
(caloVisAtt);
226
fCrystal_log
->
SetVisAttributes
(crystalVisAtt);
227
228
// define the fParameterisation region
229
G4cout
<<
"\n ---> DetectorConstruction Region Definition"
<<
G4endl
;
230
fRegion
=
new
G4Region
(
"crystals"
);
231
calo_log->
SetRegion
(
fRegion
);
232
fRegion
->
AddRootLogicalVolume
(calo_log);
233
234
return
experimentalHall_phys;
235
}
236
237
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
238
239
void
ExGflashDetectorConstruction::ConstructSDandField
()
240
{
241
// -- sensitive detectors:
242
243
G4SDManager
* SDman =
G4SDManager::GetSDMpointer
();
244
245
ExGflashSensitiveDetector
* SD =
246
new
ExGflashSensitiveDetector
(
"Calorimeter"
,
this
);
247
248
SDman->
AddNewDetector
(SD);
249
if
(
fCrystal_log
)
250
fCrystal_log
->
SetSensitiveDetector
(SD);
251
252
// -- fast simulation models:
253
// **********************************************
254
// * Initializing shower modell
255
// ***********************************************
256
G4cout
<<
"\n--> Creating shower parameterization models"
<<
G4endl
;
257
fFastShowerModel
=
new
GFlashShowerModel
(
"fFastShowerModel"
,
fRegion
);
258
fParameterisation
=
259
new
GFlashHomoShowerParameterisation
(
fDetMat
,
260
new
ExGflashHomoShowerTuning
());
261
fFastShowerModel
->
SetParameterisation
(*
fParameterisation
);
262
// Energy Cuts to kill particles:
263
fParticleBounds
=
new
GFlashParticleBounds
();
264
fFastShowerModel
->
SetParticleBounds
(*
fParticleBounds
);
265
// Makes the EnergieSpots
266
fHitMaker
=
new
GFlashHitMaker
();
267
fFastShowerModel
->
SetHitMaker
(*
fHitMaker
);
268
G4cout
<<
"end shower parameterization."
<<
G4endl
;
269
// **********************************************
270
// Get Rad Len and R molere ?
271
fSDRadLen
=
fDetMat
->
GetRadlen
();
272
}
273
274
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
275
276
void
ExGflashDetectorConstruction::SetLBining
(
G4ThreeVector
Value)
277
{
278
fNLtot
= (
G4int
)Value(0);
279
if
(
fNLtot
>
kMaxBin
) {
280
G4cout
<<
"\n ---> warning from SetLBining: "
281
<<
fNLtot
<<
" truncated to "
<<
kMaxBin
<<
G4endl
;
282
fNLtot
=
kMaxBin
;
283
}
284
fDLradl
= Value(1);
285
}
286
287
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
288
289
void
ExGflashDetectorConstruction::SetRBining
(
G4ThreeVector
Value)
290
{
291
fNRtot
= (
G4int
)Value(0);
292
if
(
fNRtot
>
kMaxBin
) {
293
G4cout
<<
"\n ---> warning from SetRBining: "
294
<<
fNRtot
<<
" truncated to "
<<
kMaxBin
<<
G4endl
;
295
fNRtot
=
kMaxBin
;
296
}
297
fDRradl
= Value(1);
298
}
299
300
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
301
302
void
ExGflashDetectorConstruction::SetMaterial
(
G4String
mat
)
303
{
304
// search the material by its name
305
G4Material
* pttoMaterial =
306
G4NistManager::Instance
()->
FindOrBuildMaterial
(mat);
307
308
if
(pttoMaterial &&
fDetMat
!= pttoMaterial) {
309
fDetMat
= pttoMaterial;
310
if
(
fCrystal_log
) {
fCrystal_log
->
SetMaterial
(
fDetMat
); }
311
if
(
fParameterisation
) {
312
fParameterisation
->
SetMaterial
(
fDetMat
);
313
fParameterisation
->
PrintMaterial
(
fDetMat
);
314
// Get Rad Len and R molere ?
315
fSDRadLen
=
fDetMat
->
GetRadlen
();
316
}
317
G4RunManager::GetRunManager
()->
PhysicsHasBeenModified
();
318
}
319
}
320
321
322
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
geant4
tree
geant4-10.6-release
examples
extended
parameterisations
gflash
gflasha
src
ExGflashDetectorConstruction.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:09
using
1.8.2 with
ECCE GitHub integration