Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // G4LogicalVolume 26 // G4LogicalVolume 27 // 27 // 28 // Class description: 28 // Class description: 29 // 29 // 30 // Represents a leaf node or unpositioned subt 30 // Represents a leaf node or unpositioned subtree in the geometry hierarchy. 31 // Logical volumes are named, and may have dau 31 // Logical volumes are named, and may have daughters ascribed to them. 32 // They are responsible for retrieval of the p 32 // They are responsible for retrieval of the physical and tracking attributes 33 // of the physical volume that it represents: 33 // of the physical volume that it represents: solid, material, magnetic field, 34 // and optionally, user limits, sensitive dete 34 // and optionally, user limits, sensitive detectors, regions, biasing weights. 35 // 35 // 36 // Get and Set functionality is provided for a 36 // Get and Set functionality is provided for all attributes, but note that 37 // most set functions should not be used when 37 // most set functions should not be used when the geometry is `closed'. 38 // As a further development, `Guard' checks c 38 // As a further development, `Guard' checks can be added to ensure 39 // only legal operations at tracking time. 39 // only legal operations at tracking time. 40 // 40 // 41 // On construction, solid, material and name m 41 // On construction, solid, material and name must be specified. 42 // 42 // 43 // Daughters are ascribed and managed by means 43 // Daughters are ascribed and managed by means of a simple 44 // GetNoDaughters,Get/SetDaughter(n),AddDaught 44 // GetNoDaughters,Get/SetDaughter(n),AddDaughter interface. 45 // 45 // 46 // Smart voxels as used for tracking optimisat 46 // Smart voxels as used for tracking optimisation. They're also an attribute. 47 // 47 // 48 // Logical volumes self register to the logica 48 // Logical volumes self register to the logical volume Store on construction, 49 // and deregister on destruction. 49 // and deregister on destruction. 50 // 50 // 51 // NOTE: This class is currently *NOT* subclas 51 // NOTE: This class is currently *NOT* subclassed, since not meant to 52 // act as a base class. Therefore, the d 52 // act as a base class. Therefore, the destructor is NOT virtual. 53 // 53 // 54 // Data members: 54 // Data members: 55 // 55 // 56 // std::vector<G4VPhysicalVolume*> fDaughte 56 // std::vector<G4VPhysicalVolume*> fDaughters 57 // - Vector of daughters. Given initial siz 57 // - Vector of daughters. Given initial size of 0. 58 // G4FieldManager* fFieldManager 58 // G4FieldManager* fFieldManager 59 // - Pointer (possibly 0) to (magnetic or o 59 // - Pointer (possibly 0) to (magnetic or other) field manager object. 60 // G4Material* fMaterial 60 // G4Material* fMaterial 61 // - Pointer to material at this node. 61 // - Pointer to material at this node. 62 // G4String fName 62 // G4String fName 63 // - Name of logical volume. 63 // - Name of logical volume. 64 // G4VSensitiveDetector *fSensitiveDetector 64 // G4VSensitiveDetector *fSensitiveDetector 65 // - Pointer (possibly 0) to `Hit' object. 65 // - Pointer (possibly 0) to `Hit' object. 66 // G4VSolid* fSolid 66 // G4VSolid* fSolid 67 // - Pointer to solid. 67 // - Pointer to solid. 68 // G4UserLimits* fUserLimits 68 // G4UserLimits* fUserLimits 69 // - Pointer (possibly 0) to user Step limi 69 // - Pointer (possibly 0) to user Step limit object for this node. 70 // G4SmartVoxelHeader* fVoxel 70 // G4SmartVoxelHeader* fVoxel 71 // - Pointer (possibly 0) to optimisation i 71 // - Pointer (possibly 0) to optimisation info objects. 72 // G4bool fOptimise 72 // G4bool fOptimise 73 // - Flag to identify if optimisation shoul 73 // - Flag to identify if optimisation should be applied or not. 74 // G4bool fRootRegion 74 // G4bool fRootRegion 75 // - Flag to identify if the logical volume 75 // - Flag to identify if the logical volume is a root region. 76 // G4double fSmartless 76 // G4double fSmartless 77 // - Quality for optimisation, average numb 77 // - Quality for optimisation, average number of voxels to be spent 78 // per content. 78 // per content. 79 // const G4VisAttributes* fVisAttributes 79 // const G4VisAttributes* fVisAttributes 80 // - Pointer (possibly 0) to visualization 80 // - Pointer (possibly 0) to visualization attributes. 81 // G4Region* fRegion 81 // G4Region* fRegion 82 // - Pointer to the cuts region (if any) 82 // - Pointer to the cuts region (if any) 83 // G4MaterialCutsCouple* fCutsCouple 83 // G4MaterialCutsCouple* fCutsCouple 84 // - Pointer (possibly 0) to associated pro 84 // - Pointer (possibly 0) to associated production cuts. 85 // G4double fBiasWeight 85 // G4double fBiasWeight 86 // - Weight used in the event biasing techn 86 // - Weight used in the event biasing technique. 87 // 87 // 88 // Following data members has been moved to G4 88 // Following data members has been moved to G4Region - M.Asai (Aug/18/2005) 89 // G4FastSimulationManager* fFastSimulation 89 // G4FastSimulationManager* fFastSimulationManager 90 // - Pointer (possibly 0) to G4FastSimulati 90 // - Pointer (possibly 0) to G4FastSimulationManager object. 91 // G4bool fIsEnvelope 91 // G4bool fIsEnvelope 92 // - Flags if the Logical Volume is an enve 92 // - Flags if the Logical Volume is an envelope for a FastSimulationManager. 93 93 94 // 15.01.13 G.Cosmo, A.Dotti: Modified for thr 94 // 15.01.13 G.Cosmo, A.Dotti: Modified for thread-safety for MT 95 // 12.11.04 G.Cosmo: Added GetMass() method fo 95 // 12.11.04 G.Cosmo: Added GetMass() method for computing mass of the tree 96 // 24.09.02 G.Cosmo: Added flags and accessors 96 // 24.09.02 G.Cosmo: Added flags and accessors for region cuts handling 97 // 17.05.02 G.Cosmo: Added IsToOptimise() meth 97 // 17.05.02 G.Cosmo: Added IsToOptimise() method and related flag 98 // 18.04.01 G.Cosmo: Migrated to STL vector 98 // 18.04.01 G.Cosmo: Migrated to STL vector 99 // 12.02.99 S.Giani: Added user defined optimi 99 // 12.02.99 S.Giani: Added user defined optimisation quality 100 // 09.11.98 M.Verderi, J.Apostolakis: Added Bi 100 // 09.11.98 M.Verderi, J.Apostolakis: Added BiasWeight member and accessors 101 // 10.20.97 P.M.DeFreitas, J.Apostolakis: Adde 101 // 10.20.97 P.M.DeFreitas, J.Apostolakis: Added pointer to a FastSimulation 102 // 11.07.95 P.Kent: Initial version 102 // 11.07.95 P.Kent: Initial version 103 // ------------------------------------------- 103 // ------------------------------------------------------------------------ 104 #ifndef G4LOGICALVOLUME_HH 104 #ifndef G4LOGICALVOLUME_HH 105 #define G4LOGICALVOLUME_HH 1 105 #define G4LOGICALVOLUME_HH 1 106 106 107 #include <vector> 107 #include <vector> 108 #include <memory> << 109 108 110 #include "G4Types.hh" 109 #include "G4Types.hh" 111 #include "G4Region.hh" // Required b 110 #include "G4Region.hh" // Required by inline methods 112 #include "G4VPhysicalVolume.hh" // Need opera 111 #include "G4VPhysicalVolume.hh" // Need operator == for vector fdaughters 113 #include "G4GeomSplitter.hh" // Needed for 112 #include "G4GeomSplitter.hh" // Needed for MT RW data splitting 114 #include "G4Threading.hh" 113 #include "G4Threading.hh" 115 114 116 // Forward declarations 115 // Forward declarations 117 // 116 // 118 class G4FieldManager; 117 class G4FieldManager; 119 class G4Material; 118 class G4Material; 120 class G4VSensitiveDetector; 119 class G4VSensitiveDetector; 121 class G4VSolid; 120 class G4VSolid; 122 class G4UserLimits; 121 class G4UserLimits; 123 class G4SmartVoxelHeader; 122 class G4SmartVoxelHeader; >> 123 class G4VisAttributes; 124 class G4FastSimulationManager; 124 class G4FastSimulationManager; 125 class G4MaterialCutsCouple; 125 class G4MaterialCutsCouple; 126 class G4VisAttributes; << 127 126 128 class G4LVData 127 class G4LVData 129 { 128 { 130 // Encapsulates the fields associated to the 129 // Encapsulates the fields associated to the class 131 // G4LogicalVolume that may not be read-only 130 // G4LogicalVolume that may not be read-only. 132 131 133 public: 132 public: 134 133 135 G4LVData(); 134 G4LVData(); 136 void initialize() 135 void initialize() 137 { 136 { 138 fSolid = nullptr; 137 fSolid = nullptr; 139 fSensitiveDetector = nullptr; 138 fSensitiveDetector = nullptr; 140 fFieldManager = nullptr; 139 fFieldManager = nullptr; 141 fMaterial = nullptr; 140 fMaterial = nullptr; 142 fMass = 0.0; 141 fMass = 0.0; 143 fCutsCouple = nullptr; 142 fCutsCouple = nullptr; 144 } 143 } 145 144 146 public: 145 public: 147 146 148 G4VSolid* fSolid = nullptr; 147 G4VSolid* fSolid = nullptr; 149 // Pointer to solid. 148 // Pointer to solid. 150 G4VSensitiveDetector* fSensitiveDetector = 149 G4VSensitiveDetector* fSensitiveDetector = nullptr; 151 // Pointer to sensitive detector. 150 // Pointer to sensitive detector. 152 G4FieldManager* fFieldManager = nullptr; 151 G4FieldManager* fFieldManager = nullptr; 153 // Pointer (possibly nullptr) to (magnet 152 // Pointer (possibly nullptr) to (magnetic or other) field manager object. 154 G4Material* fMaterial = nullptr; 153 G4Material* fMaterial = nullptr; 155 // Pointer to material at this node. 154 // Pointer to material at this node. 156 G4double fMass = 0.0; 155 G4double fMass = 0.0; 157 // Mass of the logical volume tree. 156 // Mass of the logical volume tree. 158 G4MaterialCutsCouple* fCutsCouple = nullpt 157 G4MaterialCutsCouple* fCutsCouple = nullptr; 159 // Pointer (possibly nullptr) to associa 158 // Pointer (possibly nullptr) to associated production cuts. 160 }; 159 }; 161 160 162 // The type G4LVManager is introduced to encap 161 // The type G4LVManager is introduced to encapsulate the methods used by 163 // both the master thread and worker threads t 162 // both the master thread and worker threads to allocate memory space for 164 // the fields encapsulated by the class G4LVDa 163 // the fields encapsulated by the class G4LVData. When each thread 165 // initializes the value for these fields, it 164 // initializes the value for these fields, it refers to them using a macro 166 // definition defined below. For every G4Logic 165 // definition defined below. For every G4LogicalVolume instance, there is 167 // a corresponding G4LVData instance. All G4LV 166 // a corresponding G4LVData instance. All G4LVData instances are organized 168 // by the class G4LVManager as an array. 167 // by the class G4LVManager as an array. 169 // The field "int instanceID" is added to the 168 // The field "int instanceID" is added to the class G4LogicalVolume. 170 // The value of this field in each G4LogicalVo 169 // The value of this field in each G4LogicalVolume instance is the subscript 171 // of the corresponding G4LVData instance. 170 // of the corresponding G4LVData instance. 172 // In order to use the class G4LVManager, we a 171 // In order to use the class G4LVManager, we add a static member in the class 173 // G4LogicalVolume as follows: "static G4LVMan 172 // G4LogicalVolume as follows: "static G4LVManager subInstanceManager". 174 // For the master thread, the array for G4LVDa 173 // For the master thread, the array for G4LVData instances grows dynamically 175 // along with G4LogicalVolume instances are cr 174 // along with G4LogicalVolume instances are created. For each worker thread, 176 // it copies the array of G4LVData instances f 175 // it copies the array of G4LVData instances from the master thread. 177 // In addition, it invokes a method similiar t 176 // In addition, it invokes a method similiar to the constructor explicitly 178 // to achieve the partial effect for each inst 177 // to achieve the partial effect for each instance in the array. 179 // 178 // 180 using G4LVManager = G4GeomSplitter<G4LVData>; 179 using G4LVManager = G4GeomSplitter<G4LVData>; 181 180 182 class G4LogicalVolume 181 class G4LogicalVolume 183 { 182 { 184 public: 183 public: 185 184 186 G4LogicalVolume(G4VSolid* pSolid, 185 G4LogicalVolume(G4VSolid* pSolid, 187 G4Material* pMaterial, 186 G4Material* pMaterial, 188 const G4String& name, 187 const G4String& name, 189 G4FieldManager* pFieldMgr 188 G4FieldManager* pFieldMgr = nullptr, 190 G4VSensitiveDetector* pSDe 189 G4VSensitiveDetector* pSDetector = nullptr, 191 G4UserLimits* pULimits = n 190 G4UserLimits* pULimits = nullptr, 192 G4bool optimise = true); 191 G4bool optimise = true); 193 // Constructor. The solid and material p 192 // Constructor. The solid and material pointer must be non null. 194 // The parameters for field, detector an 193 // The parameters for field, detector and user limits are optional. 195 // The volume also enters itself into th 194 // The volume also enters itself into the logical volume Store. 196 // Optimisation of the geometry (voxelis 195 // Optimisation of the geometry (voxelisation) for the volume 197 // hierarchy is applied by default. For 196 // hierarchy is applied by default. For parameterised volumes in 198 // the hierarchy, optimisation is -alway 197 // the hierarchy, optimisation is -always- applied. 199 198 200 virtual ~G4LogicalVolume(); 199 virtual ~G4LogicalVolume(); 201 // Destructor. Removes the logical volum 200 // Destructor. Removes the logical volume from the logical volume Store. 202 // This class is NOT meant to act as bas 201 // This class is NOT meant to act as base class, except for exceptional 203 // circumstances of extended types used 202 // circumstances of extended types used in the kernel. 204 203 205 G4LogicalVolume(const G4LogicalVolume&) = 204 G4LogicalVolume(const G4LogicalVolume&) = delete; 206 G4LogicalVolume& operator=(const G4Logical 205 G4LogicalVolume& operator=(const G4LogicalVolume&) = delete; 207 // Copy-constructor and assignment opera 206 // Copy-constructor and assignment operator not allowed. 208 207 209 inline const G4String& GetName() const; 208 inline const G4String& GetName() const; 210 void SetName(const G4String& pName); 209 void SetName(const G4String& pName); 211 // Returns and sets the name of the logi 210 // Returns and sets the name of the logical volume. 212 211 213 inline std::size_t GetNoDaughters() const; << 212 inline size_t GetNoDaughters() const; 214 // Returns the number of daughters (0 to 213 // Returns the number of daughters (0 to n). 215 inline G4VPhysicalVolume* GetDaughter(cons << 214 inline G4VPhysicalVolume* GetDaughter(const G4int i) const; 216 // Returns the ith daughter. Note number 215 // Returns the ith daughter. Note numbering starts from 0, 217 // and no bounds checking is performed. 216 // and no bounds checking is performed. 218 void AddDaughter(G4VPhysicalVolume* p); 217 void AddDaughter(G4VPhysicalVolume* p); 219 // Adds the volume p as a daughter of th 218 // Adds the volume p as a daughter of the current logical volume. 220 inline G4bool IsDaughter(const G4VPhysical 219 inline G4bool IsDaughter(const G4VPhysicalVolume* p) const; 221 // Returns true if the volume p is a dau 220 // Returns true if the volume p is a daughter of the current 222 // logical volume. 221 // logical volume. 223 G4bool IsAncestor(const G4VPhysicalVolume* 222 G4bool IsAncestor(const G4VPhysicalVolume* p) const; 224 // Returns true if the volume p is part 223 // Returns true if the volume p is part of the hierarchy of 225 // volumes established by the current lo 224 // volumes established by the current logical volume. Scans 226 // recursively the volume tree. 225 // recursively the volume tree. 227 void RemoveDaughter(const G4VPhysicalVolum 226 void RemoveDaughter(const G4VPhysicalVolume* p); 228 // Removes the volume p from the List of 227 // Removes the volume p from the List of daughter of the current 229 // logical volume. 228 // logical volume. 230 void ClearDaughters(); 229 void ClearDaughters(); 231 // Clears the list of daughters. Used by 230 // Clears the list of daughters. Used by the phys-volume store when 232 // the geometry tree is cleared, since m 231 // the geometry tree is cleared, since modified at run-time. 233 G4int TotalVolumeEntities() const; 232 G4int TotalVolumeEntities() const; 234 // Returns the total number of physical 233 // Returns the total number of physical volumes (replicated or placed) 235 // in the tree represented by the curren 234 // in the tree represented by the current logical volume. 236 inline EVolume CharacteriseDaughters() con 235 inline EVolume CharacteriseDaughters() const; 237 // Characterise the daughters of this lo 236 // Characterise the daughters of this logical volume. 238 inline EVolume DeduceDaughtersType() const 237 inline EVolume DeduceDaughtersType() const; 239 // Used by CharacteriseDaughters(). 238 // Used by CharacteriseDaughters(). 240 239 241 G4VSolid* GetSolid() const; 240 G4VSolid* GetSolid() const; 242 void SetSolid(G4VSolid* pSolid); 241 void SetSolid(G4VSolid* pSolid); 243 // Gets and sets the current solid. 242 // Gets and sets the current solid. 244 243 245 G4Material* GetMaterial() const; 244 G4Material* GetMaterial() const; 246 void SetMaterial(G4Material* pMaterial); 245 void SetMaterial(G4Material* pMaterial); 247 // Gets and sets the current material. 246 // Gets and sets the current material. 248 void UpdateMaterial(G4Material* pMaterial) 247 void UpdateMaterial(G4Material* pMaterial); 249 // Sets material and corresponding Mater 248 // Sets material and corresponding MaterialCutsCouple. 250 // This method is invoked by G4Navigator 249 // This method is invoked by G4Navigator while it is navigating through 251 // material parameterization. 250 // material parameterization. 252 G4double GetMass(G4bool forced = false, G4 251 G4double GetMass(G4bool forced = false, G4bool propagate = true, 253 G4Material* parMaterial = 252 G4Material* parMaterial = nullptr); 254 // Returns the mass of the logical volum 253 // Returns the mass of the logical volume tree computed from the 255 // estimated geometrical volume of each 254 // estimated geometrical volume of each solid and material associated 256 // to the logical volume and (by default 255 // to the logical volume and (by default) to its daughters. 257 // NOTE: the computation may require a c 256 // NOTE: the computation may require a considerable amount of time, 258 // depending from the complexity o 257 // depending from the complexity of the geometry tree. 259 // The returned value is cached an 258 // The returned value is cached and can be used for successive 260 // calls (default), unless recompu 259 // calls (default), unless recomputation is forced by providing 261 // 'true' for the boolean argument 260 // 'true' for the boolean argument in input. Computation should 262 // be forced if the geometry setup 261 // be forced if the geometry setup has changed after the previous 263 // call. By setting the 'propagate 262 // call. By setting the 'propagate' boolean flag to 'false' the 264 // method returns the mass of the 263 // method returns the mass of the present logical volume only 265 // (subtracted for the volume occu 264 // (subtracted for the volume occupied by the daughter volumes). 266 // An optional argument to specify 265 // An optional argument to specify a material is also provided. 267 void ResetMass(); 266 void ResetMass(); 268 // Ensure that cached value of Mass is i 267 // Ensure that cached value of Mass is invalidated - due to change in 269 // state, e.g. change of size of Solid, 268 // state, e.g. change of size of Solid, change of type of solid, 270 // or the addition/deletion 269 // or the addition/deletion of a daughter volume. 271 270 272 G4FieldManager* GetFieldManager() const; 271 G4FieldManager* GetFieldManager() const; 273 // Gets current FieldManager. 272 // Gets current FieldManager. 274 void SetFieldManager(G4FieldManager* pFiel 273 void SetFieldManager(G4FieldManager* pFieldMgr, G4bool forceToAllDaughters); 275 // Sets FieldManager and propagates it: 274 // Sets FieldManager and propagates it: 276 // i) only to daughters with G4FieldMan 275 // i) only to daughters with G4FieldManager = nullptr 277 // if forceToAllDaughters=false 276 // if forceToAllDaughters=false 278 // ii) to all daughters 277 // ii) to all daughters 279 // if forceToAllDaughters=true 278 // if forceToAllDaughters=true 280 279 281 G4VSensitiveDetector* GetSensitiveDetector 280 G4VSensitiveDetector* GetSensitiveDetector() const; 282 // Gets current SensitiveDetector. 281 // Gets current SensitiveDetector. 283 void SetSensitiveDetector(G4VSensitiveDete 282 void SetSensitiveDetector(G4VSensitiveDetector* pSDetector); 284 // Sets SensitiveDetector (can be nullpt 283 // Sets SensitiveDetector (can be nullptr). 285 284 286 inline G4UserLimits* GetUserLimits() const 285 inline G4UserLimits* GetUserLimits() const; 287 inline void SetUserLimits(G4UserLimits *pU 286 inline void SetUserLimits(G4UserLimits *pULimits); 288 // Gets and sets current UserLimits. 287 // Gets and sets current UserLimits. 289 288 290 inline G4SmartVoxelHeader* GetVoxelHeader( 289 inline G4SmartVoxelHeader* GetVoxelHeader() const; 291 inline void SetVoxelHeader(G4SmartVoxelHea 290 inline void SetVoxelHeader(G4SmartVoxelHeader *pVoxel); 292 // Gets and sets current VoxelHeader. 291 // Gets and sets current VoxelHeader. 293 292 294 inline G4double GetSmartless() const; 293 inline G4double GetSmartless() const; 295 inline void SetSmartless(G4double s); 294 inline void SetSmartless(G4double s); 296 // Gets and sets user defined optimisati 295 // Gets and sets user defined optimisation quality. 297 296 298 inline G4bool IsToOptimise() const; 297 inline G4bool IsToOptimise() const; 299 // Replies if geometry optimisation (vox 298 // Replies if geometry optimisation (voxelisation) is to be 300 // applied for this volume hierarchy. 299 // applied for this volume hierarchy. 301 inline void SetOptimisation(G4bool optim); 300 inline void SetOptimisation(G4bool optim); 302 // Specifies if to apply or not geometry 301 // Specifies if to apply or not geometry optimisation to this 303 // volume hierarchy. Note that for param 302 // volume hierarchy. Note that for parameterised volumes in the 304 // hierarchy, optimisation is always app 303 // hierarchy, optimisation is always applied. 305 304 306 inline G4bool IsRootRegion() const; 305 inline G4bool IsRootRegion() const; 307 // Replies if the logical volume represe 306 // Replies if the logical volume represents a root region or not. 308 inline void SetRegionRootFlag(G4bool rreg) 307 inline void SetRegionRootFlag(G4bool rreg); 309 // Sets/unsets the volume as a root regi 308 // Sets/unsets the volume as a root region for cuts. 310 inline G4bool IsRegion() const; 309 inline G4bool IsRegion() const; 311 // Replies if the logical volume is part 310 // Replies if the logical volume is part of a cuts region or not. 312 inline void SetRegion(G4Region* reg); 311 inline void SetRegion(G4Region* reg); 313 // Sets/unsets the volume as cuts region 312 // Sets/unsets the volume as cuts region. 314 inline G4Region* GetRegion() const; 313 inline G4Region* GetRegion() const; 315 // Return the region to which the volume 314 // Return the region to which the volume belongs, if any. 316 inline void PropagateRegion(); 315 inline void PropagateRegion(); 317 // Propagates region pointer to daughter 316 // Propagates region pointer to daughters. 318 317 319 const G4MaterialCutsCouple* GetMaterialCut 318 const G4MaterialCutsCouple* GetMaterialCutsCouple() const; 320 void SetMaterialCutsCouple(G4MaterialCutsC 319 void SetMaterialCutsCouple(G4MaterialCutsCouple* cuts); 321 // Accessors for production cuts. 320 // Accessors for production cuts. 322 321 323 G4bool operator == (const G4LogicalVolume& 322 G4bool operator == (const G4LogicalVolume& lv) const; 324 // Equality defined by address only. 323 // Equality defined by address only. 325 // Returns true if objects are at same a 324 // Returns true if objects are at same address, else false. 326 325 327 const G4VisAttributes* GetVisAttributes () << 326 inline const G4VisAttributes* GetVisAttributes () const; 328 void SetVisAttributes (const G4VisAttribut << 327 inline void SetVisAttributes (const G4VisAttributes* pVA); 329 void SetVisAttributes (const G4VisAttribut << 328 void SetVisAttributes (const G4VisAttributes& VA); 330 // Gets and sets visualization attribute << 329 // Gets and sets visualization attributes. A copy of 'VA' on the heap 331 // Arguments are converted to shared_ptr << 330 // will be made in the case the call with a const reference is used. 332 331 333 inline G4FastSimulationManager* GetFastSim 332 inline G4FastSimulationManager* GetFastSimulationManager () const; 334 // Gets current FastSimulationManager po 333 // Gets current FastSimulationManager pointer if exists, otherwise null. 335 334 336 inline void SetBiasWeight (G4double w); 335 inline void SetBiasWeight (G4double w); 337 inline G4double GetBiasWeight() const; 336 inline G4double GetBiasWeight() const; 338 // Sets and gets bias weight. 337 // Sets and gets bias weight. 339 338 340 public: 339 public: 341 340 342 G4LogicalVolume(__void__&); 341 G4LogicalVolume(__void__&); 343 // Fake default constructor for usage re 342 // Fake default constructor for usage restricted to direct object 344 // persistency for clients requiring pre 343 // persistency for clients requiring preallocation of memory for 345 // persistifiable objects. 344 // persistifiable objects. 346 345 347 virtual G4bool IsExtended() const; 346 virtual G4bool IsExtended() const; 348 // Return true if it is not a base-class 347 // Return true if it is not a base-class object. 349 348 350 inline G4FieldManager* GetMasterFieldManag 349 inline G4FieldManager* GetMasterFieldManager() const; 351 // Gets current FieldManager for the mas 350 // Gets current FieldManager for the master thread. 352 inline G4VSensitiveDetector* GetMasterSens 351 inline G4VSensitiveDetector* GetMasterSensitiveDetector() const; 353 // Gets current SensitiveDetector for th 352 // Gets current SensitiveDetector for the master thread. 354 inline G4VSolid* GetMasterSolid() const; 353 inline G4VSolid* GetMasterSolid() const; 355 // Gets current Solid for the master thr 354 // Gets current Solid for the master thread. 356 355 357 inline G4int GetInstanceID() const; 356 inline G4int GetInstanceID() const; 358 // Returns the instance ID. 357 // Returns the instance ID. 359 358 360 static const G4LVManager& GetSubInstanceMa 359 static const G4LVManager& GetSubInstanceManager(); 361 // Returns the private data instance man 360 // Returns the private data instance manager. 362 361 363 static void Clean(); 362 static void Clean(); 364 // Clear memory allocated by sub-instanc 363 // Clear memory allocated by sub-instance manager. 365 364 366 inline void Lock(); 365 inline void Lock(); 367 // Set lock identifier for final deletio 366 // Set lock identifier for final deletion of entity. 368 367 369 void InitialiseWorker(G4LogicalVolume* ptr 368 void InitialiseWorker(G4LogicalVolume* ptrMasterObject, 370 G4VSolid* pSolid, G4 369 G4VSolid* pSolid, G4VSensitiveDetector* pSDetector); 371 // This method is similar to the constru 370 // This method is similar to the constructor. It is used by each worker 372 // thread to achieve the partial effect 371 // thread to achieve the partial effect as that of the master thread. 373 372 374 void TerminateWorker(G4LogicalVolume* ptrM 373 void TerminateWorker(G4LogicalVolume* ptrMasterObject); 375 // This method is similar to the destruc 374 // This method is similar to the destructor. It is used by each worker 376 // thread to achieve the partial effect 375 // thread to achieve the partial effect as that of the master thread. 377 376 378 void AssignFieldManager(G4FieldManager* fl 377 void AssignFieldManager(G4FieldManager* fldMgr); 379 // Set the FieldManager - only at this l 378 // Set the FieldManager - only at this level (do not push down hierarchy) 380 379 381 static G4VSolid* GetSolid(G4LVData& instLV 380 static G4VSolid* GetSolid(G4LVData& instLVdata) ; // const; 382 static void SetSolid(G4LVData& instLVdata, 381 static void SetSolid(G4LVData& instLVdata, G4VSolid* pSolid); 383 // Optimised Methods - passing thread in 382 // Optimised Methods - passing thread instance of worker data 384 383 385 G4bool ChangeDaughtersType(EVolume atype); 384 G4bool ChangeDaughtersType(EVolume atype); 386 // Change the type of the daughters volu 385 // Change the type of the daughters volume to be of type atype. 387 // Meant for the user who wants to use t 386 // Meant for the user who wants to use the external navigator for 388 // the contents of a volume. 387 // the contents of a volume. 389 // Returns: success (true) or failure (f 388 // Returns: success (true) or failure (false). 390 389 391 private: 390 private: 392 391 393 using G4PhysicalVolumeList = std::vector<G 392 using G4PhysicalVolumeList = std::vector<G4VPhysicalVolume *>; 394 393 395 G4GEOM_DLL static G4LVManager subInstanceM 394 G4GEOM_DLL static G4LVManager subInstanceManager; 396 // This new field helps to use the class 395 // This new field helps to use the class G4LVManager introduced above. 397 396 398 G4PhysicalVolumeList fDaughters; 397 G4PhysicalVolumeList fDaughters; 399 // Vector of daughters. Given initial si 398 // Vector of daughters. Given initial size of 0. 400 G4String fName; 399 G4String fName; 401 // Name of logical volume. 400 // Name of logical volume. 402 G4UserLimits* fUserLimits = nullptr; 401 G4UserLimits* fUserLimits = nullptr; 403 // Pointer (possibly nullptr) to user St 402 // Pointer (possibly nullptr) to user Step limit object for this node. 404 G4SmartVoxelHeader* fVoxel = nullptr; 403 G4SmartVoxelHeader* fVoxel = nullptr; 405 // Pointer (possibly nullptr) to optimis 404 // Pointer (possibly nullptr) to optimisation info objects. 406 G4double fSmartless = 2.0; 405 G4double fSmartless = 2.0; 407 // Quality for optimisation, average num 406 // Quality for optimisation, average number of voxels to be spent 408 // per content. 407 // per content. >> 408 const G4VisAttributes* fVisAttributes = nullptr; >> 409 // Pointer (possibly nullptr) to visualization attributes. 409 G4Region* fRegion = nullptr; 410 G4Region* fRegion = nullptr; 410 // Pointer to the cuts region (if any). << 411 // Pointer to the cuts region (if any) 411 G4double fBiasWeight = 1.0; 412 G4double fBiasWeight = 1.0; 412 // Weight used in the event biasing tech 413 // Weight used in the event biasing technique. 413 std::shared_ptr<const G4VisAttributes> fVi << 414 // Pointer to visualization attributes. << 415 414 416 // Shadow of master pointers. 415 // Shadow of master pointers. 417 // Each worker thread can access this fiel 416 // Each worker thread can access this field from the master thread 418 // through these pointers. 417 // through these pointers. 419 // 418 // 420 G4VSolid* fSolid = nullptr; 419 G4VSolid* fSolid = nullptr; 421 G4VSensitiveDetector* fSensitiveDetector = 420 G4VSensitiveDetector* fSensitiveDetector = nullptr; 422 G4FieldManager* fFieldManager = nullptr; 421 G4FieldManager* fFieldManager = nullptr; 423 G4LVData* lvdata = nullptr; // For use of 422 G4LVData* lvdata = nullptr; // For use of object persistency 424 423 425 G4int instanceID; 424 G4int instanceID; 426 // This new field is used as instance ID 425 // This new field is used as instance ID. 427 EVolume fDaughtersVolumeType; 426 EVolume fDaughtersVolumeType; 428 // Are contents of volume placements, re 427 // Are contents of volume placements, replica, parameterised or external? 429 G4bool fOptimise = true; 428 G4bool fOptimise = true; 430 // Flag to identify if optimisation shou 429 // Flag to identify if optimisation should be applied or not. 431 G4bool fRootRegion = false; 430 G4bool fRootRegion = false; 432 // Flag to identify if the logical volum 431 // Flag to identify if the logical volume is a root region. 433 G4bool fLock = false; 432 G4bool fLock = false; 434 // Flag to identify if entity is locked 433 // Flag to identify if entity is locked for final deletion. 435 }; 434 }; 436 435 437 #include "G4LogicalVolume.icc" 436 #include "G4LogicalVolume.icc" 438 437 439 #endif 438 #endif 440 439