Skip to content

Commit d0b6825

Browse files
committed
Check consistency of the TPC scaling request and map mean scaler
Unless --disable-lumi-type-consistency-check option is passed. For the CTP Lumi the map->getLumi() must be > map->getCTP2IDCFallBackThreshold(), for the IDC scaling the map->getIDC() must be < map->getCTP2IDCFallBackThreshold(). The default map->getCTP2IDCFallBackThreshold() is 30.
1 parent cc7210c commit d0b6825

File tree

17 files changed

+41
-0
lines changed

17 files changed

+41
-0
lines changed

Detectors/Align/Workflow/src/BarrelAlignmentSpec.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ class BarrelAlignmentSpec : public Task
9292
{
9393
mTPCCorrMapsLoader.setLumiScaleType(tpcOpt.lumiType);
9494
mTPCCorrMapsLoader.setLumiScaleMode(tpcOpt.lumiMode);
95+
mTPCCorrMapsLoader.setCheckCTPIDCConsistency(tpcOpt.checkCTPIDCconsistency);
9596
}
9697
~BarrelAlignmentSpec() override = default;
9798
void init(InitContext& ic) final;

Detectors/GlobalTrackingWorkflow/src/CosmicsMatchingSpec.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class CosmicsMatchingSpec : public Task
6666
{
6767
mTPCCorrMapsLoader.setLumiScaleType(sclOpts.lumiType);
6868
mTPCCorrMapsLoader.setLumiScaleMode(sclOpts.lumiMode);
69+
mTPCCorrMapsLoader.setCheckCTPIDCConsistency(sclOpts.checkCTPIDCconsistency);
6970
}
7071
~CosmicsMatchingSpec() override = default;
7172
void init(InitContext& ic) final;

Detectors/GlobalTrackingWorkflow/src/SecondaryVertexingSpec.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ class SecondaryVertexingSpec : public Task
6262
{
6363
mTPCCorrMapsLoader.setLumiScaleType(sclOpts.lumiType);
6464
mTPCCorrMapsLoader.setLumiScaleMode(sclOpts.lumiMode);
65+
mTPCCorrMapsLoader.setCheckCTPIDCConsistency(sclOpts.checkCTPIDCconsistency);
6566
}
6667
~SecondaryVertexingSpec() override = default;
6768
void init(InitContext& ic) final;

Detectors/GlobalTrackingWorkflow/src/TOFMatcherSpec.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ class TOFMatcherSpec : public Task
6262
{
6363
mTPCCorrMapsLoader.setLumiScaleType(sclOpts.lumiType);
6464
mTPCCorrMapsLoader.setLumiScaleMode(sclOpts.lumiMode);
65+
mTPCCorrMapsLoader.setCheckCTPIDCConsistency(sclOpts.checkCTPIDCconsistency);
6566
}
6667
~TOFMatcherSpec() override = default;
6768
void init(InitContext& ic) final;

Detectors/GlobalTrackingWorkflow/src/TPCITSMatchingSpec.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ class TPCITSMatchingDPL : public Task
7575
{
7676
mTPCCorrMapsLoader.setLumiScaleType(sclOpts.lumiType);
7777
mTPCCorrMapsLoader.setLumiScaleMode(sclOpts.lumiMode);
78+
mTPCCorrMapsLoader.setCheckCTPIDCConsistency(sclOpts.checkCTPIDCconsistency);
7879
}
7980
~TPCITSMatchingDPL() override = default;
8081
void init(InitContext& ic) final;

Detectors/GlobalTrackingWorkflow/study/src/TPCTrackStudy.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class TPCTrackStudySpec : public Task
5555
{
5656
mTPCCorrMapsLoader.setLumiScaleType(sclOpts.lumiType);
5757
mTPCCorrMapsLoader.setLumiScaleMode(sclOpts.lumiMode);
58+
mTPCCorrMapsLoader.setCheckCTPIDCConsistency(sclOpts.checkCTPIDCconsistency);
5859
}
5960
~TPCTrackStudySpec() final = default;
6061
void init(InitContext& ic) final;

Detectors/GlobalTrackingWorkflow/study/src/TrackMCStudy.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ class TrackMCStudy : public Task
8888
{
8989
mTPCCorrMapsLoader.setLumiScaleType(sclOpts.lumiType);
9090
mTPCCorrMapsLoader.setLumiScaleMode(sclOpts.lumiMode);
91+
mTPCCorrMapsLoader.setCheckCTPIDCConsistency(sclOpts.checkCTPIDCconsistency);
9192
}
9293
~TrackMCStudy() final = default;
9394
void init(InitContext& ic) final;

