diff --git a/source/digits_hits/src/GateVirtualSegmentationSD.cc b/source/digits_hits/src/GateVirtualSegmentationSD.cc index afe840117..56efaaf4e 100644 --- a/source/digits_hits/src/GateVirtualSegmentationSD.cc +++ b/source/digits_hits/src/GateVirtualSegmentationSD.cc @@ -332,8 +332,12 @@ void GateVirtualSegmentationSD::SetVirtualID( int nBins, double pitch, G4double bin = std::floor(pos/pitch+nBins/2.); + if (bin == nBins) bin -=1; + if (bin < 0) bin = 0; m_outputDigi->SetOutputVolumeID(bin,depth); + //std::cout<<"Pos at depth"<