Geant4 Cross Reference |
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 /// \file DetectorConstruction.hh 27 /// \brief Definition of the DetectorConstruction class 28 // 29 // 30 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 33 34 #ifndef DetectorConstruction_H 35 #define DetectorConstruction_H 1 36 37 #include "G4VUserDetectorConstruction.hh" 38 #include "globals.hh" 39 40 class G4LogicalVolume; 41 class G4VPhysicalVolume; 42 class G4FieldManager; 43 class G4UniformMagField; 44 class G4Material; 45 class DetectorMessenger; 46 47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 48 49 class DetectorConstruction : public G4VUserDetectorConstruction 50 { 51 public: 52 DetectorConstruction(); 53 ~DetectorConstruction(); 54 55 G4VPhysicalVolume* Construct(); 56 void ConstructSDandField(); 57 58 void SetMagField(const G4double fieldValue); 59 void SetAbsorberMaterial(const G4String name); 60 void SetActiveMaterial(const G4String name); 61 // Use by the messenger. 62 63 inline G4Material* GetAbsorberMaterial() const; 64 inline G4Material* GetActiveMaterial() const; 65 66 inline void SetIsCalHomogeneous(const G4bool choice); 67 inline void SetIsUnitInLambda(const G4bool choice); 68 inline void SetAbsorberTotalLength(const G4double value); 69 inline void SetCalorimeterRadius(const G4double value); 70 inline void SetActiveLayerNumber(const G4int value); 71 inline void SetActiveLayerSize(const G4double value); 72 // To define the calorimeter geometry. 73 74 inline void SetIsRadiusUnitInLambda(const G4bool choice); 75 76 void UpdateGeometry(); 77 78 inline G4double GetCaloLength() const; 79 80 private: 81 void DefineMaterials(); 82 // Define all the materials. 83 84 G4VPhysicalVolume* ConstructCalorimeter(); 85 // To be invoked each time the geometry needs to be updated. 86 87 G4bool AreParametersOK(); 88 // Return true if all the parameters are sensible, false otherwise. 89 90 void PrintParameters(); 91 // Print the various parameters which define the calorimeter. 92 93 G4Material* fVacuum; 94 G4Material* fIron; 95 G4Material* fCopper; 96 G4Material* fTungsten; 97 G4Material* fLead; 98 G4Material* fUranium; 99 G4Material* fPbWO4; 100 G4Material* fPolystyrene; 101 G4Material* fLiquidArgon; 102 G4Material* fSilicon; 103 G4Material* fQuartz; 104 G4Material* fBrass; 105 G4Material* fAluminium; 106 G4Material* fGraphite; 107 G4Material* fAbsorberMaterial; 108 G4Material* fActiveMaterial; 109 110 G4LogicalVolume* fExperimentalHall_log; 111 G4VPhysicalVolume* fExperimentalHall_phys; 112 // World envelope. 113 114 G4LogicalVolume* fLogicCalo; 115 G4VPhysicalVolume* fPhysiCalo; 116 // "Calorimeter". 117 118 G4LogicalVolume* fLogicModule; 119 G4VPhysicalVolume* fPhysiModule; 120 // Module of the "calorimeter". 121 122 G4LogicalVolume* fLogicAbsorber; 123 G4VPhysicalVolume* fPhysiAbsorber; 124 // Absorber layer of the "calorimeter". 125 126 G4LogicalVolume* fLogicActive; 127 G4VPhysicalVolume* fPhysiActive; 128 // Active layer of the "calorimeter". 129 130 G4FieldManager* fFieldMgr; 131 // Pointer to the field manager. 132 133 G4UniformMagField* fUniformMagField; 134 // Pointer to the uniform magnetic field. 135 136 DetectorMessenger* fDetectorMessenger; 137 // Pointer to the Messenger. 138 139 G4bool fIsCalHomogeneous; 140 // If false then Sampling calorimeter; 141 // If true then Homogeneous calorimeter. 142 143 G4bool fIsUnitInLambda; 144 // If false then normal unit of length to express the absorber total length. 145 // If true then lambda (interaction length) to express the absorber total length. 146 147 G4double fAbsorberTotalLength; 148 // This is the total length of the absorber material, expressed 149 // in unit of length (e.g. m, cm, mm) if theIsUnitInLambda is false, 150 // otherwise in number of lambdas (interaction lengths). 151 // Notice that in the case of a sampling calorimeter (i.e. 152 // theIsCalHomogeneous is false), the active layers are not counted; 153 // in the case of an homogenous calorimeter, this length account 154 // for the overall dimension of the calorimeter. 155 156 G4double fCalorimeterRadius; 157 // This is the radius of the calorimeter which is a cylinder, expressed 158 // in unit of length (e.g. m, cm, mm) if theIsUnitInLambda is false, 159 // otherwise in number of lambdas (interaction lengths) of the absorber. 160 161 G4int fActiveLayerNumber; 162 G4double fActiveLayerSize; 163 // Number of active layers and length of each of them (in normal unit 164 // of length, e.g. mm): in the case of sampling calorimeter 165 // (i.e. theIsCalHomogeneous is false) the medium is theActiveMaterial; 166 // in the case of an homogeneous calorimeter, the "active layers" are 167 // only a fictitious way to sample the longitudinal energy deposits, 168 // but they are actually made of the same absorber material, and their 169 // thickness is taken into account in theAbsorberTotalLength. 170 171 G4bool fIsRadiusUnitInLambda; 172 // If false then normal unit of length to express the radius bin size. 173 // If true then lambda (interaction length of the absorber) to express 174 // the radius bin size. 175 176 G4double fCaloLength; // total length of the calorimeter along its (z) axis 177 178 // Scoring part 179 G4LogicalVolume* fLogicScoringUpDown; 180 G4VPhysicalVolume* fPhysiScoringUpstream; 181 G4VPhysicalVolume* fPhysiScoringDownstream; 182 G4LogicalVolume* fLogicScoringSide; 183 G4VPhysicalVolume* fPhysiScoringSide; 184 const G4double fScoringThickness = 10.0; 185 }; 186 187 inline G4Material* DetectorConstruction::GetAbsorberMaterial() const 188 { 189 return fAbsorberMaterial; 190 } 191 192 inline G4Material* DetectorConstruction::GetActiveMaterial() const 193 { 194 return fActiveMaterial; 195 } 196 197 inline void DetectorConstruction::SetIsCalHomogeneous(const G4bool choice) 198 { 199 fIsCalHomogeneous = choice; 200 } 201 202 inline void DetectorConstruction::SetIsUnitInLambda(const G4bool choice) 203 { 204 fIsUnitInLambda = choice; 205 } 206 207 inline void DetectorConstruction::SetAbsorberTotalLength(const G4double value) 208 { 209 fAbsorberTotalLength = value; 210 } 211 212 inline void DetectorConstruction::SetCalorimeterRadius(const G4double value) 213 { 214 fCalorimeterRadius = value; 215 } 216 217 inline void DetectorConstruction::SetActiveLayerNumber(const G4int value) 218 { 219 fActiveLayerNumber = value; 220 } 221 222 inline void DetectorConstruction::SetActiveLayerSize(const G4double value) 223 { 224 fActiveLayerSize = value; 225 } 226 227 inline void DetectorConstruction::SetIsRadiusUnitInLambda(const G4bool choice) 228 { 229 fIsRadiusUnitInLambda = choice; 230 } 231 232 inline G4double DetectorConstruction::GetCaloLength() const 233 { 234 return fCaloLength; 235 } 236 237 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 238 239 #endif 240