Skip to content
Snippets Groups Projects
Commit 3e2ceb9d authored by lintao@ihep.ac.cn's avatar lintao@ihep.ac.cn
Browse files

WIP: Fast simulation interface support in CEPCSW.

parent 64b918f8
No related branches found
No related tags found
No related merge requests found
...@@ -42,7 +42,12 @@ DetSimAlg::initialize() { ...@@ -42,7 +42,12 @@ DetSimAlg::initialize() {
// Detector Construction // Detector Construction
m_root_detelem = ToolHandle<IDetElemTool>(m_root_det_elem.value()); m_root_detelem = ToolHandle<IDetElemTool>(m_root_det_elem.value());
runmgr->SetUserInitialization(new DetectorConstruction(m_root_detelem));
for (auto fastsimname: m_fast_simtools) {
m_fast_simtools.push_back(fastsimname);
}
runmgr->SetUserInitialization(new DetectorConstruction(m_root_detelem, m_fast_simtools));
// Physics List // Physics List
G4VUserPhysicsList *physicsList = nullptr; G4VUserPhysicsList *physicsList = nullptr;
if (m_physics_lists_name.value() == "CEPC") { if (m_physics_lists_name.value() == "CEPC") {
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <DetSimInterface/IG4PrimaryCnvTool.h> #include <DetSimInterface/IG4PrimaryCnvTool.h>
#include <DetSimInterface/IAnaElemTool.h> #include <DetSimInterface/IAnaElemTool.h>
#include <DetSimInterface/IDetElemTool.h> #include <DetSimInterface/IDetElemTool.h>
#include <DetSimInterface/IFastSimG4Tool.h>
class DetSimAlg: public Algorithm { class DetSimAlg: public Algorithm {
public: public:
...@@ -24,6 +25,7 @@ public: ...@@ -24,6 +25,7 @@ public:
private: private:
SmartIF<IDetSimSvc> m_detsimsvc; SmartIF<IDetSimSvc> m_detsimsvc;
ToolHandleArray<IAnaElemTool> m_anaelemtools; ToolHandleArray<IAnaElemTool> m_anaelemtools;
ToolHandleArray<IFastSimG4Tool> m_fast_simtools;
ToolHandle<IDetElemTool> m_root_detelem; ToolHandle<IDetElemTool> m_root_detelem;
ToolHandle<IG4PrimaryCnvTool> m_prim_cnvtool{"G4PrimaryCnvTool", this}; ToolHandle<IG4PrimaryCnvTool> m_prim_cnvtool{"G4PrimaryCnvTool", this};
...@@ -36,6 +38,7 @@ private: ...@@ -36,6 +38,7 @@ private:
Gaudi::Property<std::string> m_physics_lists_name{this, "PhysicsList", "QGSP_BERT"}; Gaudi::Property<std::string> m_physics_lists_name{this, "PhysicsList", "QGSP_BERT"};
Gaudi::Property<std::vector<std::string>> m_ana_elems{this, "AnaElems"}; Gaudi::Property<std::vector<std::string>> m_ana_elems{this, "AnaElems"};
Gaudi::Property<std::vector<std::string>> m_fast_simnames{this, "FastSimG4Tools"};
Gaudi::Property<std::string> m_root_det_elem{this, "RootDetElem"}; Gaudi::Property<std::string> m_root_det_elem{this, "RootDetElem"};
......
...@@ -25,8 +25,9 @@ ...@@ -25,8 +25,9 @@
#include "G4ios.hh" #include "G4ios.hh"
DetectorConstruction::DetectorConstruction(ToolHandle<IDetElemTool>& root_elem) DetectorConstruction::DetectorConstruction(ToolHandle<IDetElemTool>& root_elem,
: m_root_detelem(root_elem) { ToolHandleArray<IFastSimG4Tool>& fast_simtools)
: m_root_detelem(root_elem), m_fast_simtools(fast_simtools) {
} }
...@@ -60,6 +61,13 @@ DetectorConstruction::Construct() { ...@@ -60,6 +61,13 @@ DetectorConstruction::Construct() {
false, // no boolean operations false, // no boolean operations
0); // no field specific to volume 0); // no field specific to volume
// =======================================================================
// Associate Fast Simulation Model and Regions
// =======================================================================
for (auto fastsimtool: m_fast_simtools) {
fastsimtool->CreateFastSimulationModel();
}
return physiWorld; return physiWorld;
} }
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include "GaudiKernel/ToolHandle.h" #include "GaudiKernel/ToolHandle.h"
#include "DetSimInterface/IDetElemTool.h" #include "DetSimInterface/IDetElemTool.h"
#include "DetSimInterface/IFastSimG4Tool.h"
#include "globals.hh" #include "globals.hh"
#include "G4VUserDetectorConstruction.hh" #include "G4VUserDetectorConstruction.hh"
...@@ -16,7 +17,8 @@ ...@@ -16,7 +17,8 @@
class DetectorConstruction: public G4VUserDetectorConstruction { class DetectorConstruction: public G4VUserDetectorConstruction {
public: public:
DetectorConstruction(ToolHandle<IDetElemTool>& root_elem); DetectorConstruction(ToolHandle<IDetElemTool>& root_elem,
ToolHandleArray<IFastSimG4Tool>& fast_simtools);
~DetectorConstruction(); ~DetectorConstruction();
public: public:
G4VPhysicalVolume* Construct() override; G4VPhysicalVolume* Construct() override;
...@@ -24,6 +26,7 @@ public: ...@@ -24,6 +26,7 @@ public:
private: private:
ToolHandle<IDetElemTool>& m_root_detelem; ToolHandle<IDetElemTool>& m_root_detelem;
ToolHandleArray<IFastSimG4Tool>& m_fast_simtools;
}; };
#endif #endif
#ifndef IFastSimG4Tool_h
#define IFastSimG4Tool_h
// IFastSimG4Tool is to associate the G4Region and Fast simulation model in G4.
// It is recommended to create one fast simulation model in one tool.
// -- Tao Lin <lintao@ihep.ac.cn>, 7 Dec 2020
#include "GaudiKernel/IAlgTool.h"
class IFastSimG4Tool: virtual public IAlgTool {
public:
DeclareInterfaceID(IFastSimG4Tool, 0, 1);
virtual ~IFastSimG4Tool() {}
// Build the association between G4Region and G4 Fast simulation model
virtual bool CreateFastSimulationModel() = 0;
};
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment