Skip to content

Commit bcae94b

Browse files
fetch efficiency map for iotof from ccdb
1 parent e17cfd3 commit bcae94b

3 files changed

Lines changed: 35 additions & 5 deletions

File tree

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ struct DPLDigitizerParam : public o2::conf::ConfigurableParamHelper<DPLDigitizer
3232
float efficiency = 0.98f; ///< detection efficiency
3333
std::string efficiencyFilePath{}; ///< optional efficiency map file path.
3434
///< The efficiency map is currently available at /alice/cern.ch/user/g/glucia/ALICE3/IOTOF/pixelEfficiency/PixelEfficiencyMap_TH2.root. FIXME to be removed once switch to CCDBFetcher
35+
std::string efficiencyCcdbPath{}; ///< optional efficiency map CCDB path.
36+
///< The efficiency map is currently available at Users/g/glucia/tmp/ALICE3/IOTOF/pixelEfficiency
3537
int chargeThreshold = 100; ///< charge threshold in Nelectrons
3638
int minChargeToAccount = 7; ///< minimum charge contribution to account
3739
int nSimSteps = 10; ///< number of steps in response simulation

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ class Digitizer : public TObject
9393

9494
/// Load the efficiency map from a file
9595
void loadEfficiencyMap(const std::string& filePath);
96+
void loadEfficiencyMapFromCCDB(const std::string& ccdbPath);
9697

9798
/// Check if the hit passes efficiency cut
9899
/// \param x Detector local coordinate x in cm with respect to the center of the sensitive volume.

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

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
/// \since 2026-03-17
1717
///
1818

19+
#include <CCDB/BasicCCDBManager.h>
1920
#include "IOTOFSimulation/Digitizer.h"
2021
#include "IOTOFSimulation/DPLDigitizerParam.h"
2122
#include "DetectorsRaw/HBFUtils.h"
@@ -54,17 +55,24 @@ void Digitizer::init()
5455
/// mChips[i].setDeadChanMap(mDeadChanMap);
5556
/// }
5657
}
57-
58+
5859
const auto& digitizerParams = o2::iotof::DPLDigitizerParam::Instance();
59-
if (!digitizerParams.efficiencyFilePath.empty()) {
60-
loadEfficiencyMap(digitizerParams.efficiencyFilePath);
61-
}
6260

6361
LOG(info) << "Initializing IOTOF digitizer";
6462
LOG(info) << " Time resolution: " << digitizerParams.timeResolution * 1e3 << " ps";
6563
LOG(info) << " Charge threshold: " << digitizerParams.chargeThreshold << " electrons";
66-
LOG(info) << " Detection efficiency: " << digitizerParams.efficiency * 100 << " %";
6764
LOG(info) << " Continuous mode: " << (mContinuous ? "ON" : "OFF");
65+
66+
if (!digitizerParams.efficiencyCcdbPath.empty()) {
67+
LOG(info) << "Loading efficiency map from CCDB path: " << digitizerParams.efficiencyCcdbPath;
68+
loadEfficiencyMapFromCCDB(digitizerParams.efficiencyCcdbPath);
69+
} else if (!digitizerParams.efficiencyFilePath.empty()) {
70+
LOG(info) << "Loading efficiency map from file: " << digitizerParams.efficiencyFilePath;
71+
loadEfficiencyMap(digitizerParams.efficiencyFilePath);
72+
} else {
73+
LOG(info) << "No efficiency map provided, using uniform efficiency: " << digitizerParams.efficiency * 100 << " %";
74+
}
75+
6876
sSegmentation = o2::iotof::Segmentation::Instance();
6977
}
7078

@@ -387,6 +395,25 @@ void Digitizer::loadEfficiencyMap(const std::string& filePath)
387395
file->Close();
388396
}
389397

398+
//_______________________________________________________________________
399+
void Digitizer::loadEfficiencyMapFromCCDB(const std::string& ccdbPath)
400+
{
401+
// Load the efficiency map from CCDB
402+
auto rawMap = o2::ccdb::BasicCCDBManager::instance().get<TH2D>(ccdbPath);
403+
if (!rawMap) {
404+
LOG(error) << "Failed to retrieve efficiency map from CCDB path: " << ccdbPath;
405+
return;
406+
} else {
407+
LOG(info) << "Successfully retrieved efficiency map from CCDB path: " << ccdbPath;
408+
LOG(info) << "Efficiency map dimensions: " << rawMap->GetNbinsX() << " x " << rawMap->GetNbinsY();
409+
}
410+
411+
mEfficiencyMap = dynamic_cast<TH2D*>(rawMap->Clone("mEfficiencyMap"));
412+
mEfficiencyMap->SetDirectory(nullptr); // Detach from file to avoid deletion when file is closed
413+
414+
LOG(info) << "Successfully loaded efficiency map from CCDB path: " << ccdbPath;
415+
}
416+
390417
//_______________________________________________________________________
391418
bool Digitizer::isEfficient(const float x, const float z) const
392419
{

0 commit comments

Comments
 (0)