Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:57:52

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 // G4AdjointCrossSurfChecker
0027 //
0028 // Class Description:
0029 //
0030 // This class is responsible for checking the crossing of a surface
0031 // that could be the  external boundary of a volume or the external
0032 // surface of a sphere.
0033 // It is used to check if an adjoint particle reaches the external
0034 // surface or reenter the sensitive region delimited by the adjoint
0035 // source.
0036 
0037 // Author: L. Desorgher, SpaceIT GmbH - 15 January 2007
0038 // Contract: ESA contract 21435/08/NL/AT
0039 // Customer: ESA/ESTEC
0040 //---------------------------------------------------------------------
0041 #ifndef G4AdjointCrossSurfChecker_hh
0042 #define G4AdjointCrossSurfChecker_hh 1
0043 
0044 #include "G4ThreeVector.hh"
0045 #include "globals.hh"
0046 
0047 #include <vector>
0048 
0049 class G4Step;
0050 
0051 class G4AdjointCrossSurfChecker
0052 {
0053  public:
0054   static G4AdjointCrossSurfChecker* GetInstance();
0055 
0056   G4bool CrossingASphere(const G4Step* aStep, G4double sphere_radius, G4ThreeVector sphere_center,
0057     G4ThreeVector& cross_pos, G4double& cos_to_surface, G4bool& GoingIn);
0058 
0059   G4bool GoingInOrOutOfaVolume(
0060     const G4Step* aStep, const G4String& volume_name, G4double& cos_to_surface, G4bool& GoingIn);
0061 
0062   G4bool GoingInOrOutOfaVolumeByExtSurface(const G4Step* aStep, const G4String& volume_name,
0063     const G4String& mother_lvol_name, G4double& cos_to_surface, G4bool& GoingIn);
0064 
0065   G4bool CrossingAGivenRegisteredSurface(const G4Step* aStep, const G4String& surface_name,
0066     G4ThreeVector& cross_pos, G4double& cos_to_surface, G4bool& GoingIn);
0067 
0068   G4bool CrossingAGivenRegisteredSurface(const G4Step* aStep, G4int ind, G4ThreeVector& cross_pos,
0069     G4double& cos_to_surface, G4bool& GoingIn);
0070 
0071   G4bool CrossingOneOfTheRegisteredSurface(const G4Step* aStep, G4String& surface_name,
0072     G4ThreeVector& cross_pos, G4double& cos_to_surface, G4bool& GoingIn);
0073 
0074   G4bool CrossingAnInterfaceBetweenTwoVolumes(const G4Step* aStep, const G4String& vol1_name,
0075     const G4String& vol2_name, G4ThreeVector& cross_pos, G4double& cos_to_surface, G4bool& GoingIn);
0076 
0077   G4bool AddaSphericalSurface(
0078     const G4String& SurfaceName, G4double radius, G4ThreeVector pos, G4double& area);
0079   G4bool AddaSphericalSurfaceWithCenterAtTheCenterOfAVolume(const G4String& SurfaceName,
0080     G4double radius, const G4String& volume_name, G4ThreeVector& center, G4double& area);
0081   G4bool AddanExtSurfaceOfAvolume(
0082     const G4String& SurfaceName, const G4String& volume_name, G4double& area);
0083   G4bool AddanInterfaceBetweenTwoVolumes(const G4String& SurfaceName, const G4String& volume_name1,
0084     const G4String& volume_name2, G4double& area);
0085   void ClearListOfSelectedSurface();
0086 
0087  private:
0088   G4AdjointCrossSurfChecker() = default;
0089   ~G4AdjointCrossSurfChecker();
0090 
0091   G4int FindRegisteredSurface(const G4String& name);
0092 
0093  private:
0094   static G4ThreadLocal G4AdjointCrossSurfChecker* instance;
0095 
0096   std::vector<G4String> ListOfSurfaceName;
0097   std::vector<G4String> ListOfSurfaceType;
0098   std::vector<G4double> ListOfSphereRadius;
0099   std::vector<G4ThreeVector> ListOfSphereCenter;
0100   std::vector<G4String> ListOfVol1Name;
0101   std::vector<G4String> ListOfVol2Name;
0102   std::vector<G4double> AreaOfSurface;
0103 };
0104 
0105 #endif