Skip to content
Snippets Groups Projects
CalorimeterSensDetTool.cpp 1 KiB
Newer Older
lintao@ihep.ac.cn's avatar
lintao@ihep.ac.cn committed
#include "CalorimeterSensDetTool.h"

#include "G4VSensitiveDetector.hh"

#include "DetSimSD/CaloSensitiveDetector.h"

#include "DD4hep/Detector.h"

lintao@ihep.ac.cn's avatar
lintao@ihep.ac.cn committed
DECLARE_COMPONENT(CalorimeterSensDetTool);

StatusCode
CalorimeterSensDetTool::initialize() {
    StatusCode sc;

    m_geosvc = service<IGeomSvc>("GeomSvc");
        error() << "Failed to find GeomSvc." << endmsg;
lintao@ihep.ac.cn's avatar
lintao@ihep.ac.cn committed
    return sc;
}

StatusCode
CalorimeterSensDetTool::finalize() {
    StatusCode sc;

    return sc;
}

G4VSensitiveDetector*
CalorimeterSensDetTool::createSD(const std::string& name) {

    dd4hep::Detector* dd4hep_geo = m_geosvc->lcdd();

    bool is_merge_enabled = true;
    for(auto cal_name : m_listCalsMergeDisable){
	is_merge_enabled = false;
    G4VSensitiveDetector* sd = new CaloSensitiveDetector(name, *dd4hep_geo, is_merge_enabled);
    debug() << name << " set to merge true/false = " << is_merge_enabled << endmsg;