Project
Loading...
Searching...
No Matches
CalibratordEdx.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 ALICEO2_TPC_CALIBRATORDEDX_H_
17#define ALICEO2_TPC_CALIBRATORDEDX_H_
18
19#include <array>
20#include <cstdint>
21#include <string_view>
22#include <utility>
23
24// o2 includes
27#include "CCDB/CcdbObjectInfo.h"
33
34namespace o2::tpc
35{
36
38class CalibratordEdx final : public o2::calibration::TimeSlotCalibration<o2::tpc::CalibdEdx>
39{
40 using TFType = o2::calibration::TFType;
42 using TFinterval = std::vector<std::pair<TFType, TFType>>;
43 using TimeInterval = std::vector<std::pair<long, long>>;
44 using CalibVector = std::vector<CalibdEdxCorrection>;
45
46 public:
47 CalibratordEdx() = default;
48
49 void setHistParams(int dEdxBins, float mindEdx, float maxdEdx, int angularBins, bool fitSnp)
50 {
51 mdEdxBins = dEdxBins;
52 mMindEdx = mindEdx;
53 mMaxdEdx = maxdEdx;
54 mAngularBins = angularBins;
55 mFitSnp = fitSnp;
56 }
57 void setCuts(const TrackCuts& cuts) { mCuts = cuts; }
58 void setMinEntries(int minEntries) { mMinEntries = minEntries; }
59 void setFitThresholds(int minEntriesSector, int minEntries1D, int minEntries2D) { mFitThreshold = {minEntriesSector, minEntries1D, minEntriesSector}; }
60 void setApplyCuts(bool apply) { mApplyCuts = apply; }
61 void setElectronCut(std::tuple<float, int, float> values) { mElectronCut = values; }
62 void setMaterialType(o2::base::Propagator::MatCorrType materialType) { mMatType = materialType; }
63 void setMakeGaussianFits(const bool makeGaussianFits) { mMakeGaussianFits = makeGaussianFits; }
64
67 bool hasEnoughData(const Slot& slot) const final { return slot.getContainer()->hasEnoughData(mMinEntries); };
68
70 void initOutput() final;
71
73 void finalizeSlot(Slot&) final;
74
76 Slot& emplaceNewSlot(bool front, TFType tstart, TFType tend) final;
77
79 const CalibVector& getCalibs() const { return mCalibs; }
80
82 const TFinterval& getTFinterval() const { return mTFIntervals; }
83
85 const TimeInterval& getTimeIntervals() const { return mTimeIntervals; }
86
88 void enableDebugOutput(std::string_view fileName);
89
91 void disableDebugOutput();
92
94 bool hasDebugOutput() const { return static_cast<bool>(mDebugOutputStreamer); }
95
97 void finalizeDebugOutput() const;
98
100 void setTrackDebug(bool debug) { mEnableTrackDebug = debug; }
101
103 void setDumpHistograms(uint32_t flags) { mDumpHistograms = flags; }
104
105 uint32_t getDumpHistograms() const { return mDumpHistograms; }
106
107 private:
108 int mdEdxBins{};
109 float mMindEdx{};
110 float mMaxdEdx{};
111 int mAngularBins{};
112 bool mFitSnp{};
113 bool mEnableTrackDebug{false};
114 int mMinEntries{};
115 uint32_t mDumpHistograms{0};
116 std::array<int, 3> mFitThreshold{};
117 bool mApplyCuts{true};
118 std::tuple<float, int, float> mElectronCut{};
119 TrackCuts mCuts;
121 bool mMakeGaussianFits{};
122
123 TFinterval mTFIntervals;
124 TimeInterval mTimeIntervals;
125 CalibVector mCalibs;
126
127 std::unique_ptr<o2::utils::TreeStreamRedirector> mDebugOutputStreamer;
128
129 ClassDefOverride(CalibratordEdx, 3);
130};
131
132} // namespace o2::tpc
133#endif
This file provides the container used for time based residual dE/dx calibration.
uint64_t TFType
std::ostringstream debug
dE/dx calibrator class
void initOutput() final
Empty the output vectors.
const TFinterval & getTFinterval() const
void setFitThresholds(int minEntriesSector, int minEntries1D, int minEntries2D)
uint32_t getDumpHistograms() const
void disableDebugOutput()
Disable debug output to file. Also writes and closes stored time slots.
void setTrackDebug(bool debug)
Track debugging.
bool hasEnoughData(const Slot &slot) const final
Check if there are enough data to compute the calibration.
void finalizeDebugOutput() const
Write debug output to file.
void setApplyCuts(bool apply)
void setCuts(const TrackCuts &cuts)
const CalibVector & getCalibs() const
void finalizeSlot(Slot &) final
Process time slot data and compute its calibration.
void setMinEntries(int minEntries)
void setHistParams(int dEdxBins, float mindEdx, float maxdEdx, int angularBins, bool fitSnp)
void setMaterialType(o2::base::Propagator::MatCorrType materialType)
void setElectronCut(std::tuple< float, int, float > values)
Slot & emplaceNewSlot(bool front, TFType tstart, TFType tend) final
Creates new time slot.
void setMakeGaussianFits(const bool makeGaussianFits)
void setDumpHistograms(uint32_t flags)
Dump histograms.
void enableDebugOutput(std::string_view fileName)
Enable debug output to file of the time slots calibrations outputs and dE/dx histograms.
const TimeInterval & getTimeIntervals() const
track cut class
Definition TrackCuts.h:37
GLenum GLsizei GLsizei GLint * values
Definition glcorearb.h:1576
GLbitfield flags
Definition glcorearb.h:1570
uint32_t TFType
Definition TimeSlot.h:29
Global TPC definitions and constants.
Definition SimTraits.h:167