source: trunk/examples/advanced/xray_fluorescence/include/XrayFluoDetectorConstruction.hh @ 1288

Last change on this file since 1288 was 1230, checked in by garnier, 14 years ago

update to geant4.9.3

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