source: trunk/examples/advanced/xray_fluorescence/include/XrayFluoMercuryDetectorConstruction.hh @ 1321

Last change on this file since 1321 was 807, checked in by garnier, 16 years ago

update

File size: 9.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: XrayFluoMercuryDetectorConstruction.hh
28// GEANT4 tag $Name:XrayFluo-V05-02-06
29//
30// Author: Alfonso Mantero (Alfonso.Mantero@ge.infn.it)
31//
32// History:
33// -----------
34//
35//  08 Sep 2003  Alfonso Mantero created
36//
37// -------------------------------------------------------------------
38
39#ifndef XrayFluoMercuryDetectorConstruction_hh
40#define XrayFluoMercuryDetectorConstruction_hh 1
41
42#include "XrayFluoSiLiDetectorType.hh"
43#include "XrayFluoHPGeDetectorType.hh"
44#include "XrayFluoSD.hh"
45#include "G4VUserDetectorConstruction.hh"
46#include "globals.hh"
47#include "G4RotationMatrix.hh"
48
49
50class G4Box;
51class G4Tubs;
52class G4Sphere;
53class G4LogicalVolume;
54class G4VPhysicalVolume;
55class G4Material;
56class XrayFluoMercuryDetectorMessenger;
57class XrayFluoNistMaterials;
58
59//class XrayFluoSD;
60//class XrayFluoVDetectorType;
61
62//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
63
64class XrayFluoMercuryDetectorConstruction : public G4VUserDetectorConstruction
65{
66public:
67 
68
69  ~XrayFluoMercuryDetectorConstruction();
70 
71public:
72 
73  G4VPhysicalVolume* Construct();
74 
75  void UpdateGeometry();
76
77
78  void SetMercuryMaterial(G4String newMaterial);
79
80  void SetDetectorType(G4String type);
81
82  static XrayFluoMercuryDetectorConstruction* GetInstance();
83
84  inline void SetOribitHeight(G4double size)
85  {distDe = size;};
86  inline void SetLatitude(G4double lat)
87  {ThetaHPGe = 180.* deg - lat;};
88
89  void PrintApparateParameters(); 
90
91  XrayFluoVDetectorType* GetDetectorType();
92
93
94  G4double GetWorldSizeZ()           {return WorldSizeZ;}; 
95  G4double GetWorldSizeXY()          {return WorldSizeXY;};
96 
97  G4double GetDeviceThickness()      {return DeviceThickness;}; 
98  G4double GetDeviceSizeX()          {return DeviceSizeX;};
99  G4double GetDeviceSizeY()          {return DeviceSizeY;};
100  G4double GetPixelSizeXY()          {return PixelSizeXY;};
101  G4double GetContactSizeXY()        {return ContactSizeXY;};
102
103  G4int GetNbOfPixels()              {return NbOfPixels;}; //mandatory for XrayFluoSD
104  G4int GetNbOfPixelRows()           {return NbOfPixelRows;}; 
105  G4int GetNbOfPixelColumns()        {return NbOfPixelColumns;}; 
106 
107  G4Material* GetOhmicPosMaterial()  {return OhmicPosMaterial;};
108  G4double    GetOhmicPosThickness() {return OhmicPosThickness;};     
109 
110  G4Material* GetOhmicNegMaterial()  {return OhmicNegMaterial;};
111  G4double    GetOhmicNegThickness() {return OhmicNegThickness;};     
112 
113  const G4VPhysicalVolume* GetphysiWorld() {return physiWorld;}; 
114  const G4VPhysicalVolume* GetHPGe()        {return physiHPGe;};
115  const G4VPhysicalVolume* GetMercury()     {return physiMercury;};
116
117  const G4VPhysicalVolume* GetphysiPixel()  {return physiPixel;};           
118  const G4VPhysicalVolume* GetOhmicPos()    {return physiOhmicPos;};
119  const G4VPhysicalVolume* GetOhmicNeg()    {return physiOhmicNeg;};
120
121  const G4VPhysicalVolume* GetOptic()    {return physiOptic;};
122 
123private:
124 
125  XrayFluoMercuryDetectorConstruction();
126
127  static XrayFluoMercuryDetectorConstruction* instance;
128
129  XrayFluoVDetectorType* detectorType;
130
131  G4bool mercuryGranularity;
132
133  G4double           DeviceSizeX;
134  G4double           DeviceSizeY;
135  G4double           DeviceThickness;
136 
137  G4Box*             solidWorld;    //pointer to the solid    World
138  G4LogicalVolume*   logicWorld;    //pointer to the logical  World
139  G4VPhysicalVolume* physiWorld;    //pointer to the physical World
140 
141  G4Box*             solidHPGe; //pointer to the solid    Sensor
142  G4LogicalVolume*   logicHPGe; //pointer to the logical  Sensor
143  G4VPhysicalVolume* physiHPGe; //pointer to the physical Sensor
144 
145  G4Box*             solidScreen; //pointer to the solid    Screen
146  G4LogicalVolume*   logicScreen; //pointer to the logical  Screen
147  G4VPhysicalVolume* physiScreen; //pointer to the physical Screen
148 
149  G4Sphere*             solidMercury;    //pointer to the solid    Mercury
150  G4LogicalVolume*   logicMercury;    //pointer to the logical  Mercury
151  G4VPhysicalVolume* physiMercury;    //pointer to the physical Mercury
152 
153  //  G4Tubs*             solidDia1; //pointer to the solid   Diaphragm
154  //  G4LogicalVolume*   logicDia1; //pointer to the logical  Diaphragm
155  //  G4VPhysicalVolume* physiDia1; //pointer to the physical Diaphragm
156 
157  //  G4Tubs*             solidDia3; //pointer to the solid   Diaphragm
158  //  G4LogicalVolume*   logicDia3; //pointer to the logical  Diaphragm
159  //  G4VPhysicalVolume* physiDia3; //pointer to the physical Diaphragm 
160 
161  G4Box*             solidOhmicPos;
162  G4LogicalVolume*   logicOhmicPos; 
163  G4VPhysicalVolume* physiOhmicPos; 
164 
165  G4Box*             solidOhmicNeg;
166  G4LogicalVolume*   logicOhmicNeg; 
167  G4VPhysicalVolume* physiOhmicNeg;     
168 
169  G4Box*             solidPixel;   
170  G4LogicalVolume*   logicPixel; 
171  G4VPhysicalVolume* physiPixel;   
172 
173  G4Tubs*            solidOptic;
174  G4LogicalVolume*   logicOptic;
175  G4VPhysicalVolume* physiOptic;
176
177  G4Sphere*          solidGrain;
178  G4LogicalVolume*   logicGrain;
179  G4VPhysicalVolume* physiGrain;
180
181  //materials management
182  XrayFluoNistMaterials* materials;
183
184  G4Material*          screenMaterial;
185  G4Material*        OhmicPosMaterial;
186  G4Material*        OhmicNegMaterial; 
187  G4Material*           pixelMaterial;
188  G4Material*         mercuryMaterial;
189  G4Material*           opticMaterial;
190  //  G4Material*        Dia3Material;
191  G4Material*         defaultMaterial;
192
193  //apparate parameters
194
195  G4double           OhmicPosThickness;
196  G4double           OhmicNegThickness;
197 
198  G4double           opticDia;
199  G4double           opticThickness;
200
201  G4double           screenSizeXY;
202  G4double           screenThickness;
203
204  G4int              PixelCopyNb;
205  G4int              grainCopyNb;
206  G4int              NbOfPixels;
207  G4int              NbOfPixelRows;
208  G4int              NbOfPixelColumns;
209  G4double           PixelThickness;
210  G4double           PixelSizeXY;
211  G4double           ContactSizeXY;
212
213  G4double           opticAperture;
214
215  G4double           mercuryDia;
216  G4double           sunDia;
217
218  G4double           mercurySunDistance;
219
220  G4double           grainDia;
221
222  G4double           ThetaHPGe;
223 
224  G4double           distDe;
225  G4double           distScreen;
226  G4double           distOptic;
227
228
229  G4double           PhiHPGe;
230 
231  G4RotationMatrix   zRotPhiHPGe;
232
233  G4double           WorldSizeXY;
234  G4double           WorldSizeZ;
235 
236 
237  XrayFluoMercuryDetectorMessenger* detectorMessenger; //pointer to the Messenger
238
239  XrayFluoSD* HPGeSD;  //pointer to the sensitive detector
240
241
242 
243public:
244
245  G4Material* GetMercuryMaterial() {return mercuryMaterial;}; 
246  G4Material* GetPixelMaterial()   {return pixelMaterial;}; 
247 
248  G4double GetMercuryDia()         {return mercuryDia;};
249  G4double GetSunDia()             {return sunDia;};
250
251  //Inclinaton of the orbit respect Mercury respect the equator (latitude)
252
253  G4double GetOrbitInclination()   {return 180 * deg - ThetaHPGe;}; 
254  G4double GetOrbitDistance()      {return distDe;};
255  G4double GetOpticAperture()      {return opticAperture;}; 
256
257
258 
259private:
260 
261  void DefineDefaultMaterials();
262  G4VPhysicalVolume* ConstructApparate();
263
264  //calculates some quantities used to construct geometry
265  void ComputeApparateParameters();
266
267};
268
269//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
270
271inline void XrayFluoMercuryDetectorConstruction::ComputeApparateParameters()
272{     
273  // Compute derived parameters of the apparate
274 
275  DeviceThickness = PixelThickness+OhmicNegThickness+OhmicPosThickness;
276
277  ///G4cout << "DeviceThickness(cm): "<< DeviceThickness/cm << G4endl;
278
279  DeviceSizeY =(NbOfPixelRows * std::max(ContactSizeXY,PixelSizeXY));
280  DeviceSizeX =(NbOfPixelColumns * std::max(ContactSizeXY,PixelSizeXY));
281
282  screenSizeXY = opticDia;
283
284  G4cout << "DeviceSizeX(cm): "<< DeviceSizeX/cm <<G4endl;
285  G4cout << "DeviceSizeY(cm): "<< DeviceSizeY/cm << G4endl;
286
287  //*********************************************************************
288  //**  Astronomical distances reduce by a factor 10^-7 due to G4 Bug  **
289  //*********************************************************************
290
291  WorldSizeZ = 2 * mercurySunDistance ; 
292  WorldSizeXY = (2 * distDe) + 2000 * km ;
293  //WorldSizeZ = WorldSizeXY;
294}
295
296#endif
297
298
299
300
301
302
Note: See TracBrowser for help on using the repository browser.