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

Remove checks for Geant4 version #41392

Merged
merged 2 commits into from
Apr 25, 2023
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
7 changes: 2 additions & 5 deletions SimG4Core/Application/src/ParametrisedEMPhysics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include "G4SystemOfUnits.hh"
#include "G4Transportation.hh"
#include "G4UAtomicDeexcitation.hh"
#include "G4Version.hh"
#include <memory>

#include <string>
Expand Down Expand Up @@ -78,18 +77,16 @@ ParametrisedEMPhysics::ParametrisedEMPhysics(const std::string& name, const edm:
param->SetGeneralProcessActive(genp);

bool pe = p.getParameter<bool>("PhotoeffectBelowKShell");
int type = p.getParameter<int>("G4TransportWithMSC");

#if G4VERSION_NUMBER >= 1110
param->SetPhotoeffectBelowKShell(pe);

int type = p.getParameter<int>("G4TransportWithMSC");
G4TransportationWithMscType trtype = G4TransportationWithMscType::fDisabled;
if (type == 1) {
trtype = G4TransportationWithMscType::fEnabled;
} else if (type == 2) {
trtype = G4TransportationWithMscType::fMultipleSteps;
}
param->SetTransportationWithMsc(trtype);
#endif

bool mudat = theParSet.getParameter<bool>("ReadMuonData");
param->SetRetrieveMuDataFromFile(mudat);
Expand Down
5 changes: 0 additions & 5 deletions SimG4Core/PhysicsLists/interface/CMSEmStandardPhysicsEMMT.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#ifndef SimG4Core_PhysicsLists_CMSEmStandardPhysicsEMMT_h
#define SimG4Core_PhysicsLists_CMSEmStandardPhysicsEMMT_h

#include "G4Version.hh"
#if G4VERSION_NUMBER >= 1100

#include "G4VPhysicsConstructor.hh"
#include "globals.hh"
#include "G4MscStepLimitType.hh"
Expand All @@ -23,5 +20,3 @@ class CMSEmStandardPhysicsEMMT : public G4VPhysicsConstructor {
};

#endif

#endif
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#ifndef SimG4Core_PhysicsLists_CMSEmStandardPhysicsTrackingManager_h
#define SimG4Core_PhysicsLists_CMSEmStandardPhysicsTrackingManager_h

#include "G4Version.hh"
#if G4VERSION_NUMBER >= 1100

#include "G4VTrackingManager.hh"
#include "globals.hh"
#include "G4MscStepLimitType.hh"
Expand All @@ -23,7 +20,7 @@ class G4GammaGeneralProcess;
class CMSEmStandardPhysicsTrackingManager : public G4VTrackingManager {
public:
CMSEmStandardPhysicsTrackingManager(const edm::ParameterSet &p);
~CMSEmStandardPhysicsTrackingManager();
~CMSEmStandardPhysicsTrackingManager() override;

void BuildPhysicsTable(const G4ParticleDefinition &) override;

Expand Down Expand Up @@ -65,5 +62,3 @@ class CMSEmStandardPhysicsTrackingManager : public G4VTrackingManager {
};

#endif

#endif
7 changes: 1 addition & 6 deletions SimG4Core/PhysicsLists/interface/CMSHepEmTrackingManager.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
#ifndef SimG4Core_PhysicsLists_CMSHepEmTrackingManager_h
#define SimG4Core_PhysicsLists_CMSHepEmTrackingManager_h

#include "G4Version.hh"
#if G4VERSION_NUMBER >= 1100

#include "G4HepEmTrackingManager.hh"

class CMSHepEmTrackingManager final : public G4HepEmTrackingManager {
public:
CMSHepEmTrackingManager(G4double highEnergyLimit);
~CMSHepEmTrackingManager();
~CMSHepEmTrackingManager() override;

void BuildPhysicsTable(const G4ParticleDefinition &) override;

Expand All @@ -22,5 +19,3 @@ class CMSHepEmTrackingManager final : public G4HepEmTrackingManager {
};

#endif

#endif
8 changes: 0 additions & 8 deletions SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
#include "G4IonPhysics.hh"
#include "G4StoppingPhysics.hh"
#include "G4HadronElasticPhysics.hh"

#include "G4Version.hh"
#if G4VERSION_NUMBER >= 1110
#include "G4HadronicParameters.hh"
#endif

FTFPCMS_BERT_EMM::FTFPCMS_BERT_EMM(const edm::ParameterSet& p) : PhysicsList(p) {
int ver = p.getUntrackedParameter<int>("Verbosity", 0);
Expand All @@ -33,18 +29,15 @@ FTFPCMS_BERT_EMM::FTFPCMS_BERT_EMM(const edm::ParameterSet& p) : PhysicsList(p)
// Synchroton Radiation & GN Physics
G4EmExtraPhysics* gn = new G4EmExtraPhysics(ver);
RegisterPhysics(gn);
#if G4VERSION_NUMBER >= 1110
bool mu = p.getParameter<bool>("G4MuonPairProductionByMuon");
gn->MuonToMuMu(mu);
edm::LogVerbatim("PhysicsList") << " Muon pair production by muons: " << mu;
#endif
}

// Decays
this->RegisterPhysics(new G4DecayPhysics(ver));

if (hadPhys) {
#if G4VERSION_NUMBER >= 1110
bool ngen = p.getParameter<bool>("G4NeutronGeneralProcess");
bool bc = p.getParameter<bool>("G4BCHadronicProcess");
bool hn = p.getParameter<bool>("G4LightHyperNucleiTracking");
Expand All @@ -55,7 +48,6 @@ FTFPCMS_BERT_EMM::FTFPCMS_BERT_EMM(const edm::ParameterSet& p) : PhysicsList(p)
edm::LogVerbatim("PhysicsList") << " Eneble neutron general process: " << ngen
<< "\n Enable b- and c- hadron physics: " << bc
<< "\n Enable light hyper-nuclei physics: " << hn;
#endif

// Hadron Elastic scattering
RegisterPhysics(new G4HadronElasticPhysics(ver));
Expand Down
5 changes: 0 additions & 5 deletions SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMMT.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#include "G4Version.hh"
#if G4VERSION_NUMBER >= 1100

#include "FTFPCMS_BERT_EMMT.h"
#include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysicsEMMT.h"
#include "SimG4Core/PhysicsLists/interface/CMSHadronPhysicsFTFP_BERT.h"
Expand Down Expand Up @@ -46,5 +43,3 @@ FTFPCMS_BERT_EMMT::FTFPCMS_BERT_EMMT(const edm::ParameterSet& p) : PhysicsList(p
RegisterPhysics(new G4IonPhysics(ver));
}
}

#endif
5 changes: 0 additions & 5 deletions SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMMT.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#ifndef SimG4Core_PhysicsLists_FTFPCMS_BERT_EMMT_H
#define SimG4Core_PhysicsLists_FTFPCMS_BERT_EMMT_H

#include "G4Version.hh"
#if G4VERSION_NUMBER >= 1100

#include "SimG4Core/Physics/interface/PhysicsList.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"

Expand All @@ -13,5 +10,3 @@ class FTFPCMS_BERT_EMMT : public PhysicsList {
};

#endif

#endif
5 changes: 0 additions & 5 deletions SimG4Core/PhysicsLists/plugins/module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
#include "FTFPCMS_BERT_EMH.h"
#include "FTFPCMS_BERT_EML.h"
#include "FTFPCMS_BERT_EMM.h"
#include "G4Version.hh"
#if G4VERSION_NUMBER >= 1100
#include "FTFPCMS_BERT_EMMT.h"
#endif
#include "FTFPCMS_BERT_EMN.h"
#include "FTFPCMS_BERT_EMM_TRK.h"
#include "FTFPCMS_BERT_HP_EMM.h"
Expand Down Expand Up @@ -40,10 +37,8 @@ typedef FTFPCMS_BERT_EML FTFP_BERT_EML;
DEFINE_PHYSICSLIST(FTFP_BERT_EML);
typedef FTFPCMS_BERT_EMM FTFP_BERT_EMM;
DEFINE_PHYSICSLIST(FTFP_BERT_EMM);
#if G4VERSION_NUMBER >= 1100
typedef FTFPCMS_BERT_EMMT FTFP_BERT_EMMT;
DEFINE_PHYSICSLIST(FTFP_BERT_EMMT);
#endif
typedef FTFPCMS_BERT_EMN FTFP_BERT_EMN;
DEFINE_PHYSICSLIST(FTFP_BERT_EMN);
typedef FTFPCMS_BERT_EMM_TRK FTFP_BERT_EMM_TRK;
Expand Down
15 changes: 2 additions & 13 deletions SimG4Core/PhysicsLists/src/CMSEmStandardPhysics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,8 @@
#include "G4GammaGeneralProcess.hh"
#include "G4LossTableManager.hh"

#include "G4Version.hh"
#if G4VERSION_NUMBER >= 1110
#include "G4ProcessManager.hh"
#include "G4TransportationWithMsc.hh"
#endif

#include "G4RegionStore.hh"
#include "G4Region.hh"
Expand Down Expand Up @@ -150,7 +147,6 @@ void CMSEmStandardPhysics::ConstructProcess() {
msc3->SetLocked(true);
}

#if G4VERSION_NUMBER >= 1110
G4TransportationWithMscType transportationWithMsc = param->TransportationWithMsc();
if (transportationWithMsc != G4TransportationWithMscType::fDisabled) {
// Remove default G4Transportation and replace with G4TransportationWithMsc.
Expand All @@ -176,9 +172,7 @@ void CMSEmStandardPhysics::ConstructProcess() {
transportWithMsc->AddMscModel(msc3, -1, bRegion);
}
procManager->AddProcess(transportWithMsc, -1, 0, 0);
} else
#endif
{
} else {
// Multiple scattering is registered as a separate process
G4eMultipleScattering* msc = new G4eMultipleScattering;
msc->SetEmModel(msc1);
Expand Down Expand Up @@ -225,7 +219,6 @@ void CMSEmStandardPhysics::ConstructProcess() {
msc3->SetLocked(true);
}

#if G4VERSION_NUMBER >= 1110
if (transportationWithMsc != G4TransportationWithMscType::fDisabled) {
G4ProcessManager* procManager = particle->GetProcessManager();
// Remove default G4Transportation and replace with G4TransportationWithMsc.
Expand All @@ -250,9 +243,7 @@ void CMSEmStandardPhysics::ConstructProcess() {
transportWithMsc->AddMscModel(msc3, -1, bRegion);
}
procManager->AddProcess(transportWithMsc, -1, 0, 0);
} else
#endif
{
} else {
// Register as a separate process.
G4eMultipleScattering* msc = new G4eMultipleScattering;
msc->SetEmModel(msc1);
Expand All @@ -279,13 +270,11 @@ void CMSEmStandardPhysics::ConstructProcess() {
ph->RegisterProcess(new G4eplusAnnihilation(), particle);
ph->RegisterProcess(ss, particle);

#if G4VERSION_NUMBER >= 1110
if (fG4HepEmActive) {
auto* hepEmTM = new CMSHepEmTrackingManager(highEnergyLimit);
G4Electron::Electron()->SetTrackingManager(hepEmTM);
G4Positron::Positron()->SetTrackingManager(hepEmTM);
}
#endif

// generic ion
particle = G4GenericIon::GenericIon();
Expand Down
5 changes: 0 additions & 5 deletions SimG4Core/PhysicsLists/src/CMSEmStandardPhysicsEMMT.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#include "G4Version.hh"
#if G4VERSION_NUMBER >= 1100

#include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysicsEMMT.h"
#include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysicsTrackingManager.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
Expand Down Expand Up @@ -85,5 +82,3 @@ void CMSEmStandardPhysicsEMMT::ConstructProcess() {
ph->RegisterProcess(muNucProcess, G4MuonPlus::MuonPlus());
ph->RegisterProcess(muNucProcess, G4MuonMinus::MuonMinus());
}

#endif
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#include "G4Version.hh"
#if G4VERSION_NUMBER >= 1100

#include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysicsTrackingManager.h"
#include "TrackingManagerHelper.h"

Expand Down Expand Up @@ -726,5 +723,3 @@ void CMSEmStandardPhysicsTrackingManager::HandOverOneTrack(G4Track *aTrack) {
aTrack->SetTrackStatus(fStopAndKill);
delete aTrack;
}

#endif
13 changes: 2 additions & 11 deletions SimG4Core/PhysicsLists/src/CMSEmStandardPhysicsXS.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,8 @@
#include "G4BuilderType.hh"
#include "G4GammaGeneralProcess.hh"

#include "G4Version.hh"
#if G4VERSION_NUMBER >= 1110
#include "G4ProcessManager.hh"
#include "G4TransportationWithMsc.hh"
#endif

#include "G4RegionStore.hh"
#include "G4Region.hh"
Expand Down Expand Up @@ -184,7 +181,6 @@ void CMSEmStandardPhysicsXS::ConstructProcess() {
msc3->SetLocked(true);
}

#if G4VERSION_NUMBER >= 1110
G4TransportationWithMscType transportationWithMsc = G4EmParameters::Instance()->TransportationWithMsc();
if (transportationWithMsc != G4TransportationWithMscType::fDisabled) {
G4ProcessManager* procManager = particle->GetProcessManager();
Expand All @@ -210,9 +206,7 @@ void CMSEmStandardPhysicsXS::ConstructProcess() {
transportWithMsc->AddMscModel(msc3, -1, bRegion);
}
procManager->AddProcess(transportWithMsc, -1, 0, 0);
} else
#endif
{
} else {
// Register as a separate process.
G4eMultipleScattering* msc = new G4eMultipleScattering;
msc->SetEmModel(msc1);
Expand Down Expand Up @@ -286,7 +280,6 @@ void CMSEmStandardPhysicsXS::ConstructProcess() {
msc3->SetLocked(true);
}

#if G4VERSION_NUMBER >= 1110
if (transportationWithMsc != G4TransportationWithMscType::fDisabled) {
G4ProcessManager* procManager = particle->GetProcessManager();
// Remove default G4Transportation and replace with G4TransportationWithMsc.
Expand All @@ -311,9 +304,7 @@ void CMSEmStandardPhysicsXS::ConstructProcess() {
transportWithMsc->AddMscModel(msc3, -1, bRegion);
}
procManager->AddProcess(transportWithMsc, -1, 0, 0);
} else
#endif
{
} else {
// Register as a separate process.
G4eMultipleScattering* msc = new G4eMultipleScattering;
msc->SetEmModel(msc1);
Expand Down
4 changes: 0 additions & 4 deletions SimG4Core/PhysicsLists/src/CMSHadronPhysicsFTFP_BERT.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
#include "G4SystemOfUnits.hh"
#include "G4Threading.hh"

#include "G4Version.hh"

CMSHadronPhysicsFTFP_BERT::CMSHadronPhysicsFTFP_BERT(G4int)
: CMSHadronPhysicsFTFP_BERT(3 * CLHEP::GeV, 6 * CLHEP::GeV, 12 * CLHEP::GeV, 3 * CLHEP::GeV, 6 * CLHEP::GeV) {}

Expand All @@ -41,7 +39,6 @@ void CMSHadronPhysicsFTFP_BERT::ConstructProcess() {
}

void CMSHadronPhysicsFTFP_BERT::Neutron() {
#if G4VERSION_NUMBER >= 1100
G4bool useNGeneral = G4HadronicParameters::Instance()->EnableNeutronGeneralProcess();
if (useNGeneral) {
auto theFTFP = new G4TheoFSGenerator("FTFP");
Expand All @@ -61,7 +58,6 @@ void CMSHadronPhysicsFTFP_BERT::Neutron() {
G4HadProcesses::BuildNeutronInelasticAndCapture(ni);
return;
}
#endif

G4HadronPhysicsFTFP_BERT::Neutron();
}
5 changes: 0 additions & 5 deletions SimG4Core/PhysicsLists/src/CMSHepEmTrackingManager.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#include "G4Version.hh"
#if G4VERSION_NUMBER >= 1100

#include "SimG4Core/PhysicsLists/interface/CMSHepEmTrackingManager.h"

#include "G4EventManager.hh"
Expand Down Expand Up @@ -63,5 +60,3 @@ void CMSHepEmTrackingManager::HandOverOneTrack(G4Track* aTrack) {
delete aTrack;
}
}

#endif
2 changes: 1 addition & 1 deletion SimG4Core/PhysicsLists/src/TrackingManagerHelper.icc
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ void TrackingManagerHelper::TrackNeutralParticle(G4Track* aTrack, PhysicsImpl& p

G4double MakeStep(G4Track& track, G4Step& step, G4double physicalStep) override {
G4ThreeVector pos = track.GetPosition();
G4ThreeVector dir = track.GetMomentumDirection();
const G4ThreeVector& dir = track.GetMomentumDirection();
G4StepPoint& postStepPoint = *step.GetPostStepPoint();

G4double safety = 0.0;
Expand Down