source: trunk/examples/advanced/xray_fluorescence/include/XrayFluoPlaneDetectorConstruction.hh @ 812

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

update

File size: 10.0 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:
29//
30// Author: Alfonso Mantero (Alfonso.Mantero@ge.infn.it)
31//
32// History:
33// -----------
34//
35//  29 Aug 2003  Alfonso Mantero created
36//
37// -------------------------------------------------------------------
38
39#ifndef XrayFluoPlaneDetectorConstruction_hh
40#define XrayFluoPlaneDetectorConstruction_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;
51//class G4Tubs;
52class G4Sphere;
53class G4LogicalVolume;
54class G4VPhysicalVolume;
55class G4Material;
56class XrayFluoPlaneDetectorMessenger;
57class XrayFluoNistMaterials;
58
59//class XrayFluoSD;
60//class XrayFluoVDetectorType;
61
62//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
63
64class XrayFluoPlaneDetectorConstruction : public G4VUserDetectorConstruction
65{
66public:
67 
68
69  ~XrayFluoPlaneDetectorConstruction();
70 
71public:
72 
73  G4VPhysicalVolume* Construct();
74 
75  void UpdateGeometry();
76
77
78  void SetPlaneMaterial(G4String newMaterial);
79
80  void SetDetectorType(G4String type);
81
82  static XrayFluoPlaneDetectorConstruction* GetInstance();
83
84  inline void SetPlaneGranularity(G4bool granularity) 
85  {planeGranularity = granularity;};
86
87  inline void SetGrainDia(G4double size)
88  {grainDia = size;};
89
90  void DeleteGrainObjects();
91 
92public:
93 
94  void PrintApparateParameters(); 
95
96  XrayFluoVDetectorType* GetDetectorType();
97
98
99  G4double GetWorldSizeZ()           {return WorldSizeZ;}; 
100  G4double GetWorldSizeXY()          {return WorldSizeXY;};
101 
102  G4double GetDeviceThickness()      {return DeviceThickness;}; 
103  G4double GetDeviceSizeX()          {return DeviceSizeX;};
104  G4double GetDeviceSizeY()          {return DeviceSizeY;};
105  G4double GetPixelSizeXY()          {return PixelSizeXY;};
106  G4double GetContactSizeXY()        {return ContactSizeXY;};
107
108  G4int GetNbOfPixels()              {return NbOfPixels;}; //mandatory for XrayFluoSD
109  G4int GetNbOfPixelRows()           {return NbOfPixelRows;}; 
110  G4int GetNbOfPixelColumns()        {return NbOfPixelColumns;}; 
111 
112  G4Material* GetOhmicPosMaterial()  {return OhmicPosMaterial;};
113  G4double    GetOhmicPosThickness() {return OhmicPosThickness;};     
114 
115  G4Material* GetOhmicNegMaterial()  {return OhmicNegMaterial;};
116  G4double    GetOhmicNegThickness() {return OhmicNegThickness;};     
117 
118  const G4VPhysicalVolume* GetphysiWorld() {return physiWorld;}; 
119  const G4VPhysicalVolume* GetHPGe()        {return physiHPGe;};
120  const G4VPhysicalVolume* GetPlane()     {return physiPlane;};
121  //  const G4VPhysicalVolume* GetDia1()        {return physiDia1;};
122  //  const G4VPhysicalVolume* GetDia3()        {return physiDia3;};
123 
124  const G4VPhysicalVolume* GetphysiPixel()  {return physiPixel;};           
125  const G4VPhysicalVolume* GetOhmicPos()    {return physiOhmicPos;};
126  const G4VPhysicalVolume* GetOhmicNeg()    {return physiOhmicNeg;};
127 
128private:
129 
130  XrayFluoPlaneDetectorConstruction();
131
132  static XrayFluoPlaneDetectorConstruction* instance;
133
134  XrayFluoVDetectorType* detectorType;
135
136  G4bool planeGranularity;
137
138  G4double           DeviceSizeX;
139  G4double           DeviceSizeY;
140  G4double           DeviceThickness;
141 
142  G4Box*             solidWorld;    //pointer to the solid    World
143  G4LogicalVolume*   logicWorld;    //pointer to the logical  World
144  G4VPhysicalVolume* physiWorld;    //pointer to the physical World
145 
146  G4Box*             solidHPGe; //pointer to the solid    Sensor
147  G4LogicalVolume*   logicHPGe; //pointer to the logical  Sensor
148  G4VPhysicalVolume* physiHPGe; //pointer to the physical Sensor
149 
150  G4Box*             solidScreen; //pointer to the solid    Screen
151  G4LogicalVolume*   logicScreen; //pointer to the logical  Screen
152  G4VPhysicalVolume* physiScreen; //pointer to the physical Screen
153 
154  G4Box*             solidPlane;    //pointer to the solid    Plane
155  G4LogicalVolume*   logicPlane;    //pointer to the logical  Plane
156  G4VPhysicalVolume* physiPlane;    //pointer to the physical Plane
157 
158  //  G4Tubs*             solidDia1; //pointer to the solid   Diaphragm
159  //  G4LogicalVolume*   logicDia1; //pointer to the logical  Diaphragm
160  //  G4VPhysicalVolume* physiDia1; //pointer to the physical Diaphragm
161 
162  //  G4Tubs*             solidDia3; //pointer to the solid   Diaphragm
163  //  G4LogicalVolume*   logicDia3; //pointer to the logical  Diaphragm
164  //  G4VPhysicalVolume* physiDia3; //pointer to the physical Diaphragm 
165 
166  G4Box*             solidOhmicPos;
167  G4LogicalVolume*   logicOhmicPos; 
168  G4VPhysicalVolume* physiOhmicPos; 
169 
170  G4Box*             solidOhmicNeg;
171  G4LogicalVolume*   logicOhmicNeg; 
172  G4VPhysicalVolume* physiOhmicNeg;     
173 
174  G4Box*             solidPixel;   
175  G4LogicalVolume*   logicPixel; 
176  G4VPhysicalVolume* physiPixel;   
177 
178  G4Sphere*          solidGrain;
179  G4LogicalVolume*   logicGrain;
180  G4VPhysicalVolume* physiGrain;
181
182  //materials management
183  XrayFluoNistMaterials* materials;
184
185  G4Material*        screenMaterial;
186  G4Material*        OhmicPosMaterial;
187  G4Material*        OhmicNegMaterial; 
188  G4Material*        pixelMaterial;
189  G4Material*        planeMaterial;
190  //  G4Material*        Dia1Material;
191  //  G4Material*        Dia3Material;
192  G4Material*        defaultMaterial;
193
194  //apparate parameters
195
196  G4double           OhmicPosThickness;
197  G4double           OhmicNegThickness;
198 
199  G4double           screenSizeXY;
200  G4double           screenThickness;
201
202  G4int              PixelCopyNb;
203  G4int              grainCopyNb;
204  G4int              NbOfPixels;
205  G4int              NbOfPixelRows;
206  G4int              NbOfPixelColumns;
207  G4double           PixelThickness;
208  G4double           PixelSizeXY;
209  G4double           ContactSizeXY;
210
211  G4double           planeThickness;
212  G4double           planeSizeXY;
213  G4double           grainDia;
214  //  G4double           Dia1Thickness;
215  //  G4double           Dia1SizeXY;
216  //  G4double           Dia3Thickness;
217  //  G4double           Dia3SizeXY;
218  //  G4double           DiaInnerSize;
219  //  G4double           Dia3InnerSize;
220
221 
222public:
223
224  G4Material* GetPlaneMaterial() {return planeMaterial;}; 
225  G4Material* GetPixelMaterial()  {return pixelMaterial;}; 
226  //  G4Material* GetDia1Material()  {return Dia1Material;};
227  //  G4Material* GetDia3Material()  {return Dia3Material;};
228 
229  G4double GetPlaneThickness()         {return planeThickness;};
230  G4double GetPlaneSizeXY()              {return planeSizeXY;};
231 
232//   G4double GetDia1Thickness()         {return Dia1Thickness;};
233//   G4double GetDia1SizeXY()              {return Dia1SizeXY;};
234 
235//   G4double GetDia3Thickness()         {return Dia3Thickness;};
236//   G4double GetDia3SizeXY()              {return Dia3SizeXY;};
237 
238 
239private:
240
241 
242  G4double           ThetaHPGe;
243  G4double           ThetaDia1;
244  G4double           ThetaDia3;
245 
246  G4double           DistDe;
247  G4double           distScreen;
248
249  //  G4double           DistDia;
250  //  G4double           Dia3Dist;
251  G4double           PhiHPGe;
252  //  G4double           PhiDia1;
253  //  G4double           PhiDia3;
254  //  G4double AlphaDia1;
255  //  G4double AlphaDia3;
256 
257 
258  G4RotationMatrix   zRotPhiHPGe;
259  //  G4RotationMatrix   zRotPhiDia1;
260  //  G4RotationMatrix   zRotPhiDia3;
261  G4double           WorldSizeXY;
262  G4double           WorldSizeZ;
263 
264 
265  XrayFluoPlaneDetectorMessenger* detectorMessenger; //pointer to the Messenger
266
267  XrayFluoSD* HPGeSD;  //pointer to the sensitive detector
268 
269private:
270 
271  void DefineDefaultMaterials();
272  G4VPhysicalVolume* ConstructApparate();
273
274  //calculates some quantities used to construct geometry
275  void ComputeApparateParameters();
276
277};
278
279//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
280
281inline void XrayFluoPlaneDetectorConstruction::ComputeApparateParameters()
282{     
283  // Compute derived parameters of the apparate
284 
285  DeviceThickness = PixelThickness+OhmicNegThickness+OhmicPosThickness;
286
287  G4cout << "DeviceThickness(cm): "<< DeviceThickness/cm << G4endl;
288
289  DeviceSizeY =(NbOfPixelRows * std::max(ContactSizeXY,PixelSizeXY));
290  DeviceSizeX =(NbOfPixelColumns * std::max(ContactSizeXY,PixelSizeXY));
291
292  screenSizeXY = 2 * DeviceThickness + std::max(DeviceSizeY,DeviceSizeX);
293
294  G4cout << "DeviceSizeX(cm): "<< DeviceSizeX/cm <<G4endl;
295  G4cout << "DeviceSizeY(cm): "<< DeviceSizeY/cm << G4endl;
296
297  WorldSizeZ = (2 * (DistDe  + DeviceThickness + screenThickness)) + 5*m; 
298  WorldSizeXY = (2 * (planeSizeXY))+ 5*m;
299 
300}
301
302#endif
303
304
305
306
307
308
Note: See TracBrowser for help on using the repository browser.