Skip to content
Draft
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
2 changes: 2 additions & 0 deletions include/PhysicsList.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class PhysicsList : public G4VModularPhysicsList {
G4VPhysicsConstructor* fRadDecPhysicsList = nullptr;
std::vector<G4VPhysicsConstructor*> fHadronPhys;

G4VPhysicsConstructor* fOptPhysList = nullptr;

TRestGeant4PhysicsLists* fRestPhysicsLists = nullptr;
};

Expand Down
4 changes: 4 additions & 0 deletions src/DetectorConstruction.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
#include <G4SystemOfUnits.hh>
#include <G4UniformMagField.hh>
#include <G4UserLimits.hh>
// optical surfaces
#include <G4LogicalSkinSurface.hh>
#include <G4LogicalSurface.hh>
#include <G4OpticalSurface.hh>
#include <filesystem>

#include "SimulationManager.h"
Expand Down
26 changes: 26 additions & 0 deletions src/PhysicsList.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <G4IonTable.hh>
#include <G4LossTableManager.hh>
#include <G4NeutronTrackingCut.hh>
#include <G4OpticalPhysics.hh>
#include <G4ParticleTable.hh>
#include <G4ParticleTypes.hh>
#include <G4PhotonEvaporation.hh>
Expand Down Expand Up @@ -70,6 +71,7 @@ PhysicsList::~PhysicsList() {
delete fEmPhysicsList;
delete fDecPhysicsList;
delete fRadDecPhysicsList;
delete fOptPhysList;
for (auto& hadronicPhysicsList : fHadronPhys) {
delete hadronicPhysicsList;
}
Expand Down Expand Up @@ -160,6 +162,20 @@ void PhysicsList::InitializePhysicsLists() {
}

G4cout << "Number of hadronic physics lists added " << fHadronPhys.size() << G4endl;

// Optical PhysicsList
if (fRestPhysicsLists->FindPhysicsList("G4OpticalPhysics") >= 0) {
fOptPhysList = new G4OpticalPhysics(); // by default all processes are activated and optical photons
// are tracked first
// posible aditional configuration
// fOptPhysList->Configure(kCerenkov,true); //to activate each process
// fOptPhysList->SetCerenkovStackPhotons(false);
// fOptPhysList->SetTrackSecondariesFirst(kScintillation,true);
// fOptPhysList->SetScintillationStackPhotons(false);//only relevant if we actually stack and trace
// optical photons
} else if (fRestPhysicsLists->GetVerboseLevel() >= TRestStringOutput::REST_Verbose_Level::REST_Debug) {
G4cout << "restG4. PhysicsList. G4DecayPhysics is not enabled!!" << G4endl;
}
}

void PhysicsList::ConstructParticle() {
Expand All @@ -182,11 +198,21 @@ void PhysicsList::ConstructParticle() {
for (auto& hadronicPhysicsList : fHadronPhys) {
hadronicPhysicsList->ConstructParticle();
}

// Optical physics list
if (fOptPhysList) {
fOptPhysList->ConstructParticle();
}
}

void PhysicsList::ConstructProcess() {
AddTransportation();

// Optical physics list
if (fOptPhysList) {
fOptPhysList->ConstructProcess();
}

// Electromagnetic physics list
if (fEmPhysicsList) {
fEmPhysicsList->ConstructProcess();
Expand Down