Project
Loading...
Searching...
No Matches
NoiseSlotCalibrator.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
13
14#ifndef O2_MFT_NOISESLOTCALIBRATOR
15#define O2_MFT_NOISESLOTCALIBRATOR
16
17#include <string>
18
21
25#include "gsl/span"
26
27namespace o2
28{
29
30namespace itsmft
31{
32class ROFRecord;
33} // namespace itsmft
34
35namespace mft
36{
37
39{
41
42 public:
44 NoiseSlotCalibrator(float prob, float relErr) : mProbabilityThreshold(prob), mProbRelErr(relErr)
45 {
48 mMinROFs = 1.1 * o2::itsmft::NoiseMap::getMinROFs(prob, relErr);
49 LOGP(info, "At least {} ROFs needed to apply threshold {} with relative error {}", mMinROFs, mProbabilityThreshold, mProbRelErr);
50 }
51 ~NoiseSlotCalibrator() final = default;
52
53 void setThreshold(unsigned int t) { mThreshold = t; }
54
56 gsl::span<const o2::itsmft::Digit> const& digits,
57 gsl::span<const o2::itsmft::ROFRecord> const& rofs);
58
60 gsl::span<const o2::itsmft::CompClusterExt> const& clusters,
61 gsl::span<const unsigned char> const& patterns,
62 gsl::span<const o2::itsmft::ROFRecord> const& rofs);
63
64 void setMinROFs(long n) { mMinROFs = n; }
65
66 void finalize()
67 {
68 LOG(info) << "Number of processed strobes is " << mNumberOfStrobes;
69 auto& slot = getSlots().back();
70 slot.getContainer()->applyProbThreshold(mProbabilityThreshold, mNumberOfStrobes);
71 }
72
74 {
75 const auto& slot = getSlots().back();
76 start = slot.getTFStart();
77 end = slot.getTFEnd();
78 return *(slot.getContainer());
79 }
80
81 // Functions overloaded from the calibration framework
82 bool process(calibration::TFType tf, const gsl::span<const o2::itsmft::CompClusterExt> data) final;
83
84 // Functions required by the calibration framework
85 void initOutput() final {}
87 void finalizeSlot(Slot& slot) final;
88 bool hasEnoughData(const Slot& slot) const final;
89
90 private:
91 float mProbabilityThreshold = 1e-6f;
92 float mProbRelErr = 0.2; // relative error on channel noise to apply the threshold
93 long mMinROFs = 0;
94 unsigned int mThreshold = 100;
95 unsigned int mNumberOfStrobes = 0;
96};
97
98} // namespace mft
99} // namespace o2
100
101#endif /* O2_MFT_NOISESLOTCALIBRATOR */
Definition of the ITSMFT compact cluster.
Definition of the ITSMFT digit.
Definition of the ITSMFT NoiseMap.
NoiseMap class for the ITS and MFT.
Definition NoiseMap.h:39
static long getMinROFs(float t, float relErr)
Definition NoiseMap.h:197
void setThreshold(unsigned int t)
void finalizeSlot(Slot &slot) final
Slot & emplaceNewSlot(bool, calibration::TFType, calibration::TFType) final
const o2::itsmft::NoiseMap & getNoiseMap(long &start, long &end)
NoiseSlotCalibrator(float prob, float relErr)
bool processTimeFrame(calibration::TFType tf, gsl::span< const o2::itsmft::Digit > const &digits, gsl::span< const o2::itsmft::ROFRecord > const &rofs)
bool hasEnoughData(const Slot &slot) const final
~NoiseSlotCalibrator() final=default
GLdouble n
Definition glcorearb.h:1982
GLuint GLuint end
Definition glcorearb.h:469
GLboolean * data
Definition glcorearb.h:298
GLuint start
Definition glcorearb.h:469
uint32_t TFType
Definition TimeSlot.h:29
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::unique_ptr< GPUReconstructionTimeframe > tf
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
std::vector< Cluster > clusters
std::vector< Digit > digits