@@ -81,6 +81,7 @@ void Digitizer::init()
8181 }
8282
8383 loadMap (mResolutionMap , digitizerParams.resolutionMapPath , " hResolutionMap" );
84+ prepareScaledResolutionMap ();
8485 if (!mResolutionMap ) {
8586 LOG (info) << " No resolution map loaded, using uniform time resolution: " << digitizerParams.timeResolution * 1e3 << " ps" ;
8687 }
@@ -432,6 +433,33 @@ void Digitizer::loadMap(TH2D*& map, const std::string& path, const char* mapName
432433 }
433434}
434435
436+ void Digitizer::prepareScaledResolutionMap ()
437+ {
438+ if (!mResolutionMap ) {
439+ LOG (warn) << " No resolution map available to prepare scaled resolution map." ;
440+ return ;
441+ }
442+
443+ const auto & digitizerParams = o2::iotof::DPLDigitizerParam::Instance ();
444+ const float nominalTimeResolution = digitizerParams.timeResolution ;
445+ const float minimumResolution = mResolutionMap ->GetMinimum ();
446+ if (minimumResolution <= 0 ) {
447+ LOG (warn) << " Minimum resolution in the map is non-positive, cannot prepare scaled resolution map." ;
448+ return ;
449+ }
450+
451+ mResolutionScalingMap = dynamic_cast <TH2D *>(mResolutionMap ->Clone (" hScaledResolutionMap" ));
452+ mResolutionScalingMap ->SetDirectory (nullptr ); // Detach from file to avoid deletion when file is closed
453+
454+ for (int binX = 1 ; binX <= mResolutionScalingMap ->GetNbinsX (); ++binX) {
455+ for (int binY = 1 ; binY <= mResolutionScalingMap ->GetNbinsY (); ++binY) {
456+ float originalValue = mResolutionScalingMap ->GetBinContent (binX, binY);
457+ float scalingValue = originalValue / minimumResolution;
458+ mResolutionScalingMap ->SetBinContent (binX, binY, scalingValue * nominalTimeResolution);
459+ }
460+ }
461+ }
462+
435463// _______________________________________________________________________
436464bool Digitizer::isEfficient (const float x, const float z) const
437465{
0 commit comments