Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-15 09:09:30

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 // 
0026 // class G4LogicalVolume inline implementation
0027 //
0028 // Author: Paul Kent (CERN), 11.07.1995 - Initial version
0029 // --------------------------------------------------------------------
0030 
0031 // ********************************************************************
0032 // GetName
0033 // ********************************************************************
0034 //
0035 inline
0036 const G4String& G4LogicalVolume::GetName() const
0037 {
0038   return fName;
0039 }
0040     
0041 // ********************************************************************
0042 // GetInstanceID
0043 // ********************************************************************
0044 //
0045 inline
0046 G4int G4LogicalVolume::GetInstanceID() const
0047 {
0048   return instanceID;
0049 }
0050 
0051 // ********************************************************************
0052 // GetMasterFieldManager
0053 // ********************************************************************
0054 //
0055 inline
0056 G4FieldManager* G4LogicalVolume::GetMasterFieldManager() const
0057 {
0058   return fFieldManager;
0059 }
0060 
0061 // ********************************************************************
0062 // GetNoDaughters
0063 // ********************************************************************
0064 //
0065 inline
0066 std::size_t G4LogicalVolume::GetNoDaughters() const
0067 {
0068   return fDaughters.size();
0069 }
0070 
0071 // ********************************************************************
0072 // GetDaughter
0073 // ********************************************************************
0074 //
0075 inline
0076 G4VPhysicalVolume* G4LogicalVolume::GetDaughter(const std::size_t i) const
0077 {
0078   return fDaughters[i];
0079 }
0080 
0081 // ********************************************************************
0082 // GetFastSimulationManager
0083 // ********************************************************************
0084 //
0085 inline
0086 G4FastSimulationManager* G4LogicalVolume::GetFastSimulationManager () const 
0087 {
0088   G4FastSimulationManager* fFSM = nullptr;
0089   if(fRegion != nullptr) { fFSM = fRegion->GetFastSimulationManager(); }
0090   return fFSM;
0091 }
0092 
0093 // ********************************************************************
0094 // IsDaughter
0095 // ********************************************************************
0096 //
0097 inline
0098 G4bool G4LogicalVolume::IsDaughter(const G4VPhysicalVolume* p) const
0099 {
0100   for (const auto & daughter : fDaughters)
0101   {
0102     if (*daughter==*p) { return true; }
0103   }
0104   return false;
0105 }
0106 
0107 // ********************************************************************
0108 // CharacteriseDaughters
0109 // ********************************************************************
0110 //
0111 inline
0112 EVolume G4LogicalVolume::CharacteriseDaughters() const
0113 {
0114   return fDaughtersVolumeType;
0115 }
0116 
0117 // ********************************************************************
0118 // DeduceDaughtersType
0119 // ********************************************************************
0120 //
0121 inline
0122 EVolume G4LogicalVolume::DeduceDaughtersType() const
0123 {
0124   EVolume type= kNormal;
0125   G4VPhysicalVolume* pVol;
0126     
0127   if ( GetNoDaughters() >= 1 )
0128   {
0129     pVol = GetDaughter(0);
0130     type = pVol->VolumeType();
0131   }
0132   return type;
0133 }
0134 
0135 // ********************************************************************
0136 // GetMasterSolid
0137 // ********************************************************************
0138 //
0139 inline
0140 G4VSolid* G4LogicalVolume::GetMasterSolid() const
0141 {
0142   return fSolid;
0143 }
0144 
0145 // ********************************************************************
0146 // GetMasterSensitiveDetector
0147 // ********************************************************************
0148 //
0149 inline
0150 G4VSensitiveDetector* G4LogicalVolume::GetMasterSensitiveDetector() const
0151 {
0152   return fSensitiveDetector;
0153 }
0154 
0155 // ********************************************************************
0156 // GetUserLimits
0157 // ********************************************************************
0158 //
0159 inline
0160 G4UserLimits* G4LogicalVolume::GetUserLimits() const
0161 {
0162   if(fUserLimits != nullptr) { return fUserLimits;
0163 }
0164   if(fRegion != nullptr) { return fRegion->GetUserLimits(); }
0165   return nullptr;
0166 }
0167 
0168 // ********************************************************************
0169 // SetUserLimits
0170 // ********************************************************************
0171 //
0172 inline
0173 void G4LogicalVolume::SetUserLimits(G4UserLimits* pULimits)
0174 {
0175   fUserLimits = pULimits;
0176 }
0177 
0178 // ********************************************************************
0179 // GetVoxelHeader
0180 // ********************************************************************
0181 //
0182 inline
0183 G4SmartVoxelHeader* G4LogicalVolume::GetVoxelHeader() const
0184 {
0185   return fVoxel;
0186 }
0187 
0188 // ********************************************************************
0189 // SetVoxelHeader
0190 // ********************************************************************
0191 //
0192 inline
0193 void G4LogicalVolume::SetVoxelHeader(G4SmartVoxelHeader* pVoxel)
0194 {
0195   fVoxel = pVoxel;
0196 }
0197 
0198 // ********************************************************************
0199 // GetSmartless
0200 // ********************************************************************
0201 //
0202 inline
0203 G4double G4LogicalVolume::GetSmartless() const
0204 {
0205   return fSmartless;
0206 }
0207 
0208 // ********************************************************************
0209 // SetSmartless
0210 // ********************************************************************
0211 //
0212 inline
0213 void G4LogicalVolume::SetSmartless(G4double smt)
0214 {
0215   fSmartless = smt;
0216 }
0217 
0218 // ********************************************************************
0219 // IsToOptimise
0220 // ********************************************************************
0221 //
0222 inline
0223 G4bool G4LogicalVolume::IsToOptimise() const
0224 {
0225   return fOptimise;
0226 }
0227 
0228 // ********************************************************************
0229 // SetOptimisation
0230 // ********************************************************************
0231 //
0232 inline
0233 void G4LogicalVolume::SetOptimisation(G4bool optim)
0234 {
0235   fOptimise = optim;
0236 }
0237 
0238 // ********************************************************************
0239 // IsRootRegion
0240 // ********************************************************************
0241 //
0242 inline
0243 G4bool G4LogicalVolume::IsRootRegion() const
0244 {
0245   return fRootRegion;
0246 }
0247 
0248 // ********************************************************************
0249 // SetRegionRootFlag
0250 // ********************************************************************
0251 //
0252 inline
0253 void G4LogicalVolume::SetRegionRootFlag(G4bool rreg)
0254 {
0255   fRootRegion = rreg;
0256 }
0257 
0258 // ********************************************************************
0259 // IsRegion
0260 // ********************************************************************
0261 //
0262 inline
0263 G4bool G4LogicalVolume::IsRegion() const
0264 {
0265   G4bool reg = false;
0266   if (fRegion != nullptr) { reg = true; }
0267   return reg;
0268 }
0269 
0270 // ********************************************************************
0271 // SetRegion
0272 // ********************************************************************
0273 //
0274 inline
0275 void G4LogicalVolume::SetRegion(G4Region* reg)
0276 {
0277   fRegion = reg;
0278 }
0279 
0280 // ********************************************************************
0281 // GetRegion
0282 // ********************************************************************
0283 //
0284 inline
0285 G4Region* G4LogicalVolume::GetRegion() const
0286 {
0287   return fRegion;
0288 }
0289 
0290 // ********************************************************************
0291 // PropagateRegion
0292 // ********************************************************************
0293 //
0294 inline
0295 void G4LogicalVolume::PropagateRegion()
0296 {
0297   fRegion->ScanVolumeTree(this, true);
0298 }
0299 
0300 // ********************************************************************
0301 // Lock
0302 // ********************************************************************
0303 //
0304 inline
0305 void G4LogicalVolume::Lock()
0306 {
0307   fLock = true;
0308 }
0309 
0310 // ********************************************************************
0311 // Operator ==
0312 // ********************************************************************
0313 //
0314 inline
0315 G4bool G4LogicalVolume::operator == ( const G4LogicalVolume& lv) const
0316 {
0317   return this==&lv;
0318 }
0319 
0320 // ********************************************************************
0321 // SetBiasWeight
0322 // ********************************************************************
0323 //
0324 inline
0325 void G4LogicalVolume::SetBiasWeight(G4double weight)
0326 {
0327   fBiasWeight = weight;
0328 }
0329 
0330 // ********************************************************************
0331 // GetBiasWeight
0332 // ********************************************************************
0333 //
0334 inline
0335 G4double G4LogicalVolume::GetBiasWeight() const
0336 {
0337   return fBiasWeight;
0338 }
0339 
0340 // ********************************************************************
0341 // GetVisAttributes
0342 // ********************************************************************
0343 //
0344 inline
0345 const G4VisAttributes* G4LogicalVolume::GetVisAttributes () const
0346 {
0347   return fVisAttributes.get();
0348 }