Skip to content

Commit

Permalink
only store G4TouchableHandle if visualization is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
ManuelHu committed Dec 20, 2024
1 parent 1db1765 commit 3091b9f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/RMGOpticalDetector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void RMGOpticalDetectorHit::Print() {
void RMGOpticalDetectorHit::Draw() {

const auto vis_man = G4VVisManager::GetConcreteInstance();
if (!vis_man) return;
if (!vis_man || !detector_touchable) return;

auto lv_va = detector_touchable->GetVolume()->GetLogicalVolume()->GetVisAttributes();
G4VisAttributes va;
Expand Down Expand Up @@ -120,7 +120,7 @@ bool RMGOpticalDetector::ProcessHits(G4Step* step, G4TouchableHistory* /*history

// initialize hit object for uid, if not already there
auto* hit = new RMGOpticalDetectorHit();
hit->detector_touchable = touchable;
if (G4VVisManager::GetConcreteInstance()) { hit->detector_touchable = touchable; }
hit->detector_uid = det_uid;
hit->photon_wavelength = CLHEP::c_light * CLHEP::h_Planck / step->GetTotalEnergyDeposit();
hit->global_time = step->GetPostStepPoint()->GetGlobalTime();
Expand Down

0 comments on commit 3091b9f

Please sign in to comment.