|
16 | 16 | /// \since 2026-03-17 |
17 | 17 | /// |
18 | 18 |
|
| 19 | +#include <CCDB/BasicCCDBManager.h> |
19 | 20 | #include "IOTOFSimulation/Digitizer.h" |
20 | 21 | #include "IOTOFSimulation/DPLDigitizerParam.h" |
21 | 22 | #include "DetectorsRaw/HBFUtils.h" |
@@ -54,17 +55,24 @@ void Digitizer::init() |
54 | 55 | /// mChips[i].setDeadChanMap(mDeadChanMap); |
55 | 56 | /// } |
56 | 57 | } |
57 | | - |
| 58 | + |
58 | 59 | const auto& digitizerParams = o2::iotof::DPLDigitizerParam::Instance(); |
59 | | - if (!digitizerParams.efficiencyFilePath.empty()) { |
60 | | - loadEfficiencyMap(digitizerParams.efficiencyFilePath); |
61 | | - } |
62 | 60 |
|
63 | 61 | LOG(info) << "Initializing IOTOF digitizer"; |
64 | 62 | LOG(info) << " Time resolution: " << digitizerParams.timeResolution * 1e3 << " ps"; |
65 | 63 | LOG(info) << " Charge threshold: " << digitizerParams.chargeThreshold << " electrons"; |
66 | | - LOG(info) << " Detection efficiency: " << digitizerParams.efficiency * 100 << " %"; |
67 | 64 | 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 | + |
68 | 76 | sSegmentation = o2::iotof::Segmentation::Instance(); |
69 | 77 | } |
70 | 78 |
|
@@ -387,6 +395,25 @@ void Digitizer::loadEfficiencyMap(const std::string& filePath) |
387 | 395 | file->Close(); |
388 | 396 | } |
389 | 397 |
|
| 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 | + |
390 | 417 | //_______________________________________________________________________ |
391 | 418 | bool Digitizer::isEfficient(const float x, const float z) const |
392 | 419 | { |
|
0 commit comments