Skip to content

Commit

Permalink
Merge pull request #36659 from civanch/fixed_inclxx_physics
Browse files Browse the repository at this point in the history
Fixed INCLXX physics configurations
  • Loading branch information
cmsbuild authored Jan 11, 2022
2 parents 979e457 + a53dfa1 commit de96df3
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 20 deletions.
10 changes: 5 additions & 5 deletions SimG4Core/Geometry/src/DDG4ProductionCuts.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ void DDG4ProductionCuts::initialize() {
edm::LogVerbatim("Geometry") << "DDG4ProductionCuts : new G4Region " << vv.first->GetName();
setProdCuts(vv.second, region);
}

region->AddRootLogicalVolume(vv.first);

if (verbosity_ > 0)
edm::LogVerbatim("Geometry") << " added " << vv.first->GetName() << " to region " << region->GetName();
if (nullptr != region) {
region->AddRootLogicalVolume(vv.first);
if (verbosity_ > 0)
edm::LogVerbatim("Geometry") << " added " << vv.first->GetName() << " to region " << region->GetName();
}
}
}

Expand Down
9 changes: 5 additions & 4 deletions SimG4Core/PhysicsLists/plugins/FTFPCMS_INCLXX_EMM.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ FTFPCMS_INCLXX_EMM::FTFPCMS_INCLXX_EMM(const edm::ParameterSet& p) : PhysicsList
bool hadPhys = p.getUntrackedParameter<bool>("HadPhysics", true);
bool tracking = p.getParameter<bool>("TrackingCut");
double timeLimit = p.getParameter<double>("MaxTrackTime") * CLHEP::ns;
edm::LogInfo("PhysicsList") << "You are using the simulation engine: "
<< "FTFP_INCLXX_EMM \n Flags for EM Physics " << emPhys << ", for Hadronic Physics "
<< hadPhys << " and tracking cut " << tracking << " t(ns)= " << timeLimit / CLHEP::ns;
edm::LogVerbatim("PhysicsList") << "You are using the simulation engine: "
<< "FTFP_INCLXX_EMM \n Flags for EM Physics " << emPhys << ", for Hadronic Physics "
<< hadPhys << " and tracking cut " << tracking
<< " t(ns)= " << timeLimit / CLHEP::ns;

if (emPhys) {
// EM Physics
Expand All @@ -41,7 +42,7 @@ FTFPCMS_INCLXX_EMM::FTFPCMS_INCLXX_EMM(const edm::ParameterSet& p) : PhysicsList
RegisterPhysics(new G4HadronElasticPhysics(ver));

// Hadron Physics
RegisterPhysics(new G4HadronPhysicsINCLXX(ver, true, false, true));
RegisterPhysics(new G4HadronPhysicsINCLXX("hInelastic INCLXX", true, false, true));

// Stopping Physics
RegisterPhysics(new G4StoppingPhysics(ver));
Expand Down
10 changes: 5 additions & 5 deletions SimG4Core/PhysicsLists/plugins/FTFPCMS_INCLXX_HP_EMM.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ FTFPCMS_INCLXX_HP_EMM::FTFPCMS_INCLXX_HP_EMM(const edm::ParameterSet& p) : Physi
bool tracking = p.getParameter<bool>("TrackingCut");
bool thermal = p.getUntrackedParameter<bool>("ThermalNeutrons");
double timeLimit = p.getParameter<double>("MaxTrackTime") * CLHEP::ns;
edm::LogInfo("PhysicsList") << "You are using the simulation engine: "
<< "FTFP_INCLXX_HP_EMM \n Flags for EM Physics " << emPhys << ", for Hadronic Physics "
<< hadPhys << " and tracking cut " << tracking << " t(ns)= " << timeLimit / CLHEP::ns
<< " ThermalNeutrons: " << thermal;
edm::LogVerbatim("PhysicsList") << "You are using the simulation engine: "
<< "FTFP_INCLXX_HP_EMM \n Flags for EM Physics " << emPhys
<< ", for Hadronic Physics " << hadPhys << " and tracking cut " << tracking
<< " t(ns)= " << timeLimit / CLHEP::ns << " ThermalNeutrons: " << thermal;

if (emPhys) {
// EM Physics
Expand All @@ -45,7 +45,7 @@ FTFPCMS_INCLXX_HP_EMM::FTFPCMS_INCLXX_HP_EMM(const edm::ParameterSet& p) : Physi
RegisterPhysics(new G4HadronElasticPhysicsHP(ver));

// Hadron Physics
RegisterPhysics(new G4HadronPhysicsINCLXX(ver, true, true, true));
RegisterPhysics(new G4HadronPhysicsINCLXX("hInelastic INCLXX_HP", true, true, true));

// Stopping Physics
RegisterPhysics(new G4StoppingPhysics(ver));
Expand Down
12 changes: 6 additions & 6 deletions SimG4Core/SaveSimTrackAction/src/SaveSimTrack.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ SaveSimTrack::SaveSimTrack(edm::ParameterSet const &p) {
edm::ParameterSet ps = p.getParameter<edm::ParameterSet>("SaveSimTrack");
pdgs_ = ps.getUntrackedParameter<std::vector<int>>("PDGCodes");

edm::LogInfo("SaveSimTrack") << "SaveSimTrack:: Save Sim Track if PDG code "
<< "is one from the list of " << pdgs_.size() << " items";
edm::LogVerbatim("SaveSimTrack") << "SaveSimTrack:: Save Sim Track if PDG code "
<< "is one from the list of " << pdgs_.size() << " items";
for (unsigned int k = 0; k < pdgs_.size(); ++k)
edm::LogInfo("SaveSimTrack") << "[" << k << "] " << pdgs_[k];
edm::LogVerbatim("SaveSimTrack") << "[" << k << "] " << pdgs_[k];
}

SaveSimTrack::~SaveSimTrack() {}

void SaveSimTrack::update(const BeginOfTrack *trk) {
G4Track *theTrack = (G4Track *)((*trk)());
TrackInformation *trkInfo = (TrackInformation *)(theTrack->GetUserInformation());
if (trkInfo) {
const G4Track *theTrack = (*trk)();
TrackInformation *trkInfo = reinterpret_cast<TrackInformation *>(theTrack->GetUserInformation());
if (nullptr != trkInfo) {
int pdg = theTrack->GetDefinition()->GetPDGEncoding();
if (std::find(pdgs_.begin(), pdgs_.end(), pdg) != pdgs_.end()) {
trkInfo->storeTrack(true);
Expand Down

0 comments on commit de96df3

Please sign in to comment.