Skip to content

Commit 9bd758e

Browse files
matthias-kleinershahor02
authored andcommitted
TPC: Add lumi source to CorrMapParam
1 parent 88eaaaf commit 9bd758e

File tree

6 files changed

+37
-7
lines changed

6 files changed

+37
-7
lines changed

DataFormats/Detectors/TPC/include/DataFormatsTPC/Defs.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,13 @@ inline PadFlags operator&(PadFlags a, PadFlags b) { return static_cast<PadFlags>
114114
inline PadFlags operator~(PadFlags a) { return static_cast<PadFlags>(~static_cast<int>(a)); }
115115
inline PadFlags operator|(PadFlags a, PadFlags b) { return static_cast<PadFlags>(static_cast<int>(a) | static_cast<int>(b)); }
116116

117+
/// luminosity type used for scaling of the correction or distortions
118+
enum LumiType {
119+
None = 0, ///< default undefined
120+
CTP = 1, ///< CTP
121+
IDC = 2 ///< IDCs from TPC
122+
};
123+
117124
// default point definitions for PointND, PointNDlocal, PointNDglobal are in
118125
// MathUtils/CartesianND.h
119126

Detectors/TPC/calibration/include/TPCCalibration/CorrMapParam.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include "CommonUtils/ConfigurableParam.h"
2020
#include "CommonUtils/ConfigurableParamHelper.h"
21+
#include "DataFormatsTPC/Defs.h"
2122

2223
namespace o2
2324
{
@@ -30,6 +31,7 @@ struct CorrMapParam : public o2::conf::ConfigurableParamHelper<CorrMapParam> {
3031
float lumiMeanRef = 0.; // override TPC corr.mapRef mean lumi (if > 0)"
3132
float lumiInstFactor = 1.; // scaling to apply to instantaneous lumi from CTP (but not corrmap-lumi-inst)
3233
int ctpLumiSource = 0; // CTP lumi source: 0 = LumiInfo.getLumi(), 1 = LumiInfo.getLumiAlt()
34+
LumiType lumiSource{}; // source of luminosity
3335

3436
O2ParamDef(CorrMapParam, "TPCCorrMap");
3537
};

Detectors/TPC/calibration/src/CorrectionMapsLoader.cxx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,12 @@ bool CorrectionMapsLoader::accountCCDBInputs(const ConcreteDataMatcher& matcher,
139139
setCorrMap((o2::gpu::TPCFastTransform*)obj);
140140
mCorrMap->rectifyAfterReadingFromFile();
141141
if (getMeanLumiOverride() == 0 && mCorrMap->getLumi() > 0.) {
142+
// check if the specified scale type is the same as the lumi from the provided map
143+
if (mCorrMap->getLumiSource() == LumiType::None) {
144+
LOGP(warning, "Lumi type not set in correction map");
145+
} else if (mCorrMap->getLumiSource() != getLumiScaleType()) {
146+
LOGP(error, "Lumi scale type {} and lumi source {} for correction map do not match", getLumiScaleType(), int(mCorrMap->getLumiSource()));
147+
}
142148
setMeanLumi(mCorrMap->getLumi());
143149
}
144150
LOGP(debug, "MeanLumiOverride={} MeanLumiMap={} -> meanLumi = {}", getMeanLumiOverride(), mCorrMap->getLumi(), getMeanLumi());
@@ -149,6 +155,13 @@ bool CorrectionMapsLoader::accountCCDBInputs(const ConcreteDataMatcher& matcher,
149155
setCorrMapRef((o2::gpu::TPCFastTransform*)obj);
150156
mCorrMapRef->rectifyAfterReadingFromFile();
151157
if (getMeanLumiRefOverride() == 0 && mCorrMapRef->getLumi() > 0.) {
158+
// check if the specified scale type is the same as the lumi from the provided map
159+
if (mCorrMapRef->getLumiSource() == LumiType::None) {
160+
LOGP(warning, "Lumi type not set in reference correction map");
161+
} else if ((getLumiScaleMode() != 0) && (mCorrMapRef->getLumiSource() != getLumiScaleType())) {
162+
// check only when using derivative map, since for scalemode=0 the lumi of the reference map is not used for scaling
163+
LOGP(error, "Lumi scale type {} and lumi source {} for reference correction map do not match", getLumiScaleType(), int(mCorrMapRef->getLumiSource()));
164+
}
152165
setMeanLumiRef(mCorrMapRef->getLumi());
153166
}
154167
LOGP(debug, "MeanLumiRefOverride={} MeanLumiMap={} -> meanLumi = {}", getMeanLumiRefOverride(), mCorrMapRef->getLumi(), getMeanLumiRef());
@@ -175,6 +188,12 @@ bool CorrectionMapsLoader::accountCCDBInputs(const ConcreteDataMatcher& matcher,
175188
setUpdatedLumi();
176189
int scaleType = getLumiScaleType();
177190
const std::array<std::string, 3> lumiS{"OFF", "CTP", "TPC scaler"};
191+
const auto lumiSource = par.lumiSource;
192+
if (lumiSource == LumiType::None) {
193+
LOGP(warning, "Lumi type not set in CorrMapParam");
194+
} else if (lumiSource != scaleType) {
195+
LOGP(error, "Lumi scale type {} and lumi source {} from CorrMapParam do not match", scaleType, int(lumiSource));
196+
}
178197
if (scaleType >= lumiS.size()) {
179198
LOGP(fatal, "Wrong lumi-scale-type provided!");
180199
}

Detectors/TPC/spacecharge/include/TPCSpaceCharge/SpaceChargeHelpers.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@ namespace tpc
3131
{
3232

3333
struct SCMetaData {
34-
35-
enum LumiType {
36-
CTP = 0,
37-
IDC = 1
38-
};
39-
4034
void print() const
4135
{
4236
const std::array<std::string, 2> collisionTypes{"PP", "Pb-Pb"};

GPU/TPCFastTransformation/TPCFastTransform.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ void TPCFastTransform::cloneFromObject(const TPCFastTransform& obj, char* newFla
6161
mLumi = obj.mLumi;
6262
mLumiError = obj.mLumiError;
6363
mLumiScaleFactor = obj.mLumiScaleFactor;
64+
mLumiSource = obj.mLumiSource;
6465
// variable-size data
6566

6667
char* distBuffer = FlatObject::relocatePointer(oldFlatBufferPtr, mFlatBufferPtr, obj.mCorrection.getFlatBufferPtr());

GPU/TPCFastTransformation/TPCFastTransform.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "TPCFastSpaceChargeCorrection.h"
2323
#include "GPUCommonMath.h"
2424
#include "GPUDebugStreamer.h"
25+
#include "DataFormatsTPC/Defs.h"
2526

2627
#if !defined(GPUCA_GPUCODE)
2728
#include <string>
@@ -158,6 +159,7 @@ class TPCFastTransform : public FlatObject
158159
void setLumi(float l) { mLumi = l; }
159160
void setLumiError(float e) { mLumiError = e; }
160161
void setLumiScaleFactor(float s) { mLumiScaleFactor = s; }
162+
void setLumiSource(o2::tpc::LumiType l) { mLumiSource = l; }
161163

162164
/// Sets the time stamp of the current calibaration
163165
void setTimeStamp(long int v) { mTimeStamp = v; }
@@ -253,6 +255,9 @@ class TPCFastTransform : public FlatObject
253255
/// Return map user defined lumi scale factor
254256
GPUd() float getLumiScaleFactor() const { return mLumiScaleFactor; }
255257

258+
/// Return map lumi source type
259+
o2::tpc::LumiType getLumiSource() const { return mLumiSource; }
260+
256261
/// maximal possible drift time of the active area
257262
GPUd() float getMaxDriftTime(int slice, int row, float pad) const;
258263

@@ -330,13 +335,15 @@ class TPCFastTransform : public FlatObject
330335
float mLumiError; ///< error on luminosity
331336
float mLumiScaleFactor; ///< user correction factor for lumi (e.g. normalization, efficiency correction etc.)
332337

338+
o2::tpc::LumiType mLumiSource{o2::tpc::LumiType::CTP}; ///< source of luminosity
339+
333340
/// Correction of (x,u,v) with tricubic interpolator on a regular grid
334341
TPCSlowSpaceChargeCorrection* mCorrectionSlow{nullptr}; ///< reference space charge corrections
335342

336343
GPUd() void TransformInternal(int slice, int row, float& u, float& v, float& x, const TPCFastTransform* ref, float scale, int scaleMode) const;
337344

338345
#ifndef GPUCA_ALIROOT_LIB
339-
ClassDefNV(TPCFastTransform, 3);
346+
ClassDefNV(TPCFastTransform, 4);
340347
#endif
341348
};
342349

0 commit comments

Comments
 (0)