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

WIP: enable the dedx simtool.

parent e36e16f6
No related branches found
No related tags found
No related merge requests found
......@@ -126,6 +126,10 @@ from Configurables import DriftChamberSensDetTool
calo_sensdettool = CalorimeterSensDetTool("CalorimeterSensDetTool")
driftchamber_sensdettool = DriftChamberSensDetTool("DriftChamberSensDetTool")
driftchamber_sensdettool.DedxSimTool = "DummyDedxSimTool"
from Configurables import DummyDedxSimTool
dedx_simtool = DummyDedxSimTool("DummyDedxSimTool")
##############################################################################
# POD I/O
......
......@@ -17,7 +17,7 @@ StatusCode DummyDedxSimTool::finalize() {
}
double DummyDedxSimTool::dedx(const G4Step* aStep) {
double result = 0.0;
double result = aStep->GetTotalEnergyDeposit();
return result;
......
......@@ -17,6 +17,12 @@ StatusCode DriftChamberSensDetTool::initialize() {
return StatusCode::FAILURE;
}
m_dedx_simtool = ToolHandle<IDedxSimTool>(m_dedx_sim_option.value());
if (!m_dedx_simtool) {
error() << "Failed to find dedx simtoo." << endmsg;
return StatusCode::FAILURE;
}
return sc;
}
......@@ -30,7 +36,13 @@ G4VSensitiveDetector*
DriftChamberSensDetTool::createSD(const std::string& name) {
dd4hep::Detector* dd4hep_geo = m_geosvc->lcdd();
G4VSensitiveDetector* sd = new DriftChamberSensitiveDetector(name, *dd4hep_geo);
G4VSensitiveDetector* sd = nullptr;
if (name == "DriftChamber") {
DriftChamberSensitiveDetector* dcsd = new DriftChamberSensitiveDetector(name, *dd4hep_geo);
dcsd->setDedxSimTool(m_dedx_simtool);
}
return sd;
}
......@@ -10,9 +10,12 @@
*/
#include "GaudiKernel/AlgTool.h"
#include "GaudiKernel/ToolHandle.h"
#include "DetSimInterface/ISensDetTool.h"
#include "DetSimInterface/IDedxSimTool.h"
#include "DetInterface/IGeoSvc.h"
class DriftChamberSensDetTool: public extends<AlgTool, ISensDetTool> {
public:
......@@ -30,6 +33,8 @@ private:
// in order to initialize SD, we need to get the lcdd()
SmartIF<IGeoSvc> m_geosvc;
ToolHandle<IDedxSimTool> m_dedx_simtool;
Gaudi::Property<std::string> m_dedx_sim_option{this, "DedxSimTool"};
};
......
......@@ -12,6 +12,12 @@ DriftChamberSensitiveDetector::DriftChamberSensitiveDetector(const std::string&
collectionName.insert(coll_name);
}
bool DriftChamberSensitiveDetector::setDedxSimTool(ToolHandle<IDedxSimTool> simtool) {
m_dedx_simtool = simtool;
return true;
}
void
DriftChamberSensitiveDetector::Initialize(G4HCofThisEvent* HCE) {
......
......@@ -8,6 +8,8 @@
*/
#include "DetSimSD/DDG4SensitiveDetector.h"
#include "DetSimInterface/IDedxSimTool.h"
#include "GaudiKernel/ToolHandle.h"
class DriftChamberSensitiveDetector: public DDG4SensitiveDetector {
public:
......@@ -16,6 +18,8 @@ public:
public:
DriftChamberSensitiveDetector(const std::string& name, dd4hep::Detector& description);
bool setDedxSimTool(ToolHandle<IDedxSimTool>);
public:
// Geant4 interface
......@@ -28,6 +32,9 @@ protected:
HitCollection* m_hc;
// this is passed from SensDetTool
ToolHandle<IDedxSimTool> m_dedx_simtool;
};
#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