Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-13 09:10:26

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 // -------------------------------------------------------------------
0027 //
0028 // GEANT4 Class header file
0029 //
0030 // File name:     G4OpticalParameters
0031 //
0032 // Author:        Daren Sawkey based on G4EmParameters
0033 //
0034 // Creation date: 14.07.2020
0035 //
0036 // Modifications:
0037 //
0038 //
0039 // Class Description:
0040 //
0041 // A utility static class, responsable for keeping parameters
0042 // for all optical physics processes and models.
0043 //
0044 // It is initialized by the master thread but can be updated
0045 // at any moment. Parameters may be used in run time or at
0046 // initialisation
0047 //
0048 // -------------------------------------------------------------------
0049 //
0050 
0051 #ifndef G4OpticalParameters_h
0052 #define G4OpticalParameters_h 1
0053 
0054 #include "globals.hh"
0055 #include "G4ios.hh"
0056 #include "G4ThreeVector.hh"
0057 #include "G4Threading.hh"
0058 #include <vector>
0059 #include <memory>
0060 
0061 class G4OpticalParametersMessenger;
0062 class G4StateManager;
0063 
0064 enum G4OpticalProcessIndex
0065 {
0066   kCerenkov,       ///< Cerenkov process index
0067   kScintillation,  ///< Scintillation process index
0068   kAbsorption,     ///< Absorption process index
0069   kRayleigh,       ///< Rayleigh scattering process index
0070   kMieHG,          ///< Mie scattering process index
0071   kBoundary,       ///< Boundary process index
0072   kWLS,            ///< Wave Length Shifting process index
0073   kWLS2,           ///< Second Wave Length Shifting process index
0074   kNoProcess       ///< Number of processes, no selected process
0075 };
0076 
0077 enum G4XRayModelType
0078 {
0079   kCerenkovDefault = 0,  // default model
0080   kScintillationDefault, // default model
0081 };
0082 
0083 /// Return the name for a given optical process index
0084 G4String G4OpticalProcessName(G4int);
0085 
0086 inline G4String G4OpticalProcessName(G4int processNumber)
0087 {
0088   switch(processNumber)
0089   {
0090     case kCerenkov:
0091       return "Cerenkov";
0092     case kScintillation:
0093       return "Scintillation";
0094     case kAbsorption:
0095       return "OpAbsorption";
0096     case kRayleigh:
0097       return "OpRayleigh";
0098     case kMieHG:
0099       return "OpMieHG";
0100     case kBoundary:
0101       return "OpBoundary";
0102     case kWLS:
0103       return "OpWLS";
0104     case kWLS2:
0105       return "OpWLS2";
0106     default:
0107       return "NoProcess";
0108   }
0109 }
0110 
0111 class G4OpticalParameters
0112 {
0113  public:
0114   static G4OpticalParameters* Instance();
0115 
0116   ~G4OpticalParameters();
0117 
0118   void SetDefaults();
0119 
0120   // printing
0121   void StreamInfo(std::ostream& os) const;
0122   void Dump() const;
0123   friend std::ostream& operator<<(std::ostream& os, const G4OpticalParameters&);
0124 
0125   void  SetVerboseLevel(G4int);
0126   G4int GetVerboseLevel() const;
0127 
0128   void   SetProcessActivation(const G4String&, G4bool);
0129   G4bool GetProcessActivation(const G4String&) const;
0130 
0131   // Cerenkov
0132   void  SetCerenkovMaxPhotonsPerStep(G4int);
0133   G4int GetCerenkovMaxPhotonsPerStep() const;
0134   void  SetCerenkovVerboseLevel(G4int);
0135   G4int GetCerenkovVerboseLevel() const;
0136   void     SetCerenkovMaxBetaChange(G4double);
0137   G4double GetCerenkovMaxBetaChange() const;
0138   void   SetCerenkovTrackSecondariesFirst(G4bool);
0139   G4bool GetCerenkovTrackSecondariesFirst() const;
0140   void   SetCerenkovStackPhotons(G4bool);
0141   G4bool GetCerenkovStackPhotons() const;
0142   void   SetCerenkovOffloadPhotons(G4bool);
0143   G4bool GetCerenkovOffloadPhotons() const;
0144   void   EnableCerenkovGeneral(G4bool);
0145   G4bool CerenkovGeneral() const;
0146   
0147   // Scintillation
0148   void   SetScintByParticleType(G4bool);
0149   G4bool GetScintByParticleType() const;
0150   void   SetScintTrackInfo(G4bool);
0151   G4bool GetScintTrackInfo() const;
0152   void   SetScintTrackSecondariesFirst(G4bool);
0153   G4bool GetScintTrackSecondariesFirst() const;
0154   void   SetScintFiniteRiseTime(G4bool);
0155   G4bool GetScintFiniteRiseTime() const;
0156   void   SetScintStackPhotons(G4bool);
0157   G4bool GetScintStackPhotons() const;
0158   void   SetScintVerboseLevel(G4int);
0159   G4int  GetScintVerboseLevel() const;
0160   void   SetScintOffloadPhotons(G4bool);
0161   G4bool GetScintOffloadPhotons() const;
0162 
0163   // WLS
0164   void     SetWLSTimeProfile(const G4String&);
0165   G4String GetWLSTimeProfile() const;
0166   void  SetWLSVerboseLevel(G4int);
0167   G4int GetWLSVerboseLevel() const;
0168 
0169   // WLS2
0170   void     SetWLS2TimeProfile(const G4String&);
0171   G4String GetWLS2TimeProfile() const;
0172   void  SetWLS2VerboseLevel(G4int);
0173   G4int GetWLS2VerboseLevel() const;
0174 
0175   // boundary
0176   void  SetBoundaryVerboseLevel(G4int);
0177   G4int GetBoundaryVerboseLevel() const;
0178   void   SetBoundaryInvokeSD(G4bool);
0179   G4bool GetBoundaryInvokeSD() const;
0180 
0181   // absorption
0182   void  SetAbsorptionVerboseLevel(G4int);
0183   G4int GetAbsorptionVerboseLevel() const;
0184 
0185   // rayleigh
0186   void  SetRayleighVerboseLevel(G4int);
0187   G4int GetRayleighVerboseLevel() const;
0188 
0189   // mie
0190   void  SetMieVerboseLevel(G4int);
0191   G4int GetMieVerboseLevel() const;
0192 
0193   // active volumes
0194   const std::vector<std::pair<G4XRayModelType, const G4String> >&
0195   ActiveVolumes() const;
0196   void SetActiveVolume(const G4String& name, G4XRayModelType type);
0197 
0198  private:
0199   G4OpticalParameters();
0200   void Initialise();
0201   G4bool IsLocked() const;
0202   void PrintWarning(G4ExceptionDescription& ed) const;
0203 
0204   static G4OpticalParameters* theInstance;
0205 
0206   G4OpticalParametersMessenger* theMessenger;
0207   G4StateManager* fStateManager;
0208 
0209   G4int verboseLevel;
0210 
0211   // Whether to activate each process
0212   std::map<G4String, G4bool> processActivation;
0213 
0214   // cerenkov/////////////////
0215   G4bool cerenkovStackPhotons;
0216   G4bool cerenkovTrackSecondariesFirst;
0217   G4bool cerenkovOffloadPhotons;
0218   G4bool cerenkovGeneral;
0219   G4int cerenkovVerboseLevel;
0220   G4int cerenkovMaxPhotons;
0221   G4double cerenkovMaxBetaChange;
0222 
0223   // scintillation /////////////////
0224 
0225   /// option to set a finite rise-time; Note: the G4Scintillation
0226   /// process expects the user to have set the constant material
0227   /// property SCINTILLATIONRISETIME{1,2,3}
0228   G4bool scintFiniteRiseTime;
0229 
0230   /// option to  allow for the light yield to be a function of
0231   /// particle type and deposited energy in case of non-linear
0232   /// light emission in scintillators
0233   G4bool scintByParticleType;
0234 
0235   /// option to allow for G4ScintillationTrackInformation
0236   /// to be attached to a scintillation photon's track
0237   G4bool scintTrackInfo;
0238 
0239   /// option to allow stacking of secondary scintillation photons
0240   G4bool scintStackPhotons;
0241 
0242   /// option to enable offloading of secondary scintillation photons
0243   G4bool scintOffloadPhotons;
0244 
0245   G4int scintVerboseLevel;
0246   G4bool scintTrackSecondariesFirst;
0247 
0248   ///////////////// WLS
0249   G4String wlsTimeProfileName;
0250   G4int wlsVerboseLevel;
0251 
0252   ///////////////// WLS2
0253   G4String wls2TimeProfileName;
0254   G4int wls2VerboseLevel;
0255 
0256   //////////////// absorption
0257   G4int absorptionVerboseLevel;
0258 
0259   //////////////// rayleigh
0260   G4int rayleighVerboseLevel;
0261 
0262   //////////////// mie
0263   G4int mieVerboseLevel;
0264 
0265   //////////////// boundary
0266   /// G4OpBoundaryProcess to call InvokeSD method
0267   G4bool boundaryInvokeSD;
0268   G4int boundaryVerboseLevel;
0269 
0270   //////////////// active volumes
0271   std::vector<std::pair<G4XRayModelType, const G4String> > xrayVolumes;
0272 
0273 #ifdef G4MULTITHREADED
0274   static G4Mutex opticalParametersMutex;
0275 #endif
0276 };
0277 
0278 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0279 
0280 #endif