Geant4 Cross Reference |
>> 1 // This code implementation is the intellectual property of >> 2 // the GEANT4 collaboration. >> 3 // >> 4 // By copying, distributing or modifying the Program (or any work >> 5 // based on the Program) you indicate your acceptance of this statement, >> 6 // and all its terms. >> 7 // >> 8 // $Id: G4LogicalVolume.icc,v 1.3 1999/12/15 14:49:51 gunter Exp $ >> 9 // GEANT4 tag $Name: geant4-02-00 $ 1 // 10 // 2 // ******************************************* << 3 // * License and Disclaimer << 4 // * << 5 // * The Geant4 software is copyright of th << 6 // * the Geant4 Collaboration. It is provided << 7 // * conditions of the Geant4 Software License << 8 // * LICENSE and available at http://cern.ch/ << 9 // * include a list of copyright holders. << 10 // * << 11 // * Neither the authors of this software syst << 12 // * institutes,nor the agencies providing fin << 13 // * work make any representation or warran << 14 // * regarding this software system or assum << 15 // * use. Please see the license in the file << 16 // * for the full disclaimer and the limitatio << 17 // * << 18 // * This code implementation is the result << 19 // * technical work of the GEANT4 collaboratio << 20 // * By using, copying, modifying or distri << 21 // * any work based on the software) you ag << 22 // * use in resulting scientific publicati << 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* << 25 // 11 // 26 // class G4LogicalVolume inline implementation << 12 // class G4LogicalVolume Inline Implementation file 27 // 13 // 28 // 15.01.13 - G.Cosmo, A.Dotti: Modified for t << 14 // 10.20.97 - P. MoraDeFreitas : Added SetFastSimulation method. 29 // 10.20.97 - P. MoraDeFreitas : Added SetFast << 30 // 05.11.98 - M. Verderi: Add Get/Set methods 15 // 05.11.98 - M. Verderi: Add Get/Set methods for fBiasWeight 31 // 09.11.98 - J.Apostolakis: Changed Magnetic << 16 // 09.11.98 - J. Apostolakis: Changed MagneticField to FieldManager 32 // 12.02.99 - S.Giani: Added set/get methods f 17 // 12.02.99 - S.Giani: Added set/get methods for voxelization quality 33 // 18.04.01 - G.Cosmo: Migrated to STL vector << 34 // 17.05.02 - G.Cosmo: Added IsToOptimise() me << 35 // ------------------------------------------- << 36 << 37 // ******************************************* << 38 // GetName << 39 // ******************************************* << 40 // << 41 inline << 42 const G4String& G4LogicalVolume::GetName() con << 43 { << 44 return fName; << 45 } << 46 << 47 // ******************************************* << 48 // GetInstanceID << 49 // ******************************************* << 50 // << 51 inline << 52 G4int G4LogicalVolume::GetInstanceID() const << 53 { << 54 return instanceID; << 55 } << 56 << 57 // ******************************************* << 58 // GetMasterFieldManager << 59 // ******************************************* << 60 // << 61 inline << 62 G4FieldManager* G4LogicalVolume::GetMasterFiel << 63 { << 64 return fFieldManager; << 65 } << 66 << 67 // ******************************************* << 68 // GetNoDaughters << 69 // ******************************************* << 70 // << 71 inline << 72 std::size_t G4LogicalVolume::GetNoDaughters() << 73 { << 74 return fDaughters.size(); << 75 } << 76 << 77 // ******************************************* << 78 // GetDaughter << 79 // ******************************************* << 80 // << 81 inline << 82 G4VPhysicalVolume* G4LogicalVolume::GetDaughte << 83 { << 84 return fDaughters[i]; << 85 } << 86 18 87 // ******************************************* << 19 inline G4String G4LogicalVolume::GetName() const 88 // GetFastSimulationManager << 20 { 89 // ******************************************* << 21 return fName; 90 // << 22 } 91 inline << 23 92 G4FastSimulationManager* G4LogicalVolume::GetF << 24 inline void G4LogicalVolume::SetName(const G4String& pName) 93 { << 25 { 94 G4FastSimulationManager* fFSM = nullptr; << 26 fName=pName; 95 if(fRegion != nullptr) fFSM = fRegion->GetFa << 27 } 96 return fFSM; << 28 97 } << 29 inline G4FieldManager* G4LogicalVolume::GetFieldManager() const 98 << 30 { 99 // ******************************************* << 31 return fFieldManager; 100 // IsDaughter << 32 } 101 // ******************************************* << 33 102 // << 34 inline G4int G4LogicalVolume::GetNoDaughters() const 103 inline << 35 { 104 G4bool G4LogicalVolume::IsDaughter(const G4VPh << 36 return fDaughters.entries(); 105 { << 37 } 106 for (const auto & daughter : fDaughters) << 38 107 { << 39 inline G4VPhysicalVolume* G4LogicalVolume::GetDaughter(const G4int i) const 108 if (*daughter==*p) return true; << 40 { 109 } << 41 return fDaughters(i); 110 return false; << 42 } 111 } << 43 112 << 44 inline G4FastSimulationManager* 113 // ******************************************* << 45 G4LogicalVolume::GetFastSimulationManager () const 114 // CharacteriseDaughters << 46 { 115 // ******************************************* << 47 return fFastSimulationManager; 116 // << 48 } 117 inline << 49 118 EVolume G4LogicalVolume::CharacteriseDaughters << 50 inline void G4LogicalVolume::AddDaughter(G4VPhysicalVolume* pNewDaughter) 119 { << 51 { 120 return fDaughtersVolumeType; << 52 // manual resize operation to avoid Rogue grabbing RW_DEFAULT 121 } << 53 fDaughters.resize(fDaughters.entries()+1); 122 << 54 fDaughters.insert(pNewDaughter); 123 // ******************************************* << 55 // Propagates the mother's FastSimulationManager pointer. If we are in 124 // DeduceDaughtersType << 56 // the World logical volume, propagates only if pointer != 0. 125 // ******************************************* << 57 // (perhaps someone would like to parametrize all the World volume 126 // << 58 // for a particle type, why not ?). 127 inline << 59 G4VPhysicalVolume *myPhysical= pNewDaughter->GetMother(); 128 EVolume G4LogicalVolume::DeduceDaughtersType() << 60 G4VPhysicalVolume *pMotherPhys; 129 { << 61 G4LogicalVolume *pDaughterLogical; 130 EVolume type= kNormal; << 62 131 G4VPhysicalVolume* pVol; << 63 if( myPhysical !=0 ){ >> 64 pMotherPhys= myPhysical->GetMother(); >> 65 pDaughterLogical = pNewDaughter->GetLogicalVolume(); >> 66 >> 67 if( (pMotherPhys!=0) || >> 68 ( pMotherPhys==0) && (fFastSimulationManager!=0)) >> 69 { >> 70 if(pDaughterLogical->GetFastSimulationManager() != fFastSimulationManager) >> 71 pDaughterLogical-> >> 72 SetFastSimulationManager(fFastSimulationManager,FALSE); >> 73 } >> 74 else { >> 75 pDaughterLogical->SetFastSimulationManager(NULL,FALSE); >> 76 } >> 77 } >> 78 >> 79 >> 80 // Propagate the Field Manager, if the daughter has no field Manager. >> 81 pDaughterLogical = pNewDaughter->GetLogicalVolume(); >> 82 G4FieldManager* pDaughterFieldManager = pDaughterLogical->GetFieldManager(); >> 83 >> 84 if( pDaughterFieldManager == 0 ){ >> 85 pDaughterLogical->SetFieldManager(fFieldManager, >> 86 true); >> 87 } 132 88 133 if ( GetNoDaughters() >= 1 ) << 134 { << 135 pVol = GetDaughter(0); << 136 type = pVol->VolumeType(); << 137 } << 138 return type; << 139 } << 140 << 141 // ******************************************* << 142 // GetMasterSolid << 143 // ******************************************* << 144 // << 145 inline << 146 G4VSolid* G4LogicalVolume::GetMasterSolid() co << 147 { << 148 return fSolid; << 149 } << 150 << 151 // ******************************************* << 152 // GetMasterSensitiveDetector << 153 // ******************************************* << 154 // << 155 inline << 156 G4VSensitiveDetector* G4LogicalVolume::GetMast << 157 { << 158 return fSensitiveDetector; << 159 } << 160 << 161 // ******************************************* << 162 // GetUserLimits << 163 // ******************************************* << 164 // << 165 inline << 166 G4UserLimits* G4LogicalVolume::GetUserLimits() << 167 { << 168 if(fUserLimits != nullptr) return fUserLimit << 169 if(fRegion != nullptr) return fRegion->GetUs << 170 return nullptr; << 171 } << 172 << 173 // ******************************************* << 174 // SetUserLimits << 175 // ******************************************* << 176 // << 177 inline << 178 void G4LogicalVolume::SetUserLimits(G4UserLimi << 179 { << 180 fUserLimits = pULimits; << 181 } << 182 << 183 // ******************************************* << 184 // GetVoxelHeader << 185 // ******************************************* << 186 // << 187 inline << 188 G4SmartVoxelHeader* G4LogicalVolume::GetVoxelH << 189 { << 190 return fVoxel; << 191 } << 192 << 193 // ******************************************* << 194 // SetVoxelHeader << 195 // ******************************************* << 196 // << 197 inline << 198 void G4LogicalVolume::SetVoxelHeader(G4SmartVo << 199 { << 200 fVoxel = pVoxel; << 201 } << 202 << 203 // ******************************************* << 204 // GetSmartless << 205 // ******************************************* << 206 // << 207 inline << 208 G4double G4LogicalVolume::GetSmartless() const << 209 { << 210 return fSmartless; << 211 } << 212 << 213 // ******************************************* << 214 // SetSmartless << 215 // ******************************************* << 216 // << 217 inline << 218 void G4LogicalVolume::SetSmartless(G4double sm << 219 { << 220 fSmartless = smt; << 221 } << 222 << 223 // ******************************************* << 224 // IsToOptimise << 225 // ******************************************* << 226 // << 227 inline << 228 G4bool G4LogicalVolume::IsToOptimise() const << 229 { << 230 return fOptimise; << 231 } << 232 << 233 // ******************************************* << 234 // SetOptimisation << 235 // ******************************************* << 236 // << 237 inline << 238 void G4LogicalVolume::SetOptimisation(G4bool o << 239 { << 240 fOptimise = optim; << 241 } << 242 << 243 // ******************************************* << 244 // IsRootRegion << 245 // ******************************************* << 246 // << 247 inline << 248 G4bool G4LogicalVolume::IsRootRegion() const << 249 { << 250 return fRootRegion; << 251 } << 252 << 253 // ******************************************* << 254 // SetRegionRootFlag << 255 // ******************************************* << 256 // << 257 inline << 258 void G4LogicalVolume::SetRegionRootFlag(G4bool << 259 { << 260 fRootRegion = rreg; << 261 } 89 } 262 90 263 // ******************************************* << 91 inline G4bool G4LogicalVolume::IsDaughter(const G4VPhysicalVolume* p) const 264 // IsRegion << 92 { 265 // ******************************************* << 93 return fDaughters.contains(p); 266 // << 94 } 267 inline << 95 268 G4bool G4LogicalVolume::IsRegion() const << 96 inline void G4LogicalVolume::RemoveDaughter(const G4VPhysicalVolume* p) 269 { << 97 { 270 G4bool reg = false; << 98 fDaughters.remove(p); 271 if (fRegion != nullptr) reg = true; << 99 fDaughters.resize(fDaughters.entries()); 272 return reg; << 100 } 273 } << 101 >> 102 inline G4VSolid* G4LogicalVolume::GetSolid() const >> 103 { >> 104 return fSolid; >> 105 } >> 106 >> 107 inline void G4LogicalVolume::SetSolid(G4VSolid *pSolid) >> 108 { >> 109 assert(pSolid != 0); >> 110 fSolid=pSolid; >> 111 } >> 112 >> 113 inline G4Material* G4LogicalVolume::GetMaterial() const >> 114 { >> 115 return fMaterial; >> 116 } >> 117 >> 118 inline void G4LogicalVolume::SetMaterial(G4Material *pMaterial) >> 119 { >> 120 // assert(pMaterial != 0); >> 121 fMaterial=pMaterial; >> 122 } >> 123 >> 124 inline G4VSensitiveDetector* G4LogicalVolume::GetSensitiveDetector() const >> 125 { >> 126 return fSensitiveDetector; >> 127 } >> 128 >> 129 inline void G4LogicalVolume::SetSensitiveDetector(G4VSensitiveDetector *pSDetector) >> 130 { >> 131 fSensitiveDetector=pSDetector; >> 132 } >> 133 >> 134 inline G4UserLimits* G4LogicalVolume::GetUserLimits() const >> 135 { >> 136 return fUserLimits; >> 137 } >> 138 >> 139 inline void G4LogicalVolume::SetUserLimits(G4UserLimits *pULimits) >> 140 { >> 141 fUserLimits=pULimits; >> 142 } >> 143 >> 144 inline G4SmartVoxelHeader* G4LogicalVolume::GetVoxelHeader() const >> 145 { >> 146 return fVoxel; >> 147 } >> 148 >> 149 inline void G4LogicalVolume::SetVoxelHeader(G4SmartVoxelHeader *pVoxel) >> 150 { >> 151 fVoxel=pVoxel; >> 152 } >> 153 >> 154 inline G4double G4LogicalVolume::GetSmartless() >> 155 { >> 156 return fSmartless; >> 157 } >> 158 >> 159 inline void G4LogicalVolume::SetSmartless(G4double s) >> 160 { >> 161 fSmartless=s; >> 162 } >> 163 >> 164 inline G4bool G4LogicalVolume::operator == ( const G4LogicalVolume& lv) const >> 165 { >> 166 return (this==&lv) ? true : false; >> 167 } 274 168 275 // ******************************************* << 169 inline const G4VisAttributes* G4LogicalVolume::GetVisAttributes () const { 276 // SetRegion << 170 return fVisAttributes; 277 // ******************************************* << 278 // << 279 inline << 280 void G4LogicalVolume::SetRegion(G4Region* reg) << 281 { << 282 fRegion = reg; << 283 } 171 } 284 172 285 // ******************************************* << 173 inline void G4LogicalVolume::SetVisAttributes (const G4VisAttributes* pVA) { 286 // GetRegion << 174 fVisAttributes = pVA; 287 // ******************************************* << 288 // << 289 inline << 290 G4Region* G4LogicalVolume::GetRegion() const << 291 { << 292 return fRegion; << 293 } 175 } 294 176 295 // ******************************************* << 177 inline void G4LogicalVolume::SetVisAttributes (const G4VisAttributes& VA) { 296 // PropagateRegion << 178 fVisAttributes = &VA; 297 // ******************************************* << 298 // << 299 inline << 300 void G4LogicalVolume::PropagateRegion() << 301 { << 302 fRegion->ScanVolumeTree(this, true); << 303 } 179 } 304 180 305 // ******************************************* << 181 inline void 306 // Lock << 182 G4LogicalVolume::BecomeEnvelopeForFastSimulation(G4FastSimulationManager* pPA) { 307 // ******************************************* << 183 SetFastSimulationManager(pPA,TRUE); 308 // << 309 inline << 310 void G4LogicalVolume::Lock() << 311 { << 312 fLock = true; << 313 } 184 } 314 185 315 // ******************************************* << 186 inline void G4LogicalVolume::SetBiasWeight(G4double w) 316 // Operator == << 187 { fBiasWeight = w; } 317 // ******************************************* << 318 // << 319 inline << 320 G4bool G4LogicalVolume::operator == ( const G4 << 321 { << 322 return this==&lv; << 323 } << 324 188 325 // ******************************************* << 189 inline G4double G4LogicalVolume::GetBiasWeight() const 326 // SetBiasWeight << 190 { return fBiasWeight; } 327 // ******************************************* << 328 // << 329 inline << 330 void G4LogicalVolume::SetBiasWeight(G4double w << 331 { << 332 fBiasWeight = weight; << 333 } << 334 191 335 // ******************************************* << 336 // GetBiasWeight << 337 // ******************************************* << 338 // << 339 inline << 340 G4double G4LogicalVolume::GetBiasWeight() cons << 341 { << 342 return fBiasWeight; << 343 } << 344 << 345 // ******************************************* << 346 // GetVisAttributes << 347 // ******************************************* << 348 // << 349 inline << 350 const G4VisAttributes* G4LogicalVolume::GetVis << 351 { << 352 return fVisAttributes.get(); << 353 } << 354 192