Project
Loading...
Searching...
No Matches
TOFCalibCollector.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 TOF_CALIB_COLLECTOR_H_
13#define TOF_CALIB_COLLECTOR_H_
14
17#include "TOFBase/Geo.h"
21
22#include <array>
23
24namespace o2
25{
26namespace tof
27{
28
30{
31
33 using Geo = o2::tof::Geo;
34
35 public:
37
38 TOFCalibInfoSlot(float phase = 0.0) : mLHCphase(phase)
39 {
40 for (int ch = 0; ch < Geo::NCHANNELS; ch++) {
41 mEntriesSlot[ch] = 0;
42 }
43 }
44
45 ~TOFCalibInfoSlot() = default;
46
47 void print() const;
48 void printEntries() const;
49 void fill(const gsl::span<const o2::dataformats::CalibInfoTOF> data);
50 void fill(const gsl::span<const o2::tof::CalibInfoCluster> data);
51 void merge(const TOFCalibInfoSlot* prev);
52 void setLHCphase(float val) { mLHCphase = val; }
53 float getLHCphase() const { return mLHCphase; }
54
55 auto& getEntriesPerChannel() const { return mEntriesSlot; }
56 auto& getEntriesPerChannel() { return mEntriesSlot; }
57 auto& getCollectedCalibInfoSlot() { return mTOFCollectedCalibInfoSlot; }
58 auto& getCollectedCalibInfoSlot() const { return mTOFCollectedCalibInfoSlot; }
59
60 private:
61 std::array<int, Geo::NCHANNELS> mEntriesSlot; // vector containing number of entries per channel
62 std::vector<o2::dataformats::CalibInfoTOF> mTOFCollectedCalibInfoSlot;
63 float mLHCphase = 0; // current LHCphase inside the BC (-5000 < phase < 20000)
64
65 ClassDefNV(TOFCalibInfoSlot, 1);
66};
67
68class TOFCalibCollector final : public o2::calibration::TimeSlotCalibration<o2::tof::TOFCalibInfoSlot>
69{
70 using TFType = o2::calibration::TFType;
72
73 public:
74 TOFCalibCollector(bool TFsendingPolicy, int maxNumOfHits, bool test = false) : mTFsendingPolicy(TFsendingPolicy), mMaxNumOfHits(maxNumOfHits), mTest(test){};
75
76 ~TOFCalibCollector() final = default;
77
78 bool hasEnoughData(const Slot& slot) const final;
79 void initOutput() final;
80 void finalizeSlot(Slot& slot) final;
81 Slot& emplaceNewSlot(bool front, TFType tstart, TFType tend) final;
82 void setIsTest(bool istest) { mTest = istest; }
83 auto& getCollectedCalibInfo() const { return mTOFCollectedCalibInfo; }
84 auto& getEntriesPerChannel() const { return mEntries; }
85 void setIsMaxNumberOfHitsAbsolute(bool absNumber) { mAbsMaxNumOfHits = absNumber; }
86 void setLHCphase(float val) { mLHCphase = val; }
87 float getLHCphase() const { return mLHCphase; }
88
89 private:
90 bool mTFsendingPolicy = false; // whether we will send information at every TF or only when we have a certain statistics
91 int mMaxNumOfHits = 500; // maximum number of hits for one single channel to trigger the sending of the information (if mTFsendingPolicy = false)
92 bool mTest = false; // flag to say whether we are in test mode or not
93 bool mAbsMaxNumOfHits = true; // to decide if the mMaxNumOfHits should be multiplied by the number of TOF channels
94 std::array<int, Geo::NCHANNELS> mEntries; // vector containing number of entries per channel
95 std::vector<o2::dataformats::CalibInfoTOF> mTOFCollectedCalibInfo;
96 float mLHCphase = 0; // current LHCphase inside the BC (-5000 < phase < 20000)
97
98 ClassDefOverride(TOFCalibCollector, 3);
99};
100
101} // end namespace tof
102} // end namespace o2
103
104#endif /* TOF_CHANNEL_CALIBRATOR_H_ */
Class to store the output of the matching to TOF for calibration.
Class to store the output of the matching to TOF for calibration (no channel info,...
uint64_t phase
Definition RawEventData.h:7
TOF geo parameters (only statics)
Definition Geo.h:28
static constexpr Int_t NSECTORS
Definition Geo.h:120
static constexpr int NCHANNELS
Definition Geo.h:124
Slot & emplaceNewSlot(bool front, TFType tstart, TFType tend) final
void finalizeSlot(Slot &slot) final
~TOFCalibCollector() final=default
TOFCalibCollector(bool TFsendingPolicy, int maxNumOfHits, bool test=false)
bool hasEnoughData(const Slot &slot) const final
void setIsMaxNumberOfHitsAbsolute(bool absNumber)
static constexpr int NCHANNELSXSECTOR
auto & getEntriesPerChannel() const
void merge(const TOFCalibInfoSlot *prev)
void fill(const gsl::span< const o2::dataformats::CalibInfoTOF > data)
TOFCalibInfoSlot(float phase=0.0)
auto & getCollectedCalibInfoSlot() const
GLboolean * data
Definition glcorearb.h:298
GLuint GLfloat * val
Definition glcorearb.h:1582
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.