Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
XrayFluoDetectorConstruction.hh
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 //
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 "globals.hh"
45 #include "G4RotationMatrix.hh"
47 #include "G4Navigator.hh"
48 #include "G4Cache.hh"
49 
52 #include "XrayFluoSD.hh"
53 #include "XrayFluoGeometry.hh"
54 
55 class G4Box;
56 class G4Tubs;
57 class G4Sphere;
58 class G4LogicalVolume;
59 class G4VPhysicalVolume;
60 class G4Material;
63 
64 //class XrayFluoSD;
65 //class XrayFluoVDetectorType;
66 
67 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
68 
70 {
71 public:
72 
73 
75 
76 public:
77 
79 
80  void ConstructSDandField();
81 
82  void UpdateGeometry();
83 
85 
86  void SetSampleMaterial(G4String newMaterial);
87 
88  void SetDetectorType(G4String type);
89 
91 
92  inline void SetSampleGranularity(G4bool granularity)
93  {sampleGranularity = granularity;};
94 
95  inline void PhaseSpaceOn()
96  {phaseSpaceFlag = true;};
97 
98  inline void PhaseSpaceOff()
99  {phaseSpaceFlag = false;};
100 
101  inline G4bool GetPhaseSpaceFlag() const
102  {return phaseSpaceFlag;};
103 
104  inline void SetGrainDia(G4double size)
105  {grainDia = size;};
106 
107  void DeleteGrainObjects();
108 
109 public:
110 
111  void PrintApparateParameters();
112 
114 
115 
116  G4double GetWorldSizeZ() const {return WorldSizeZ;};
117  G4double GetWorldSizeXY() const {return WorldSizeXY;};
118 
119  G4double GetDeviceThickness() const {return DeviceThickness;};
120  G4double GetDeviceSizeX() const {return DeviceSizeX;};
121  G4double GetDeviceSizeY() const {return DeviceSizeY;};
122  G4double GetPixelSizeXY() const {return PixelSizeXY;};
123  G4double GetContactSizeXY() const {return ContactSizeXY;};
124 
125  G4int GetNbOfPixels() const {return NbOfPixels;};
126  G4int GetNbOfPixelRows() const {return NbOfPixelRows;};
127  G4int GetNbOfPixelColumns() const {return NbOfPixelColumns;};
128 
129  G4Material* GetOhmicPosMaterial() const {return OhmicPosMaterial;};
130  G4double GetOhmicPosThickness() const {return OhmicPosThickness;};
131 
132  G4Material* GetOhmicNegMaterial() const {return OhmicNegMaterial;};
133  G4double GetOhmicNegThickness() const {return OhmicNegThickness;};
134 
137 
138  const G4VPhysicalVolume* GetphysiWorld() const {return physiWorld;};
139  const G4VPhysicalVolume* GetHPGe() const {return physiHPGe;};
140  const G4VPhysicalVolume* GetSample() const {return physiSample;};
141  const G4VPhysicalVolume* GetDia1() const {return physiDia1;};
142  const G4VPhysicalVolume* GetDia3() const {return physiDia3;};
143 
144  const G4VPhysicalVolume* GetphysiPixel() const {return physiPixel;};
145  const G4VPhysicalVolume* GetOhmicPos() const {return physiOhmicPos;};
146  const G4VPhysicalVolume* GetOhmicNeg() const {return physiOhmicNeg;};
147  const G4VPhysicalVolume* GetWindow () const {return physiWindow ;};
148 private:
149 
150  G4Navigator* aNavigator;
151 
153 
154  static XrayFluoDetectorConstruction* instance;
155 
156  XrayFluoVDetectorType* detectorType;
157 
158  G4bool sampleGranularity;
159  G4bool phaseSpaceFlag;
160 
161  G4double DeviceSizeX;
162  G4double DeviceSizeY;
163  G4double DeviceThickness;
164 
165  G4Box* solidWorld; //pointer to the solid World
166  G4LogicalVolume* logicWorld; //pointer to the logical World
167  G4VPhysicalVolume* physiWorld; //pointer to the physical World
168 
169  G4Box* solidHPGe; //pointer to the solid Sensor
170  G4LogicalVolume* logicHPGe; //pointer to the logical Sensor
171  G4VPhysicalVolume* physiHPGe; //pointer to the physical Sensor
172 
173  G4Box* solidSample; //pointer to the solid Sample
174  G4LogicalVolume* logicSample; //pointer to the logical Sample
175  G4VPhysicalVolume* physiSample; //pointer to the physical Sample
176 
177  G4Tubs* solidDia1; //pointer to the solid Diaphragm
178  G4LogicalVolume* logicDia1; //pointer to the logical Diaphragm
179  G4VPhysicalVolume* physiDia1; //pointer to the physical Diaphragm
180 
181  G4Tubs* solidDia3; //pointer to the solid Diaphragm
182  G4LogicalVolume* logicDia3; //pointer to the logical Diaphragm
183  G4VPhysicalVolume* physiDia3; //pointer to the physical Diaphragm
184 
185  G4Box* solidOhmicPos;
186  G4LogicalVolume* logicOhmicPos;
187  G4VPhysicalVolume* physiOhmicPos;
188 
189  G4Box* solidWindow; // added
190  G4LogicalVolume* logicWindow; // added
191  G4VPhysicalVolume* physiWindow; // added
192 
193  G4Box* solidOhmicNeg;
194  G4LogicalVolume* logicOhmicNeg;
195  G4VPhysicalVolume* physiOhmicNeg;
196 
197  G4Box* solidPixel;
198  G4LogicalVolume* logicPixel;
199  G4VPhysicalVolume* physiPixel;
200 
201  G4Sphere* solidGrain;
202  G4LogicalVolume* logicGrain;
203  G4VPhysicalVolume* physiGrain;
204 
205 
206  //materials management
207  XrayFluoNistMaterials* materials;
208 
209  G4Material* OhmicPosMaterial;
210  G4Material* OhmicNegMaterial;
211  G4Material* pixelMaterial;
212  G4Material* sampleMaterial;
213  G4Material* Dia1Material;
214  G4Material* Dia3Material;
215  G4Material* defaultMaterial;
216  G4Material* windowMaterial; //added
217 
218 
219  //apparate parameters
220 
221  G4double OhmicPosThickness;
222 
223  G4double OhmicNegThickness;
224 
225  G4double windowThickness; //added
226 
227  G4int PixelCopyNb;
228  G4int grainCopyNb;
229  G4int NbOfPixels;
230  G4int NbOfPixelRows;
231  G4int NbOfPixelColumns;
232  G4double PixelThickness; // added
233 
234 
235 
236  G4double PixelSizeXY;
237  G4double ContactSizeXY;
238 
239 public:
240 
241  G4Material* GetSampleMaterial() const {return sampleMaterial;};
242  G4Material* GetPixelMaterial() const {return pixelMaterial;};
243  G4Material* GetDia1Material() const {return Dia1Material;};
244  G4Material* GetDia3Material() const {return Dia3Material;};
245 
246 
247  G4Navigator* GetGeometryNavigator() const {return aNavigator;};
248 
249 private:
250 
251  G4double SampleThickness;
252  G4double SampleSizeXY;
253  G4double grainDia;
254  G4double Dia1Thickness;
255  G4double Dia1SizeXY;
256  G4double Dia3Thickness;
257  G4double Dia3SizeXY;
258  G4double DiaInnerSize;
259  G4double Dia3InnerSize;
260  // G4double DistSi;
261 public:
262 
263 
264  G4double GetSampleThickness() const {return SampleThickness;};
265  G4double GetSampleSizeXY() const {return SampleSizeXY;};
266 
267  G4double GetDia1Thickness() const {return Dia1Thickness;};
268  G4double GetDia1SizeXY() const {return Dia1SizeXY;};
269 
270  G4double GetDia3Thickness() const {return Dia3Thickness;};
271  G4double GetDia3SizeXY() const {return Dia3SizeXY;};
272 
273 
274 private:
275 
276 
277  G4double ThetaHPGe;
278  G4double ThetaDia1;
279  G4double ThetaDia3;
280 
281  G4double DistDe;
282  G4double DistDia;
283  G4double Dia3Dist;
284  G4double PhiHPGe;
285  G4double PhiDia1;
286  G4double PhiDia3;
287  G4double AlphaDia1;
288  G4double AlphaDia3;
289 
290 
291  G4RotationMatrix zRotPhiHPGe;
292  G4RotationMatrix zRotPhiDia1;
293  G4RotationMatrix zRotPhiDia3;
294  G4double WorldSizeXY;
295  G4double WorldSizeZ;
296 
297 
298  XrayFluoDetectorMessenger* detectorMessenger; //pointer to the Messenger
299 
300  G4Cache<XrayFluoSD*> HPGeSD; //pointer to the sensitive detector
301 
302  G4Region* sampleRegion;
303 
304 
305 private:
306 
307  void DefineDefaultMaterials();
308  G4VPhysicalVolume* ConstructApparate();
309 
310  //calculates some quantities used to construct geometry
311  void ComputeApparateParameters();
312 
313 };
314 
315 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
316 
317 inline void XrayFluoDetectorConstruction::ComputeApparateParameters()
318 {
319  // Compute derived parameters of the apparate
320 
321  if (phaseSpaceFlag) {
322 
323  WorldSizeZ = 10 *CLHEP::m;
324  WorldSizeXY = 10 *CLHEP::m;
325 
326  }
327  else {
328 
329  DeviceThickness = PixelThickness+OhmicNegThickness+OhmicPosThickness+windowThickness;//change!
330 
331  G4cout << "DeviceThickness(cm): "<< DeviceThickness/CLHEP::cm << G4endl;
332 
333  DeviceSizeY =(NbOfPixelRows * std::max(ContactSizeXY,PixelSizeXY));
334  DeviceSizeX =(NbOfPixelColumns * std::max(ContactSizeXY,PixelSizeXY));
335 
336  G4cout << "DeviceSizeX(cm): "<< DeviceSizeX/CLHEP::cm <<G4endl;
337  G4cout << "DeviceSizeY(cm): "<< DeviceSizeY/CLHEP::cm << G4endl;
338 
339  WorldSizeZ = (2 * (DistDe +1.4142 *(std::max(std::max(DeviceThickness,DeviceSizeY), DeviceSizeX))))+5*CLHEP::m;
340  WorldSizeXY = 2 * (DistDe +1.4142 *Dia1SizeXY)+5*CLHEP::m;
341 
342  }
343 }
344 
345 #endif
const G4VPhysicalVolume * GetOhmicPos() const
static constexpr double m
static constexpr double cm
Definition: SystemOfUnits.h:99
CLHEP::Hep3Vector G4ThreeVector
const G4VPhysicalVolume * GetHPGe() const
Definition: G4Box.hh:64
Definition: G4Tubs.hh:85
const G4VPhysicalVolume * GetOhmicNeg() const
int G4int
Definition: G4Types.hh:78
static XrayFluoDetectorConstruction * GetInstance()
const G4VPhysicalVolume * GetWindow() const
XrayFluoVDetectorType * GetDetectorType() const
void SetSampleMaterial(G4String newMaterial)
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
const G4VPhysicalVolume * GetDia1() const
const G4VPhysicalVolume * GetSample() const
const G4VPhysicalVolume * GetphysiPixel() const
const G4VPhysicalVolume * GetphysiWorld() const
T max(const T t1, const T t2)
brief Return the largest of the two arguments
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
const G4VPhysicalVolume * GetDia3() const
void SetSampleGranularity(G4bool granularity)