Project
Loading...
Searching...
No Matches
CalibratorGain.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
15
16#ifndef O2_TRD_CALIBRATORGAIN_H
17#define O2_TRD_CALIBRATORGAIN_H
18
23#include "CCDB/CcdbObjectInfo.h"
26
27#include "Rtypes.h"
28#include "TProfile.h"
29#include "Fit/Fitter.h"
30#include "TFile.h"
31#include "TTree.h"
32#include <TF1Convolution.h>
33
34#include <array>
35#include <cstdlib>
36#include <memory>
37
38namespace o2
39{
40namespace trd
41{
42
43class CalibratorGain final : public o2::calibration::TimeSlotCalibration<o2::trd::GainCalibHistos>
44{
46
47 public:
48 CalibratorGain() = default;
49 ~CalibratorGain() final = default;
50
51 bool hasEnoughData(const Slot& slot) const final { return slot.getContainer()->getNEntries() >= mMinEntriesTotal; }
52 void initOutput() final;
53 void finalizeSlot(Slot& slot) final;
54 Slot& emplaceNewSlot(bool front, TFType tStart, TFType tEnd) final;
55
58 void createOutputFile();
59
62 void closeOutputFile();
63
64 const std::vector<o2::trd::CalGain>& getCcdbObjectVector() const { return mObjectVector; }
65 std::vector<o2::ccdb::CcdbObjectInfo>& getCcdbObjectInfoVector() { return mInfoVector; }
66
67 void initProcessing();
68
72
73 private:
74 bool mInitDone{false};
75 const TRDCalibParams& mParams{TRDCalibParams::Instance()};
76 size_t mMinEntriesTotal{mParams.minEntriesTotalGainCalib};
77 size_t mMinEntriesChamber{mParams.minEntriesChamberGainCalib};
78 bool mEnableOutput{false};
79 std::unique_ptr<TFile> mOutFile{nullptr};
80 std::unique_ptr<TTree> mOutTree{nullptr};
81 std::unique_ptr<TF1Convolution> mFconv;
82 std::unique_ptr<TF1> mFitFunction;
83 std::array<float, constants::MAXCHAMBER> mFitResults;
84 std::array<std::unique_ptr<TH1F>, constants::MAXCHAMBER> mdEdxhists;
85 std::vector<o2::ccdb::CcdbObjectInfo> mInfoVector;
86 std::vector<o2::trd::CalGain> mObjectVector;
87
88 ClassDefOverride(CalibratorGain, 1);
89};
90
91} // namespace trd
92} // namespace o2
93
94#endif // O2_TRD_CALIBRATORGAIN_H
Object with MPV dEdx values per chamber to be written into the CCDB.
Global TRD definitions and constants.
Class to store the TRD dEdx distribution for each TRD chamber.
uint64_t TFType
void finalizeSlot(Slot &slot) final
bool hasEnoughData(const Slot &slot) const final
std::vector< o2::ccdb::CcdbObjectInfo > & getCcdbObjectInfoVector()
Slot & emplaceNewSlot(bool front, TFType tStart, TFType tEnd) final
void retrievePrev(o2::framework::ProcessingContext &pc)
const std::vector< o2::trd::CalGain > & getCcdbObjectVector() const
~CalibratorGain() final=default
constexpr int MAXCHAMBER
the maximum number of installed chambers
Definition Constants.h:30
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Defining DataPointCompositeObject explicitly as copiable.
size_t minEntriesTotalGainCalib
minimum total required for meaningful fits
size_t minEntriesChamberGainCalib
minimum number of entries per chamber to fit single time slot