|
18 | 18 | // o2 includes |
19 | 19 | #include "CCDB/CcdbApi.h" |
20 | 20 | #include "CCDB/CcdbObjectInfo.h" |
21 | | -#include "CommonUtils/NameConf.h" |
| 21 | +// #include "CommonUtils/NameConf.h" |
22 | 22 | #include "DataFormatsTPC/TrackTPC.h" |
23 | | -#include "DataFormatsParameters/GRPObject.h" |
| 23 | +// #include "DataFormatsParameters/GRPObject.h" |
24 | 24 | #include "DetectorsCalibration/Utils.h" |
25 | 25 | #include "Framework/Task.h" |
26 | 26 | #include "Framework/DataProcessorSpec.h" |
27 | 27 | #include "Framework/ConfigParamRegistry.h" |
28 | 28 | #include "Framework/CCDBParamSpec.h" |
| 29 | +#include "GPUO2InterfaceConfigurableParam.h" |
29 | 30 | #include "TPCCalibration/CalibdEdx.h" |
30 | 31 | #include "TPCWorkflow/ProcessingHelpers.h" |
31 | | -#include "TPCBase/CDBInterface.h" |
| 32 | +#include "TPCBase/CDBTypes.h" |
32 | 33 | #include "TPCBase/Utils.h" |
33 | 34 | #include "DetectorsBase/GRPGeomHelper.h" |
34 | 35 |
|
@@ -68,14 +69,37 @@ class CalibdEdxDevice : public Task |
68 | 69 | mCalib->set2DFitThreshold(minEntries2D); |
69 | 70 | mCalib->setElectronCut(fitThreshold, fitPasses, fitThresholdLowFactor); |
70 | 71 | mCalib->setMaterialType(mMatType); |
| 72 | + |
| 73 | + mCustomdEdxFileName = o2::gpu::GPUConfigurableParamGPUSettingsO2::Instance().dEdxCorrFile; |
| 74 | + mDisableTimeGain = o2::gpu::GPUConfigurableParamGPUSettingsO2::Instance().dEdxDisableResidualGain; |
| 75 | + |
| 76 | + if (mDisableTimeGain) { |
| 77 | + LOGP(info, "TimeGain correction was disabled via GPU_global.dEdxDisableResidualGain=1"); |
| 78 | + } |
| 79 | + |
| 80 | + if (!mDisableTimeGain && !mCustomdEdxFileName.empty()) { |
| 81 | + std::unique_ptr<TFile> fdEdxCustom(TFile::Open(mCustomdEdxFileName.data())); |
| 82 | + if (!fdEdxCustom || !fdEdxCustom->IsOpen() || fdEdxCustom->IsZombie()) { |
| 83 | + LOGP(error, "Could not open custom TimeGain file {}", mCustomdEdxFileName); |
| 84 | + } else { |
| 85 | + const auto timeGain = fdEdxCustom->Get<o2::tpc::CalibdEdxCorrection>("CalibdEdxCorrection"); |
| 86 | + if (!timeGain) { |
| 87 | + LOGP(error, "Could not load 'CalibdEdxCorrection' from file {}", mCustomdEdxFileName); |
| 88 | + } else { |
| 89 | + const auto meanParamTot = timeGain->getMeanParams(ChargeType::Tot); |
| 90 | + LOGP(info, "Loaded custom TimeGain from file {} with {} dimensions and mean qTot Params {}", mCustomdEdxFileName, timeGain->getDims(), utils::elementsToString(meanParamTot)); |
| 91 | + mCalib->setCalibrationInput(*timeGain); |
| 92 | + } |
| 93 | + } |
| 94 | + } |
71 | 95 | } |
72 | 96 |
|
73 | 97 | void finaliseCCDB(o2::framework::ConcreteDataMatcher& matcher, void* obj) final |
74 | 98 | { |
75 | 99 | if (o2::base::GRPGeomHelper::instance().finaliseCCDB(matcher, obj)) { |
76 | 100 | return; |
77 | 101 | } |
78 | | - if (matcher == ConcreteDataMatcher("TPC", "TIMEGAIN", 0)) { |
| 102 | + if ((mDisableTimeGain == 0) && mCustomdEdxFileName.empty() && (matcher == ConcreteDataMatcher("TPC", "TIMEGAIN", 0))) { |
79 | 103 | mCalib->setCalibrationInput(*(o2::tpc::CalibdEdxCorrection*)obj); |
80 | 104 | const auto meanParamTot = mCalib->getCalibrationInput().getMeanParams(ChargeType::Tot); |
81 | 105 | LOGP(info, "Updating TimeGain with {} dimensions and mean qTot Params {}", mCalib->getCalibrationInput().getDims(), utils::elementsToString(meanParamTot)); |
@@ -143,7 +167,9 @@ class CalibdEdxDevice : public Task |
143 | 167 | uint64_t mRunNumber{0}; ///< processed run number |
144 | 168 | uint64_t mTimeStampStart{0}; ///< time stamp for first TF for CCDB output |
145 | 169 | std::unique_ptr<CalibdEdx> mCalib; |
146 | | - bool mMakeGaussianFits{true}; ///< make gaussian fits or take the mean |
| 170 | + bool mMakeGaussianFits{true}; ///< make gaussian fits or take the mean |
| 171 | + bool mDisableTimeGain{false}; ///< if time gain is disabled via GPU_global.dEdxDisableResidualGain=1 |
| 172 | + std::string mCustomdEdxFileName{}; ///< name of the custom dE/dx file configured via GPU_global.dEdxCorrFile |
147 | 173 | }; |
148 | 174 |
|
149 | 175 | DataProcessorSpec getCalibdEdxSpec(const o2::base::Propagator::MatCorrType matType) |
|
0 commit comments