Project
Loading...
Searching...
No Matches
CorrectionMapsHelper.cxx
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
13#include "GPUCommonLogger.h"
14
15using namespace o2::gpu;
16
17//________________________________________________________
19{
20 if (mOwner) {
21 delete mCorrMap;
22 delete mCorrMapRef;
23 delete mCorrMapMShape;
24 }
25 mLumiCTPAvailable = false;
26 mCorrMap = nullptr;
27 mCorrMapRef = nullptr;
28 mCorrMapMShape = nullptr;
29 mUpdatedFlags = 0;
30 mInstLumiCTP = 0.f;
31 mInstLumi = 0.f;
32 mMeanLumi = 0.f;
33 mMeanLumiRef = 0.f;
34 mScaleInverse = false;
35}
36
38{
39 if (mCorrMap || mCorrMapRef) {
40 throw std::runtime_error("Must not change ownership while we contain objects");
41 }
42 mOwner = v;
43}
44
45//________________________________________________________
47{
48 if (mOwner) {
49 delete mCorrMap;
50 }
51 mCorrMap = m;
52}
53
54//________________________________________________________
62
70
71//________________________________________________________
72void CorrectionMapsHelper::setCorrMap(std::unique_ptr<TPCFastTransform>&& m)
73{
74 if (!mOwner) {
75 throw std::runtime_error("we must not take the ownership from a unique ptr if mOwner is not set");
76 }
77 delete mCorrMap;
78 mCorrMap = m.release();
79}
80
81//________________________________________________________
82void CorrectionMapsHelper::setCorrMapRef(std::unique_ptr<TPCFastTransform>&& m)
83{
84 if (!mOwner) {
85 throw std::runtime_error("we must not take the ownership from a unique ptr if mOwner is not set");
86 }
87 delete mCorrMapRef;
88 mCorrMapRef = m.release();
89}
90
91void CorrectionMapsHelper::setCorrMapMShape(std::unique_ptr<TPCFastTransform>&& m)
92{
93 if (!mOwner) {
94 throw std::runtime_error("we must not take the ownership from a unique ptr if mOwnerMShape is not set");
95 }
96 delete mCorrMapMShape;
97 mCorrMapMShape = m.release();
98}
99
101{
102 if (!canUseCorrections()) {
103 mLumiScale = -1.f;
104 } else if ((mLumiScaleMode == 1) || (mLumiScaleMode == 2)) {
106 LOGP(debug, "mInstLumi: {} mMeanLumi: {} mMeanLumiRef: {}", mInstLumi, mMeanLumi, mMeanLumiRef);
107 } else {
109 }
111 if (report) {
113 }
114}
115
116//________________________________________________________
118{
119 LOGP(info, "Map scaling update: LumiScaleType={} instLumi(CTP)={} instLumi(scaling)={} meanLumiRef={}, meanLumi={} -> LumiScale={} lumiScaleMode={}, M-Shape map valid: {}, M-Shape default: {}",
120 mLumiScaleType == 0 ? "NoScaling" : (mLumiScaleType == 1 ? "LumiCTP" : "TPCScaler"), getInstLumiCTP(), getInstLumi(), getMeanLumiRef(), getMeanLumi(), getLumiScale(),
121 mLumiScaleMode == 0 ? "Linear" : "Derivative", (mCorrMapMShape != nullptr), isCorrMapMShapeDummy());
122}
Helper class to access correction maps.
std::ostringstream debug
void setCorrMapMShape(o2::gpu::TPCFastTransform *m)
void setCorrMapRef(o2::gpu::TPCFastTransform *m)
o2::gpu::TPCFastTransform * mCorrMapMShape
o2::gpu::TPCFastTransform * mCorrMap
void updateLumiScale(bool report=false)
o2::gpu::TPCFastTransform * mCorrMapRef
void setCorrMap(std::unique_ptr< o2::gpu::TPCFastTransform > &&m)
const GLfloat * m
Definition glcorearb.h:4066
const GLdouble * v
Definition glcorearb.h:832
void report(gsl::span< o2::InteractionTimeRecord > irs, int threshold, bool verbose)