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
12
#include "
CorrectionMapsHelper.h
"
13
#include "
GPUCommonLogger.h
"
14
15
using namespace
o2::gpu
;
16
17
//________________________________________________________
18
void
CorrectionMapsHelper::clear
()
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
37
void
CorrectionMapsHelper::setOwner
(
bool
v
)
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
//________________________________________________________
46
void
CorrectionMapsHelper::setCorrMap
(
TPCFastTransform
*
m
)
47
{
48
if
(
mOwner
) {
49
delete
mCorrMap
;
50
}
51
mCorrMap
=
m
;
52
}
53
54
//________________________________________________________
55
void
CorrectionMapsHelper::setCorrMapRef
(
TPCFastTransform
*
m
)
56
{
57
if
(
mOwner
) {
58
delete
mCorrMapRef
;
59
}
60
mCorrMapRef
=
m
;
61
}
62
63
void
CorrectionMapsHelper::setCorrMapMShape
(
TPCFastTransform
*
m
)
64
{
65
if
(
mOwner
) {
66
delete
mCorrMapMShape
;
67
}
68
mCorrMapMShape
=
m
;
69
}
70
71
//________________________________________________________
72
void
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
//________________________________________________________
82
void
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
91
void
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
100
void
CorrectionMapsHelper::updateLumiScale
(
bool
report
)
101
{
102
if
(!
canUseCorrections
()) {
103
mLumiScale
= -1.f;
104
}
else
if
((
mLumiScaleMode
== 1) || (
mLumiScaleMode
== 2)) {
105
mLumiScale
=
mMeanLumiRef
? (
mInstLumi
-
mMeanLumi
) /
mMeanLumiRef
: 0.f;
106
LOGP(
debug
,
"mInstLumi: {} mMeanLumi: {} mMeanLumiRef: {}"
,
mInstLumi
,
mMeanLumi
,
mMeanLumiRef
);
107
}
else
{
108
mLumiScale
=
mMeanLumi
?
mInstLumi
/
mMeanLumi
: 0.f;
109
}
110
setUpdatedLumi
();
111
if
(
report
) {
112
reportScaling
();
113
}
114
}
115
116
//________________________________________________________
117
void
CorrectionMapsHelper::reportScaling
()
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
}
CorrectionMapsHelper.h
Helper class to access correction maps.
GPUCommonLogger.h
debug
std::ostringstream debug
Definition
VariantJSONHelpers.h:307
o2::gpu::CorrectionMapsHelper::setCorrMapMShape
void setCorrMapMShape(o2::gpu::TPCFastTransform *m)
Definition
CorrectionMapsHelper.cxx:63
o2::gpu::CorrectionMapsHelper::mOwner
bool mOwner
Definition
CorrectionMapsHelper.h:168
o2::gpu::CorrectionMapsHelper::mMeanLumi
float mMeanLumi
Definition
CorrectionMapsHelper.h:176
o2::gpu::CorrectionMapsHelper::mLumiCTPAvailable
bool mLumiCTPAvailable
Definition
CorrectionMapsHelper.h:169
o2::gpu::CorrectionMapsHelper::setCorrMapRef
void setCorrMapRef(o2::gpu::TPCFastTransform *m)
Definition
CorrectionMapsHelper.cxx:55
o2::gpu::CorrectionMapsHelper::mInstLumiCTP
float mInstLumiCTP
Definition
CorrectionMapsHelper.h:174
o2::gpu::CorrectionMapsHelper::mCorrMapMShape
o2::gpu::TPCFastTransform * mCorrMapMShape
Definition
CorrectionMapsHelper.h:186
o2::gpu::CorrectionMapsHelper::mCorrMap
o2::gpu::TPCFastTransform * mCorrMap
Definition
CorrectionMapsHelper.h:184
o2::gpu::CorrectionMapsHelper::setOwner
void setOwner(bool v)
Definition
CorrectionMapsHelper.cxx:37
o2::gpu::CorrectionMapsHelper::mScaleInverse
bool mScaleInverse
Definition
CorrectionMapsHelper.h:183
o2::gpu::CorrectionMapsHelper::mUpdatedFlags
int32_t mUpdatedFlags
Definition
CorrectionMapsHelper.h:173
o2::gpu::CorrectionMapsHelper::setUpdatedLumi
void setUpdatedLumi()
Definition
CorrectionMapsHelper.h:125
o2::gpu::CorrectionMapsHelper::mLumiScaleType
int32_t mLumiScaleType
Definition
CorrectionMapsHelper.h:171
o2::gpu::CorrectionMapsHelper::mMeanLumiRef
float mMeanLumiRef
Definition
CorrectionMapsHelper.h:177
o2::gpu::CorrectionMapsHelper::mLumiScale
float mLumiScale
Definition
CorrectionMapsHelper.h:178
o2::gpu::CorrectionMapsHelper::updateLumiScale
void updateLumiScale(bool report=false)
Definition
CorrectionMapsHelper.cxx:100
o2::gpu::CorrectionMapsHelper::mCorrMapRef
o2::gpu::TPCFastTransform * mCorrMapRef
Definition
CorrectionMapsHelper.h:185
o2::gpu::CorrectionMapsHelper::canUseCorrections
bool canUseCorrections() const
Definition
CorrectionMapsHelper.h:140
o2::gpu::CorrectionMapsHelper::clear
void clear()
Definition
CorrectionMapsHelper.cxx:18
o2::gpu::CorrectionMapsHelper::mInstLumi
float mInstLumi
Definition
CorrectionMapsHelper.h:175
o2::gpu::CorrectionMapsHelper::setCorrMap
void setCorrMap(std::unique_ptr< o2::gpu::TPCFastTransform > &&m)
Definition
CorrectionMapsHelper.cxx:46
o2::gpu::CorrectionMapsHelper::reportScaling
void reportScaling()
Definition
CorrectionMapsHelper.cxx:117
o2::gpu::CorrectionMapsHelper::mLumiScaleMode
int32_t mLumiScaleMode
Definition
CorrectionMapsHelper.h:172
o2::gpu::TPCFastTransform
Definition
TPCFastTransform.h:97
m
const GLfloat * m
Definition
glcorearb.h:4066
v
const GLdouble * v
Definition
glcorearb.h:832
report
void report(gsl::span< o2::InteractionTimeRecord > irs, int threshold, bool verbose)
Definition
inspect-collision-context.cxx:24
o2::gpu
Definition
TrackTRD.h:35
GPU
TPCFastTransformation
CorrectionMapsHelper.cxx
Generated on Tue Feb 25 2025 22:51:09 for Project by
1.9.8