From 5e8a3a72c42f232fc14f993a11431d542d4606c6 Mon Sep 17 00:00:00 2001 From: GiorgioAlbertoLucia Date: Mon, 21 Sep 2026 12:04:55 +0200 Subject: [PATCH 01/13] merge files --- .../ALICE3/IOTOF/simulation/src/Digitizer.cxx | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx b/Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx index c56e97435db06..b3495e7eb011c 100644 --- a/Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx +++ b/Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx @@ -103,7 +103,6 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, int evID, int srcID) { LOG(debug) << "\nProcessing hit with detector ID: " << hit.GetDetectorID() << ", track ID: " << hit.GetTrackID() << ", energy loss: " << hit.GetEnergyLoss() << " GeV, time: " << hit.GetTime() * sec2ns << " ns"; // Process a single hit and create a digit if it passes all cuts - // Get detector element ID const int chipID = hit.GetDetectorID(); if (chipID < 0 || chipID >= mGeometry->getSize() || mGeometry->getSize() < 1) { @@ -117,6 +116,26 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, int evID, int srcID) LOG(debug) << "Hit rejected because chip " << chipID << " is disabled"; return; } + + // middle position of the hit in the sensor frame + const auto& matrix = mGeometry->getMatrixL2G(chipID); + auto xyzPositionStart = matrix ^ hit.GetPosStart(); + auto xyzPositionEnd = matrix ^ hit.GetPos(); + const auto xMid = 0.5f * (xyzPositionStart.X() + xyzPositionEnd.X()); + const auto zMid = 0.5f * (xyzPositionStart.Z() + xyzPositionEnd.Z()); + // move this to the local pixel coordinates for the efficiency map + int row, col; + float xPixelCenter, zPixelCenter; + if (!sSegmentation->localToDetector(xMid, zMid, row, col, mGeometry->getIOTOFLayer(chipID))) { + LOG(debug) << "Hit rejected because position (" << xMid << ", " << zMid << ") is outside the active area of chip " << chipID; + return; // hit is outside the active area + } + sSegmentation->detectorToLocalUnchecked(row, col, xPixelCenter, zPixelCenter, mGeometry->getIOTOFLayer(chipID)); + + if (!isEfficient(xMid - xPixelCenter, zMid - zPixelCenter)) { + LOG(debug) << "Hit rejected by efficiency cut"; + return; + } // Convert energy loss to charge (number of electrons) float energyLoss = hit.GetEnergyLoss(); // in GeV From 5b8b0e926caa387b7996402837af5c4db9b1ce5a Mon Sep 17 00:00:00 2001 From: GiorgioAlbertoLucia Date: Fri, 11 Sep 2026 10:17:00 +0200 Subject: [PATCH 02/13] change binning of the histograms --- Detectors/Upgrades/ALICE3/IOTOF/macros/CheckDigitsIOTOF.C | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Detectors/Upgrades/ALICE3/IOTOF/macros/CheckDigitsIOTOF.C b/Detectors/Upgrades/ALICE3/IOTOF/macros/CheckDigitsIOTOF.C index f2631fc826292..62f8d1d12f1ce 100644 --- a/Detectors/Upgrades/ALICE3/IOTOF/macros/CheckDigitsIOTOF.C +++ b/Detectors/Upgrades/ALICE3/IOTOF/macros/CheckDigitsIOTOF.C @@ -264,14 +264,14 @@ void CheckDigitsIOTOF(std::string digifile = "tf3digits.root", std::string hitfi auto canvdXdZ = new TCanvas("canvdXdZ", "", 1600, 800); canvdXdZ->Divide(2, 1); canvdXdZ->cd(1); - nt->Draw(Form("dx:dz>>h_dx_vs_dz_ITOF(600, -%f, %f, 600, -%f, %f)", canvaEdgeRow, canvaEdgeCol, canvaEdgeRow, canvaEdgeCol), "id >= 0 && id < 1920", "colz"); - addTLines(chipInfo.PitchRow, chipInfo.PitchCol); + nt->Draw("dx:dz>>h_dx_vs_dz_ITOF(150, -0.03, 0.03, 150, -0.03, 0.03)", "id >= 0 && id < 1920", "colz"); + addTLines(0.01); auto h = (TH2F*)gPad->GetPrimitive("h_dx_vs_dz_ITOF"); Info("ITOF", "RMS(dx)=%.1f mu", h->GetRMS(2) * 1e4); Info("ITOF", "RMS(dz)=%.1f mu", h->GetRMS(1) * 1e4); canvdXdZ->cd(2); - nt->Draw(Form("dx:dz>>h_dx_vs_dz_OTOF(600, -%f, %f, 600, -%f, %f)", canvaEdgeRow, canvaEdgeCol, canvaEdgeRow, canvaEdgeCol), "id >= 1920 && id < 55488", "colz"); - addTLines(chipInfo.PitchRow, chipInfo.PitchCol); + nt->Draw("dx:dz>>h_dx_vs_dz_OTOF(150, -0.03, 0.03, 150, -0.03, 0.03)", "id >= 1920 && id < 55488", "colz"); + addTLines(0.01); h = (TH2F*)gPad->GetPrimitive("h_dx_vs_dz_OTOF"); Info("OTOF", "RMS(dx)=%.1f mu", h->GetRMS(2) * 1e4); Info("OTOF", "RMS(dz)=%.1f mu", h->GetRMS(1) * 1e4); From 0c9ce2327d1fe66a6ab6dfdb437c6f9a6724344f Mon Sep 17 00:00:00 2001 From: GiorgioAlbertoLucia Date: Fri, 11 Sep 2026 10:24:40 +0200 Subject: [PATCH 03/13] clang-format --- .../Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx b/Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx index b3495e7eb011c..b46928bc77729 100644 --- a/Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx +++ b/Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx @@ -103,6 +103,10 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, int evID, int srcID) { LOG(debug) << "\nProcessing hit with detector ID: " << hit.GetDetectorID() << ", track ID: " << hit.GetTrackID() << ", energy loss: " << hit.GetEnergyLoss() << " GeV, time: " << hit.GetTime() * sec2ns << " ns"; // Process a single hit and create a digit if it passes all cuts +<<<<<<< HEAD +======= + +>>>>>>> b8b8f45953 (clang-format) // Get detector element ID const int chipID = hit.GetDetectorID(); if (chipID < 0 || chipID >= mGeometry->getSize() || mGeometry->getSize() < 1) { @@ -116,7 +120,7 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, int evID, int srcID) LOG(debug) << "Hit rejected because chip " << chipID << " is disabled"; return; } - + // middle position of the hit in the sensor frame const auto& matrix = mGeometry->getMatrixL2G(chipID); auto xyzPositionStart = matrix ^ hit.GetPosStart(); From 8eb118bbbe41e6e1e3fc6622b702c60e6ab7a542 Mon Sep 17 00:00:00 2001 From: GiorgioAlbertoLucia Date: Fri, 11 Sep 2026 11:15:32 +0200 Subject: [PATCH 04/13] revert size of the histograms --- Detectors/Upgrades/ALICE3/IOTOF/macros/CheckDigitsIOTOF.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Detectors/Upgrades/ALICE3/IOTOF/macros/CheckDigitsIOTOF.C b/Detectors/Upgrades/ALICE3/IOTOF/macros/CheckDigitsIOTOF.C index 62f8d1d12f1ce..0712eb3247729 100644 --- a/Detectors/Upgrades/ALICE3/IOTOF/macros/CheckDigitsIOTOF.C +++ b/Detectors/Upgrades/ALICE3/IOTOF/macros/CheckDigitsIOTOF.C @@ -264,13 +264,13 @@ void CheckDigitsIOTOF(std::string digifile = "tf3digits.root", std::string hitfi auto canvdXdZ = new TCanvas("canvdXdZ", "", 1600, 800); canvdXdZ->Divide(2, 1); canvdXdZ->cd(1); - nt->Draw("dx:dz>>h_dx_vs_dz_ITOF(150, -0.03, 0.03, 150, -0.03, 0.03)", "id >= 0 && id < 1920", "colz"); + nt->Draw("dx:dz>>h_dx_vs_dz_ITOF(600, -0.03, 0.03, 600, -0.03, 0.03)", "id >= 0 && id < 1920", "colz"); addTLines(0.01); auto h = (TH2F*)gPad->GetPrimitive("h_dx_vs_dz_ITOF"); Info("ITOF", "RMS(dx)=%.1f mu", h->GetRMS(2) * 1e4); Info("ITOF", "RMS(dz)=%.1f mu", h->GetRMS(1) * 1e4); canvdXdZ->cd(2); - nt->Draw("dx:dz>>h_dx_vs_dz_OTOF(150, -0.03, 0.03, 150, -0.03, 0.03)", "id >= 1920 && id < 55488", "colz"); + nt->Draw("dx:dz>>h_dx_vs_dz_OTOF(600, -0.03, 0.03, 600, -0.03, 0.03)", "id >= 1920 && id < 55488", "colz"); addTLines(0.01); h = (TH2F*)gPad->GetPrimitive("h_dx_vs_dz_OTOF"); Info("OTOF", "RMS(dx)=%.1f mu", h->GetRMS(2) * 1e4); From f6d9ce3dec0de84146ff5a45b0a7ac6a418739cd Mon Sep 17 00:00:00 2001 From: GiorgioAlbertoLucia Date: Mon, 21 Sep 2026 12:01:28 +0200 Subject: [PATCH 05/13] fetch efficiency map for iotof from ccdb --- .../IOTOFSimulation/DPLDigitizerParam.h | 2 + .../include/IOTOFSimulation/Digitizer.h | 1 + .../ALICE3/IOTOF/simulation/src/Digitizer.cxx | 37 ++++++++++++++++--- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/Detectors/Upgrades/ALICE3/IOTOF/simulation/include/IOTOFSimulation/DPLDigitizerParam.h b/Detectors/Upgrades/ALICE3/IOTOF/simulation/include/IOTOFSimulation/DPLDigitizerParam.h index 7f96b8e509d0c..eb9ba50afc8d2 100644 --- a/Detectors/Upgrades/ALICE3/IOTOF/simulation/include/IOTOFSimulation/DPLDigitizerParam.h +++ b/Detectors/Upgrades/ALICE3/IOTOF/simulation/include/IOTOFSimulation/DPLDigitizerParam.h @@ -32,6 +32,8 @@ struct DPLDigitizerParam : public o2::conf::ConfigurableParamHelper #include "IOTOFSimulation/Digitizer.h" #include "IOTOFSimulation/DPLDigitizerParam.h" #include "DetectorsRaw/HBFUtils.h" @@ -54,17 +55,24 @@ void Digitizer::init() /// mChips[i].setDeadChanMap(mDeadChanMap); /// } } - + const auto& digitizerParams = o2::iotof::DPLDigitizerParam::Instance(); - if (!digitizerParams.efficiencyFilePath.empty()) { - loadEfficiencyMap(digitizerParams.efficiencyFilePath); - } LOG(info) << "Initializing IOTOF digitizer"; LOG(info) << " Time resolution: " << digitizerParams.timeResolution * 1e3 << " ps"; LOG(info) << " Charge threshold: " << digitizerParams.chargeThreshold << " electrons"; - LOG(info) << " Detection efficiency: " << digitizerParams.efficiency * 100 << " %"; LOG(info) << " Continuous mode: " << (mContinuous ? "ON" : "OFF"); + + if (!digitizerParams.efficiencyCcdbPath.empty()) { + LOG(info) << "Loading efficiency map from CCDB path: " << digitizerParams.efficiencyCcdbPath; + loadEfficiencyMapFromCCDB(digitizerParams.efficiencyCcdbPath); + } else if (!digitizerParams.efficiencyFilePath.empty()) { + LOG(info) << "Loading efficiency map from file: " << digitizerParams.efficiencyFilePath; + loadEfficiencyMap(digitizerParams.efficiencyFilePath); + } else { + LOG(info) << "No efficiency map provided, using uniform efficiency: " << digitizerParams.efficiency * 100 << " %"; + } + sSegmentation = o2::iotof::Segmentation::Instance(); } @@ -387,6 +395,25 @@ void Digitizer::loadEfficiencyMap(const std::string& filePath) file->Close(); } +//_______________________________________________________________________ +void Digitizer::loadEfficiencyMapFromCCDB(const std::string& ccdbPath) +{ + // Load the efficiency map from CCDB + auto rawMap = o2::ccdb::BasicCCDBManager::instance().get(ccdbPath); + if (!rawMap) { + LOG(error) << "Failed to retrieve efficiency map from CCDB path: " << ccdbPath; + return; + } else { + LOG(info) << "Successfully retrieved efficiency map from CCDB path: " << ccdbPath; + LOG(info) << "Efficiency map dimensions: " << rawMap->GetNbinsX() << " x " << rawMap->GetNbinsY(); + } + + mEfficiencyMap = dynamic_cast(rawMap->Clone("mEfficiencyMap")); + mEfficiencyMap->SetDirectory(nullptr); // Detach from file to avoid deletion when file is closed + + LOG(info) << "Successfully loaded efficiency map from CCDB path: " << ccdbPath; +} + //_______________________________________________________________________ bool Digitizer::isEfficient(const float x, const float z) const { From 955dd92705274f87ac320cbdf76bf84973c8ab95 Mon Sep 17 00:00:00 2001 From: GiorgioAlbertoLucia Date: Thu, 1 Oct 2026 15:12:48 +0200 Subject: [PATCH 06/13] add efficiency map from ccdb --- .../ALICE3/IOTOF/simulation/src/Digitizer.cxx | 33 +++---------------- 1 file changed, 5 insertions(+), 28 deletions(-) diff --git a/Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx b/Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx index 5389fc81be8b9..6eaa61f617af1 100644 --- a/Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx +++ b/Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx @@ -16,10 +16,10 @@ /// \since 2026-03-17 /// -#include #include "IOTOFSimulation/Digitizer.h" #include "IOTOFSimulation/DPLDigitizerParam.h" #include "DetectorsRaw/HBFUtils.h" +#include "CCDB/BasicCCDBManager.h" #include #include @@ -55,16 +55,16 @@ void Digitizer::init() /// mChips[i].setDeadChanMap(mDeadChanMap); /// } } - - const auto& digitizerParams = o2::iotof::DPLDigitizerParam::Instance(); + const auto& digitizerParams = o2::iotof::DPLDigitizerParam::Instance(); + LOG(info) << "Initializing IOTOF digitizer"; LOG(info) << " Time resolution: " << digitizerParams.timeResolution * 1e3 << " ps"; LOG(info) << " Charge threshold: " << digitizerParams.chargeThreshold << " electrons"; LOG(info) << " Continuous mode: " << (mContinuous ? "ON" : "OFF"); if (!digitizerParams.efficiencyCcdbPath.empty()) { - LOG(info) << "Loading efficiency map from CCDB path: " << digitizerParams.efficiencyCcdbPath; + LOG(info) << "Loading efficiency map from CCDB: " << digitizerParams.efficiencyCcdbPath; loadEfficiencyMapFromCCDB(digitizerParams.efficiencyCcdbPath); } else if (!digitizerParams.efficiencyFilePath.empty()) { LOG(info) << "Loading efficiency map from file: " << digitizerParams.efficiencyFilePath; @@ -111,10 +111,7 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, int evID, int srcID) { LOG(debug) << "\nProcessing hit with detector ID: " << hit.GetDetectorID() << ", track ID: " << hit.GetTrackID() << ", energy loss: " << hit.GetEnergyLoss() << " GeV, time: " << hit.GetTime() * sec2ns << " ns"; // Process a single hit and create a digit if it passes all cuts -<<<<<<< HEAD -======= ->>>>>>> b8b8f45953 (clang-format) // Get detector element ID const int chipID = hit.GetDetectorID(); if (chipID < 0 || chipID >= mGeometry->getSize() || mGeometry->getSize() < 1) { @@ -129,26 +126,6 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, int evID, int srcID) return; } - // middle position of the hit in the sensor frame - const auto& matrix = mGeometry->getMatrixL2G(chipID); - auto xyzPositionStart = matrix ^ hit.GetPosStart(); - auto xyzPositionEnd = matrix ^ hit.GetPos(); - const auto xMid = 0.5f * (xyzPositionStart.X() + xyzPositionEnd.X()); - const auto zMid = 0.5f * (xyzPositionStart.Z() + xyzPositionEnd.Z()); - // move this to the local pixel coordinates for the efficiency map - int row, col; - float xPixelCenter, zPixelCenter; - if (!sSegmentation->localToDetector(xMid, zMid, row, col, mGeometry->getIOTOFLayer(chipID))) { - LOG(debug) << "Hit rejected because position (" << xMid << ", " << zMid << ") is outside the active area of chip " << chipID; - return; // hit is outside the active area - } - sSegmentation->detectorToLocalUnchecked(row, col, xPixelCenter, zPixelCenter, mGeometry->getIOTOFLayer(chipID)); - - if (!isEfficient(xMid - xPixelCenter, zMid - zPixelCenter)) { - LOG(debug) << "Hit rejected by efficiency cut"; - return; - } - // Convert energy loss to charge (number of electrons) float energyLoss = hit.GetEnergyLoss(); // in GeV int charge = energyToCharge(energyLoss); @@ -395,11 +372,11 @@ void Digitizer::loadEfficiencyMap(const std::string& filePath) file->Close(); } -//_______________________________________________________________________ void Digitizer::loadEfficiencyMapFromCCDB(const std::string& ccdbPath) { // Load the efficiency map from CCDB auto rawMap = o2::ccdb::BasicCCDBManager::instance().get(ccdbPath); + if (!rawMap) { LOG(error) << "Failed to retrieve efficiency map from CCDB path: " << ccdbPath; return; From 63a861ae7255ed95e915687f183208dbd490bfd2 Mon Sep 17 00:00:00 2001 From: GiorgioAlbertoLucia Date: Thu, 1 Oct 2026 15:15:01 +0200 Subject: [PATCH 07/13] clang format --- .../Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx b/Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx index 6eaa61f617af1..20160972d3b7e 100644 --- a/Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx +++ b/Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx @@ -57,12 +57,12 @@ void Digitizer::init() } const auto& digitizerParams = o2::iotof::DPLDigitizerParam::Instance(); - + LOG(info) << "Initializing IOTOF digitizer"; LOG(info) << " Time resolution: " << digitizerParams.timeResolution * 1e3 << " ps"; LOG(info) << " Charge threshold: " << digitizerParams.chargeThreshold << " electrons"; LOG(info) << " Continuous mode: " << (mContinuous ? "ON" : "OFF"); - + if (!digitizerParams.efficiencyCcdbPath.empty()) { LOG(info) << "Loading efficiency map from CCDB: " << digitizerParams.efficiencyCcdbPath; loadEfficiencyMapFromCCDB(digitizerParams.efficiencyCcdbPath); @@ -372,7 +372,7 @@ void Digitizer::loadEfficiencyMap(const std::string& filePath) file->Close(); } -void Digitizer::loadEfficiencyMapFromCCDB(const std::string& ccdbPath) +void Digitizer::loadEfficiencyMapFromCCDB(const std::string& ccdbPath) { // Load the efficiency map from CCDB auto rawMap = o2::ccdb::BasicCCDBManager::instance().get(ccdbPath); @@ -384,7 +384,7 @@ void Digitizer::loadEfficiencyMapFromCCDB(const std::string& ccdbPath) LOG(info) << "Successfully retrieved efficiency map from CCDB path: " << ccdbPath; LOG(info) << "Efficiency map dimensions: " << rawMap->GetNbinsX() << " x " << rawMap->GetNbinsY(); } - + mEfficiencyMap = dynamic_cast(rawMap->Clone("mEfficiencyMap")); mEfficiencyMap->SetDirectory(nullptr); // Detach from file to avoid deletion when file is closed From 123e6e75888fd1c49afdffa0bf5eea5cdb20efca Mon Sep 17 00:00:00 2001 From: GiorgioAlbertoLucia Date: Thu, 1 Oct 2026 15:21:41 +0200 Subject: [PATCH 08/13] revert to original --- Detectors/Upgrades/ALICE3/IOTOF/macros/CheckDigitsIOTOF.C | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Detectors/Upgrades/ALICE3/IOTOF/macros/CheckDigitsIOTOF.C b/Detectors/Upgrades/ALICE3/IOTOF/macros/CheckDigitsIOTOF.C index 0712eb3247729..f2631fc826292 100644 --- a/Detectors/Upgrades/ALICE3/IOTOF/macros/CheckDigitsIOTOF.C +++ b/Detectors/Upgrades/ALICE3/IOTOF/macros/CheckDigitsIOTOF.C @@ -264,14 +264,14 @@ void CheckDigitsIOTOF(std::string digifile = "tf3digits.root", std::string hitfi auto canvdXdZ = new TCanvas("canvdXdZ", "", 1600, 800); canvdXdZ->Divide(2, 1); canvdXdZ->cd(1); - nt->Draw("dx:dz>>h_dx_vs_dz_ITOF(600, -0.03, 0.03, 600, -0.03, 0.03)", "id >= 0 && id < 1920", "colz"); - addTLines(0.01); + nt->Draw(Form("dx:dz>>h_dx_vs_dz_ITOF(600, -%f, %f, 600, -%f, %f)", canvaEdgeRow, canvaEdgeCol, canvaEdgeRow, canvaEdgeCol), "id >= 0 && id < 1920", "colz"); + addTLines(chipInfo.PitchRow, chipInfo.PitchCol); auto h = (TH2F*)gPad->GetPrimitive("h_dx_vs_dz_ITOF"); Info("ITOF", "RMS(dx)=%.1f mu", h->GetRMS(2) * 1e4); Info("ITOF", "RMS(dz)=%.1f mu", h->GetRMS(1) * 1e4); canvdXdZ->cd(2); - nt->Draw("dx:dz>>h_dx_vs_dz_OTOF(600, -0.03, 0.03, 600, -0.03, 0.03)", "id >= 1920 && id < 55488", "colz"); - addTLines(0.01); + nt->Draw(Form("dx:dz>>h_dx_vs_dz_OTOF(600, -%f, %f, 600, -%f, %f)", canvaEdgeRow, canvaEdgeCol, canvaEdgeRow, canvaEdgeCol), "id >= 1920 && id < 55488", "colz"); + addTLines(chipInfo.PitchRow, chipInfo.PitchCol); h = (TH2F*)gPad->GetPrimitive("h_dx_vs_dz_OTOF"); Info("OTOF", "RMS(dx)=%.1f mu", h->GetRMS(2) * 1e4); Info("OTOF", "RMS(dz)=%.1f mu", h->GetRMS(1) * 1e4); From 86df8d0065488c4c1de74412b71881a60427be05 Mon Sep 17 00:00:00 2001 From: GiorgioAlbertoLucia Date: Thu, 1 Oct 2026 17:24:03 +0200 Subject: [PATCH 09/13] remove deprecated efficiency loader --- .../IOTOFSimulation/DPLDigitizerParam.h | 2 -- .../include/IOTOFSimulation/Digitizer.h | 1 - .../ALICE3/IOTOF/simulation/src/Digitizer.cxx | 29 ------------------- 3 files changed, 32 deletions(-) diff --git a/Detectors/Upgrades/ALICE3/IOTOF/simulation/include/IOTOFSimulation/DPLDigitizerParam.h b/Detectors/Upgrades/ALICE3/IOTOF/simulation/include/IOTOFSimulation/DPLDigitizerParam.h index eb9ba50afc8d2..8e23a4e3e153d 100644 --- a/Detectors/Upgrades/ALICE3/IOTOF/simulation/include/IOTOFSimulation/DPLDigitizerParam.h +++ b/Detectors/Upgrades/ALICE3/IOTOF/simulation/include/IOTOFSimulation/DPLDigitizerParam.h @@ -30,8 +30,6 @@ struct DPLDigitizerParam : public o2::conf::ConfigurableParamHelperIsOpen()) { - LOG(error) << "Failed to open efficiency map file: " << filePath; - return; - } - - auto* rawMap = dynamic_cast(file->Get("hEfficiencyMap")); - if (!rawMap) { - LOG(error) << "Failed to retrieve efficiency map from file: " << filePath; - LOG(error) << "Available keys in the file:"; - TIter next(file->GetListOfKeys()); - TKey* key; - while ((key = dynamic_cast(next()))) { - LOG(error) << " " << key->GetName() << " (" << key->GetClassName() << ")"; - } - file->Close(); - return; - } - mEfficiencyMap = dynamic_cast(rawMap->Clone("mEfficiencyMap")); - mEfficiencyMap->SetDirectory(nullptr); // Detach from file to avoid deletion when file is closed - - file->Close(); -} void Digitizer::loadEfficiencyMapFromCCDB(const std::string& ccdbPath) { From 9736bff1bec2ba97d7bba6ae91fd95eafbd37920 Mon Sep 17 00:00:00 2001 From: GiorgioAlbertoLucia Date: Fri, 2 Oct 2026 16:26:06 +0200 Subject: [PATCH 10/13] keep inclusion of efficiency file direct loading --- .../IOTOFSimulation/DPLDigitizerParam.h | 2 ++ .../include/IOTOFSimulation/Digitizer.h | 1 + .../ALICE3/IOTOF/simulation/src/Digitizer.cxx | 30 +++++++++++++++++++ 3 files changed, 33 insertions(+) diff --git a/Detectors/Upgrades/ALICE3/IOTOF/simulation/include/IOTOFSimulation/DPLDigitizerParam.h b/Detectors/Upgrades/ALICE3/IOTOF/simulation/include/IOTOFSimulation/DPLDigitizerParam.h index 8e23a4e3e153d..eb9ba50afc8d2 100644 --- a/Detectors/Upgrades/ALICE3/IOTOF/simulation/include/IOTOFSimulation/DPLDigitizerParam.h +++ b/Detectors/Upgrades/ALICE3/IOTOF/simulation/include/IOTOFSimulation/DPLDigitizerParam.h @@ -30,6 +30,8 @@ struct DPLDigitizerParam : public o2::conf::ConfigurableParamHelperIsOpen()) { + LOG(error) << "Failed to open efficiency map file: " << filePath; + return; + } + + auto* rawMap = dynamic_cast(file->Get("hEfficiencyMap")); + if (!rawMap) { + LOG(error) << "Failed to retrieve efficiency map from file: " << filePath; + LOG(error) << "Available keys in the file:"; + TIter next(file->GetListOfKeys()); + TKey* key; + while ((key = dynamic_cast(next()))) { + LOG(error) << " " << key->GetName() << " (" << key->GetClassName() << ")"; + } + file->Close(); + return; + } + mEfficiencyMap = dynamic_cast(rawMap->Clone("mEfficiencyMap")); + mEfficiencyMap->SetDirectory(nullptr); // Detach from file to avoid deletion when file is closed + + file->Close(); +} + void Digitizer::loadEfficiencyMapFromCCDB(const std::string& ccdbPath) { // Load the efficiency map from CCDB From e1fa1796d0f626e659466173ae240efbe9222f26 Mon Sep 17 00:00:00 2001 From: GiorgioAlbertoLucia Date: Fri, 2 Oct 2026 16:38:16 +0200 Subject: [PATCH 11/13] make the map loading funciton generic --- .../include/IOTOFSimulation/Digitizer.h | 6 ++++-- .../ALICE3/IOTOF/simulation/src/Digitizer.cxx | 16 ++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Detectors/Upgrades/ALICE3/IOTOF/simulation/include/IOTOFSimulation/Digitizer.h b/Detectors/Upgrades/ALICE3/IOTOF/simulation/include/IOTOFSimulation/Digitizer.h index c9dd01187950a..3f175169e8617 100644 --- a/Detectors/Upgrades/ALICE3/IOTOF/simulation/include/IOTOFSimulation/Digitizer.h +++ b/Detectors/Upgrades/ALICE3/IOTOF/simulation/include/IOTOFSimulation/Digitizer.h @@ -92,8 +92,8 @@ class Digitizer : public TObject int energyToCharge(float energyLoss) const; /// Load the efficiency map from a file - void loadEfficiencyMap(const std::string& filePath); - void loadEfficiencyMapFromCCDB(const std::string& ccdbPath); + void loadMap(TH2* map, const std::string& filePath, const char* mapName); + void loadMapFromCCDB(TH2* map, const std::string& ccdbPath, const char* mapName); /// Check if the hit passes efficiency cut /// \param x Detector local coordinate x in cm with respect to the center of the sensitive volume. @@ -119,6 +119,8 @@ class Digitizer : public TObject const o2::iotof::GeometryTGeo* mGeometry = nullptr; ///< IOTOF geometry TH2D* mEfficiencyMap = nullptr; ///< Efficiency map for the detector + TH2D* mResolutionMap = nullptr; ///< Resolution map for the detector + TH2D* mTimeOfArrivalMap = nullptr; ///< Time of arrival map for the detector std::vector mChips; //! Chips in the detector, indexed by chip ID std::deque>> mExtraLabelBuffer; //! buffer for multiple mc labels to the same pixel diff --git a/Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx b/Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx index 51261c73443c0..7761d0d2b7edf 100644 --- a/Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx +++ b/Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx @@ -65,10 +65,10 @@ void Digitizer::init() if (!digitizerParams.efficiencyCcdbPath.empty()) { LOG(info) << "Loading efficiency map from CCDB: " << digitizerParams.efficiencyCcdbPath; - loadEfficiencyMapFromCCDB(digitizerParams.efficiencyCcdbPath); + loadMapFromCCDB(mEfficiencyMap, digitizerParams.efficiencyCcdbPath, "mEfficiencyMap"); } else if (!digitizerParams.efficiencyFilePath.empty()) { LOG(info) << "Loading efficiency map from file: " << digitizerParams.efficiencyFilePath; - loadEfficiencyMap(digitizerParams.efficiencyFilePath); + loadMap(mEfficiencyMap, digitizerParams.efficiencyFilePath, "mEfficiencyMap"); } else { LOG(info) << "No efficiency map provided, using uniform efficiency: " << digitizerParams.efficiency * 100 << " %"; } @@ -346,7 +346,7 @@ int Digitizer::energyToCharge(float energyLoss) const //_______________________________________________________________________ -void Digitizer::loadEfficiencyMap(const std::string& filePath) +void Digitizer::loadMap(TH1D* map, const std::string& filePath, const char* mapName) { // Load the efficiency map from a file TFile* file = TFile::Open(filePath.c_str()); @@ -367,13 +367,13 @@ void Digitizer::loadEfficiencyMap(const std::string& filePath) file->Close(); return; } - mEfficiencyMap = dynamic_cast(rawMap->Clone("mEfficiencyMap")); - mEfficiencyMap->SetDirectory(nullptr); // Detach from file to avoid deletion when file is closed + map = dynamic_cast(rawMap->Clone(mapName)); + map->SetDirectory(nullptr); // Detach from file to avoid deletion when file is closed file->Close(); } -void Digitizer::loadEfficiencyMapFromCCDB(const std::string& ccdbPath) +void Digitizer::loadMapFromCCDB(TH1D* map, const std::string& ccdbPath, const char* mapName) { // Load the efficiency map from CCDB auto rawMap = o2::ccdb::BasicCCDBManager::instance().get(ccdbPath); @@ -386,8 +386,8 @@ void Digitizer::loadEfficiencyMapFromCCDB(const std::string& ccdbPath) LOG(info) << "Efficiency map dimensions: " << rawMap->GetNbinsX() << " x " << rawMap->GetNbinsY(); } - mEfficiencyMap = dynamic_cast(rawMap->Clone("mEfficiencyMap")); - mEfficiencyMap->SetDirectory(nullptr); // Detach from file to avoid deletion when file is closed + map = dynamic_cast(rawMap->Clone(mapName)); + map->SetDirectory(nullptr); // Detach from file to avoid deletion when file is closed LOG(info) << "Successfully loaded efficiency map from CCDB path: " << ccdbPath; } From 2503e9adccf8543033a88fc5227b39dfcbf86a92 Mon Sep 17 00:00:00 2001 From: GiorgioAlbertoLucia Date: Mon, 5 Oct 2026 10:03:23 +0200 Subject: [PATCH 12/13] fix syntax to load generic map --- .../ALICE3/IOTOF/simulation/src/Digitizer.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx b/Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx index 7761d0d2b7edf..b655ffa7f512f 100644 --- a/Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx +++ b/Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx @@ -65,10 +65,10 @@ void Digitizer::init() if (!digitizerParams.efficiencyCcdbPath.empty()) { LOG(info) << "Loading efficiency map from CCDB: " << digitizerParams.efficiencyCcdbPath; - loadMapFromCCDB(mEfficiencyMap, digitizerParams.efficiencyCcdbPath, "mEfficiencyMap"); + loadMapFromCCDB(mEfficiencyMap, digitizerParams.efficiencyCcdbPath); } else if (!digitizerParams.efficiencyFilePath.empty()) { LOG(info) << "Loading efficiency map from file: " << digitizerParams.efficiencyFilePath; - loadMap(mEfficiencyMap, digitizerParams.efficiencyFilePath, "mEfficiencyMap"); + loadMap(mEfficiencyMap, digitizerParams.efficiencyFilePath, "hEfficiencyMap"); } else { LOG(info) << "No efficiency map provided, using uniform efficiency: " << digitizerParams.efficiency * 100 << " %"; } @@ -355,7 +355,7 @@ void Digitizer::loadMap(TH1D* map, const std::string& filePath, const char* mapN return; } - auto* rawMap = dynamic_cast(file->Get("hEfficiencyMap")); + auto* rawMap = dynamic_cast(file->Get(mapName)); if (!rawMap) { LOG(error) << "Failed to retrieve efficiency map from file: " << filePath; LOG(error) << "Available keys in the file:"; @@ -367,13 +367,13 @@ void Digitizer::loadMap(TH1D* map, const std::string& filePath, const char* mapN file->Close(); return; } - map = dynamic_cast(rawMap->Clone(mapName)); + map = dynamic_cast(rawMap->Clone()); map->SetDirectory(nullptr); // Detach from file to avoid deletion when file is closed file->Close(); } -void Digitizer::loadMapFromCCDB(TH1D* map, const std::string& ccdbPath, const char* mapName) +void Digitizer::loadMapFromCCDB(TH1D* map, const std::string& ccdbPath) { // Load the efficiency map from CCDB auto rawMap = o2::ccdb::BasicCCDBManager::instance().get(ccdbPath); @@ -386,7 +386,7 @@ void Digitizer::loadMapFromCCDB(TH1D* map, const std::string& ccdbPath, const ch LOG(info) << "Efficiency map dimensions: " << rawMap->GetNbinsX() << " x " << rawMap->GetNbinsY(); } - map = dynamic_cast(rawMap->Clone(mapName)); + map = dynamic_cast(rawMap->Clone()); map->SetDirectory(nullptr); // Detach from file to avoid deletion when file is closed LOG(info) << "Successfully loaded efficiency map from CCDB path: " << ccdbPath; From 42f544b96978aafad5d36f717f7529fbe9066a27 Mon Sep 17 00:00:00 2001 From: GiorgioAlbertoLucia Date: Mon, 5 Oct 2026 11:26:53 +0200 Subject: [PATCH 13/13] change resolution computation at digit level, add relative information from resolution map --- .../IOTOFSimulation/DPLDigitizerParam.h | 8 +++++ .../ALICE3/IOTOF/simulation/src/Digitizer.cxx | 35 +++++++++++++++++-- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/Detectors/Upgrades/ALICE3/IOTOF/simulation/include/IOTOFSimulation/DPLDigitizerParam.h b/Detectors/Upgrades/ALICE3/IOTOF/simulation/include/IOTOFSimulation/DPLDigitizerParam.h index eb9ba50afc8d2..9ea9e825dd68f 100644 --- a/Detectors/Upgrades/ALICE3/IOTOF/simulation/include/IOTOFSimulation/DPLDigitizerParam.h +++ b/Detectors/Upgrades/ALICE3/IOTOF/simulation/include/IOTOFSimulation/DPLDigitizerParam.h @@ -30,10 +30,18 @@ struct DPLDigitizerParam : public o2::conf::ConfigurableParamHelperPoisson(electronsPerStep * nEleResp); // Noise can be added here if needed @@ -324,12 +345,22 @@ void Digitizer::stepping(const o2::itsmft::Hit& hit, float**& respMatrix, float* } //_______________________________________________________________________ -double Digitizer::smearTime(double time) const +double Digitizer::smearTime(double time, const float x, const float y) const { // Apply Gaussian smearing to simulate detector time resolution const auto& digitizerParams = o2::iotof::DPLDigitizerParam::Instance(); + + float resolutionScaling = 1.; + if (mResolutionMap) { + const float minimumResolution = mResolutionMap->GetMinimum(); + int bin = mResolutionMap->FindBin(x * o2::iotof::Digitizer::cm2um, y * o2::iotof::Digitizer::cm2um); + resolutionScaling = mResolutionMap->GetBinContent(bin) / minimumResolution; + LOG(debug) << "Time resolution map check: x=" << x * o2::iotof::Digitizer::cm2um << ", y=" << y * o2::iotof::Digitizer::cm2um << ", bin=" << bin << ", resolution=" << minimumResolution; + LOG(debug) << "Time resolution scaling: " << resolutionScaling; + } + if (digitizerParams.timeResolution > 0) { - return time + gRandom->Gaus(0, digitizerParams.timeResolution); + return time + gRandom->Gaus(0, digitizerParams.timeResolution * resolutionScaling); } return time; }