G4ParameterisedNavigation.icc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 // 
00030 // class G4ParameterisedNavigation Inline implementation
00031 //
00032 // --------------------------------------------------------------------
00033 
00034 // ********************************************************************
00035 // IdentifyAndPlaceSolid
00036 // ********************************************************************
00037 //
00038 inline
00039 G4VSolid* G4ParameterisedNavigation::
00040 IdentifyAndPlaceSolid( G4int num,
00041                        G4VPhysicalVolume *apparentPhys, // PhysV or PhysT
00042                        G4VPVParameterisation *curParam  )
00043 {
00044   G4VSolid *sampleSolid; 
00045 
00046   sampleSolid = curParam->ComputeSolid(num, apparentPhys);
00047   sampleSolid->ComputeDimensions(curParam, num, apparentPhys);
00048   curParam->ComputeTransformation(num, apparentPhys);
00049 
00050   return sampleSolid; 
00051 }
00052 
00053 // ********************************************************************
00054 // ParamVoxelLocate
00055 // ********************************************************************
00056 //
00057 inline
00058 G4SmartVoxelNode*
00059 G4ParameterisedNavigation::ParamVoxelLocate( G4SmartVoxelHeader* pHead,
00060                                        const G4ThreeVector& localPoint )
00061 {
00062   // If no parameterisation axis is specified, adopt default
00063   // location strategy as for placements
00064   //  
00065   if ( pHead->GetParamAxis()==kUndefined )
00066   {
00067     fVoxelNode = G4VoxelNavigation::VoxelLocate(pHead,localPoint);
00068   }
00069   else
00070   {
00071     G4double targetHeaderMin, targetHeaderNodeWidth;
00072     G4int targetHeaderNoSlices, targetNodeNo;
00073     EAxis targetHeaderAxis;
00074 
00075     targetHeaderAxis = pHead->GetAxis();
00076     targetHeaderNoSlices = pHead->GetNoSlices();
00077     targetHeaderMin = pHead->GetMinExtent();
00078     targetHeaderNodeWidth = (pHead->GetMaxExtent()-targetHeaderMin)
00079                           / targetHeaderNoSlices;
00080     targetNodeNo = G4int ( (localPoint(targetHeaderAxis)-targetHeaderMin)
00081                            / targetHeaderNodeWidth );
00082     // Rounding protection
00083     //
00084     if ( targetNodeNo<0 )
00085     {
00086       targetNodeNo = 0;
00087     }
00088     else if ( targetNodeNo>=targetHeaderNoSlices )
00089          {
00090            targetNodeNo = targetHeaderNoSlices-1;
00091          }
00092     fVoxelAxis = targetHeaderAxis;
00093     fVoxelNoSlices = targetHeaderNoSlices;
00094     fVoxelSliceWidth = targetHeaderNodeWidth;
00095     fVoxelNodeNo = targetNodeNo;
00096     fVoxelHeader = pHead;    
00097     fVoxelNode = pHead->GetSlice(targetNodeNo)->GetNode();
00098   }
00099   return fVoxelNode;
00100 }
00101 

Generated on Mon May 27 17:49:15 2013 for Geant4 by  doxygen 1.4.7