|
35 | 35 | #include "EMCALBase/ClusterFactory.h" |
36 | 36 | #include "EMCALBase/Geometry.h" |
37 | 37 | #include "EMCALBase/NonlinearityHandler.h" |
| 38 | +#include "EMCALCalibration/EMCALTempCalibExtractor.h" |
38 | 39 | #include "EMCALReconstruction/Clusterizer.h" |
39 | 40 | #include "Framework/ASoA.h" |
40 | 41 | #include "Framework/AnalysisDataModel.h" |
@@ -113,6 +114,9 @@ struct EmcalCorrectionTask { |
113 | 114 | Configurable<float> trackMinPt{"trackMinPt", 0.3, "Minimum pT for tracks to perform track matching, to reduce computing time. Tracks below a certain pT will be loopers anyway."}; |
114 | 115 | Configurable<bool> fillQA{"fillQA", false, "Switch to turn on QA histograms."}; |
115 | 116 | Configurable<bool> useCCDBAlignment{"useCCDBAlignment", false, "EXPERTS ONLY! Switch to use the alignment object stored in CCDB instead of using the default alignment from the global geometry object."}; |
| 117 | + Configurable<bool> applyTempCalib{"applyTempCalib", false, "Switch to turn on Temperature calibration."}; |
| 118 | + Configurable<std::string> pathTempCalibCCDB{"pathTempCalibCCDB", "Users/j/jokonig/EMCalTempCalibParams", "Path in the ccdb where slope and intercept for each cell are stored"}; // change to official path as soon as it is available |
| 119 | + Configurable<bool> useTempCalibMean{"useTempCalibMean", false, "Switch to turn on Temperature mean calculation instead of median."}; |
116 | 120 |
|
117 | 121 | // Require EMCAL cells (CALO type 1) |
118 | 122 | Filter emccellfilter = aod::calo::caloType == selectedCellType; |
@@ -142,6 +146,10 @@ struct EmcalCorrectionTask { |
142 | 146 | // EMCal geometry |
143 | 147 | o2::emcal::Geometry* geometry; |
144 | 148 |
|
| 149 | + // EMCal cell temperature calibrator |
| 150 | + std::unique_ptr<o2::emcal::EMCALTempCalibExtractor> mTempCalibExtractor; |
| 151 | + bool mIsTempCalibInitialized = false; |
| 152 | + |
145 | 153 | std::vector<std::pair<int, int>> mExtraTimeShiftRunRanges; |
146 | 154 |
|
147 | 155 | // Current run number |
@@ -171,6 +179,10 @@ struct EmcalCorrectionTask { |
171 | 179 | geometry->SetMisalMatrixFromCcdb(); |
172 | 180 | } |
173 | 181 |
|
| 182 | + if (applyTempCalib) { |
| 183 | + mTempCalibExtractor = std::make_unique<o2::emcal::EMCALTempCalibExtractor>(); |
| 184 | + } |
| 185 | + |
174 | 186 | // read all the cluster definitions specified in the options |
175 | 187 | if (clusterDefinitions->length()) { |
176 | 188 | std::stringstream parser(clusterDefinitions.value); |
@@ -316,6 +328,11 @@ struct EmcalCorrectionTask { |
316 | 328 | // get run number |
317 | 329 | runNumber = bc.runNumber(); |
318 | 330 |
|
| 331 | + if (applyTempCalib && !mIsTempCalibInitialized) { // needs to be called once |
| 332 | + mTempCalibExtractor->InitializeFromCCDB(pathTempCalibCCDB, static_cast<uint64_t>(runNumber)); |
| 333 | + mIsTempCalibInitialized = true; |
| 334 | + } |
| 335 | + |
319 | 336 | // Convert aod::Calo to o2::emcal::Cell which can be used with the clusterizer. |
320 | 337 | // In particular, we need to filter only EMCAL cells. |
321 | 338 |
|
@@ -343,6 +360,9 @@ struct EmcalCorrectionTask { |
343 | 360 | if (applyCellAbsScale) { |
344 | 361 | amplitude *= getAbsCellScale(cell.cellNumber()); |
345 | 362 | } |
| 363 | + if (applyTempCalib) { |
| 364 | + amplitude *= mTempCalibExtractor->getGainCalibFactor(static_cast<unsigned short>(cell.cellNumber())); |
| 365 | + } |
346 | 366 | cellsBC.emplace_back(cell.cellNumber(), |
347 | 367 | amplitude, |
348 | 368 | cell.time() + getCellTimeShift(cell.cellNumber(), amplitude, o2::emcal::intToChannelType(cell.cellType()), runNumber), |
|
0 commit comments