diff --git a/Simulation/DetSimSD/src/CaloSensitiveDetector.cpp b/Simulation/DetSimSD/src/CaloSensitiveDetector.cpp index 9500a0cca158a2d95474c2a20dc40c94a262f483..11fb8cddabccf91713e068f0a4396772079ce2c1 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;