Skip to content

Commit 3cbd00a

Browse files
committed
Add/use in TPCFastTransform mean IDC data member on top of Lumi
Nominally both IDC (setIDC(val)) and Lumi (setLumi(val)) info of the map should be filled at the creation time. Depending what is used for the corrections (accoding to --lumi-type value: 1 for CTP lumi or 2 for IDC scaler) the getLumi or getIDC will be used. For the old maps, where the mIDC is absent (i.e. default value -1 returned by getIDC()) but the Lumi was used to stored the IDC mean value, we check if getLumi() is below the threshold TPCCorrMap.CTP2IDCFallBackThreshold (by default set to 30). If this is a case, the getLumi() value will be used as IDC scale, otherwise a Fatal will be thrown. Note that the inverse check is not done: if CTP Lumi scaling is requested for the old map where getLumi returns IDC, a wrong scale will be accepted.
1 parent fdc30b1 commit 3cbd00a

File tree

5 files changed

+52
-8
lines changed

5 files changed

+52
-8
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ struct CorrMapParam : public o2::conf::ConfigurableParamHelper<CorrMapParam> {
2929
float lumiMean = 0.; // override TPC corr.map mean lumi (if > 0), disable corrections if < 0
3030
float lumiMeanRef = 0.; // override TPC corr.mapRef mean lumi (if > 0)"
3131
float lumiInstFactor = 1.; // scaling to apply to instantaneous lumi from CTP (but not to IDC scaler)
32+
float CTP2IDCFallBackThreshold = 30.; // if needed, interpret map->getLumi() as map->getIDC(), provided map->getLumi() is below this threshold
3233
int ctpLumiSource = 0; // CTP lumi source: 0 = LumiInfo.getLumi(), 1 = LumiInfo.getLumiAlt()
3334

3435
O2ParamDef(CorrMapParam, "TPCCorrMap");

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class CorrectionMapsLoader : public o2::gpu::CorrectionMapsHelper
6363
void init(o2::framework::InitContext& ic);
6464
void copySettings(const CorrectionMapsLoader& src);
6565
void updateInverse(); /// recalculate inverse correction
66+
float getMapMeanRate(const o2::gpu::TPCFastTransform* mp) const;
6667

6768
static void requestCCDBInputs(std::vector<o2::framework::InputSpec>& inputs, std::vector<o2::framework::ConfigParamSpec>& options, const CorrectionMapsLoaderGloOpts& gloOpts);
6869
static void addGlobalOptions(std::vector<o2::framework::ConfigParamSpec>& options);

Detectors/TPC/calibration/src/CorrectionMapsLoader.cxx

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,20 +176,22 @@ bool CorrectionMapsLoader::accountCCDBInputs(const ConcreteDataMatcher& matcher,
176176
if (matcher == ConcreteDataMatcher("TPC", "CorrMap", 0)) {
177177
setCorrMap((o2::gpu::TPCFastTransform*)obj);
178178
mCorrMap->rectifyAfterReadingFromFile();
179-
if (getMeanLumiOverride() == 0 && mCorrMap->getLumi() > 0.) {
180-
setMeanLumi(mCorrMap->getLumi(), false);
179+
float mapMeanRate = getMapMeanRate(mCorrMap); // instead of mCorrMap->getLumi()
180+
if (getMeanLumiOverride() == 0 && mapMeanRate > 0.) {
181+
setMeanLumi(mapMeanRate, false);
181182
}
182-
LOGP(debug, "MeanLumiOverride={} MeanLumiMap={} -> meanLumi = {}", getMeanLumiOverride(), mCorrMap->getLumi(), getMeanLumi());
183+
LOGP(debug, "MeanLumiOverride={} MeanLumiMap={} -> meanLumi = {}", getMeanLumiOverride(), mapMeanRate, getMeanLumi());
183184
setUpdatedMap();
184185
return true;
185186
}
186187
if (matcher == ConcreteDataMatcher("TPC", "CorrMapRef", 0)) {
187188
setCorrMapRef((o2::gpu::TPCFastTransform*)obj);
188189
mCorrMapRef->rectifyAfterReadingFromFile();
190+
float mapRefMeanRate = getMapMeanRate(mCorrMapRef); // instead of mCorrMapRef->getLumi()
189191
if (getMeanLumiRefOverride() == 0) {
190-
setMeanLumiRef(mCorrMapRef->getLumi());
192+
setMeanLumiRef(mapRefMeanRate);
191193
}
192-
LOGP(debug, "MeanLumiRefOverride={} MeanLumiMap={} -> meanLumi = {}", getMeanLumiRefOverride(), mCorrMapRef->getLumi(), getMeanLumiRef());
194+
LOGP(debug, "MeanLumiRefOverride={} MeanLumiMap={} -> meanLumi = {}", getMeanLumiRefOverride(), mapRefMeanRate, getMeanLumiRef());
193195
setUpdatedMapRef();
194196
return true;
195197
}
@@ -296,4 +298,27 @@ void CorrectionMapsLoader::updateInverse()
296298
}
297299
}
298300

301+
float CorrectionMapsLoader::getMapMeanRate(const o2::gpu::TPCFastTransform* mp) const
302+
{
303+
float val = 0;
304+
if (getLumiScaleType() == 1) { // CTP Lumi
305+
val = mp->getLumi();
306+
} else if (getLumiScaleType() == 2) { // TPC Scaler (IDC)
307+
val = mp->getIDC();
308+
if (val < 0. && mp->getLumi() >= 0.) {
309+
if (mp->getLumi() < o2::tpc::CorrMapParam::Instance().CTP2IDCFallBackThreshold) {
310+
val = mp->getLumi();
311+
static bool reportFallBack = true;
312+
if (reportFallBack) {
313+
reportFallBack = false;
314+
LOGP(warn, "IDC scaling is requested but map IDC record is empty. Since map Lumi={} is less than fall-back threshold {}, interpret Lumi record as IDC",
315+
val, o2::tpc::CorrMapParam::Instance().CTP2IDCFallBackThreshold);
316+
}
317+
} else {
318+
LOGP(fatal, "IDC scaling is requested but map IDC record is empty. The map Lumi={} exceeds Lumi->IDC fall-back threshold {}", mp->getLumi(), o2::tpc::CorrMapParam::Instance().CTP2IDCFallBackThreshold);
319+
}
320+
}
321+
}
322+
return val;
323+
}
299324
#endif // #ifndef GPUCA_GPUCODE_DEVICE

GPU/TPCFastTransformation/TPCFastTransform.cxx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
using namespace o2::gpu;
3838

3939
TPCFastTransform::TPCFastTransform()
40-
: FlatObject(), mTimeStamp(0), mCorrection(), mApplyCorrection(1), mT0(0.f), mVdrift(0.f), mVdriftCorrY(0.f), mLdriftCorr(0.f), mTOFcorr(0.f), mPrimVtxZ(0.f), mLumi(0.f), mLumiError(0.f), mLumiScaleFactor(1.0f)
40+
: FlatObject(), mTimeStamp(0), mCorrection(), mApplyCorrection(1), mT0(0.f), mVdrift(0.f), mVdriftCorrY(0.f), mLdriftCorr(0.f), mTOFcorr(0.f), mPrimVtxZ(0.f), mLumi(-1.0f), mLumiError(0.f), mLumiScaleFactor(1.0f), mIDC(-1.f), mIDCError(0.f)
4141
{
4242
// Default Constructor: creates an empty uninitialized object
4343
}
@@ -60,6 +60,8 @@ void TPCFastTransform::cloneFromObject(const TPCFastTransform& obj, char* newFla
6060
mPrimVtxZ = obj.mPrimVtxZ;
6161
mLumi = obj.mLumi;
6262
mLumiError = obj.mLumiError;
63+
mIDC = obj.mIDC;
64+
mIDCError = obj.mIDCError;
6365
mLumiScaleFactor = obj.mLumiScaleFactor;
6466
// variable-size data
6567

@@ -108,8 +110,10 @@ void TPCFastTransform::startConstruction(const TPCFastSpaceChargeCorrection& cor
108110
mLdriftCorr = 0.f;
109111
mTOFcorr = 0.f;
110112
mPrimVtxZ = 0.f;
111-
mLumi = 0.f;
113+
mLumi = -1.0f;
112114
mLumiError = 0.f;
115+
mIDC = -1.0f;
116+
mIDCError = 0.f;
113117
mLumiScaleFactor = 1.f;
114118

115119
// variable-size data
@@ -160,6 +164,8 @@ void TPCFastTransform::print() const
160164
LOG(info) << "mPrimVtxZ = " << mPrimVtxZ;
161165
LOG(info) << "mLumi = " << mLumi;
162166
LOG(info) << "mLumiError = " << mLumiError;
167+
LOG(info) << "mIDC = " << mIDC;
168+
LOG(info) << "mIDCError = " << mIDCError;
163169
LOG(info) << "mLumiScaleFactor = " << mLumiScaleFactor;
164170
mCorrection.print();
165171
#endif

GPU/TPCFastTransformation/TPCFastTransform.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ class TPCFastTransform : public FlatObject
162162
void setLumi(float l) { mLumi = l; }
163163
void setLumiError(float e) { mLumiError = e; }
164164
void setLumiScaleFactor(float s) { mLumiScaleFactor = s; }
165+
void setIDC(float l) { mIDC = l; }
166+
void setIDCError(float e) { mIDCError = e; }
165167

166168
/// Sets the time stamp of the current calibaration
167169
void setTimeStamp(int64_t v) { mTimeStamp = v; }
@@ -254,6 +256,12 @@ class TPCFastTransform : public FlatObject
254256
/// Return map lumi error
255257
GPUd() float getLumiError() const { return mLumiError; }
256258

259+
/// Return map lumi
260+
GPUd() float getIDC() const { return mIDC; }
261+
262+
/// Return map lumi error
263+
GPUd() float getIDCError() const { return mIDCError; }
264+
257265
/// Return map user defined lumi scale factor
258266
GPUd() float getLumiScaleFactor() const { return mLumiScaleFactor; }
259267

@@ -334,12 +342,15 @@ class TPCFastTransform : public FlatObject
334342
float mLumiError; ///< error on luminosity
335343
float mLumiScaleFactor; ///< user correction factor for lumi (e.g. normalization, efficiency correction etc.)
336344

345+
float mIDC; ///< IDC estimator
346+
float mIDCError; ///< error on IDC
347+
337348
/// Correction of (x,u,v) with tricubic interpolator on a regular grid
338349
TPCSlowSpaceChargeCorrection* mCorrectionSlow{nullptr}; ///< reference space charge corrections
339350

340351
GPUd() void TransformInternal(int32_t slice, int32_t row, float& u, float& v, float& x, const TPCFastTransform* ref, const TPCFastTransform* ref2, float scale, float scale2, int32_t scaleMode) const;
341352

342-
ClassDefNV(TPCFastTransform, 3);
353+
ClassDefNV(TPCFastTransform, 4);
343354
};
344355

345356
// =======================================================================

0 commit comments

Comments
 (0)