Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:43

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