From 640367fb3a0e409b90c32b33317138e4c2fb56d6 Mon Sep 17 00:00:00 2001 From: Chengdong Fu <fucd@ihep.ac.cn> Date: Mon, 25 Oct 2021 11:12:50 +0800 Subject: [PATCH] keep step position for unmerge case --- Simulation/DetSimSD/src/CaloSensitiveDetector.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Simulation/DetSimSD/src/CaloSensitiveDetector.cpp b/Simulation/DetSimSD/src/CaloSensitiveDetector.cpp index 9500a0cc..11fb8cdd 100644 --- a/Simulation/DetSimSD/src/CaloSensitiveDetector.cpp +++ b/Simulation/DetSimSD/src/CaloSensitiveDetector.cpp @@ -52,11 +52,14 @@ CaloSensitiveDetector::ProcessHits(G4Step* step, G4TouchableHistory*) { //G4ThreeVector local(0,0,0); //G4ThreeVector global = h.preTouchable()->GetHistory()->GetTopTransform().InverseTransformPoint(local); //hit = new CalorimeterHit(dd4hep::Position(global.x(), global.y(), global.z())); - dd4hep::Position posCellCenter = getNominalPosition(step, id); - hit = new CalorimeterHit(posCellCenter); + if(m_isMergeEnabled){ + dd4hep::Position posCellCenter = getNominalPosition(step, id); + hit = new CalorimeterHit(posCellCenter); + m_hitMap[id] = hit; + } + else hit = new CalorimeterHit(pos); hit->cellID = id; //getCellID( step ); m_hc->insert(hit); - if(m_isMergeEnabled) m_hitMap[id] = hit; } hit->truth.push_back(contrib); hit->energyDeposit += contrib.deposit; -- GitLab