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#ifndef GPUCA_GPUCODE_DEVICE
20#include <memory>
21#include <vector>
22#endif
23#include "GPUCommonDef.h"
24#include "TPCFastTransform.h"
25
26namespace o2
27{
28namespace gpu
29{
30
32{
33 public:
37 void updateLumiScale(bool report = false);
38 void clear();
39
40 GPUd() void Transform(int32_t slice, int32_t row, float pad, float time, float& x, float& y, float& z, float vertexTime = 0) const
41 {
43 }
44
45 GPUd() void TransformXYZ(int32_t slice, int32_t row, float& x, float& y, float& z) const
46 {
47 mCorrMap->TransformXYZ(slice, row, x, y, z, mCorrMapRef, mCorrMapMShape, mLumiScale, 1, mLumiScaleMode);
48 }
49
50 GPUd() void InverseTransformYZtoX(int32_t slice, int32_t row, float y, float z, float& x) const
51 {
52 mCorrMap->InverseTransformYZtoX(slice, row, y, z, x, mCorrMapRef, mCorrMapMShape, (mScaleInverse ? mLumiScale : 0), (mScaleInverse ? 1 : 0), mLumiScaleMode);
53 }
54
55 GPUd() void InverseTransformYZtoNominalYZ(int32_t slice, int32_t row, float y, float z, float& ny, float& nz) const
56 {
57 mCorrMap->InverseTransformYZtoNominalYZ(slice, row, y, z, ny, nz, mCorrMapRef, mCorrMapMShape, (mScaleInverse ? mLumiScale : 0), (mScaleInverse ? 1 : 0), mLumiScaleMode);
58 }
59
60 GPUd() const o2::gpu::TPCFastTransform* getCorrMap() const { return mCorrMap; }
61 GPUd() const o2::gpu::TPCFastTransform* getCorrMapRef() const { return mCorrMapRef; }
62 GPUd() const o2::gpu::TPCFastTransform* getCorrMapMShape() const { return mCorrMapMShape; }
63
64 bool getOwner() const { return mOwner; }
65
69 void reportScaling();
70 void setInstLumiCTP(float v)
71 {
72 if (v != mInstLumiCTP) {
74 }
75 }
76
77 void setInstLumi(float v, bool report = false)
78 {
79 if (v != mInstLumi) {
80 mInstLumi = v;
82 }
83 }
84
85 void setMeanLumi(float v, bool report = false)
86 {
87 if (v != mMeanLumi) {
88 mMeanLumi = v;
90 }
91 }
92
93 void setMeanLumiRef(float v, bool report = false)
94 {
95 if (v != mMeanLumiRef) {
98 }
99 }
100
101 void setLumiScaleMode(int32_t v)
102 {
103 if (v != mLumiScaleMode) {
105 updateLumiScale(false);
106 }
107 }
108
109 GPUd() float getInstLumiCTP() const { return mInstLumiCTP; }
110 GPUd() float getInstLumi() const { return mInstLumi; }
111 GPUd() float getMeanLumi() const { return mMeanLumi; }
112 GPUd() float getMeanLumiRef() const { return mMeanLumiRef; }
113
114 GPUd() float getLumiScale() const { return mLumiScale; }
115 GPUd() int32_t getLumiScaleMode() const { return mLumiScaleMode; }
116
117 bool isUpdated() const { return mUpdatedFlags != 0; }
118 bool isUpdatedMap() const { return (mUpdatedFlags & UpdateFlags::MapBit) != 0; }
119 bool isUpdatedMapRef() const { return (mUpdatedFlags & UpdateFlags::MapRefBit) != 0; }
121 bool isUpdatedLumi() const { return (mUpdatedFlags & UpdateFlags::LumiBit) != 0; }
126
127#if !defined(GPUCA_GPUCODE_DEVICE)
128 void setCorrMap(std::unique_ptr<o2::gpu::TPCFastTransform>&& m);
129 void setCorrMapRef(std::unique_ptr<o2::gpu::TPCFastTransform>&& m);
130 void setCorrMapMShape(std::unique_ptr<o2::gpu::TPCFastTransform>&& m);
131#endif
132 void setOwner(bool v);
135 bool getLumiCTPAvailable() const { return mLumiCTPAvailable; }
136 void setLumiScaleType(int32_t v) { mLumiScaleType = v; }
137 int32_t getLumiScaleType() const { return mLumiScaleType; }
139 bool getUseMShapeCorrection() const { return mEnableMShape; }
140 bool canUseCorrections() const { return mMeanLumi >= 0.; }
143 float getMeanLumiOverride() const { return mMeanLumiOverride; }
145
148
149 int32_t getUpdateFlags() const { return mUpdatedFlags; }
150
151 bool getScaleInverse() const { return mScaleInverse; }
152
154 GPUd() bool isCorrMapMShapeDummy() const
155 {
156 if (mCorrMapMShape) {
157 // just check for the first spline the number of knots which are 4 in case of default spline object
158 return mCorrMapMShape->getCorrection().getSpline(0, 0).getNumberOfKnots() == 4;
159 }
160 return true;
161 }
162
163 protected:
164 enum UpdateFlags { MapBit = 0x1,
166 LumiBit = 0x4,
167 MapMShapeBit = 0x10 };
168 bool mOwner = false; // is content of pointers owned by the helper
169 bool mLumiCTPAvailable = false; // is CTP Lumi available
170 // these 2 are global options, must be set by the workflow global options
171 int32_t mLumiScaleType = -1; // use CTP Lumi (1) or TPCScaler (2) for the correction scaling, 0 - no scaling
172 int32_t mLumiScaleMode = -1; // scaling-mode of the correciton maps
173 int32_t mUpdatedFlags = 0;
174 float mInstLumiCTP = 0.; // instanteneous luminosity from CTP (a.u)
175 float mInstLumi = 0.; // instanteneous luminosity (a.u) used for TPC corrections scaling
176 float mMeanLumi = 0.; // mean luminosity of the map (a.u) used for TPC corrections scaling
177 float mMeanLumiRef = 0.; // mean luminosity of the ref map (a.u) used for TPC corrections scaling reference
178 float mLumiScale = 0.; // precalculated mInstLumi/mMeanLumi
179 float mMeanLumiOverride = -1.f; // optional value to override mean lumi
180 float mMeanLumiRefOverride = -1.f; // optional value to override ref mean lumi
181 float mInstCTPLumiOverride = -1.f; // optional value to override inst lumi from CTP
182 bool mEnableMShape = false;
183 bool mScaleInverse{false}; // if set to false the inverse correction is already scaled and will not scaled again
184 o2::gpu::TPCFastTransform* mCorrMap{nullptr}; // current transform
185 o2::gpu::TPCFastTransform* mCorrMapRef{nullptr}; // reference transform
186 o2::gpu::TPCFastTransform* mCorrMapMShape{nullptr}; // correction map for v-shape distortions on A-side
188};
189
190} // namespace gpu
191} // namespace o2
192
193#endif
Definition of TPCFastTransform class.
void setCorrMapMShape(o2::gpu::TPCFastTransform *m)
GPUd() float getMeanLumi() const
GPUd() int32_t getLumiScaleMode() const
GPUd() float getInstLumiCTP() const
GPUd() float getLumiScale() const
void setCorrMapRef(o2::gpu::TPCFastTransform *m)
o2::gpu::TPCFastTransform * mCorrMapMShape
o2::gpu::TPCFastTransform * mCorrMap
void setMeanLumiRef(float v, bool report=false)
ClassDefNV(CorrectionMapsHelper, 6)
void setCorrMapMShape(std::unique_ptr< o2::gpu::TPCFastTransform > &&m)
bool mEnableMShape
use v shape correction
void setInstLumi(float v, bool report=false)
GPUd() void Transform(int32_t slice
CorrectionMapsHelper(const CorrectionMapsHelper &)=delete
int32_t float float float float float float vertexTime
GPUd() float getMeanLumiRef() const
void setCorrMapRef(std::unique_ptr< o2::gpu::TPCFastTransform > &&m)
GPUd() bool isCorrMapMShapeDummy() const
return returns if the correction map for the M-shape correction is a dummy spline object
void updateLumiScale(bool report=false)
void setMeanLumi(float v, bool report=false)
o2::gpu::TPCFastTransform * mCorrMapRef
GPUd() float getInstLumi() const
void setCorrMap(std::unique_ptr< o2::gpu::TPCFastTransform > &&m)
TPCFastSpaceChargeCorrection & getCorrection()
Gives a reference for external initialization of TPC corrections.
GLint GLenum GLint x
Definition glcorearb.h:403
const GLfloat * m
Definition glcorearb.h:4066
const GLdouble * v
Definition glcorearb.h:832
GLdouble f
Definition glcorearb.h:310
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
void report(gsl::span< o2::InteractionTimeRecord > irs, int threshold, bool verbose)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...