Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Geant4/G4MultiUnion.icc was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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 G4MultiUnion inline implementation.
0027 
0028 // Author: Marek Gayer (CERN), 19.10.2012 - Original implementation from USolids
0029 //         Gabriele Cosmo (CERN) 06.04.2017 - Adapted implementation in Geant4
0030 //                                            for VecGeom migration
0031 // --------------------------------------------------------------------
0032 
0033 inline G4Voxelizer& G4MultiUnion::GetVoxels() const
0034 {
0035   return (G4Voxelizer&)fVoxels;
0036 }
0037 
0038 inline const G4Transform3D& G4MultiUnion::GetTransformation(G4int index) const
0039 {
0040   return fTransformObjs[index];
0041 }
0042 
0043 inline G4VSolid* G4MultiUnion::GetSolid(G4int index) const
0044 {
0045   return fSolids[index];
0046 }
0047 
0048 inline G4int G4MultiUnion::GetNumberOfSolids() const
0049 {
0050   return G4int(fSolids.size());
0051 }
0052 
0053 inline void G4MultiUnion::SetAccurateSafety(G4bool flag)
0054 {
0055   fAccurate = flag;
0056 }
0057 
0058 inline
0059 G4ThreeVector G4MultiUnion::GetLocalPoint(const G4Transform3D& trans,
0060                                           const G4ThreeVector& global) const
0061 {
0062   // Returns local point coordinates converted from the global frame defined
0063   // by the transformation. This is defined by multiplying the inverse
0064   // transformation with the global vector.
0065 
0066   G4double px = global.x() - trans.dx();
0067   G4double py = global.y() - trans.dy();
0068   G4double pz = global.z() - trans.dz();
0069   G4double x = trans.xx()*px + trans.yx()*py + trans.zx()*pz;
0070   G4double y = trans.xy()*px + trans.yy()*py + trans.zy()*pz;
0071   G4double z = trans.xz()*px + trans.yz()*py + trans.zz()*pz;
0072   return { x, y, z };
0073 }
0074 
0075 inline
0076 G4ThreeVector G4MultiUnion::GetLocalVector(const G4Transform3D& trans,
0077                                            const G4ThreeVector& global) const
0078 {
0079   // Returns local point coordinates converted from the global frame defined
0080   // by the transformation. This is defined by multiplying the inverse
0081   // transformation with the global vector.
0082 
0083   G4double vx = global.x();
0084   G4double vy = global.y();
0085   G4double vz = global.z();
0086   G4double x = trans.xx()*vx + trans.yx()*vy + trans.zx()*vz;
0087   G4double y = trans.xy()*vx + trans.yy()*vy + trans.zy()*vz;
0088   G4double z = trans.xz()*vx + trans.yz()*vy + trans.zz()*vz;
0089   return { x, y, z };
0090 }
0091 
0092 inline
0093 G4ThreeVector G4MultiUnion::GetGlobalPoint(const G4Transform3D& trans,
0094                                            const G4ThreeVector& local) const
0095 {
0096   // Returns global point coordinates converted from the local frame defined
0097   // by the transformation. This is defined by multiplying this transformation
0098   // with the local vector.
0099 
0100   G4double px = local.x();
0101   G4double py = local.y();
0102   G4double pz = local.z();
0103   G4double x = trans.xx()*px + trans.xy()*py + trans.xz()*pz + trans.dx();
0104   G4double y = trans.yx()*px + trans.yy()*py + trans.yz()*pz + trans.dy();
0105   G4double z = trans.zx()*px + trans.zy()*py + trans.zz()*pz + trans.dz();
0106   return { x, y, z };
0107 }
0108 
0109 inline
0110 G4ThreeVector G4MultiUnion::GetGlobalVector(const G4Transform3D& trans,
0111                                             const G4ThreeVector& local) const
0112 {
0113   // Returns vector components converted from the local frame defined by the
0114   // transformation to the global one. This is defined by multiplying this
0115   // transformation with the local vector while ignoring the translation.
0116 
0117   G4double vx = local.x();
0118   G4double vy = local.y();
0119   G4double vz = local.z();
0120   G4double x = trans.xx()*vx + trans.xy()*vy + trans.xz()*vz;
0121   G4double y = trans.yx()*vx + trans.yy()*vy + trans.yz()*vz;
0122   G4double z = trans.zx()*vx + trans.zy()*vy + trans.zz()*vz;
0123   return { x, y, z };
0124 }