Precalibrated Ion Beam Identification Detector Simulation 1.0
A pilot study detector simulation, written in C++ with Geant4.
DetectorConstruction.hh
Go to the documentation of this file.
00001 
00013 #ifndef DetectorConstruction_h
00014 #define DetectorConstruction_h 1//!<Inclusion guard
00015 
00016 #include "G4VUserDetectorConstruction.hh" 
00017 #include "globals.hh"
00018 #include "G4FieldManager.hh"
00019 #include "G4TransportationManager.hh"
00020 #include "G4RunManager.hh"
00021 #include "DetectorMessenger.hh"
00022 
00023 #include "G4Material.hh"
00024 #include "G4Tubs.hh"
00025 #include "G4Trap.hh"
00026 #include "G4Box.hh"
00027 #include "G4LogicalVolume.hh"
00028 #include "G4PVPlacement.hh"
00029 #include "G4PVReplica.hh"
00030 
00031 #include "G4GeometryManager.hh"
00032 #include "G4PhysicalVolumeStore.hh"
00033 #include "G4LogicalVolumeStore.hh"
00034 #include "G4SolidStore.hh"
00035 
00036 #include "G4VisAttributes.hh"
00037 #include "G4Colour.hh"
00038 
00039 
00040 
00041 
00042 class G4Trap;
00043 class G4Tubs;
00044 class G4Box;
00045 class G4LogicalVolume;
00046 class G4VPhysicalVolume;
00047 class G4Material;
00048 class G4UniformMagField;
00049 class DetectorMessenger;
00050 
00051 
00054 class DetectorConstruction : public G4VUserDetectorConstruction
00055 {
00056   public:
00057   DetectorConstruction(); 
00058   ~DetectorConstruction(); 
00059 
00060   void SetDefaultDetectorParameters();
00061 
00062   //CHANGE A MATERIAL: INVOKED FROM MESSENGER CLASS
00063   void SetScintillatorMaterial (G4String 
00064                                 ); 
00065 
00066   void SetScintillatorDiameter(G4double 
00067                                ); 
00068   
00069   void SetShieldingMaterial(G4String 
00070                             ); 
00071   
00072   void SetGeDetectorShellMaterial(G4String
00073                                      ); 
00074 
00075   void SetBeamBlockerMaterial(G4String 
00076                                  ); 
00077 
00078   void SetShieldingBeamBlockerMaterial(G4String 
00079                                        ); 
00080 
00081   void SetGermaniumDetectorMaterial(G4String 
00082                                        ); 
00083 
00084   void SetEffectiveSlowdownThickness(G4double thickness 
00085                                      ); 
00086 
00087   void SetSlowdownLength(G4double length 
00088                                                ); 
00089   
00090   void SetSlowdownThickness(G4double thickness 
00091                                                   ); 
00092 
00093 void SetShieldingThickness(G4double thickness 
00094                                                   ); 
00095 
00096 void SetTopShieldingThickness(G4double thickness 
00097                                                   ); 
00098   
00099   void SetBeamBlockerThickness(G4double thickness 
00100                                ); 
00101 
00102   void SetShieldingBeamBlockerThickness(G4double thickness 
00103                                         );
00104 
00105 
00106   void SetGeDetectorRadius(G4double radius 
00107                                                  ); 
00108   void SetGeDetectorShellLength(G4double length 
00109                                                       ); 
00110 
00111   void SetGeDetectorLength(G4double length 
00112                                                  ); 
00113 
00114   void SetGeDetectorShellInnerRadius(G4double radius 
00115                                                            ); 
00116 
00117   void SetGeDetectorShellOuterRadius(G4double radius 
00118                                                            ); 
00119 
00120   void SetGapMaterial (G4String 
00121                           ); 
00122 
00123   void SetScintillatorShieldingGapThickness(G4double 
00124                           ); 
00125 
00126   void SetSlowdownMaterial(G4String 
00127                               ); 
00128 
00129   
00130   void SetSlowdownHeightGap(G4double 
00131                                ); 
00132 
00133   void SetNumberOfScintillatorBoxes(G4int 
00134                                     ); 
00135 
00136   void SetNumberOfScintillatorsPerBox (G4int 
00137                          ); 
00138 
00139   void SetBetaFlipping(G4bool 
00140                        ); 
00141       
00142   G4VPhysicalVolume* Construct(); 
00143   
00144   void UpdateGeometry(); 
00145   
00146   G4double GetWorldSizeX() {return WorldSizeX;};
00148   G4double GetWorldSizeY() {return WorldSizeY;}; 
00150   G4double GetWorldSizeZ() {return WorldSizeZ;}; 
00151 
00152 
00157 
00158   G4double GetScintillatorBoxSizeX() {return ScintillatorBoxSizeX;};
00160   G4double GetScintillatorBoxSizeY() {return ScintillatorBoxSizeY;};
00162   G4double GetScintillatorBoxSizeZ() {return ScintillatorBoxSizeZ;};
00163 
00165   G4double GetBackScintillatorPlateSizeY(){ return BackScintillatorPlateSizeY;}
00166   
00168   G4int    GetNumberOfScintillatorBoxes() {return NumberOfScintillatorBoxes;};
00170   G4int    GetNumberOfScintillatorsPerBox() {return NumberOfScintillatorsPerBox;}; 
00171   
00172 
00174   G4Material* GetScintillatorMaterial() {return ScintillatorMaterial;};
00176   G4double    GetScintillatorDiameter() {return ScintillatorDiameter;};      
00178   G4Material* GetGapMaterial() {return GapMaterial;};
00180   G4double    GetScintillatorShieldingGapThickness() {return ScintillatorShieldingGapThickness;};
00182   const G4VPhysicalVolume* GetphysiWorld() {return physiWorld;};           
00184   const G4VPhysicalVolume* GetAbsorber()  {return physiScintillator;};
00186   const G4VPhysicalVolume* GetGap() {return physiGap;};
00188   const G4VPhysicalVolume* GetScintillator() {return physiScintillator;};
00190   const G4VPhysicalVolume* GetUpperBetaDetector() {return physiUpperBetaDetector;};
00192   const G4VPhysicalVolume* GetLowerBetaDetector() {return physiLowerBetaDetector;};
00194   const G4VPhysicalVolume* GetGermaniumDetector() {return physiGermaniumDetector;};
00196   const G4VPhysicalVolume* GetUpperFrontScintillatorPlate() {return physiUpperFrontScintillatorPlate;};
00198   const G4VPhysicalVolume* GetLowerFrontScintillatorPlate() {return physiLowerFrontScintillatorPlate;};
00200   const G4VPhysicalVolume* GetBackScintillatorPlate() {return physiBackScintillatorPlate;};
00201 
00202 private:
00203   
00204   G4Material*        ScintillatorMaterial;     
00205   G4double           ScintillatorThickness;    
00206   
00207   G4Material*        GapMaterial;             
00208   G4double           ScintillatorShieldingGapThickness;            
00209   
00210   G4int              NumberOfScintillatorsPerBox;              
00211   G4int         NumberOfScintillatorBoxes;   
00212   
00213   G4double              ScintillatorBoxSizeX;    
00214   G4double           ScintillatorBoxSizeY;    
00215   G4double           ScintillatorBoxSizeZ;    
00216   G4double              SlotWidthY;    
00217   G4double           SlotWidthZ;     
00218  
00219   G4double              ScintillatorDiameter;    
00220   G4double              ScintillatorLength;      
00221   
00222   G4double           ScintillatorPlateThickness;    
00223   G4double           FrontScintillatorPlateSizeY;    
00224   G4double           FrontScintillatorPlateSizeZ;    
00225   G4double           BackScintillatorPlateSizeY;    
00226   
00227   G4double              GeDetectorRadius;              
00228   G4double              GeDetectorLength;              
00229   G4double              GeDetectorShellLength;         
00230   G4double              GeDetectorShellInnerRadius;    
00231   G4double              GeDetectorShellOuterRadius;    
00232   G4double              BeamBlockerThickness;          
00233 
00234   G4double              ShieldingBeamBlockerThickness; 
00235 
00236   G4double              GeDetectorContainerSizeX;      
00237   
00238   G4Material*        defaultMaterial;   
00239   G4double              WorldSizeZ;        
00240   G4double           WorldSizeY;        
00241   G4double           WorldSizeX;        
00242   
00243   G4Material*   ShieldingMaterial;        
00244   G4double              ShieldingThickness;       
00245   G4double              TopShieldingThickness;    
00246   
00247   G4Material*        BeamBlockerMaterial; 
00248 
00249   G4Material*        ShieldingBeamBlockerMaterial; 
00250   
00251   G4Box*             solidWorld;    
00252   G4LogicalVolume*   logicWorld;    
00253   G4VPhysicalVolume* physiWorld;    
00254   
00255   G4Material*        GeDetectorShellMaterial; 
00256   G4Material*        GermaniumDetectorMaterial; 
00257   
00258   
00259   G4Box*             solidScintillatorBox;    
00260   G4LogicalVolume*   logicScintillatorBox;    
00261   G4VPhysicalVolume* physiScintillatorBox;    
00262   
00263   
00264   
00265   
00266   
00267   
00268   G4Box*             solidSlot;    
00269   G4LogicalVolume*   logicSlot;    
00270   G4VPhysicalVolume* physiSlot;    
00271   
00272   G4Tubs*            solidScintillator; 
00273   G4LogicalVolume*   logicScintillator; 
00274   G4VPhysicalVolume* physiScintillator; 
00275   
00276   G4Box*             solidGap;      
00277   G4LogicalVolume*   logicGap;      
00278   G4VPhysicalVolume* physiGap;      
00279   
00280   
00281   
00282   
00283   G4Box*             solidShielding;    
00284   G4LogicalVolume*   logicShielding;    
00285   G4VPhysicalVolume* physiShielding;    
00286   
00287   
00288   G4Box*             solidTopShielding;    
00289   G4LogicalVolume*   logicTopShielding;    
00290   G4VPhysicalVolume* physiTopShielding;    
00291 
00292 
00293   G4Box*             solidShieldingBeamBlocker;    
00294   G4LogicalVolume*   logicShieldingBeamBlocker;    
00295   G4VPhysicalVolume* physiShieldingBeamBlocker;    
00296   
00297   
00298   G4Box*             solidTopShieldingBeamBlocker;    
00299   G4LogicalVolume*   logicTopShieldingBeamBlocker;    
00300   G4VPhysicalVolume* physiTopShieldingBeamBlocker;    
00301 
00302 
00303 
00304   
00305   G4Box*             solidBetaDetector;    
00306   G4LogicalVolume*   logicBetaDetector;    
00307   G4VPhysicalVolume* physiUpperBetaDetector;    
00308   
00309   G4Box*             solidLowerBetaDetector;    
00310   G4LogicalVolume*   logicLowerBetaDetector;    
00311   G4VPhysicalVolume* physiLowerBetaDetector;    
00312   
00313   
00314   
00315   DetectorMessenger* detectorMessenger;  
00316   
00318   
00319   G4Box*             solidFrontScintillatorPlate;      
00320   G4LogicalVolume*   logicFrontScintillatorPlate;      
00321   G4VPhysicalVolume* physiUpperFrontScintillatorPlate;      
00322   G4VPhysicalVolume* physiLowerFrontScintillatorPlate;      
00323   
00324   G4Box*             solidBackScintillatorPlate;      
00325   G4LogicalVolume*   logicBackScintillatorPlate;      
00326   G4VPhysicalVolume* physiBackScintillatorPlate;      
00327   
00328   
00329   
00330   
00332   
00333   
00334   G4double SlowdownThickness;                 
00335   G4double SlowdownLength;                    
00336   G4double SlowdownHeightGap;                 
00337   G4double EffectiveSlowdownThickness;           
00338   
00339   G4Trap*            solidSlowdown;              
00340   G4LogicalVolume*   logicSlowdown;              
00341   G4VPhysicalVolume* physiUpperSlowdown;      
00342   G4VPhysicalVolume* physiLowerSlowdown;      
00343   
00344   G4Material*        SlowdownMaterial; 
00345   
00346   
00347   
00349   
00350   G4Tubs*            solidGermaniumDetector; 
00351   G4LogicalVolume*   logicGermaniumDetector; 
00352   G4VPhysicalVolume* physiGermaniumDetector; 
00353   
00354   
00355   G4Tubs*            solidGeDetectorShell; 
00356   G4LogicalVolume*   logicGeDetectorShell; 
00357   G4VPhysicalVolume* physiGeDetectorShell; 
00358   
00359   G4Box*            solidGeDetectorContainer; 
00360   G4LogicalVolume*   logicGeDetectorContainer; 
00361   G4VPhysicalVolume* physiGeDetectorContainer; 
00362   
00363   
00364   
00365   
00366   
00367   G4Tubs*            solidGeDetectorShellTop; 
00368   G4LogicalVolume*   logicGeDetectorShellTop; 
00369   G4VPhysicalVolume* physiGeDetectorShellTop; 
00370   
00371   G4Tubs*            solidGeDetectorShellBottom; 
00372   G4LogicalVolume*   logicGeDetectorShellBottom; 
00373   G4VPhysicalVolume* physiGeDetectorShellBottom; 
00374   
00375   G4Box*            solidBeamBlocker;  
00376   G4LogicalVolume*   logicBeamBlocker; 
00377   G4VPhysicalVolume* physiBeamBlocker; 
00378   
00379   
00380   G4double BetaDetectorPositionY; 
00381   G4double BeamBlockerYWidth; 
00382   G4double BeamBlockerZWidth; 
00383   G4double BeamBlockerXPosition; 
00384   G4double ScintillatorPositionX;
00385   G4double ScintillatorPositionY;
00386   G4double ScintillatorPositionZ;
00387 
00388   G4double ShieldingPositionX;
00389   G4double ShieldingPositionY;
00390   G4double ShieldingPositionZ;
00391 
00392   G4double TopShieldingPositionX;
00393   G4double TopShieldingPositionY;
00394   G4double TopShieldingPositionZ;
00395 
00396   G4double PlateShieldingSpacing;
00397 
00398   G4double ShieldingBeamBlockerPositionX;
00399 
00400   G4bool FlipBeta;
00401 
00402 private:
00403   
00404   void ConstructWorld();
00405   void ConstructBetaDetector();
00406   void ConstructScintillatorBox();
00407   void ConstructScintillatorSlot();
00408   void ConstructScintillator();
00409   void ConstructShielding();
00410   void ConstructBeamBlocker();
00411   void ConstructScintillatorPlates();
00412   void ConstructSlowdown();
00413   void ConstructGermaniumDetector();
00414   void ConstructShieldingBeamBlocker();
00415   void SetVisualizationAttributes();
00416  
00417     
00418   void DefineMaterials(); 
00419   void ComputeDependentDetectorParameters(); 
00420   G4VPhysicalVolume* ConstructDetector(); 
00421 };
00422 
00423 inline void DetectorConstruction::ComputeDependentDetectorParameters()
00424 {
00425   // Compute derived parameters of the scintillators
00426   SlotWidthY = ScintillatorDiameter + 2*ScintillatorShieldingGapThickness + TopShieldingThickness; //Width of one scintillator slot in Y direction.
00427   SlotWidthZ = ScintillatorDiameter + 2*ScintillatorShieldingGapThickness + ShieldingThickness;   //Width of one scintillator slot in Z direction.
00428 
00429 
00430   ScintillatorBoxSizeX  = ScintillatorLength + ShieldingBeamBlockerThickness;
00431   ScintillatorBoxSizeY = SlotWidthY;   //The scintillator box has the same Y width as the slot.
00432   ScintillatorBoxSizeZ = NumberOfScintillatorsPerBox*SlotWidthZ;   //The scintillator box has the sum of the slotwidths of the individual scintillators as width.
00433 
00434   GeDetectorContainerSizeX = 1.*GeDetectorShellOuterRadius+ScintillatorLength+BeamBlockerThickness;    //Calculating GeDetectorContainerSizeX.
00435   
00436   FrontScintillatorPlateSizeY = (NumberOfScintillatorBoxes*ScintillatorBoxSizeY-TopShieldingThickness);
00437   BackScintillatorPlateSizeY = 2*ScintillatorBoxSizeY*NumberOfScintillatorBoxes + 1.1*2*GeDetectorShellOuterRadius; //3*1.2*GeDetectorShellOuterRadius+ScintillatorDiameter;
00438   
00439   SlowdownHeightGap = (SlowdownThickness - EffectiveSlowdownThickness)*(SlowdownLength/SlowdownThickness);     //Calculating SlowdownHeightGap.
00440   
00441   BetaDetectorPositionY = ScintillatorBoxSizeY*NumberOfScintillatorBoxes/2+1.1*GeDetectorShellOuterRadius;
00442   
00443 
00444   ShieldingBeamBlockerPositionX = -ScintillatorLength/2;
00445 
00446   ScintillatorPositionX = ShieldingBeamBlockerThickness/2;
00447   ScintillatorPositionY = -TopShieldingThickness/2;
00448   ScintillatorPositionZ = -ShieldingThickness/2;
00449 
00450   ShieldingPositionX = ScintillatorPositionX;
00451   ShieldingPositionY = 0;
00452   ShieldingPositionZ = (SlotWidthZ-ShieldingThickness)/2;   //its position
00453 
00454   TopShieldingPositionX = ScintillatorPositionX;
00455   TopShieldingPositionY = (SlotWidthY-TopShieldingThickness)/2;
00456   TopShieldingPositionZ = -ShieldingThickness/2;
00457 
00458   BeamBlockerYWidth = 2*1.1*GeDetectorShellOuterRadius;
00459   BeamBlockerZWidth = 1.1*GeDetectorShellLength;
00460   BeamBlockerXPosition = -(GeDetectorContainerSizeX-BeamBlockerThickness)/2;
00461   
00462   // X and Z expression aren't completely general, unfortunately.
00463   WorldSizeX = 1.5*2*(1.2*ScintillatorBoxSizeX + SlowdownThickness*1.2); 
00464   WorldSizeY = std::max(2*1.2*SlowdownLength, NumberOfScintillatorBoxes*2*1.2*ScintillatorBoxSizeY + 2.*GeDetectorShellOuterRadius); 
00465   WorldSizeZ = std::max(2*1.2*ScintillatorBoxSizeZ,1.1*GeDetectorShellLength*1.2);
00466 }
00467 
00468 #endif
00469 
 All Classes Files Functions Variables Defines

Back to the main page of the Precalibrated Ion Beam Identification Detector project

Created by Rikard Lundmark