diff --git a/source/digits_hits/src/GateVirtualSegmentationSD.cc b/source/digits_hits/src/GateVirtualSegmentationSD.cc index 8ee984876..56efaaf4e 100644 --- a/source/digits_hits/src/GateVirtualSegmentationSD.cc +++ b/source/digits_hits/src/GateVirtualSegmentationSD.cc @@ -295,8 +295,6 @@ G4double GateVirtualSegmentationSD::calculatePitch(G4double crystal_size, G4doub double min_diff = 999; int num_pitches = 1; - if (std::fmod(crystal_size, target_pitch) == 0) return target_pitch; - while (true) { double pitch = crystal_size / num_pitches; @@ -334,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"<