Project
Loading...
Searching...
No Matches
CellRecalibratorSpec.h
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#ifndef O2_EMCAL_CELLRECALIBRATOR_SPEC
13#define O2_EMCAL_CELLRECALIBRATOR_SPEC
14
15#include <bitset>
16#include <cstdint>
17#include <optional>
23#include "Framework/Task.h"
25
26namespace o2
27{
28
29namespace emcal
30{
31
32class Cell;
33class TriggerRecord;
34
57{
58 public:
61 enum class LEDEventSettings {
62 KEEP,
63 DROP,
65 };
74 CellRecalibratorSpec(uint32_t outputspec, LEDEventSettings ledsettings, bool badChannelCalib, bool timeCalib, bool gainCalib, bool isMC, std::shared_ptr<CalibLoader>(calibHandler));
75
77 ~CellRecalibratorSpec() final = default;
78
81 void init(framework::InitContext& ctx) final;
82
90 void run(framework::ProcessingContext& ctx) final;
91
99 void finaliseCCDB(framework::ConcreteDataMatcher& matcher, void* obj) final;
100
103 void setRunBadChannelCalibration(bool doRun) { mCalibrationSettings.set(BADCHANNEL_CALIB, doRun); };
104
107 void setRunTimeCalibration(bool doRun) { mCalibrationSettings.set(TIME_CALIB, doRun); }
108
111 void setRunGainCalibration(bool doRun) { mCalibrationSettings.set(GAIN_CALIB, doRun); }
112
115 bool isRunBadChannlCalibration() const { return mCalibrationSettings.test(BADCHANNEL_CALIB); }
116
119 bool isRunTimeCalibration() const { return mCalibrationSettings.test(TIME_CALIB); }
120
123 bool isRunGainCalibration() const { return mCalibrationSettings.test(GAIN_CALIB); }
124
125 private:
127 void updateCalibObjects();
128
133 void writeTrigger(const gsl::span<const o2::emcal::Cell> selectedCells, const o2::emcal::TriggerRecord& eventtrigger, std::vector<o2::emcal::Cell>& outputcontainer, std::vector<o2::emcal::TriggerRecord>& outputtriggers);
134
135 void writeMCLabels(const o2::dataformats::MCTruthContainer<o2::emcal::MCLabel>& inputlabels, o2::dataformats::MCTruthContainer<o2::emcal::MCLabel>& outputContainer, const std::vector<int>& keptIndices, int firstindex);
136
139 enum CalibrationType_t {
140 BADCHANNEL_CALIB = 0,
141 TIME_CALIB = 1,
142 GAIN_CALIB = 2
143 };
144
145 uint32_t mOutputSubspec = 0;
146 bool mIsMC = false;
148 std::bitset<8> mCalibrationSettings;
149 std::shared_ptr<CalibLoader> mCalibrationHandler;
150 CellRecalibrator mCellRecalibrator;
151};
152
161framework::DataProcessorSpec getCellRecalibratorSpec(uint32_t inputSubspec, uint32_t outputSubspec, uint32_t ledsettings, bool badChannelCalib, bool timeCalib, bool gainCalib, bool isMC);
162
163} // namespace emcal
164
165} // namespace o2
166
167#endif // O2_EMCAL_CELLRECALIBRATOR_SPEC
Definition of a container to keep Monte Carlo truth external to simulation objects.
A container to hold and manage MC truth information/labels.
Recalibration workflow at cell level.
LEDEventSettings
Dedicated handling for LED events.
@ REDIRECT
Redirect LED events to dedicated output.
@ KEEP
Keep LED events in timeframe (uncalibrated)
void setRunGainCalibration(bool doRun)
Switch for the gain calibration.
void setRunTimeCalibration(bool doRun)
Switch for time calibration.
~CellRecalibratorSpec() final=default
Destructor.
void finaliseCCDB(framework::ConcreteDataMatcher &matcher, void *obj) final
Fetching cell objects and assigning them to the internal handlers.
void setRunBadChannelCalibration(bool doRun)
Switch for bad channel calibration.
bool isRunBadChannlCalibration() const
Check if the bad channel calibration is enabled.
void run(framework::ProcessingContext &ctx) final
Run recalibration of cells for a new timeframe.
bool isRunTimeCalibration() const
Check if the time calibration is enabled.
bool isRunGainCalibration() const
Check if the gain calibration is enabled.
void init(framework::InitContext &ctx) final
Initialize recalibrator.
Header for data corresponding to the same hardware trigger.
framework::DataProcessorSpec getCellRecalibratorSpec(uint32_t inputSubspec, uint32_t outputSubspec, uint32_t ledsettings, bool badChannelCalib, bool timeCalib, bool gainCalib, bool isMC)
Create CellRecalibrator processor spec.
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...