Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-11-05 09:08:22

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 //
0029 // ClassName:      G4HadronicParameters
0030 //
0031 // Author:         2018 Alberto Ribon
0032 //
0033 // Description:    Singleton to keep global hadronic parameters.
0034 //
0035 // Modified:
0036 //
0037 //----------------------------------------------------------------------------
0038 //
0039 #ifndef G4HadronicParameters_h
0040 #define G4HadronicParameters_h 1
0041 
0042 #include "globals.hh"
0043 
0044 class G4HadronicParametersMessenger;
0045 
0046 
0047 class G4HadronicParameters {
0048   public:
0049 
0050     static G4HadronicParameters* Instance();
0051     ~G4HadronicParameters();
0052 
0053     // printing
0054     void StreamInfo(std::ostream& os) const;
0055     void Dump() const;
0056 
0057     inline G4double GetMaxEnergy() const;
0058     void SetMaxEnergy( const G4double val );
0059     // Getter/Setter for the upper limit for Geant4 hadronic physics, for any application.
0060     // Any hadronic model, physics list builder and constructor should use this method
0061     // instead of putting an arbitrary value in the code.
0062     // Any application which tries to use hadronic physics for an energy higher than this limit
0063     // will get a run-time crash, because no model is found.
0064 
0065     inline G4double GetMinEnergyTransitionFTF_Cascade() const;
0066     inline G4double GetMaxEnergyTransitionFTF_Cascade() const;
0067     void SetMinEnergyTransitionFTF_Cascade( const G4double val );
0068     void SetMaxEnergyTransitionFTF_Cascade( const G4double val );
0069     // Getter/Setter of the recommended energy limits, for physics lists, of the
0070     // transition region between the Fritiof (FTF) string model and the
0071     // intranuclear cascade model, either Bertini (BERT) or Binary (BIC). 
0072 
0073     inline G4double GetMinEnergyTransitionQGS_FTF() const;
0074     inline G4double GetMaxEnergyTransitionQGS_FTF() const;
0075     void SetMinEnergyTransitionQGS_FTF( const G4double val );
0076     void SetMaxEnergyTransitionQGS_FTF( const G4double val );
0077     // Getter/Setter of the recommended energy limits, for physics lists, of the
0078     // transition region between the two strings models - the Quark Gluon String (QGS)
0079     // model and the Fritiof (FTF) model.
0080 
0081     inline G4double GetMinEnergyINCLXX_Pbar() const;
0082     inline G4double GetMaxEnergyINCLXX_Pbar() const;
0083     void SetMinEnergyINCLXX_Pbar( const G4double val );
0084     void SetMaxEnergyINCLXX_Pbar( const G4double val );
0085     // Getter/Setter of the recommended energy limits, for physics lists, of the
0086     // intranuclear cascade model INCLXX, for pbar interaction. 
0087 
0088     inline G4double EnergyThresholdForHeavyHadrons() const;
0089     void SetEnergyThresholdForHeavyHadrons( G4double val );
0090     // If max kinetic energy is below this limit, then EM and hadronic physics are not 
0091     // instantiated for hyperons, anti-hyperons, anti light ions, b-, c- particles.
0092 
0093     inline G4double XSFactorNucleonInelastic() const;
0094     void SetXSFactorNucleonInelastic( G4double val );
0095     inline G4double XSFactorNucleonElastic() const;
0096     void SetXSFactorNucleonElastic( G4double val );
0097     // Cross section factor for protons and neutrons.
0098 
0099     inline G4double XSFactorPionInelastic() const;
0100     void SetXSFactorPionInelastic( G4double val );
0101     inline G4double XSFactorPionElastic() const;
0102     void SetXSFactorPionElastic( G4double val );
0103     // Cross section factor for pions.
0104 
0105     inline G4double XSFactorHadronInelastic() const;
0106     void SetXSFactorHadronInelastic( G4double val );
0107     inline G4double XSFactorHadronElastic() const;
0108     void SetXSFactorHadronElastic( G4double val );
0109     // Cross section factor for other hadrons and ions.
0110 
0111     inline G4double XSFactorEM() const;
0112     void SetXSFactorEM( G4double val );
0113     // Cross section factor for gamma and leptons.
0114 
0115     inline G4bool EnableBCParticles() const;
0116     void SetEnableBCParticles( G4bool val );
0117     // Baryons and mesons with c- and b- quarks may be enabled/disabled.
0118     // This flag is used both by EM and hadronic physics constructors.
0119 
0120     inline G4bool EnableHyperNuclei() const;
0121     void SetEnableHyperNuclei( G4bool val );
0122     // Light hyper-nuclei may be enabled/disabled.
0123     // This flag is used both by EM and hadronic physics constructors.
0124 
0125     inline G4bool ApplyFactorXS() const;
0126     void SetApplyFactorXS( G4bool val );
0127     // Flag enabling cross section factor definition.
0128 
0129     inline G4int GetVerboseLevel() const;
0130     void SetVerboseLevel( const G4int val );
0131     // Getter/Setter of the general verbosity level for hadronics.
0132   
0133     inline G4bool EnableCRCoalescence() const;
0134     void SetEnableCRCoalescence( G4bool val );
0135     // Boolean switch that allows to apply the Cosmic Ray (CR) coalescence algorithm
0136     // to the secondaries produced by a string model. By default it is disabled.
0137 
0138     inline G4bool EnableIntegralInelasticXS() const;
0139     inline G4bool EnableIntegralElasticXS() const;
0140     void SetEnableIntegralInelasticXS( G4bool val );
0141     void SetEnableIntegralElasticXS( G4bool val );
0142     // Enable/disable integral method for main types of hadrons.
0143   
0144     inline G4bool EnableDiffDissociationForBGreater10() const;
0145     // For nucleon-hadron interactions, it's not decided what to do with diffraction
0146     // dissociation. For the moment, they are turned off. This option allows it to
0147     // be turned back on. Applies to Baryon Number > 10 or # target nucleons > 10.
0148     void SetEnableDiffDissociationForBGreater10(G4bool val);
0149 
0150     inline G4bool EnableCoherentChargeExchange() const;
0151     void SetEnableCoherentChargeExchange( G4bool val );
0152     // Coherent Charge exchange process may be enabled/disabled.
0153 
0154     inline G4bool EnableNeutronGeneralProcess() const;
0155     void SetEnableNeutronGeneralProcess( G4bool val );
0156     // Neutron general process may be enabled/disabled.
0157 
0158     inline G4bool EnableNUDEX() const;
0159     void SetEnableNUDEX( G4bool val );
0160     // NUDEX gamma de-excitation is enabled/disabled.
0161 
0162     inline const G4String& GetTypeTablePT() const;
0163     void SetTypeTablePT( const G4String& typeTablePT );
0164     // Specify the type of PT table - between  "calendf"  and  "njoy"  for
0165     // the URR (Unresolved Resonance Region) treatment of low-energy neutrons.
0166     // ( Note that there is no default: an empty string "" is returned if
0167     //   it is not set explicitly. )
0168 
0169     inline G4double GetEPRelativeLevel() const;
0170     inline G4double GetEPAbsoluteLevel() const;
0171     inline G4int GetEPReportLevel() const;
0172     inline G4bool GetBinaryDebug() const;
0173     inline const G4String& GetDirPARTICLEXS() const;
0174     inline const G4String& GetPhysListDocDir() const;
0175     inline const G4String& GetPhysListName() const;
0176     // Access to environment variables.
0177 
0178     inline G4double GetNeutronKineticEnergyThresholdForSVT() const;
0179     void SetNeutronKineticEnergyThresholdForSVT( const G4double val );
0180     // Getter/Setter for the neutron kinetic energy threshold for 
0181     // applying the SVT (Sampling of the Velocity of the Target) algorithm.
0182 
0183     inline G4double GetTimeThresholdForRadioactiveDecay() const;
0184     void SetTimeThresholdForRadioactiveDecay( const G4double val );
0185     // Getter/Setter for the time threshold of radioactive decays
0186     // (i.e. radioactive decays that happen later than this value are ignored).
0187 
0188     inline G4bool IsBertiniAs11_2() const;
0189     void SetBertiniAs11_2( G4bool val );
0190     inline G4bool IsBertiniAngularEmissionsAs11_2() const;
0191     void SetBertiniAngularEmissionsAs11_2( G4bool val );
0192     inline G4bool IsBertiniNucleiModelAs11_2() const;
0193     void SetBertiniNucleiModelAs11_2( G4bool val );
0194     // Getter/Setter for the Bertini model behavior with respect to the
0195     // Geant4 version 11.2.
0196     // The first two methods "*BertiniAs11_2" refer to the overall behavior
0197     // of the Bertini model - the one which should matter the most for the
0198     // majority of applications.
0199     // The methods "*BertiniAngularEmissionsAs11_2" refer to the angular
0200     // distributions of the >= 4-body final state emissions.
0201     // The last two methods "*BertiniNucleiModelAs11_2" refer to the
0202     // modelling of nuclei.
0203     // The overall behavior of Bertini with respect to the version Geant4
0204     // version 11.2 depends on both the angular distributios of the
0205     // >= 4-body final state emissions, and the modelling of nuclei.
0206     // "True" in these methods means that the corresponding behavior of
0207     // the Geant4 version 11.2 is retrieved;
0208     // "False" means that the corresponding behavior of the Geant4 version
0209     // 11.3 is retrieved.
0210   
0211   private:
0212 
0213     G4HadronicParameters();
0214 
0215     G4bool IsLocked() const;
0216 
0217     static G4HadronicParameters* sInstance;
0218 
0219     G4HadronicParametersMessenger* fMessenger;
0220 
0221     G4double fMaxEnergy;
0222     G4double fMinEnergyTransitionFTF_Cascade;
0223     G4double fMaxEnergyTransitionFTF_Cascade;
0224     G4double fMinEnergyTransitionQGS_FTF;
0225     G4double fMaxEnergyTransitionQGS_FTF;
0226     G4double fMinEnergyINCLXX_Pbar;
0227     G4double fMaxEnergyINCLXX_Pbar;
0228     G4double fEnergyThresholdForHeavyHadrons;
0229     G4double fXSFactorNucleonInelastic = 1.0;
0230     G4double fXSFactorPionInelastic = 1.0;
0231     G4double fXSFactorHadronInelastic = 1.0;
0232     G4double fXSFactorNucleonElastic = 1.0;
0233     G4double fXSFactorPionElastic = 1.0;
0234     G4double fXSFactorHadronElastic = 1.0;
0235     G4double fXSFactorEM = 1.0;
0236     G4double fXSFactorLimit = 0.2;
0237     G4double fRelativeDiff = DBL_MAX;
0238     G4double fAbsoluteDiff = DBL_MAX;
0239     G4double fNeutronEkinThresholdForSVT = -1.0;
0240     G4double fTimeThresholdForRadioactiveDecays = -1.0;
0241     
0242     G4int fVerboseLevel = 1;
0243     G4int fReportLevel = 0;
0244 
0245     G4bool fEnableBC = false;
0246     G4bool fEnableHyperNuclei = false;
0247     G4bool fApplyFactorXS = false;
0248     G4bool fEnableCRCoalescence = false;
0249     G4bool fEnableIntegralInelasticXS = true;
0250     G4bool fEnableIntegralElasticXS = true;
0251     G4bool fEnableDiffDissociationForBGreater10 = false;
0252     G4bool fEnableNUDEX = false;
0253     G4bool fNeutronGeneral = false;
0254     G4bool fChargeExchange = false;
0255     G4bool fBinaryDebug = false;
0256     G4bool fBertiniAngularEmissionsAs11_2 = false;  // Keep the new G4 11.3 behavior
0257     G4bool fBertiniNucleiModelAs11_2 = false;       // Keep the new G4 11.3 behavior
0258 
0259     G4String fTypeTablePT = "";
0260     G4String fDirPARTICLEXS = "";
0261     G4String fPhysListDocDir = "";
0262     G4String fPhysListName = "";
0263 };
0264 
0265 inline G4double G4HadronicParameters::GetMaxEnergy() const { 
0266   return fMaxEnergy;
0267 }
0268 
0269 inline G4double G4HadronicParameters::GetMinEnergyTransitionFTF_Cascade() const { 
0270   return fMinEnergyTransitionFTF_Cascade;
0271 }
0272 inline G4double G4HadronicParameters::GetMaxEnergyTransitionFTF_Cascade() const { 
0273   return fMaxEnergyTransitionFTF_Cascade;
0274 }
0275 
0276 inline G4double G4HadronicParameters::GetMinEnergyTransitionQGS_FTF() const { 
0277   return fMinEnergyTransitionQGS_FTF;
0278 }
0279 
0280 inline G4double G4HadronicParameters::GetMaxEnergyTransitionQGS_FTF() const { 
0281   return fMaxEnergyTransitionQGS_FTF;
0282 }
0283 
0284 inline G4double G4HadronicParameters::GetMinEnergyINCLXX_Pbar() const { 
0285   return fMinEnergyINCLXX_Pbar;
0286 }
0287 inline G4double G4HadronicParameters::GetMaxEnergyINCLXX_Pbar() const { 
0288   return fMaxEnergyINCLXX_Pbar;
0289 } 
0290 
0291 inline G4double G4HadronicParameters::EnergyThresholdForHeavyHadrons() const {
0292   return fEnergyThresholdForHeavyHadrons;
0293 }
0294 
0295 inline G4double G4HadronicParameters::XSFactorNucleonInelastic() const {
0296   return fXSFactorNucleonInelastic;
0297 }
0298 
0299 inline G4double G4HadronicParameters::XSFactorNucleonElastic() const {
0300   return fXSFactorNucleonElastic;
0301 }
0302 
0303 inline G4double G4HadronicParameters::XSFactorPionInelastic() const {
0304   return fXSFactorPionInelastic;
0305 }
0306 
0307 inline G4double G4HadronicParameters::XSFactorPionElastic() const {
0308   return fXSFactorPionElastic;
0309 }
0310 
0311 inline G4double G4HadronicParameters::XSFactorHadronInelastic() const {
0312   return fXSFactorHadronInelastic;
0313 }
0314 
0315 inline G4double G4HadronicParameters::XSFactorHadronElastic() const {
0316   return fXSFactorHadronElastic;
0317 }
0318 
0319 inline G4double G4HadronicParameters::XSFactorEM() const {
0320   return fXSFactorEM;
0321 }
0322 
0323 inline G4int G4HadronicParameters::GetVerboseLevel() const { 
0324   return fVerboseLevel;
0325 }
0326 
0327 inline G4bool G4HadronicParameters::EnableBCParticles() const {
0328   return fEnableBC;
0329 }
0330 
0331 inline G4bool G4HadronicParameters::EnableHyperNuclei() const {
0332   return fEnableHyperNuclei;
0333 }
0334 
0335 inline G4bool G4HadronicParameters::ApplyFactorXS() const {
0336   return fApplyFactorXS;
0337 }
0338 
0339 inline G4bool G4HadronicParameters::EnableCRCoalescence() const {
0340   return fEnableCRCoalescence;
0341 }
0342 
0343 inline G4bool G4HadronicParameters::EnableIntegralInelasticXS() const {
0344   return fEnableIntegralInelasticXS;
0345 }
0346 
0347 inline G4bool G4HadronicParameters::EnableIntegralElasticXS() const {
0348   return fEnableIntegralElasticXS;
0349 }
0350 
0351 inline G4bool G4HadronicParameters::EnableDiffDissociationForBGreater10() const {
0352   return fEnableDiffDissociationForBGreater10;
0353 }
0354 
0355 inline G4bool G4HadronicParameters::EnableNeutronGeneralProcess() const {
0356   return fNeutronGeneral;
0357 }
0358 
0359 inline G4bool G4HadronicParameters::EnableNUDEX() const {
0360   return fEnableNUDEX;
0361 }
0362 
0363 inline const G4String& G4HadronicParameters::GetTypeTablePT() const {
0364   return fTypeTablePT;
0365 }
0366 
0367 inline G4bool G4HadronicParameters::EnableCoherentChargeExchange() const {
0368   return fChargeExchange;
0369 }
0370 
0371 inline G4bool G4HadronicParameters::GetBinaryDebug() const {
0372   return fBinaryDebug;
0373 }
0374 
0375 inline G4double G4HadronicParameters::GetEPRelativeLevel() const {
0376   return fRelativeDiff;
0377 }
0378 
0379 inline G4double G4HadronicParameters::GetEPAbsoluteLevel() const {
0380   return fAbsoluteDiff;
0381 }
0382 
0383 inline G4int G4HadronicParameters::GetEPReportLevel() const {
0384   return fReportLevel;
0385 }
0386 
0387 inline const G4String& G4HadronicParameters::GetDirPARTICLEXS() const {
0388   return fDirPARTICLEXS;
0389 }
0390 
0391 inline const G4String& G4HadronicParameters::GetPhysListDocDir() const {
0392   return fPhysListDocDir;
0393 }
0394 
0395 inline const G4String& G4HadronicParameters::GetPhysListName() const {
0396   return fPhysListName;
0397 }
0398 
0399 inline G4double G4HadronicParameters::GetNeutronKineticEnergyThresholdForSVT() const { 
0400   return fNeutronEkinThresholdForSVT;
0401 }
0402 
0403 inline G4double G4HadronicParameters::GetTimeThresholdForRadioactiveDecay() const { 
0404   return fTimeThresholdForRadioactiveDecays;
0405 }
0406 
0407 inline G4bool G4HadronicParameters::IsBertiniAs11_2() const {
0408   return ( fBertiniAngularEmissionsAs11_2 && fBertiniNucleiModelAs11_2 );
0409 }  
0410 
0411 inline G4bool G4HadronicParameters::IsBertiniAngularEmissionsAs11_2() const {
0412   return fBertiniAngularEmissionsAs11_2;
0413 }
0414   
0415 inline G4bool G4HadronicParameters::IsBertiniNucleiModelAs11_2() const {
0416   return fBertiniNucleiModelAs11_2;
0417 }
0418 
0419 inline std::ostream& operator<<(std::ostream& os, const G4HadronicParameters& p)
0420 {
0421   p.StreamInfo(os);
0422   return os;
0423 }
0424 
0425 #endif