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
38
42 void setCorrMapMShape(std::unique_ptr<o2::gpu::TPCFastTransform>&& m);
43
44 void reportScaling();
45 void setInstLumiCTP(float v)
46 {
47 if (v != mInstLumiCTP) {
49 }
50 }
51
52 void setInstLumi(float v, bool report = false)
53 {
54 if (v != mInstLumi) {
55 mInstLumi = v;
57 }
58 }
59
60 void setMeanLumi(float v, bool report = false)
61 {
62 if (v != mMeanLumi) {
63 mMeanLumi = v;
65 }
66 }
67
68 void setMeanLumiRef(float v, bool report = false)
69 {
70 if (v != mMeanLumiRef) {
73 }
74 }
75
77 {
78 if (v != mLumiScaleMode) {
80 updateLumiScale(false);
81 }
82 }
83
86
87 float getInstLumiCTP() const { return mInstLumiCTP; }
88 float getInstLumi() const { return mInstLumi; }
89 float getMeanLumi() const { return mMeanLumi; }
90 float getMeanLumiRef() const { return mMeanLumiRef; }
91
92 float getLumiScale() const { return mLumiScale; }
94
95 bool isUpdated() const { return mUpdatedFlags != 0; }
96 bool isUpdatedMap() const { return (mUpdatedFlags & UpdateFlags::MapBit) != 0; }
97 bool isUpdatedMapRef() const { return (mUpdatedFlags & UpdateFlags::MapRefBit) != 0; }
99 bool isUpdatedLumi() const { return (mUpdatedFlags & UpdateFlags::LumiBit) != 0; }
107 bool getLumiCTPAvailable() const { return mLumiCTPAvailable; }
111 bool getUseMShapeCorrection() const { return mEnableMShape; }
112 bool canUseCorrections() const { return mMeanLumi >= 0.; }
115 float getMeanLumiOverride() const { return mMeanLumiOverride; }
117
120
121 int32_t getUpdateFlags() const { return mUpdatedFlags; }
122
125 {
126 if (mCorrMapMShape) {
127 // just check for the first spline the number of knots which are 4 in case of default spline object
128 return mCorrMapMShape->getCorrection().getSplineForRow(0).getNumberOfKnots() == 4;
129 }
130 return true;
131 }
132
133 protected:
134 enum UpdateFlags { MapBit = 0x1,
136 LumiBit = 0x4,
139 bool mLumiCTPAvailable = false; // is CTP Lumi available
140 // these 2 are global options, must be set by the workflow global options
141 tpc::LumiScaleType mLumiScaleType = tpc::LumiScaleType::Unset; // use CTP Lumi (1) or TPCScaler (2) for the correction scaling, 0 - no scaling
142 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)
143 int32_t mUpdatedFlags = 0;
144 float mInstLumiCTP = 0.; // instanteneous luminosity from CTP (a.u)
145 float mInstLumi = 0.; // instanteneous luminosity (a.u) used for TPC corrections scaling
146 float mMeanLumi = 0.; // mean luminosity of the map (a.u) used for TPC corrections scaling
147 float mMeanLumiRef = 0.; // mean luminosity of the ref map (a.u) used for TPC corrections scaling reference
148 float mLumiScale = 0.; // precalculated mInstLumi/mMeanLumi
149 float mMeanLumiOverride = -1.f; // optional value to override mean lumi
150 float mMeanLumiRefOverride = -1.f; // optional value to override ref mean lumi
151 float mInstCTPLumiOverride = -1.f; // optional value to override inst lumi from CTP
152 bool mEnableMShape = false;
153 bool mCheckCTPIDCConsistency{true}; // check of selected CTP or IDC scaling source being consistent with the map
154 o2::gpu::TPCFastTransform* mCorrMap{nullptr}; // current transform
155 o2::gpu::TPCFastTransform* mCorrMapRef{nullptr}; // reference transform
156 o2::gpu::TPCFastTransform* mCorrMapSecEdgeFluc{nullptr}; // sector edge fluctuation correction map
157 std::unique_ptr<o2::gpu::TPCFastTransform> mCorrMapMShape{nullptr}; // correction map for M-shape distortions on A-side
159};
160
161} // namespace o2::gpu
162
163#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)
const o2::gpu::TPCFastTransform * getCorrMapSecEdgeFluc() const
void setLumiScaleType(tpc::LumiScaleType v)
void setCorrMapSecEdgeFluc(o2::gpu::TPCFastTransform *m)
void setLumiScaleMode(tpc::LumiScaleMode v)
const o2::gpu::TPCFastTransform * getCorrMapMShape() const
o2::gpu::TPCFastTransform * mCorrMapSecEdgeFluc
tpc::LumiScaleType getLumiScaleType() const
ClassDefNV(CorrectionMapsHelper, 7)
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)