Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-21 09:10:53

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 G4ParameterisedNavigation Inline implementation
0027 //
0028 // Author: Paul Kent (CERN), August 1996
0029 // --------------------------------------------------------------------
0030 
0031 // ********************************************************************
0032 // IdentifyAndPlaceSolid
0033 // ********************************************************************
0034 //
0035 inline G4VSolid* G4ParameterisedNavigation::
0036 IdentifyAndPlaceSolid( G4int num,
0037                        G4VPhysicalVolume* apparentPhys, // PhysV or PhysT
0038                        G4VPVParameterisation* curParam  )
0039 {
0040   G4VSolid *sampleSolid; 
0041 
0042   sampleSolid = curParam->ComputeSolid(num, apparentPhys);
0043   sampleSolid->ComputeDimensions(curParam, num, apparentPhys);
0044   curParam->ComputeTransformation(num, apparentPhys);
0045 
0046   return sampleSolid; 
0047 }
0048 
0049 // ********************************************************************
0050 // ParamVoxelLocate
0051 // ********************************************************************
0052 //
0053 inline G4SmartVoxelNode*
0054 G4ParameterisedNavigation::ParamVoxelLocate( G4SmartVoxelHeader* pHead,
0055                                        const G4ThreeVector& localPoint )
0056 {
0057   // If no parameterisation axis is specified, adopt default
0058   // location strategy as for placements
0059   //  
0060   if ( pHead->GetParamAxis()==kUndefined )
0061   {
0062     fVoxelNode = G4VoxelNavigation::VoxelLocate(pHead,localPoint);
0063   }
0064   else
0065   {
0066     G4double targetHeaderMin, targetHeaderNodeWidth;
0067     G4int targetHeaderNoSlices, targetNodeNo;
0068     EAxis targetHeaderAxis;
0069 
0070     targetHeaderAxis = pHead->GetAxis();
0071     targetHeaderNoSlices = G4int(pHead->GetNoSlices());
0072     targetHeaderMin = pHead->GetMinExtent();
0073     targetHeaderNodeWidth = (pHead->GetMaxExtent()-targetHeaderMin)
0074                           / targetHeaderNoSlices;
0075     targetNodeNo = G4int ( (localPoint(targetHeaderAxis)-targetHeaderMin)
0076                            / targetHeaderNodeWidth );
0077     // Rounding protection
0078     //
0079     if ( targetNodeNo<0 )
0080     {
0081       targetNodeNo = 0;
0082     }
0083     else if ( targetNodeNo>=targetHeaderNoSlices )
0084     {
0085       targetNodeNo = targetHeaderNoSlices-1;
0086     }
0087     fVoxelAxis = targetHeaderAxis;
0088     fVoxelNoSlices = targetHeaderNoSlices;
0089     fVoxelSliceWidth = targetHeaderNodeWidth;
0090     fVoxelNodeNo = targetNodeNo;
0091     fVoxelHeader = pHead;    
0092     fVoxelNode = pHead->GetSlice(targetNodeNo)->GetNode();
0093   }
0094   return fVoxelNode;
0095 }
0096