Detectors/GlobalTrackingWorkflow/study/src/TrackingStudy.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ class TrackingStudySpec : public Task
7575
{
7676
mTPCCorrMapsLoader.setLumiScaleType(sclOpts.lumiType);
7777
mTPCCorrMapsLoader.setLumiScaleMode(sclOpts.lumiMode);
78+
mTPCCorrMapsLoader.setCheckCTPIDCConsistency(sclOpts.checkCTPIDCconsistency);
7879
}
7980
~TrackingStudySpec() final = default;
8081
void init(InitContext& ic) final;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ struct CorrectionMapsLoaderGloOpts {
4242
int lumiMode = 0; ///< what corrections method to use: 0: classical scaling, 1: Using of the derivative map, 2: Using of the derivative map for MC
4343
bool enableMShapeCorrection = false;
4444
bool requestCTPLumi = true; //< request CTP Lumi regardless of what is used for corrections scaling
45+
bool checkCTPIDCconsistency = true; //< check the selected CTP or IDC scaling source being consistent with mean scaler of the map
4546

4647
bool needTPCScalersWorkflow() const
4748
{
@@ -63,6 +64,7 @@ class CorrectionMapsLoader : public o2::gpu::CorrectionMapsHelper
6364
void init(o2::framework::InitContext& ic);
6465
void copySettings(const CorrectionMapsLoader& src);
6566
void updateInverse(); /// recalculate inverse correction
67+
void checkMeanScaleConsistency(float meanLumi, float threshold) const;
6668
float getMapMeanRate(const o2::gpu::TPCFastTransform* mp, bool lumiOverridden) const;
6769

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

Detectors/TPC/calibration/src/CorrectionMapsLoader.cxx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ void CorrectionMapsLoader::addGlobalOptions(std::vector<ConfigParamSpec>& option
138138
addOption(options, ConfigParamSpec{"corrmap-lumi-mode", o2::framework::VariantType::Int, 0, {"scaling mode: (default) 0 = static + scale * full; 1 = full + scale * derivative; 2 = full + scale * derivative (for MC)"}});
139139
addOption(options, ConfigParamSpec{"enable-M-shape-correction", o2::framework::VariantType::Bool, false, {"Enable M-shape distortion correction"}});
140140
addOption(options, ConfigParamSpec{"disable-ctp-lumi-request", o2::framework::VariantType::Bool, false, {"do not request CTP lumi (regardless what is used for corrections)"}});
141+
addOption(options, ConfigParamSpec{"disable-lumi-type-consistency-check", o2::framework::VariantType::Bool, false, {"disable check of selected CTP or IDC scaling source being consistent with the map"}});
141142
}
142143

143144
//________________________________________________________
@@ -148,6 +149,7 @@ CorrectionMapsLoaderGloOpts CorrectionMapsLoader::parseGlobalOptions(const o2::f
148149
tpcopt.lumiMode = opts.get<int>("corrmap-lumi-mode");
149150
tpcopt.enableMShapeCorrection = opts.get<bool>("enable-M-shape-correction");
150151
tpcopt.requestCTPLumi = !opts.get<bool>("disable-ctp-lumi-request");
152+
tpcopt.checkCTPIDCconsistency = !opts.get<bool>("disable-lumi-type-consistency-check");
151153
if (!tpcopt.requestCTPLumi && tpcopt.lumiType == 1) {
152154
LOGP(fatal, "Scaling with CTP Lumi is requested but this input is disabled");
153155
}
@@ -192,6 +194,9 @@ bool CorrectionMapsLoader::accountCCDBInputs(const ConcreteDataMatcher& matcher,
192194
} else if (getLumiScaleType() == 2) {
193195
mapMeanRate = mCorrMap->getIDC();
194196
}
197+
if (mCheckCTPIDCConsistency) {
198+
checkMeanScaleConsistency(mapMeanRate, mCorrMap->getCTP2IDCFallBackThreshold());
199+
}
195200
if (getMeanLumiOverride() == 0 && mapMeanRate > 0.) {
196201
setMeanLumi(mapMeanRate, false);
197202
}
@@ -218,6 +223,9 @@ bool CorrectionMapsLoader::accountCCDBInputs(const ConcreteDataMatcher& matcher,
218223
} else if (getLumiScaleType() == 2) {
219224
mapRefMeanRate = mCorrMapRef->getIDC();
220225
}
226+
if (mCheckCTPIDCConsistency) {
227+
checkMeanScaleConsistency(mapRefMeanRate, mCorrMapRef->getCTP2IDCFallBackThreshold());
228+
}
221229
if (getMeanLumiRefOverride() == 0) {
222230
setMeanLumiRef(mapRefMeanRate);
223231
}
@@ -328,4 +336,17 @@ void CorrectionMapsLoader::updateInverse()
328336
}
329337
}
330338

339+
void CorrectionMapsLoader::checkMeanScaleConsistency(float meanLumi, float threshold) const
340+
{
341+
if (getLumiScaleType() == 1) {
342+
if (meanLumi < threshold) {
343+
LOGP(fatal, "CTP Lumi scaling source is requested, but the map mean scale {} is below the threshold {}", meanLumi, threshold);
344+
}
345+
} else if (getLumiScaleType() == 2) {
346+
if (meanLumi > threshold) {
347+
LOGP(fatal, "IDC scaling source is requested, but the map mean scale {} is above the threshold {}", meanLumi, threshold);
348+
}
349+
}
350+
}
351+
331352
#endif // #ifndef GPUCA_GPUCODE_DEVICE

0 commit comments

Comments
 (0)