Project
Loading...
Searching...
No Matches
CalibLoader.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#include <filesystem>
13#include <fairlogger/Logger.h>
14#include "EMCALCalib/CalibDB.h"
16#include "EMCALCalib/FeeDCS.h"
26#include "TFile.h"
27
28using namespace o2::emcal;
29
30void CalibLoader::defineInputSpecs(std::vector<o2::framework::InputSpec>& inputs)
31{
32 if (hasBadChannelMap()) {
33 inputs.push_back({"badChannelMap", o2::header::gDataOriginEMC, "BADCHANNELMAP", 0, o2::framework::Lifetime::Condition, o2::framework::ccdbParamSpec(CalibDB::getCDBPathBadChannelMap())});
34 }
35 if (hasBCMScaleFactors()) {
36 inputs.push_back({"bcmScaleFactors", o2::header::gDataOriginEMC, "BCMSCALEFACTORS", 0, o2::framework::Lifetime::Condition, o2::framework::ccdbParamSpec(CalibDB::getCDBPathChannelScaleFactors())});
37 }
38 if (hasFEEDCS()) {
39 inputs.push_back({"feeDCS", o2::header::gDataOriginEMC, "FEEDCS", 0, o2::framework::Lifetime::Condition, o2::framework::ccdbParamSpec(CalibDB::getCDBPathFeeDCS())});
40 }
41 if (hasTimeCalib()) {
42 inputs.push_back({"timeCalibParams", o2::header::gDataOriginEMC, "TIMECALIBPARAMS", 0, o2::framework::Lifetime::Condition, o2::framework::ccdbParamSpec(CalibDB::getCDBPathTimeCalibrationParams())});
43 }
44 if (hasGainCalib()) {
45 inputs.push_back({"gainCalibParams", o2::header::gDataOriginEMC, "GAINCALIBPARAMS", 0, o2::framework::Lifetime::Condition, o2::framework::ccdbParamSpec(CalibDB::getCDBPathGainCalibrationParams())});
46 }
47 if (hasTemperatureCalib()) {
48 inputs.push_back({"tempCalibParams", o2::header::gDataOriginEMC, "TEMPCALIBPARAMS", 0, o2::framework::Lifetime::Condition, o2::framework::ccdbParamSpec(CalibDB::getCDBPathTemperatureCalibrationParams())});
49 }
50 if (hasRecoParams()) {
51 inputs.push_back({"recoParams", o2::header::gDataOriginEMC, "RECOPARAM", 0, o2::framework::Lifetime::Condition, o2::framework::ccdbParamSpec("EMC/Config/RecoParam")});
52 }
53 if (hasSimParams()) {
54 inputs.push_back({"simParams", o2::header::gDataOriginEMC, "SIMPARAM", 0, o2::framework::Lifetime::Condition, o2::framework::ccdbParamSpec("EMC/Config/SimParam")});
55 }
56}
57
59{
61 if (hasBadChannelMap()) {
62 ctx.inputs().get<o2::emcal::BadChannelMap*>("badChannelMap");
63 }
64 if (hasBCMScaleFactors()) {
65 ctx.inputs().get<o2::emcal::EMCALChannelScaleFactors*>("bcmScaleFactors");
66 }
67 if (hasFEEDCS()) {
68 ctx.inputs().get<o2::emcal::FeeDCS*>("feeDCS");
69 }
70 if (hasTimeCalib()) {
71 ctx.inputs().get<o2::emcal::TimeCalibrationParams*>("timeCalibParams");
72 }
73 if (hasGainCalib()) {
74 ctx.inputs().get<o2::emcal::GainCalibrationFactors*>("gainCalibParams");
75 }
76 if (hasTemperatureCalib()) {
77 ctx.inputs().get<o2::emcal::TempCalibrationParams*>("tempCalibParams");
78 }
79 if (hasRecoParams()) {
80 ctx.inputs().get<o2::emcal::RecoParam*>("recoParams");
81 }
82 if (hasSimParams()) {
83 ctx.inputs().get<o2::emcal::SimParam*>("simParams");
84 }
85}
86
88{
89 if (matcher == o2::framework::ConcreteDataMatcher("EMC", "BADCHANNELMAP", 0)) {
90 if (hasBadChannelMap()) {
91 LOG(info) << "New bad channel map loaded";
92 mBadChannelMap = reinterpret_cast<o2::emcal::BadChannelMap*>(obj);
94 } else {
95 LOG(error) << "New bad channel map available even though bad channel calibration was not enabled, not loading";
96 }
97 return true;
98 }
99 if (matcher == o2::framework::ConcreteDataMatcher("EMC", "BCMSCALEFACTORS", 0)) {
100 if (hasBCMScaleFactors()) {
101 LOG(info) << "New BCM scale factors loaded";
102 mBCMScaleFactors = reinterpret_cast<o2::emcal::EMCALChannelScaleFactors*>(obj);
104 } else {
105 LOG(error) << "New BCSM scale factors available even though not enabled, not loading";
106 }
107 return true;
108 }
109 if (matcher == o2::framework::ConcreteDataMatcher("EMC", "FEEDCS", 0)) {
110 if (hasFEEDCS()) {
111 LOG(info) << "New FEE DCS params loaded";
112 mFeeDCS = reinterpret_cast<o2::emcal::FeeDCS*>(obj);
114 } else {
115 LOG(error) << "New FEE DCS params available even though FEE DCS was not enabled, not loading";
116 }
117 return true;
118 }
119 if (matcher == o2::framework::ConcreteDataMatcher("EMC", "TIMECALIBPARAMS", 0)) {
120 if (hasTimeCalib()) {
121 LOG(info) << "New time calibration paramset loaded";
122 mTimeCalibParams = reinterpret_cast<o2::emcal::TimeCalibrationParams*>(obj);
124 } else {
125 LOG(error) << "New time calibration paramset available even though time calibration was not enabled, not loading";
126 }
127 return true;
128 }
129 if (matcher == o2::framework::ConcreteDataMatcher("EMC", "GAINCALIBPARAMS", 0)) {
130 if (hasGainCalib()) {
131 LOG(info) << "New gain calibration paramset loaded";
132 mGainCalibParams = reinterpret_cast<o2::emcal::GainCalibrationFactors*>(obj);
134 } else {
135 LOG(error) << "New gain calibration paramset available even though the gain calibration was not enabled, not loading";
136 }
137 return true;
138 }
139 if (matcher == o2::framework::ConcreteDataMatcher("EMC", "TEMPCALIBPARAMS", 0)) {
140 if (hasTemperatureCalib()) {
141 LOG(info) << "New temperature calibration paramset loaded";
142 mTempCalibParams = reinterpret_cast<o2::emcal::TempCalibrationParams*>(obj);
144 } else {
145 LOG(error) << "New temperature calibration paramset available even though the temperature calibration was not enabled, not loading";
146 }
147 return true;
148 }
149 if (matcher == o2::framework::ConcreteDataMatcher("EMC", "RECOPARAM", 0)) {
150 if (hasRecoParams()) {
151 LOG(info) << "New reconstruction parameters loaded";
152 mRecoParam = reinterpret_cast<o2::emcal::RecoParam*>(obj);
154 } else {
155 LOG(error) << "New reconstruction parameters available even though reconstruction parameters were not requested, not loading";
156 }
157 return true;
158 }
159 if (matcher == o2::framework::ConcreteDataMatcher("EMC", "SIMPARAM", 0)) {
160 if (hasSimParams()) {
161 LOG(info) << "New simulation parameters loaded";
162 mSimParam = reinterpret_cast<o2::emcal::SimParam*>(obj);
164 } else {
165 LOG(error) << "New simulation parameters available even though simulation parameters were not requested, not loading";
166 }
167 return true;
168 }
169 return false;
170}
CCDB container for masked cells in EMCAL.
static const char * getCDBPathTimeCalibrationParams()
Get CDB path for the time calibration.
Definition CalibDB.h:338
static const char * getCDBPathBadChannelMap()
Get CDB path for the bad channel map.
Definition CalibDB.h:334
static const char * getCDBPathFeeDCS()
Get CDB path for the FEE DCS settings.
Definition CalibDB.h:358
static const char * getCDBPathChannelScaleFactors()
Get CCDB path for the scale factors used in the bad channel calibration.
Definition CalibDB.h:366
static const char * getCDBPathGainCalibrationParams()
Get CDB path for the gain calibration.
Definition CalibDB.h:354
static const char * getCDBPathTemperatureCalibrationParams()
Get CDB path for the temperature calibration.
Definition CalibDB.h:346
void setUpdateGainCalib()
Mark gain calibration params as updated.
bool hasTimeCalib() const
Check whether the time calibration params are handled.
Definition CalibLoader.h:96
bool hasTemperatureCalib() const
Check whether the temperature calibration params are handled.
void setUpdateRecoParams()
Mark reconstruction params as updated.
void setUpdateTimeCalib()
Mark time calibration params as updated.
void defineInputSpecs(std::vector< framework::InputSpec > &ccdbInputs)
Define input specs in workflow for calibration objects to be loaded from the CCDB.
bool hasGainCalib() const
Check whether the gain calibration factors are handled.
void setUpdateBCMScaleFactors()
Mark BCM scale factors as updated.
void setUpdateBadChannelMap()
Mark bad channel map as updated.
bool hasBCMScaleFactors() const
Check whether the BCM scale factors are handled.
Definition CalibLoader.h:88
void setUpdateFEEDCS()
Mark FEE DCS params as updated.
void setUpdateTemperatureCalib()
Mark temperature calibration params as updated.
void checkUpdates(o2::framework::ProcessingContext &ctx)
Check for updates of the calibration objects in the processing context.
void resetUpdateStatus()
Reset the update status (all objects marked as false)
bool hasSimParams() const
Check whether the reconstruction params are handled.
bool hasRecoParams() const
Check whether the reconstruction params are handled.
bool hasBadChannelMap() const
Check whether the bad channel map is handled.
Definition CalibLoader.h:84
bool finalizeCCDB(framework::ConcreteDataMatcher &matcher, void *obj)
Callback for objects loaded from CCDB.
bool hasFEEDCS() const
Check whether the FEE DCS params are handled.
Definition CalibLoader.h:92
void setUpdateSimParams()
Mark simulation params as updated.
CCDB container for the gain calibration factors.
EMCal reconstruction parameters.
Definition RecoParam.h:28
EMCal simulation parameters.
Definition SimParam.h:28
decltype(auto) get(R binding, int part=0) const
InputRecord & inputs()
The inputs associated with this processing context.
constexpr o2::header::DataOrigin gDataOriginEMC
Definition DataHeader.h:565
std::vector< ConfigParamSpec > ccdbParamSpec(std::string const &path, int runDependent, std::vector< CCDBMetadata > metadata={}, int qrate=0)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"