Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compatibility issues with Geant4 11. #882

Merged
merged 3 commits into from
Nov 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 39 additions & 1 deletion DDG4/plugins/Geant4Processes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ DECLARE_GEANT4_PROCESS(G4CoulombScattering)
DECLARE_GEANT4_PROCESS(G4PolarizedCompton)
#include "G4PolarizedGammaConversion.hh"
DECLARE_GEANT4_PROCESS(G4PolarizedGammaConversion)
#include "G4ePairProduction.hh"
DECLARE_GEANT4_PROCESS(G4ePairProduction)

#if G4VERSION_NUMBER < 1100
#include "G4PolarizedPhotoElectricEffect.hh"
DECLARE_GEANT4_PROCESS(G4PolarizedPhotoElectricEffect)
#include "G4ePolarizedBremsstrahlung.hh"
Expand All @@ -112,6 +116,33 @@ DECLARE_GEANT4_PROCESS(G4ePolarizedIonisation)
#include "G4eplusPolarizedAnnihilation.hh"
DECLARE_GEANT4_PROCESS(G4eplusPolarizedAnnihilation)

#else
#include "G4PolarizedAnnihilation.hh"
DECLARE_GEANT4_PROCESS(G4PolarizedAnnihilation)
#include "G4PolarizedAnnihilationXS.hh"
DECLARE_GEANT4_PROCESS(G4PolarizedAnnihilationXS)
#include "G4PolarizedBremsstrahlung.hh"
DECLARE_GEANT4_PROCESS(G4PolarizedBremsstrahlung)
#include "G4PolarizedCompton.hh"
DECLARE_GEANT4_PROCESS(G4PolarizedCompton)
#include "G4PolarizedComptonXS.hh"
DECLARE_GEANT4_PROCESS(G4PolarizedComptonXS)
#include "G4PolarizedGammaConversion.hh"
DECLARE_GEANT4_PROCESS(G4PolarizedGammaConversion)
#include "G4PolarizedGammaConversionXS.hh"
DECLARE_GEANT4_PROCESS(G4PolarizedGammaConversionXS)
#include "G4PolarizedIonisation.hh"
DECLARE_GEANT4_PROCESS(G4PolarizedIonisation)
#include "G4PolarizedIonisationBhabhaXS.hh"
DECLARE_GEANT4_PROCESS(G4PolarizedIonisationBhabhaXS)
#include "G4PolarizedIonisationMollerXS.hh"
DECLARE_GEANT4_PROCESS(G4PolarizedIonisationMollerXS)
#include "G4PolarizedPhotoElectric.hh"
DECLARE_GEANT4_PROCESS(G4PolarizedPhotoElectric)
#include "G4PolarizedPhotoElectricXS.hh"
DECLARE_GEANT4_PROCESS(G4PolarizedPhotoElectricXS)
#endif

// Processes for simulation of X-rays and optical protons production by charged particles
#include "G4SynchrotronRadiation.hh"
DECLARE_GEANT4_PROCESS(G4SynchrotronRadiation)
Expand Down Expand Up @@ -184,6 +215,7 @@ DECLARE_GEANT4_PROCESS(G4BraggNoDeltaModel)
DECLARE_GEANT4_PROCESS(G4ChipsElasticModel)
#include "G4DNABornExcitationModel.hh"
DECLARE_GEANT4_PROCESS(G4DNABornExcitationModel)

#include "G4eBremParametrizedModel.hh"
DECLARE_GEANT4_PROCESS(G4eBremParametrizedModel)
#include "G4eBremsstrahlungRelModel.hh"
Expand All @@ -208,8 +240,15 @@ DECLARE_GEANT4_PROCESS(G4ecpssrFormFactorLixsModel)
DECLARE_GEANT4_PROCESS(G4ecpssrFormFactorMixsModel)
#include "G4EmMultiModel.hh"
DECLARE_GEANT4_PROCESS(G4EmMultiModel)

#if G4VERSION_NUMBER < 1100
#include "G4ePolarizedBremsstrahlungModel.hh"
DECLARE_GEANT4_PROCESS(G4ePolarizedBremsstrahlungModel)
#else
#include "G4PolarizedBremsstrahlungModel.hh"
DECLARE_GEANT4_PROCESS(G4PolarizedBremsstrahlungModel)
#endif

#include "G4FTFModel.hh"
DECLARE_GEANT4_PROCESS(G4FTFModel)
#include "G4GoudsmitSaundersonMscModel.hh"
Expand Down Expand Up @@ -241,7 +280,6 @@ DECLARE_GEANT4_PROCESS(G4ICRU73QOModel)

#endif


#if 0
#include ".hh"
DECLARE_GEANT4_PROCESS()
Expand Down
9 changes: 9 additions & 0 deletions DDG4/plugins/Geant4ScintillationPhysics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@

#if G4VERSION_NUMBER >= 1070
#include "G4OpticalParameters.hh"

/// This is a beta release problem:
#if G4VERSION_NUMBER == 1100
#include "G4OpticalParameters.hh"
#pragma message("Geant4 version 11 beta: temporary fix to be removed!")
void G4OpticalParameters::SetScintExcitationRatio(double) {}
void G4OpticalParameters::SetScintYieldFactor(double) {}
#endif

