From c10f3b27e477dbb2d9aaa8e61eb5011a70560745 Mon Sep 17 00:00:00 2001 From: lintao <lintao51@gmail.com> Date: Sat, 19 Dec 2020 00:25:03 +0800 Subject: [PATCH] WIP: allow to associate a fastsim model with multiple regions --- .../DetSimFastModel/src/DummyFastSimG4Tool.cpp | 17 +++++++++-------- .../DetSimFastModel/src/DummyFastSimG4Tool.h | 3 ++- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Simulation/DetSimFastModel/src/DummyFastSimG4Tool.cpp b/Simulation/DetSimFastModel/src/DummyFastSimG4Tool.cpp index 47420ae3..6fa049f8 100644 --- a/Simulation/DetSimFastModel/src/DummyFastSimG4Tool.cpp +++ b/Simulation/DetSimFastModel/src/DummyFastSimG4Tool.cpp @@ -27,14 +27,15 @@ bool DummyFastSimG4Tool::CreateFastSimulationModel() { // * Associate model and region G4String model_name = "DummyFastSimG4Model"; - G4String region_name = "DriftChamberRegion"; - G4Region* aEnvelope = G4RegionStore::GetInstance()->GetRegion(region_name); - if (!aEnvelope) { - error() << "Failed to find G4Region '" << region_name << "'" << endmsg; - return false; + for (auto region_name: m_regions.value()) { + G4Region* aEnvelope = G4RegionStore::GetInstance()->GetRegion(region_name); + if (!aEnvelope) { + error() << "Failed to find G4Region '" << region_name << "'" << endmsg; + return false; + } + + DummyFastSimG4Model* model = new DummyFastSimG4Model(model_name+region_name, aEnvelope); + info() << "Create Model " << model_name << " for G4Region " << region_name << endmsg; } - - DummyFastSimG4Model* model = new DummyFastSimG4Model(model_name, aEnvelope); - info() << "Create Model " << model_name << " for G4Region " << region_name << endmsg; return true; } diff --git a/Simulation/DetSimFastModel/src/DummyFastSimG4Tool.h b/Simulation/DetSimFastModel/src/DummyFastSimG4Tool.h index 2254d892..54c09dbe 100644 --- a/Simulation/DetSimFastModel/src/DummyFastSimG4Tool.h +++ b/Simulation/DetSimFastModel/src/DummyFastSimG4Tool.h @@ -14,7 +14,8 @@ public: bool CreateFastSimulationModel() override; private: - + // the regions will be associated with the fast sim model + Gaudi::Property<std::vector<std::string>> m_regions{this, "Regions"}; }; #endif -- GitLab