Project
Loading...
Searching...
No Matches
CorrectionMapsHelper.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 TPC_CORRECTION_MAPS_HELPER_H_
17#define TPC_CORRECTION_MAPS_HELPER_H_
18
19#include "TPCFastTransform.h"
20#include "CorrectionMapsTypes.h"
21
22namespace o2::gpu
23{
24
26{
27 public:
31 void updateLumiScale(bool report = false);
32 void clear();
33
37
40 void setCorrMapMShape(std::unique_ptr<o2::gpu::TPCFastTransform>&& m);
41
42 void reportScaling();
43 void setInstLumiCTP(float v)
44 {
45 if (v != mInstLumiCTP) {
47 }
48 }
49
50 void setInstLumi(float v, bool report = false)
51 {
52 if (v != mInstLumi) {
53 mInstLumi = v;
55 }
56 }
57
58 void setMeanLumi(float v, bool report = false)
59 {
60 if (v != mMeanLumi) {
61 mMeanLumi = v;
63 }
64 }
65
66 void setMeanLumiRef(float v, bool report = false)
67 {
68 if (v != mMeanLumiRef) {
71 }
72 }
73
75 {
76 if (v != mLumiScaleMode) {
78 updateLumiScale(false);
79 }
80 }
81
84
85 float getInstLumiCTP() const { return mInstLumiCTP; }
86 float getInstLumi() const { return mInstLumi; }
87 float getMeanLumi() const { return mMeanLumi; }
88 float getMeanLumiRef() const { return mMeanLumiRef; }
89
90 float getLumiScale() const { return mLumiScale; }
92
93 bool isUpdated() const { return mUpdatedFlags != 0; }
94 bool isUpdatedMap() const { return (mUpdatedFlags & UpdateFlags::MapBit) != 0; }
95 bool isUpdatedMapRef() const { return (mUpdatedFlags & UpdateFlags::MapRefBit) != 0; }
97 bool isUpdatedLumi() const { return (mUpdatedFlags & UpdateFlags::LumiBit) != 0; }
104 bool getLumiCTPAvailable() const { return mLumiCTPAvailable; }
108 bool getUseMShapeCorrection() const { return mEnableMShape; }
109 bool canUseCorrections() const { return mMeanLumi >= 0.; }
112 float getMeanLumiOverride() const { return mMeanLumiOverride; }
114
117
118 int32_t getUpdateFlags() const { return mUpdatedFlags; }
119
122 {
123 if (mCorrMapMShape) {
124 // just check for the first spline the number of knots which are 4 in case of default spline object
125 return mCorrMapMShape->getCorrection().getSplineForRow(0).getNumberOfKnots() == 4;
126 }
127 return true;
128 }
129
130 protected:
131 enum UpdateFlags { MapBit = 0x1,
133 LumiBit = 0x4,
134 MapMShapeBit = 0x10 };
135 bool mLumiCTPAvailable = false; // is CTP Lumi available
136 // these 2 are global options, must be set by the workflow global options
137 tpc::LumiScaleType mLumiScaleType = tpc::LumiScaleType::Unset; // use CTP Lumi (1) or TPCScaler (2) for the correction scaling, 0 - no scaling
138 tpc::LumiScaleMode mLumiScaleMode = tpc::LumiScaleMode::Unset; // scaling-mode of the correction maps: 0 = linear scaling, 1 = using the derivative map, 2 = using the derivative map for MC (i.e. only apply the scaled derivative on top of the reference map)
139 int32_t mUpdatedFlags = 0;
140 float mInstLumiCTP = 0.; // instanteneous luminosity from CTP (a.u)
141 float mInstLumi = 0.; // instanteneous luminosity (a.u) used for TPC corrections scaling
142 float mMeanLumi = 0.; // mean luminosity of the map (a.u) used for TPC corrections scaling
143 float mMeanLumiRef = 0.; // mean luminosity of the ref map (a.u) used for TPC corrections scaling reference
144 float mLumiScale = 0.; // precalculated mInstLumi/mMeanLumi
145 float mMeanLumiOverride = -1.f; // optional value to override mean lumi
146 float mMeanLumiRefOverride = -1.f; // optional value to override ref mean lumi
147 float mInstCTPLumiOverride = -1.f; // optional value to override inst lumi from CTP
148 bool mEnableMShape = false;
149 bool mCheckCTPIDCConsistency{true}; // check of selected CTP or IDC scaling source being consistent with the map
150 o2::gpu::TPCFastTransform* mCorrMap{nullptr}; // current transform
151 o2::gpu::TPCFastTransform* mCorrMapRef{nullptr}; // reference transform
152 std::unique_ptr<o2::gpu::TPCFastTransform> mCorrMapMShape{nullptr}; // correction map for M-shape distortions on A-side
154};
155
156} // namespace o2::gpu
157
158#endif
Helper class for enums and structs related to the correction maps.
Definition of TPCFastTransform class.
o2::gpu::TPCFastTransform * mCorrMap
void setMeanLumiRef(float v, bool report=false)
void setLumiScaleType(tpc::LumiScaleType v)
ClassDefNV(CorrectionMapsHelper, 6)
void setLumiScaleMode(tpc::LumiScaleMode v)
const o2::gpu::TPCFastTransform * getCorrMapMShape() const
tpc::LumiScaleType getLumiScaleType() const
bool mEnableMShape
use v shape correction
void setInstLumi(float v, bool report=false)
void setCorrMapRef(o2::gpu::TPCFastTransform *m)
CorrectionMapsHelper(const CorrectionMapsHelper &)=delete
const o2::gpu::TPCFastTransform * getCorrMap() const
std::unique_ptr< o2::gpu::TPCFastTransform > mCorrMapMShape
void updateLumiScale(bool report=false)
void setCorrMapMShape(std::unique_ptr< o2::gpu::TPCFastTransform > &&m)
void setMeanLumi(float v, bool report=false)
o2::gpu::TPCFastTransform * mCorrMapRef
void setCorrMap(o2::gpu::TPCFastTransform *m)
bool isCorrMapMShapeDummy() const
return returns if the correction map for the M-shape correction is a dummy spline object
const o2::gpu::TPCFastTransform * getCorrMapRef() const
tpc::LumiScaleMode getLumiScaleMode() const
const GLfloat * m
Definition glcorearb.h:4066
const GLdouble * v
Definition glcorearb.h:832
GLdouble f
Definition glcorearb.h:310
void report(gsl::span< o2::InteractionTimeRecord > irs, int threshold, bool verbose)