mnovak42 / g4hepem

Geant4 EM physics simulation R&D project looking for solutions to reduce the computing performance bottleneck experienced by HEP detector simulation applications.
Apache License 2.0
8 stars 12 forks source link

Deprecation warning on use of G4VEmModel::SetLPMFlag with Geant4 11.2.x #104

Open drbenmorgan opened 1 month ago

drbenmorgan commented 1 month ago

Just found this in testing with AdePT and the newer Geant4 versions. Compiling G4HepEm with Geant4 11.2.X leads to a compiler warning:

[26/95] Building CXX object G4HepEm/G4HepEmInit/CMakeFiles/g4HepEmInit.dir/src/G4HepEmElectronInit.cc.o
.../G4HepEm/G4HepEmInit/src/G4HepEmElectronInit.cc:65:12: warning: 'SetLPMFlag' is deprecated: Use G4EmParameters::Instance()->SetLPM instead [-Wdeprecated-declarations]
  modelSB->SetLPMFlag(false);
           ^
/.../include/Geant4/G4VEmModel.hh:393:5: note: 'SetLPMFlag' has been explicitly marked deprecated here
  [[deprecated("Use G4EmParameters::Instance()->SetLPM instead")]]
    ^
/.../G4HepEm/G4HepEmInit/src/G4HepEmElectronInit.cc:77:12: warning: 'SetLPMFlag' is deprecated: Use G4EmParameters::Instance()->SetLPM instead [-Wdeprecated-declarations]
  modelRB->SetLPMFlag(true);
           ^
/.../include/Geant4/G4VEmModel.hh:393:5: note: 'SetLPMFlag' has been explicitly marked deprecated here
  [[deprecated("Use G4EmParameters::Instance()->SetLPM instead")]]
    ^
2 warnings generated.

As these are being explicitly applied at the model level, and with different true/false values, I wasn't sure of the appropriate fix, and whether this is simple or not!

mnovak42 commented 1 month ago

I decided to set the LPM flags explicitly only for verbosity reasons. We can simply drop setting them as we follow the default LPM settings: ON in the high energy model while OFF in the Seltzer-Berger model as the LPM suppression is not available there). Therefore, not setting the LPM flags won't have any effects to the model settings.

We had a complex and unnecessary inheritance of the bremsstrahlung models in Geant4 that has been simplified recently (including the LPM option setters/getters).

I will take care of this soon.