|
||||
File indexing completed on 2025-01-18 09:59:13
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 Description: 0027 // 0028 // A utility static class, responsable for keeping common parameters 0029 // for all transportation processes. These parameters can be relevant only 0030 // to some types of particles, e.g. only stable charged particles. 0031 // 0032 // Constraints (creation/update): 0033 // - It must initialized only by the master thread. 0034 // - It should be updated before the transportation processes have been instantiated. 0035 // Note: It can be updated only if the state of the simulation is PreInit, Init or Idle. 0036 // 0037 // Only those instances of G4Transportation (and derived classes) that are created 0038 // *after* G4TransportationParameters will be aware of it and will copy 0039 // the values of its parameters. 0040 // (So in a multithreaded application, runs that start after this is created will obtain them.) 0041 // 0042 // Use: Parameters may be used in run time or at initialisation 0043 // 0044 // Meaning of parameters: 0045 // - Warning energy: below this, looping tracks can be killed without any message 0046 // - Important energy: between warning E and this, looping tracks will complain and die 0047 // - Number of Trials: above 'important energy' looping tracks get this number of chances. 0048 0049 // Author: J. Apostolakis Nov 2022 0050 // Inspired by G4EmParameters by V. Ivanchenko 0051 // ------------------------------------------------------------------- 0052 // 0053 0054 #ifndef G4TransportationParameters_hh 0055 #define G4TransportationParameters_hh 0056 0057 #include "globals.hh" 0058 0059 class G4TransportationParameters 0060 { 0061 public: 0062 static G4TransportationParameters* Instance(); 0063 0064 ~G4TransportationParameters() = default; 0065 0066 G4bool SetNumberOfTrials( G4int val ); 0067 0068 // All three methods below enforce the relation WarningE <= ImportantE 0069 G4bool SetWarningEnergy( G4double val ); 0070 G4bool SetImportantEnergy( G4double val ); 0071 // If the relation fails, the methods above warn and use the new value for both. 0072 G4bool SetWarningAndImportantEnergies( G4double warnE, G4double imprtE ); 0073 // If the relation does *not* hold, it warns and 0074 // uses the smaller as the 'warning Energy' 0075 // and the larger as the 'important energy' 0076 0077 G4int GetNumberOfTrials() const { return fNumberOfTrials; } 0078 G4double GetWarningEnergy() const { return fWarningEnergy; } 0079 G4double GetImportantEnergy() const { return fImportantEnergy; } 0080 G4bool IsMagneticMomentEnabled() const { return fUseMagneticMoment; } 0081 0082 G4bool EnableUseOfMagneticMoment(G4bool useMoment=true); 0083 // Whether to deflect particles with force due to magnetic moment 0084 0085 G4bool SetHighLooperThresholds(); // Shortcut method - old values (meant for HEP) 0086 G4bool SetIntermediateLooperThresholds(); // Intermediate values - also used as default 0087 G4bool SetLowLooperThresholds(); // Set low thresholds - for low-E applications 0088 G4bool SetSilenceAllLooperWarnings(G4bool val=true); 0089 // return value = success or failure of setting the parameter 0090 0091 G4bool GetSilenceAllLooperWarnings(){ return fSilenceLooperWarnings; } 0092 0093 void ReportLockError(G4String methodName, G4bool verbose= false) const; 0094 // Report error - in case the state of G4 is incorrect, and update methods fail 0095 0096 // Probe whether the 'default' instance exists, without creating it 0097 static G4bool Exists() { return theInstance != nullptr; } 0098 0099 // printing 0100 void StreamInfo(std::ostream& os) const; 0101 void Dump() const; 0102 friend std::ostream& operator<< (std::ostream& os, const G4TransportationParameters&); 0103 0104 private: 0105 G4TransportationParameters(); 0106 // Currently private - but potentially will open it up, to allow per-particle specialisation 0107 0108 // void Initialise(); 0109 0110 G4bool IsLocked() const; 0111 0112 void PrintWarning(G4ExceptionDescription& ed) const; 0113 0114 private: 0115 static G4TransportationParameters* theInstance; 0116 0117 // STATE 0118 // Values for initialising 'loopers' parameters of Transport process 0119 G4double fWarningEnergy = -1.0; // Warn above this energy 0120 G4double fImportantEnergy = -1.0; // Give a few trials above this E 0121 G4int fNumberOfTrials = 10; // Number of trials an important looper survives 0122 0123 // Flags for use of gravity field(s) or fields which interact with the magnetic moment 0124 G4bool fUseMagneticMoment = false; 0125 G4bool fUseGravity = false; 0126 0127 // Flag to *Supress* all 'looper' warnings 0128 G4bool fSilenceLooperWarnings= false; 0129 }; 0130 0131 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |