Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:50

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