#endif

#include "G4Scintillation.hh"
Expand Down
46 changes: 41 additions & 5 deletions DDG4/src/Geant4Converter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,16 @@ namespace {
case kWLSCOMPONENT: return make_pair(CLHEP::keV/units::keV, 1.0);
case kWLSABSLENGTH: return make_pair(CLHEP::keV/units::keV, CLHEP::m/units::m);
case kABSLENGTH: return make_pair(CLHEP::keV/units::keV, CLHEP::m/units::m);
#if G4VERSION_NUMBER >= 1100
case kWLSCOMPONENT2: return make_pair(CLHEP::keV/units::keV, 1.0);
case kWLSABSLENGTH2: return make_pair(CLHEP::keV/units::keV, CLHEP::m/units::m);
case kSCINTILLATIONCOMPONENT1: return make_pair(CLHEP::keV/units::keV, units::keV/CLHEP::keV);
case kSCINTILLATIONCOMPONENT2: return make_pair(CLHEP::keV/units::keV, units::keV/CLHEP::keV);
case kSCINTILLATIONCOMPONENT3: return make_pair(CLHEP::keV/units::keV, units::keV/CLHEP::keV);
#else
case kFASTCOMPONENT: return make_pair(CLHEP::keV/units::keV, 1.0);
case kSLOWCOMPONENT: return make_pair(CLHEP::keV/units::keV, 1.0);
#endif
case kPROTONSCINTILLATIONYIELD: return make_pair(CLHEP::keV/units::keV, units::keV/CLHEP::keV); // Yields: 1/energy
case kDEUTERONSCINTILLATIONYIELD: return make_pair(CLHEP::keV/units::keV, units::keV/CLHEP::keV);
case kTRITONSCINTILLATIONYIELD: return make_pair(CLHEP::keV/units::keV, units::keV/CLHEP::keV);
Expand Down Expand Up @@ -179,11 +187,6 @@ namespace {
case kMIEHG_FORWARD_RATIO: return 1.0;
case kSCINTILLATIONYIELD: return units::keV/CLHEP::keV; // Energy
case kRESOLUTIONSCALE: return 1.0;
case kFASTTIMECONSTANT: return CLHEP::second/units::second; // Time
case kFASTSCINTILLATIONRISETIME: return CLHEP::second/units::second; // Time
case kSLOWTIMECONSTANT: return CLHEP::second/units::second; // Time
case kSLOWSCINTILLATIONRISETIME: return CLHEP::second/units::second; // Time
case kYIELDRATIO: return 1.0;
case kFERMIPOT: return CLHEP::keV/units::keV; // Energy
case kDIFFUSION: return 1.0;
case kSPINFLIP: return 1.0;
Expand All @@ -202,6 +205,39 @@ namespace {
case kMR_ANGNOTHETA: return 1.0;
case kMR_ANGNOPHI: return 1.0;
case kMR_ANGCUT: return 1.0;

#if G4VERSION_NUMBER >= 1100
case kSCINTILLATIONTIMECONSTANT1: return CLHEP::second/units::second; // Time
case kSCINTILLATIONTIMECONSTANT2: return CLHEP::second/units::second; // Time
case kSCINTILLATIONTIMECONSTANT3: return CLHEP::second/units::second; // Time
case kSCINTILLATIONRISETIME1: return CLHEP::second/units::second; // Time
case kSCINTILLATIONRISETIME2: return CLHEP::second/units::second; // Time
case kSCINTILLATIONRISETIME3: return CLHEP::second/units::second; // Time
case kSCINTILLATIONYIELD1: return 1.0;
case kSCINTILLATIONYIELD2: return 1.0;
case kSCINTILLATIONYIELD3: return 1.0;
case kPROTONSCINTILLATIONYIELD1: return 1.0;
case kPROTONSCINTILLATIONYIELD2: return 1.0;
case kPROTONSCINTILLATIONYIELD3: return 1.0;
case kDEUTERONSCINTILLATIONYIELD1: return 1.0;
case kDEUTERONSCINTILLATIONYIELD2: return 1.0;
case kDEUTERONSCINTILLATIONYIELD3: return 1.0;
case kALPHASCINTILLATIONYIELD1: return 1.0;
case kALPHASCINTILLATIONYIELD2: return 1.0;
case kALPHASCINTILLATIONYIELD3: return 1.0;
case kIONSCINTILLATIONYIELD1: return 1.0;
case kIONSCINTILLATIONYIELD2: return 1.0;
case kIONSCINTILLATIONYIELD3: return 1.0;
case kELECTRONSCINTILLATIONYIELD1: return 1.0;
case kELECTRONSCINTILLATIONYIELD2: return 1.0;
case kELECTRONSCINTILLATIONYIELD3: return 1.0;
#else
case kFASTTIMECONSTANT: return CLHEP::second/units::second; // Time
case kFASTSCINTILLATIONRISETIME: return CLHEP::second/units::second; // Time
case kSLOWTIMECONSTANT: return CLHEP::second/units::second; // Time
case kSLOWSCINTILLATIONRISETIME: return CLHEP::second/units::second; // Time
case kYIELDRATIO: return 1.0;
#endif
default:
break;
}
Expand Down