Project
Loading...
Searching...
No Matches
MeanVertexCalibrator.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 MEAN_VERTEX_CALIBRATOR_H_
13#define MEAN_VERTEX_CALIBRATOR_H_
14
19#include "CCDB/CcdbObjectInfo.h"
21#include <array>
22#include <deque>
23
24namespace o2
25{
26namespace calibration
27{
28
29class MeanVertexCalibrator final : public o2::calibration::TimeSlotCalibration<o2::calibration::MeanVertexData>
30{
35 using MVObjectVector = std::vector<MVObject>;
37 using CcdbObjectInfoVector = std::vector<CcdbObjectInfo>;
38
39 public:
40 struct HistoParams {
41 int nBins = 0.;
42 float binWidth = 0.;
43 float minRange = 0.;
44 float maxRange = 0.;
45 };
46
48 ~MeanVertexCalibrator() final = default;
49
50 bool hasEnoughData(const Slot& slot) const final;
51 void initOutput() final;
52 void finalizeSlot(Slot& slot) final;
53 Slot& emplaceNewSlot(bool front, TFType tstart, TFType tend) final;
54
55 void doSimpleMovingAverage(std::deque<float>& dq, float& sma);
56 void doSimpleMovingAverage(std::deque<MVObject>& dq, MVObject& sma);
57
58 const MVObjectVector& getMeanVertexObjectVector() const { return mMeanVertexVector; }
59 const CcdbObjectInfoVector& getMeanVertexObjectInfoVector() const { return mInfoVector; }
60 CcdbObjectInfoVector& getMeanVertexObjectInfoVector() { return mInfoVector; }
61
62 void useVerboseMode(bool flag) { mVerbose = flag; }
63 bool getVerboseMode() const { return mVerbose; }
64
66 void fitMeanVertexCoord(int icoord, const float* array, const HistoParams& hpar, o2::dataformats::MeanVertexObject& mvo);
67 HistoParams binVector(std::vector<float>& vectOut, const std::vector<float>& vectIn, o2::calibration::MeanVertexData* c, int dim);
68 void printVector(const std::vector<float>& vect, const HistoParams& hpar);
69 void printVector(const float* vect, const HistoParams& hpar);
70
71 private:
72 CcdbObjectInfoVector mInfoVector; // vector of CCDB Infos , each element is filled with the CCDB description
73 // of the accompanying LHCPhase
74 MVObjectVector mMeanVertexVector; // vector of Mean Vertex Objects, each element is filled in "process"
75 // when we finalize one slot (multiple can be finalized during the same
76 // "process", which is why we have a vector. Each element is to be considered
77 // the output of the device, and will go to the CCDB. It is the simple
78 // moving average
79 std::deque<MVObject> mTmpMVobjDq; // This is the deque of MeanVertex objecs that will be used for the
80 // simple moving average
81 MVObject mSMAMVobj; // object containing the Simple Moving Average to be put to CCDB
82 std::deque<long> mTmpMVobjDqTimeStart; // This is the deque of MeanVertex objecs that will be used for the
83 // simple moving average, start time of used TFs
84 std::deque<o2::math_utils::detail::Bracket<long>> mTmpMVobjDqTime; // This is the deque for the start and end time of the
85 // slots used for the SMA
86 bool mVerbose = false; // Whether to log in verbose mode
87
88 ClassDefOverride(MeanVertexCalibrator, 1);
89};
90
91} // end namespace calibration
92} // end namespace o2
93
94#endif /* TOF_LHCPHASE_CALIBRATION_H_ */
Class to represent an interval and some operations over it.
uint32_t c
Definition RawData.h:2
Slot & emplaceNewSlot(bool front, TFType tstart, TFType tend) final
void printVector(const std::vector< float > &vect, const HistoParams &hpar)
const MVObjectVector & getMeanVertexObjectVector() const
void fitMeanVertexCoord(int icoord, const float *array, const HistoParams &hpar, o2::dataformats::MeanVertexObject &mvo)
bool hasEnoughData(const Slot &slot) const final
bool fitMeanVertex(o2::calibration::MeanVertexData *c, o2::dataformats::MeanVertexObject &mvo)
void doSimpleMovingAverage(std::deque< float > &dq, float &sma)
HistoParams binVector(std::vector< float > &vectOut, const std::vector< float > &vectIn, o2::calibration::MeanVertexData *c, int dim)
const CcdbObjectInfoVector & getMeanVertexObjectInfoVector() const
CcdbObjectInfoVector & getMeanVertexObjectInfoVector()
GLenum array
Definition glcorearb.h:4274
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Defining DataPointCompositeObject explicitly as copiable.