Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-14 08:36:07

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 // Implementation of inline methods of G4TwistBoxSide
0027 // --------------------------------------------------------------------
0028 
0029 inline
0030 G4double G4TwistBoxSide::GetValueA(G4double phi)
0031 {
0032   return ( fDx4plus2 + fDx4minus2 * ( 2 * phi ) / fPhiTwist  ) ;
0033 }
0034 
0035 
0036 inline 
0037 G4double G4TwistBoxSide::GetValueB(G4double phi) 
0038 {
0039   return ( fDy2plus1 + fDy2minus1 * ( 2 * phi ) / fPhiTwist ) ;
0040 }
0041 
0042 inline
0043 G4double G4TwistBoxSide::Xcoef(G4double u, G4double phi)
0044 {
0045   
0046   return GetValueA(phi)/2. + u*fTAlph    ;
0047 
0048 }
0049 
0050 inline G4ThreeVector
0051 G4TwistBoxSide::SurfacePoint( G4double phi, G4double u, G4bool isGlobal ) 
0052 {
0053   // function to calculate a point on the surface, given by parameters phi,u
0054 
0055   G4ThreeVector SurfPoint ( Xcoef(u,phi) * std::cos(phi)
0056                           - u * std::sin(phi) + fdeltaX*phi/fPhiTwist,
0057                             Xcoef(u,phi) * std::sin(phi)
0058                           + u * std::cos(phi) + fdeltaY*phi/fPhiTwist,
0059                             2*fDz*phi/fPhiTwist  );
0060 
0061   if (isGlobal) { return (fRot * SurfPoint + fTrans); }
0062   return SurfPoint;
0063 }
0064 
0065 inline
0066 G4double G4TwistBoxSide::GetBoundaryMin(G4double phi)
0067 {
0068   return -0.5*GetValueB(phi) ;
0069 }
0070 
0071 inline
0072 G4double G4TwistBoxSide::GetBoundaryMax(G4double phi)
0073 {
0074   return 0.5*GetValueB(phi) ;
0075 }
0076 
0077 inline
0078 G4double G4TwistBoxSide::GetSurfaceArea()
0079 {
0080   return (fDz*(std::sqrt(16*fDy1*fDy1
0081          + (fa1md1 + 4*fDy1*fTAlph)*(fa1md1 + 4*fDy1*fTAlph))
0082          + std::sqrt(16*fDy1*fDy1 + (fa2md2 + 4*fDy1*fTAlph)
0083          * (fa2md2 + 4*fDy1*fTAlph))))/2. ;
0084 }
0085 
0086 inline
0087 G4ThreeVector G4TwistBoxSide::NormAng( G4double phi, G4double u ) 
0088 {
0089   // function to calculate the norm at a given point on the surface
0090   // replace a1-d1
0091 
0092   G4ThreeVector nvec( 4*fDz*(std::cos(phi) + fTAlph*std::sin(phi)) ,
0093                       4*fDz*(-(fTAlph*std::cos(phi)) + std::sin(phi)),
0094                       (fDx2 + fDx4)*fPhiTwist*fTAlph
0095                                    + 2*fDx4minus2*(-1 + fTAlph*phi)
0096                                    + 2*fPhiTwist*(1 + fTAlph*fTAlph)*u
0097                                 - 2*(fdeltaX - fdeltaY*fTAlph)*std::cos(phi)
0098                                 - 2*(fdeltaY + fdeltaX*fTAlph)*std::sin(phi) );
0099   return nvec.unit();
0100 }