Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-24 09:09:11

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 // G4EnclosingCylinder
0027 //
0028 // Class description:
0029 //
0030 // A utility class for quickly deciding if a point is clearly outside a
0031 // polyhedra or polycone or deciding if a trajectory is clearly going to
0032 // miss those shapes.
0033 
0034 // Author: David C. Williams (UCSC), 1998 - Created
0035 // --------------------------------------------------------------------
0036 #ifndef G4ENCLOSINGCYLINDER_HH
0037 #define G4ENCLOSINGCYLINDER_HH
0038 
0039 #include "G4Types.hh"
0040 #include "geomdefs.hh"
0041 #include "G4ThreeVector.hh"
0042 
0043 class G4ReduciblePolygon;
0044 
0045 /**
0046  * @brief G4EnclosingCylinder is a utility class defining an envelope for
0047  * quickly deciding if a point is clearly outside a polyhedra or polycone or
0048  * deciding if a trajectory is clearly going to miss those shapes.
0049  */
0050 
0051 class G4EnclosingCylinder
0052 {
0053   public:
0054 
0055     /**
0056      * Constructs the envelope, given its parameters.
0057      *  @param[in] rz Pointer to the polygon structure.
0058      *  @param[in] phiIsOpen Boolean flag to indicate if it is a section in Phi.
0059      *  @param[in] startPhi Starting Phi angle.
0060      *  @param[in] totalPhi Total Phi angle of the section.
0061      */
0062     G4EnclosingCylinder( const G4ReduciblePolygon* rz,
0063                                G4bool phiIsOpen, 
0064                                G4double startPhi, G4double totalPhi );
0065 
0066     /**
0067      * Default Destructor.
0068      */
0069     ~G4EnclosingCylinder() = default;
0070   
0071     /**
0072      * Decides very rapidly if the point 'p' is outside the cylinder.
0073      *  @returns If not certain to be outside, return false.
0074      */
0075     G4bool MustBeOutside( const G4ThreeVector& p ) const;
0076 
0077     /**
0078      * Decides very rapidly if the trajectory is going to miss the cylinder.
0079      *  @returns If not certain to miss, return false.
0080      */
0081     G4bool ShouldMiss( const G4ThreeVector& p, const G4ThreeVector& v ) const;
0082 
0083     /**
0084      * Fake default constructor for usage restricted to direct object
0085      * persistency for clients requiring preallocation of memory for
0086      * persistifiable objects.
0087      */
0088     G4EnclosingCylinder(__void__&);
0089 
0090   private:
0091 
0092     G4double radius;    // radius of our cylinder
0093     G4double zLo, zHi;  // z extent
0094   
0095     G4bool    phiIsOpen; // true if there is a phi segment
0096     G4double  startPhi,  // for isPhiOpen==true, starting of phi segment
0097               totalPhi;  // for isPhiOpen==true, size of phi segment
0098 
0099     G4double rx1=0.0, ry1=0.0,
0100              dx1=0.0, dy1=0.0;
0101     G4double rx2=0.0, ry2=0.0,
0102              dx2=0.0, dy2=0.0;
0103      
0104     G4bool   concave;  // true, if x/y cross section is concave
0105 };
0106 
0107 #endif