Project
Loading...
Searching...
No Matches
PHOSRunbyrunCalibrator.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_CALIBRATION_PHOSRUNBYRUN_CALIBRATOR_H
13#define O2_CALIBRATION_PHOSRUNBYRUN_CALIBRATOR_H
14
17
18#include "Framework/Task.h"
23#include <boost/histogram.hpp>
24#include "TH1.h"
27#include "PHOSBase/Geometry.h"
28
29using namespace o2::framework;
30
31namespace o2
32{
33namespace phos
34{
35
37{
38 public:
39 using boostHisto = boost::histogram::histogram<std::tuple<boost::histogram::axis::regular<double, boost::use_default, boost::use_default, boost::use_default>>, boost::histogram::unlimited_storage<std::allocator<char>>>;
40
41 PHOSRunbyrunSlot(bool useCCDB, std::string path);
43
44 ~PHOSRunbyrunSlot() = default;
45
46 void print() const;
47 void fill(const gsl::span<const Cluster>& clusters, const gsl::span<const TriggerRecord>& trs);
48 void fill(const gsl::span<const Cluster>& /*clusters*/){}; // not used
49 void merge(const PHOSRunbyrunSlot* prev);
50 void clear();
51
52 boostHisto& getCollectedHistos(int m) { return mReMi[m]; }
53
54 void setRunStartTime(long tf) { mRunStartTime = tf; }
55
56 private:
57 bool checkCluster(const Cluster& clu);
58
59 private:
60 bool mUseCCDB = false;
61 long mRunStartTime = 0;
62 float mPtCut = 1.5;
63 std::string mCCDBPath{"http://alice-ccdb.cern.ch"};
64 std::array<boostHisto, 8> mReMi;
65 std::unique_ptr<RingBuffer> mBuffer;
66 std::unique_ptr<BadChannelsMap> mBadMap;
67
68 ClassDefNV(PHOSRunbyrunSlot, 1);
69};
70
71//==========================================================================================
72class PHOSRunbyrunCalibrator final : public o2::calibration::TimeSlotCalibration<o2::phos::PHOSRunbyrunSlot>
73{
75
76 public:
79
80 bool hasEnoughData(const Slot& slot) const final;
81 void initOutput() final;
82 void finalizeSlot(Slot& slot) final;
83 Slot& emplaceNewSlot(bool front, TFType tstart, TFType tend) final;
84 bool process(TFType tf, const gsl::span<const Cluster>& clu, const gsl::span<const TriggerRecord>& trs);
85
86 std::array<float, 8> getCalibration() { return mRunByRun; }
87 void writeHistos();
88
89 // Functions used in histo fittings
90 double CBRatio(double* x, double* p);
91 double CBSignal(double* x, double* p);
92 double bg(double* x, double* p);
93
94 private:
95 void scanClusters(o2::framework::ProcessingContext& pc);
96 bool checkCluster(const Cluster& clu);
97
98 private:
99 bool mUseCCDB = false;
100 long mRunStartTime = 0;
101 std::string mCCDBPath{"http://alice-ccdb.cern.ch"};
102 std::array<float, 8> mRunByRun;
103 std::array<TH1F*, 8> mReMi;
104
105 ClassDefOverride(PHOSRunbyrunCalibrator, 1);
106};
107
108} // namespace phos
109} // namespace o2
110
111#endif
Device to collect energy and time PHOS energy and time calibration.
Contains PHOS cluster parameters.
Definition Cluster.h:39
double CBSignal(double *x, double *p)
std::array< float, 8 > getCalibration()
bool hasEnoughData(const Slot &slot) const final
Slot & emplaceNewSlot(bool front, TFType tstart, TFType tend) final
void fill(const gsl::span< const Cluster > &clusters, const gsl::span< const TriggerRecord > &trs)
void merge(const PHOSRunbyrunSlot *prev)
boost::histogram::histogram< std::tuple< boost::histogram::axis::regular< double, boost::use_default, boost::use_default, boost::use_default > >, boost::histogram::unlimited_storage< std::allocator< char > > > boostHisto
void fill(const gsl::span< const Cluster > &)
boostHisto & getCollectedHistos(int m)
GLint GLenum GLint x
Definition glcorearb.h:403
const GLfloat * m
Definition glcorearb.h:4066
GLsizei const GLchar *const * path
Definition glcorearb.h:3591
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::unique_ptr< GPUReconstructionTimeframe > tf
VectorOfTObjectPtrs other
Cluster clu
std::vector< Cluster > clusters