Skip to content

Commit f9095c9

Browse files
author
jokonig
committed
[PWGJE,EMCAL-567] Add temperature calib. to EMC corr. task
- EMCal temperature calibration procedure is implemented in O2 and now used in the emcal correction task - The temperature is assumed to be stable over the run and the temperature parameters are evaluated once at the initialization.
1 parent 3271038 commit f9095c9

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

PWGJE/TableProducer/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ endif()
9393

9494
o2physics_add_dpl_workflow(emcal-correction-task
9595
SOURCES emcalCorrectionTask.cxx
96-
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsBase O2::EMCALBase O2::EMCALReconstruction
96+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsBase O2::EMCALBase O2::EMCALReconstruction O2::EMCALCalibration
9797
COMPONENT_NAME Analysis)
9898

9999
o2physics_add_dpl_workflow(emcal-matchedtracks-writer

PWGJE/TableProducer/emcalCorrectionTask.cxx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "EMCALBase/ClusterFactory.h"
3636
#include "EMCALBase/Geometry.h"
3737
#include "EMCALBase/NonlinearityHandler.h"
38+
#include "EMCALCalibration/EMCALTempCalibExtractor.h"
3839
#include "EMCALReconstruction/Clusterizer.h"
3940
#include "Framework/ASoA.h"
4041
#include "Framework/AnalysisDataModel.h"
@@ -113,6 +114,9 @@ struct EmcalCorrectionTask {
113114
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."};
114115
Configurable<bool> fillQA{"fillQA", false, "Switch to turn on QA histograms."};
115116
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."};
116120

117121
// Require EMCAL cells (CALO type 1)
118122
Filter emccellfilter = aod::calo::caloType == selectedCellType;
@@ -142,6 +146,10 @@ struct EmcalCorrectionTask {
142146
// EMCal geometry
143147
o2::emcal::Geometry* geometry;
144148

149+
// EMCal cell temperature calibrator
150+
std::unique_ptr<o2::emcal::EMCALTempCalibExtractor> mTempCalibExtractor;
151+
bool mIsTempCalibInitialized = false;
152+
145153
std::vector<std::pair<int, int>> mExtraTimeShiftRunRanges;
146154

147155
// Current run number
@@ -171,6 +179,10 @@ struct EmcalCorrectionTask {
171179
geometry->SetMisalMatrixFromCcdb();
172180
}
173181

182+
if (applyTempCalib) {
183+
mTempCalibExtractor = std::make_unique<o2::emcal::EMCALTempCalibExtractor>();
184+
}
185+
174186
// read all the cluster definitions specified in the options
175187
if (clusterDefinitions->length()) {
176188
std::stringstream parser(clusterDefinitions.value);
@@ -316,6 +328,11 @@ struct EmcalCorrectionTask {
316328
// get run number
317329
runNumber = bc.runNumber();
318330

331+
if (applyTempCalib && !mIsTempCalibInitialized) { // needs to be called once
332+
mTempCalibExtractor->InitializeFromCCDB(pathTempCalibCCDB, static_cast<uint64_t>(runNumber));
333+
mIsTempCalibInitialized = true;
334+
}
335+
319336
// Convert aod::Calo to o2::emcal::Cell which can be used with the clusterizer.
320337
// In particular, we need to filter only EMCAL cells.
321338

@@ -343,6 +360,9 @@ struct EmcalCorrectionTask {
343360
if (applyCellAbsScale) {
344361
amplitude *= getAbsCellScale(cell.cellNumber());
345362
}
363+
if (applyTempCalib) {
364+
amplitude *= mTempCalibExtractor->getGainCalibFactor(static_cast<unsigned short>(cell.cellNumber()));
365+
}
346366
cellsBC.emplace_back(cell.cellNumber(),
347367
amplitude,
348368
cell.time() + getCellTimeShift(cell.cellNumber(), amplitude, o2::emcal::intToChannelType(cell.cellType()), runNumber),

0 commit comments

Comments
 (0)