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[ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /geometry/management/include/G4LogicalVolume.icc (Version 11.3.0) and /geometry/management/include/G4LogicalVolume.icc (Version 4.0)


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