Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-22 08:51:38

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 // G4NavigationLogger
0027 //
0028 // Class description:
0029 //
0030 // Simple utility class for use by navigation systems
0031 // for verbosity and check-mode.
0032 
0033 // Author: Gabriele Cosmo (CERN), November 2010
0034 // --------------------------------------------------------------------
0035 #ifndef G4NAVIGATIONLOGGER_HH
0036 #define G4NAVIGATIONLOGGER_HH 1
0037 
0038 #include "G4NavigationHistory.hh"
0039 #include "G4VPhysicalVolume.hh"
0040 #include "G4LogicalVolume.hh"
0041 #include "G4VSolid.hh"
0042 #include "G4ThreeVector.hh"
0043 
0044 /**
0045  * @brief G4NavigationLogger is a simple utility class for use by the
0046  * navigation systems for verbosity and check-mode.
0047  */
0048 
0049 class G4NavigationLogger
0050 {
0051   public:
0052 
0053     /**
0054      * Constructor and Destructor.
0055      */
0056     G4NavigationLogger(const G4String& id);
0057    ~G4NavigationLogger();
0058 
0059     /**
0060      * Reports about first check - mother safety.
0061      */
0062     void PreComputeStepLog  (const G4VPhysicalVolume* motherPhysical,
0063                                    G4double motherSafety,
0064                              const G4ThreeVector& localPoint) const;
0065    
0066     /**
0067      * Reports about a candidate daughter.
0068      */ 
0069     void AlongComputeStepLog(const G4VSolid* sampleSolid,
0070                              const G4ThreeVector& samplePoint,
0071                              const G4ThreeVector& sampleDirection,
0072                              const G4ThreeVector& localDirection,
0073                                    G4double sampleSafety,
0074                                    G4double sampleStep) const;
0075    
0076     /**
0077      * Checks suspicious distance to a candidate daughter.
0078      */
0079     void CheckDaughterEntryPoint(const G4VSolid* sampleSolid,
0080                                  const G4ThreeVector& samplePoint,
0081                                  const G4ThreeVector& sampleDirection,
0082                                  const G4VSolid* motherSolid,
0083                                  const G4ThreeVector& localPoint,
0084                                  const G4ThreeVector& localDirection,
0085                                        G4double motherStep,
0086                                        G4double sampleStep) const;
0087    
0088     /**
0089      * Reports exit distance from mother.
0090      */ 
0091     void PostComputeStepLog (const G4VSolid* motherSolid,
0092                              const G4ThreeVector& localPoint,
0093                              const G4ThreeVector& localDirection,
0094                                    G4double motherStep,
0095                                    G4double motherSafety) const;
0096    
0097     /**
0098      * Reports about safety computation.
0099      */
0100     void ComputeSafetyLog   (const G4VSolid* solid,
0101                              const G4ThreeVector& point,
0102                                    G4double safety,
0103                                    G4bool isMotherVolume,    //  For labeling
0104                                    G4int banner= -1) const;
0105    
0106     /**
0107      * Reports about a new minimum distance to candidate daughter.
0108      */
0109     void PrintDaughterLog   (const G4VSolid* sampleSolid,
0110                              const G4ThreeVector& samplePoint,
0111                                    G4double sampleSafety,
0112                                    G4bool   onlySafety,
0113                              const G4ThreeVector& sampleDirection,
0114                                    G4double sampleStep) const;
0115 
0116     /**
0117      * Reports issue with normal from Solid - for ComputeStep().
0118      */
0119     G4bool CheckAndReportBadNormal(const G4ThreeVector& unitNormal,
0120                                    const G4ThreeVector& localPoint,
0121                                    const G4ThreeVector& localDirection,
0122                                          G4double       step,
0123                                    const G4VSolid*      solid,                                 
0124                                    const char* msg) const;
0125 
0126     /**
0127      * Reports issue with normal from Rotation - for ComputeStep().
0128      */
0129     G4bool CheckAndReportBadNormal(const G4ThreeVector& unitNormal,
0130                                    const G4ThreeVector& originalNormal,
0131                                    const G4RotationMatrix& rotationM,
0132                                    const char* msg) const;
0133    
0134     /**
0135      * Reports if point wrongly located outside mother volume.
0136      */
0137     void ReportOutsideMother(const G4ThreeVector& localPoint,
0138                              const G4ThreeVector& localDirection,
0139                              const G4VPhysicalVolume* motherPV,
0140                                    G4double tDist = 30.0*CLHEP::cm) const;
0141 
0142     /**
0143      * Auxiliary method to report information about volume
0144      * and position/direction
0145      */
0146     void ReportVolumeAndIntersection(std::ostream& ostrm,
0147                                      const G4ThreeVector& localPoint,
0148                                      const G4ThreeVector& localDirection,
0149                                      const G4VPhysicalVolume* physical) const;
0150       
0151     /**
0152      * Verbosity control.
0153      */
0154     inline G4int GetVerboseLevel() const  { return fVerbose; }
0155     inline void  SetVerboseLevel(G4int level)  { fVerbose = level; }
0156 
0157     /**
0158      * Accessors/modifiers.
0159      */
0160     inline G4double GetMinTriggerDistance() const {return fMinTriggerDistance;}
0161     inline void     SetMinTriggerDistance(G4double d) {fMinTriggerDistance= d;}
0162     inline G4bool   GetReportSoftWarnings() const {return fReportSoftWarnings;}    
0163     inline void     SetReportSoftWarnings(G4bool b) {fReportSoftWarnings = b;} 
0164 
0165   private:
0166 
0167     G4String fId;                  // Navigation type
0168     G4int    fVerbose = 0;         // Verbosity level
0169     G4double fMinTriggerDistance = DBL_MAX;  // Errors beyond this are fatal
0170     G4bool   fReportSoftWarnings = false; // Flag to warn about small issues
0171 };
0172 
0173 #endif