Project
Loading...
Searching...
No Matches
FV0CalibCollector.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 FV0_CALIB_COLLECTOR_H_
13#define FV0_CALIB_COLLECTOR_H_
14
18#include "FV0Base/Constants.h"
19
20#include <array>
21
22namespace o2
23{
24namespace fv0
25{
26
28{
30
31 public:
32 static constexpr int NCHANNELS = Constants::nFv0Channels;
33 static constexpr int HISTO_RANGE = 200;
34
36 {
37 for (int ch = 0; ch < NCHANNELS; ch++) {
38 mEntriesSlot[ch] = 0;
39 }
40 }
41
42 ~FV0CalibInfoSlot() = default;
43
44 void print() const;
45 void printEntries() const;
46 void fill(const gsl::span<const o2::fv0::FV0CalibrationInfoObject> data);
47 void merge(const FV0CalibInfoSlot* prev);
48
49 auto& getEntriesPerChannel() const { return mEntriesSlot; }
50 auto& getEntriesPerChannel() { return mEntriesSlot; }
51 auto& getCollectedCalibInfoSlot() { return mFV0CollectedCalibInfoSlot; }
52 auto& getCollectedCalibInfoSlot() const { return mFV0CollectedCalibInfoSlot; }
53
54 private:
55 std::array<int, NCHANNELS> mEntriesSlot{}; // vector containing number of entries per channel
56 std::vector<o2::fv0::FV0CalibrationInfoObject> mFV0CollectedCalibInfoSlot;
57
58 ClassDefNV(FV0CalibInfoSlot, 1);
59};
60
61class FV0CalibCollector final : public o2::calibration::TimeSlotCalibration<o2::fv0::FV0CalibInfoSlot>
62{
63 using TFType = o2::calibration::TFType;
65 static constexpr int NCHANNELS = Constants::nFv0Channels;
66
67 public:
68 FV0CalibCollector(bool TFsendingPolicy, int maxNumOfHits, bool test = false) : mTFsendingPolicy(TFsendingPolicy), mMaxNumOfHits(maxNumOfHits), mTest(test){};
69
70 ~FV0CalibCollector() final = default;
71
72 bool hasEnoughData(const Slot& slot) const final;
73 void initOutput() final;
74 void finalizeSlot(Slot& slot) final;
75 Slot& emplaceNewSlot(bool front, TFType tstart, TFType tend) final;
76 void setIsTest(bool istest) { mTest = istest; }
77 auto& getCollectedCalibInfo() const { return mFV0CollectedCalibInfo; }
78 auto& getEntriesPerChannel() const { return mEntries; }
79 void setIsMaxNumberOfHitsAbsolute(bool absNumber) { mAbsMaxNumOfHits = absNumber; }
80
81 private:
82 bool mTFsendingPolicy = false; // whether we will send information at every TF or only when we have a certain statistics
83 int mMaxNumOfHits = 1000000; // maximum number of hits for one single channel to trigger the sending of the information (if mTFsendingPolicy = false)
84 bool mTest = false; // flag to say whether we are in test mode or not
85 bool mAbsMaxNumOfHits = true; // to decide if the mMaxNumOfHits should be multiplied by the number of FV0 channels
86 std::array<int, NCHANNELS> mEntries{}; // vector containing number of entries per channel
87 std::vector<o2::fv0::FV0CalibrationInfoObject> mFV0CollectedCalibInfo;
88
89 ClassDefOverride(FV0CalibCollector, 1);
90};
91
92} // end namespace fv0
93} // end namespace o2
94
95#endif /* FV0 CALIB COLLECTOR */
General constants in FV0.
void finalizeSlot(Slot &slot) final
void setIsMaxNumberOfHitsAbsolute(bool absNumber)
FV0CalibCollector(bool TFsendingPolicy, int maxNumOfHits, bool test=false)
bool hasEnoughData(const Slot &slot) const final
~FV0CalibCollector() final=default
Slot & emplaceNewSlot(bool front, TFType tstart, TFType tend) final
auto & getEntriesPerChannel() const
void merge(const FV0CalibInfoSlot *prev)
static constexpr int NCHANNELS
auto & getCollectedCalibInfoSlot() const
void fill(const gsl::span< const o2::fv0::FV0CalibrationInfoObject > data)
static constexpr int HISTO_RANGE
GLboolean * data
Definition glcorearb.h:298
uint32_t TFType
Definition TimeSlot.h:29
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
FIXME: do not use data model tables.
static constexpr int nFv0Channels
Definition Constants.h:32