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 | // |
---|
27 | // $Id: XrayFluoDetectorConstruction.hh |
---|
28 | // GEANT4 tag $Name: xray_fluo-V03-02-00 |
---|
29 | // |
---|
30 | // Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it) |
---|
31 | // |
---|
32 | // History: |
---|
33 | // ----------- |
---|
34 | // 28 Nov 2001 Elena Guardincerri Created |
---|
35 | // Nov 2002 Alfonso Mantero materials added, Material selection implementation |
---|
36 | // 16 Jul 2003 Alfonso Mantero Detector type selection added + minor fixes |
---|
37 | // 21 Aug 2003 Alfonso Mantero Material Management moved to XrayFluoMaterials |
---|
38 | // |
---|
39 | // ------------------------------------------------------------------- |
---|
40 | |
---|
41 | #ifndef XrayFluoDetectorConstruction_hh |
---|
42 | #define XrayFluoDetectorConstruction_hh 1 |
---|
43 | |
---|
44 | #include "XrayFluoSiLiDetectorType.hh" |
---|
45 | #include "XrayFluoHPGeDetectorType.hh" |
---|
46 | #include "XrayFluoSD.hh" |
---|
47 | #include "G4VUserDetectorConstruction.hh" |
---|
48 | #include "globals.hh" |
---|
49 | #include "G4RotationMatrix.hh" |
---|
50 | |
---|
51 | #include "XrayFluoGeometry.hh" |
---|
52 | |
---|
53 | class G4Box; |
---|
54 | class G4Tubs; |
---|
55 | class G4Sphere; |
---|
56 | class G4LogicalVolume; |
---|
57 | class G4VPhysicalVolume; |
---|
58 | class G4Material; |
---|
59 | class XrayFluoDetectorMessenger; |
---|
60 | class XrayFluoNistMaterials; |
---|
61 | |
---|
62 | //class XrayFluoSD; |
---|
63 | //class XrayFluoVDetectorType; |
---|
64 | |
---|
65 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
66 | |
---|
67 | class XrayFluoDetectorConstruction : public G4VUserDetectorConstruction |
---|
68 | { |
---|
69 | public: |
---|
70 | |
---|
71 | |
---|
72 | ~XrayFluoDetectorConstruction(); |
---|
73 | |
---|
74 | public: |
---|
75 | |
---|
76 | G4VPhysicalVolume* Construct(); |
---|
77 | |
---|
78 | void UpdateGeometry(); |
---|
79 | |
---|
80 | void SetOhmicPosThickness(G4double); |
---|
81 | |
---|
82 | void SetSampleMaterial(G4String newMaterial); |
---|
83 | |
---|
84 | void SetDetectorType(G4String type); |
---|
85 | |
---|
86 | static XrayFluoDetectorConstruction* GetInstance(); |
---|
87 | |
---|
88 | inline void SetSampleGranularity(G4bool granularity) |
---|
89 | {sampleGranularity = granularity;}; |
---|
90 | |
---|
91 | inline void PhaseSpaceOn() |
---|
92 | {phaseSpaceFlag = true;}; |
---|
93 | |
---|
94 | inline void PhaseSpaceOff() |
---|
95 | {phaseSpaceFlag = false;}; |
---|
96 | |
---|
97 | inline G4bool GetPhaseSpaceFlag() |
---|
98 | {return phaseSpaceFlag;}; |
---|
99 | |
---|
100 | inline void SetGrainDia(G4double size) |
---|
101 | {grainDia = size;}; |
---|
102 | |
---|
103 | void DeleteGrainObjects(); |
---|
104 | |
---|
105 | public: |
---|
106 | |
---|
107 | void PrintApparateParameters(); |
---|
108 | |
---|
109 | XrayFluoVDetectorType* GetDetectorType(); |
---|
110 | |
---|
111 | |
---|
112 | G4double GetWorldSizeZ() {return WorldSizeZ;}; |
---|
113 | G4double GetWorldSizeXY() {return WorldSizeXY;}; |
---|
114 | |
---|
115 | G4double GetDeviceThickness() {return DeviceThickness;}; |
---|
116 | G4double GetDeviceSizeX() {return DeviceSizeX;}; |
---|
117 | G4double GetDeviceSizeY() {return DeviceSizeY;}; |
---|
118 | G4double GetPixelSizeXY() {return PixelSizeXY;}; |
---|
119 | G4double GetContactSizeXY() {return ContactSizeXY;}; |
---|
120 | |
---|
121 | G4int GetNbOfPixels() {return NbOfPixels;}; |
---|
122 | G4int GetNbOfPixelRows() {return NbOfPixelRows;}; |
---|
123 | G4int GetNbOfPixelColumns() {return NbOfPixelColumns;}; |
---|
124 | |
---|
125 | G4Material* GetOhmicPosMaterial() {return OhmicPosMaterial;}; |
---|
126 | G4double GetOhmicPosThickness() {return OhmicPosThickness;}; |
---|
127 | |
---|
128 | G4Material* GetOhmicNegMaterial() {return OhmicNegMaterial;}; |
---|
129 | G4double GetOhmicNegThickness() {return OhmicNegThickness;}; |
---|
130 | |
---|
131 | G4ThreeVector GetDetectorPosition(); |
---|
132 | G4ThreeVector GetSamplePosition() {return G4ThreeVector(0,0,0);}; |
---|
133 | |
---|
134 | const G4VPhysicalVolume* GetphysiWorld() {return physiWorld;}; |
---|
135 | const G4VPhysicalVolume* GetHPGe() {return physiHPGe;}; |
---|
136 | const G4VPhysicalVolume* GetSample() {return physiSample;}; |
---|
137 | const G4VPhysicalVolume* GetDia1() {return physiDia1;}; |
---|
138 | const G4VPhysicalVolume* GetDia3() {return physiDia3;}; |
---|
139 | |
---|
140 | const G4VPhysicalVolume* GetphysiPixel() {return physiPixel;}; |
---|
141 | const G4VPhysicalVolume* GetOhmicPos() {return physiOhmicPos;}; |
---|
142 | const G4VPhysicalVolume* GetOhmicNeg() {return physiOhmicNeg;}; |
---|
143 | |
---|
144 | private: |
---|
145 | |
---|
146 | XrayFluoDetectorConstruction(); |
---|
147 | |
---|
148 | static XrayFluoDetectorConstruction* instance; |
---|
149 | |
---|
150 | XrayFluoVDetectorType* detectorType; |
---|
151 | |
---|
152 | G4bool sampleGranularity; |
---|
153 | G4bool phaseSpaceFlag; |
---|
154 | |
---|
155 | G4double DeviceSizeX; |
---|
156 | G4double DeviceSizeY; |
---|
157 | G4double DeviceThickness; |
---|
158 | |
---|
159 | G4Box* solidWorld; //pointer to the solid World |
---|
160 | G4LogicalVolume* logicWorld; //pointer to the logical World |
---|
161 | G4VPhysicalVolume* physiWorld; //pointer to the physical World |
---|
162 | |
---|
163 | G4Box* solidHPGe; //pointer to the solid Sensor |
---|
164 | G4LogicalVolume* logicHPGe; //pointer to the logical Sensor |
---|
165 | G4VPhysicalVolume* physiHPGe; //pointer to the physical Sensor |
---|
166 | |
---|
167 | G4Box* solidSample; //pointer to the solid Sample |
---|
168 | G4LogicalVolume* logicSample; //pointer to the logical Sample |
---|
169 | G4VPhysicalVolume* physiSample; //pointer to the physical Sample |
---|
170 | |
---|
171 | G4Tubs* solidDia1; //pointer to the solid Diaphragm |
---|
172 | G4LogicalVolume* logicDia1; //pointer to the logical Diaphragm |
---|
173 | G4VPhysicalVolume* physiDia1; //pointer to the physical Diaphragm |
---|
174 | |
---|
175 | G4Tubs* solidDia3; //pointer to the solid Diaphragm |
---|
176 | G4LogicalVolume* logicDia3; //pointer to the logical Diaphragm |
---|
177 | G4VPhysicalVolume* physiDia3; //pointer to the physical Diaphragm |
---|
178 | |
---|
179 | G4Box* solidOhmicPos; |
---|
180 | G4LogicalVolume* logicOhmicPos; |
---|
181 | G4VPhysicalVolume* physiOhmicPos; |
---|
182 | |
---|
183 | G4Box* solidOhmicNeg; |
---|
184 | G4LogicalVolume* logicOhmicNeg; |
---|
185 | G4VPhysicalVolume* physiOhmicNeg; |
---|
186 | |
---|
187 | G4Box* solidPixel; |
---|
188 | G4LogicalVolume* logicPixel; |
---|
189 | G4VPhysicalVolume* physiPixel; |
---|
190 | |
---|
191 | G4Sphere* solidGrain; |
---|
192 | G4LogicalVolume* logicGrain; |
---|
193 | G4VPhysicalVolume* physiGrain; |
---|
194 | |
---|
195 | //materials management |
---|
196 | XrayFluoNistMaterials* materials; |
---|
197 | |
---|
198 | G4Material* OhmicPosMaterial; |
---|
199 | G4Material* OhmicNegMaterial; |
---|
200 | G4Material* pixelMaterial; |
---|
201 | G4Material* sampleMaterial; |
---|
202 | G4Material* Dia1Material; |
---|
203 | G4Material* Dia3Material; |
---|
204 | G4Material* defaultMaterial; |
---|
205 | |
---|
206 | //apparate parameters |
---|
207 | |
---|
208 | G4double OhmicPosThickness; |
---|
209 | |
---|
210 | G4double OhmicNegThickness; |
---|
211 | |
---|
212 | G4int PixelCopyNb; |
---|
213 | G4int grainCopyNb; |
---|
214 | G4int NbOfPixels; |
---|
215 | G4int NbOfPixelRows; |
---|
216 | G4int NbOfPixelColumns; |
---|
217 | G4double PixelThickness; |
---|
218 | |
---|
219 | G4double PixelSizeXY; |
---|
220 | G4double ContactSizeXY; |
---|
221 | |
---|
222 | public: |
---|
223 | |
---|
224 | G4Material* GetSampleMaterial() {return sampleMaterial;}; |
---|
225 | G4Material* GetPixelMaterial() {return pixelMaterial;}; |
---|
226 | G4Material* GetDia1Material() {return Dia1Material;}; |
---|
227 | G4Material* GetDia3Material() {return Dia3Material;}; |
---|
228 | |
---|
229 | private: |
---|
230 | |
---|
231 | G4double SampleThickness; |
---|
232 | G4double SampleSizeXY; |
---|
233 | G4double grainDia; |
---|
234 | G4double SiSizeXY; |
---|
235 | G4double Dia1Thickness; |
---|
236 | G4double Dia1SizeXY; |
---|
237 | G4double Dia3Thickness; |
---|
238 | G4double Dia3SizeXY; |
---|
239 | G4double DiaInnerSize; |
---|
240 | G4double Dia3InnerSize; |
---|
241 | // G4double DistSi; |
---|
242 | public: |
---|
243 | |
---|
244 | |
---|
245 | G4double GetSampleThickness() {return SampleThickness;}; |
---|
246 | G4double GetSampleSizeXY() {return SampleSizeXY;}; |
---|
247 | |
---|
248 | G4double GetDia1Thickness() {return Dia1Thickness;}; |
---|
249 | G4double GetDia1SizeXY() {return Dia1SizeXY;}; |
---|
250 | |
---|
251 | G4double GetDia3Thickness() {return Dia3Thickness;}; |
---|
252 | G4double GetDia3SizeXY() {return Dia3SizeXY;}; |
---|
253 | |
---|
254 | |
---|
255 | private: |
---|
256 | |
---|
257 | |
---|
258 | G4double ThetaHPGe; |
---|
259 | G4double ThetaDia1; |
---|
260 | G4double ThetaDia3; |
---|
261 | |
---|
262 | G4double DistDe; |
---|
263 | G4double DistDia; |
---|
264 | G4double Dia3Dist; |
---|
265 | G4double PhiHPGe; |
---|
266 | G4double PhiDia1; |
---|
267 | G4double PhiDia3; |
---|
268 | G4double AlphaDia1; |
---|
269 | G4double AlphaDia3; |
---|
270 | |
---|
271 | |
---|
272 | G4RotationMatrix zRotPhiHPGe; |
---|
273 | G4RotationMatrix zRotPhiDia1; |
---|
274 | G4RotationMatrix zRotPhiDia3; |
---|
275 | G4double WorldSizeXY; |
---|
276 | G4double WorldSizeZ; |
---|
277 | |
---|
278 | |
---|
279 | XrayFluoDetectorMessenger* detectorMessenger; //pointer to the Messenger |
---|
280 | |
---|
281 | XrayFluoSD* HPGeSD; //pointer to the sensitive detector |
---|
282 | |
---|
283 | G4Region* sampleRegion; |
---|
284 | |
---|
285 | |
---|
286 | private: |
---|
287 | |
---|
288 | void DefineDefaultMaterials(); |
---|
289 | G4VPhysicalVolume* ConstructApparate(); |
---|
290 | |
---|
291 | //calculates some quantities used to construct geometry |
---|
292 | void ComputeApparateParameters(); |
---|
293 | |
---|
294 | }; |
---|
295 | |
---|
296 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
297 | |
---|
298 | inline void XrayFluoDetectorConstruction::ComputeApparateParameters() |
---|
299 | { |
---|
300 | // Compute derived parameters of the apparate |
---|
301 | |
---|
302 | if (phaseSpaceFlag) { |
---|
303 | |
---|
304 | WorldSizeZ = 10 *m; |
---|
305 | WorldSizeXY = 10 *m; |
---|
306 | |
---|
307 | } |
---|
308 | else { |
---|
309 | |
---|
310 | DeviceThickness = PixelThickness+OhmicNegThickness+OhmicPosThickness; |
---|
311 | |
---|
312 | G4cout << "DeviceThickness(cm): "<< DeviceThickness/cm << G4endl; |
---|
313 | |
---|
314 | DeviceSizeY =(NbOfPixelRows * std::max(ContactSizeXY,PixelSizeXY)); |
---|
315 | DeviceSizeX =(NbOfPixelColumns * std::max(ContactSizeXY,PixelSizeXY)); |
---|
316 | |
---|
317 | G4cout << "DeviceSizeX(cm): "<< DeviceSizeX/cm <<G4endl; |
---|
318 | G4cout << "DeviceSizeY(cm): "<< DeviceSizeY/cm << G4endl; |
---|
319 | |
---|
320 | WorldSizeZ = (2 * (DistDe +1.4142 *(std::max(std::max(DeviceThickness,DeviceSizeY), DeviceSizeX))))+5*m; |
---|
321 | WorldSizeXY = 2 * (DistDe +1.4142 *Dia1SizeXY)+5*m; |
---|
322 | |
---|
323 | } |
---|
324 | } |
---|
325 | |
---|
326 | #endif |
---|
327 | |
---|
328 | |
---|
329 | |
---|
330 | |
---|
331 | |
---|
332 | |
---|