Skip to content

Commit 6715407

Browse files
precompute the resolution map based on input and configured resolution value
1 parent 676caa8 commit 6715407

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

‎Detectors/Upgrades/ALICE3/IOTOF/simulation/include/IOTOFSimulation/Digitizer.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ class Digitizer : public TObject
9595
/// \param mapName Name of the histogram inside the ROOT file (ignored for CCDB)
9696
void loadMap(TH2D*& map, const std::string& path, const char* mapName);
9797

98+
void prepareScaledResolutionMap();
99+
98100
/// Check if the hit passes efficiency cut
99101
/// \param x Detector local coordinate x in cm with respect to the center of the sensitive volume.
100102
/// \param z Detector local coordinate z in cm with respect to the center of the sensitive volume.
@@ -120,6 +122,7 @@ class Digitizer : public TObject
120122
const o2::iotof::GeometryTGeo* mGeometry = nullptr; ///< IOTOF geometry
121123
TH2D* mEfficiencyMap = nullptr; ///< Efficiency map for the detector
122124
TH2D* mResolutionMap = nullptr; ///< Resolution map for the detector
125+
TH2D* mSaledResolutionMap = nullptr; ///< Scaled resolution map for the detector
123126
TH2D* mTimeOfArrivalMap = nullptr; ///< Time of arrival map for the detector
124127

125128
std::vector<o2::iotof::Chip> mChips; //! Chips in the detector, indexed by chip ID

‎Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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
//_______________________________________________________________________
436464
bool Digitizer::isEfficient(const float x, const float z) const
437465
{

0 commit comments

Comments
 (0)