@@ -195,23 +195,29 @@ void GateSpatialResolution::Digitize(){
195195 G4double Pz = P.z ();
196196 G4double stddevX, stddevY, stddevZ;
197197
198- if (m_fwhmDistrib2D){
199- if (m_nameAxis.length () != 2 ) {
200- GateError ( " *** ERROR*** GateSpatialResolution::Digitize. There was an attempt to use fwhmDistrib2D but the length of the named axis is not 2!\n " );
201- }
202- else {
203-
204- if (m_nameAxis.find (' X' ) != std::string::npos) stddevX = m_fwhmDistrib2D->Value2D (P.x () * mm, P.y () * mm);
205- else if (fwhmX) stddevX = fwhmX / GateConstants::fwhm_to_sigma;
206-
207- if (m_nameAxis.find (' Y' ) != std::string::npos) stddevY = m_fwhmDistrib2D->Value2D (P.x () * mm, P.y () * mm);
208- else if (fwhmY) stddevY = fwhmY / GateConstants::fwhm_to_sigma;
209-
210- if (m_nameAxis.find (' Z' ) != std::string::npos) stddevZ = m_fwhmDistrib2D->Value2D (P.x () * mm, P.y () * mm);
211- else if (fwhmZ) stddevZ = fwhmZ / GateConstants::fwhm_to_sigma;
212- }
198+ if (m_fwhmDistrib2D) {
199+ if (m_nameAxis.size () != 2 ) {
200+ GateError (" *** ERROR*** GateSpatialResolution::Digitize. "
201+ " Attempt to use fwhmDistrib2D but the length of the named axis is not 2!\n " );
202+ } else {
203+ if (m_nameAxis == " XY" ) {
204+ stddevX = m_fwhmDistrib2D->Value2D (P.x () * mm, P.y () * mm);
205+ stddevY = m_fwhmDistrib2D->Value2D (P.x () * mm, P.y () * mm);
206+ if (fwhmZ) stddevZ = fwhmZ / GateConstants::fwhm_to_sigma;
207+ } else if (m_nameAxis == " XZ" ) {
208+ stddevX = m_fwhmDistrib2D->Value2D (P.x () * mm, P.z () * mm);
209+ stddevZ = m_fwhmDistrib2D->Value2D (P.x () * mm, P.z () * mm);
210+ if (fwhmY) stddevY = fwhmY / GateConstants::fwhm_to_sigma;
211+ } else if (m_nameAxis == " YZ" ) {
212+ stddevY = m_fwhmDistrib2D->Value2D (P.y () * mm, P.z () * mm);
213+ stddevZ = m_fwhmDistrib2D->Value2D (P.y () * mm, P.z () * mm);
214+ if (fwhmX) stddevX = fwhmX / GateConstants::fwhm_to_sigma;
215+ } else {
216+ GateError (" *** ERROR*** GateSpatialResolution::Digitize. "
217+ " Unrecognized axis configuration: " + m_nameAxis + " \n " );
218+ }
219+ }
213220 }
214-
215221 else {
216222
217223 if (m_fwhmXdistrib) stddevX = m_fwhmXdistrib->Value (P.x () * mm);
@@ -220,7 +226,7 @@ void GateSpatialResolution::Digitize(){
220226 if (m_fwhmYdistrib) stddevY = m_fwhmYdistrib->Value (P.y () * mm);
221227 else if (fwhmY) stddevY = fwhmY / GateConstants::fwhm_to_sigma;
222228
223- if (m_fwhmZdistrib) stddevZ = fwhmZ / GateConstants::fwhm_to_sigma; // TODO! stddevZ = m_fwhmZdistrib->Value(P.z() * mm);
229+ if (m_fwhmZdistrib) stddevZ = m_fwhmZdistrib->Value (P.z () * mm);
224230 else if (fwhmZ) stddevZ = fwhmZ / GateConstants::fwhm_to_sigma;
225231
226232 }
0 commit comments