Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Detectors/Align/Workflow/src/BarrelAlignmentSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class BarrelAlignmentSpec : public Task
{
mTPCCorrMapsLoader.setLumiScaleType(tpcOpt.lumiType);
mTPCCorrMapsLoader.setLumiScaleMode(tpcOpt.lumiMode);
mTPCCorrMapsLoader.setCheckCTPIDCConsistency(tpcOpt.checkCTPIDCconsistency);
}
~BarrelAlignmentSpec() override = default;
void init(InitContext& ic) final;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class CosmicsMatchingSpec : public Task
{
mTPCCorrMapsLoader.setLumiScaleType(sclOpts.lumiType);
mTPCCorrMapsLoader.setLumiScaleMode(sclOpts.lumiMode);
mTPCCorrMapsLoader.setCheckCTPIDCConsistency(sclOpts.checkCTPIDCconsistency);
}
~CosmicsMatchingSpec() override = default;
void init(InitContext& ic) final;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class SecondaryVertexingSpec : public Task
{
mTPCCorrMapsLoader.setLumiScaleType(sclOpts.lumiType);
mTPCCorrMapsLoader.setLumiScaleMode(sclOpts.lumiMode);
mTPCCorrMapsLoader.setCheckCTPIDCConsistency(sclOpts.checkCTPIDCconsistency);
}
~SecondaryVertexingSpec() override = default;
void init(InitContext& ic) final;
Expand Down
1 change: 1 addition & 0 deletions Detectors/GlobalTrackingWorkflow/src/TOFMatcherSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class TOFMatcherSpec : public Task
{
mTPCCorrMapsLoader.setLumiScaleType(sclOpts.lumiType);
mTPCCorrMapsLoader.setLumiScaleMode(sclOpts.lumiMode);
mTPCCorrMapsLoader.setCheckCTPIDCConsistency(sclOpts.checkCTPIDCconsistency);
}
~TOFMatcherSpec() override = default;
void init(InitContext& ic) final;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class TPCITSMatchingDPL : public Task
{
mTPCCorrMapsLoader.setLumiScaleType(sclOpts.lumiType);
mTPCCorrMapsLoader.setLumiScaleMode(sclOpts.lumiMode);
mTPCCorrMapsLoader.setCheckCTPIDCConsistency(sclOpts.checkCTPIDCconsistency);
}
~TPCITSMatchingDPL() override = default;
void init(InitContext& ic) final;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class TPCTrackStudySpec : public Task
{
mTPCCorrMapsLoader.setLumiScaleType(sclOpts.lumiType);
mTPCCorrMapsLoader.setLumiScaleMode(sclOpts.lumiMode);
mTPCCorrMapsLoader.setCheckCTPIDCConsistency(sclOpts.checkCTPIDCconsistency);
}
~TPCTrackStudySpec() final = default;
void init(InitContext& ic) final;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ class TrackMCStudy : public Task
{
mTPCCorrMapsLoader.setLumiScaleType(sclOpts.lumiType);
mTPCCorrMapsLoader.setLumiScaleMode(sclOpts.lumiMode);
mTPCCorrMapsLoader.setCheckCTPIDCConsistency(sclOpts.checkCTPIDCconsistency);
}
~TrackMCStudy() final = default;
void init(InitContext& ic) final;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class TrackingStudySpec : public Task
{
mTPCCorrMapsLoader.setLumiScaleType(sclOpts.lumiType);
mTPCCorrMapsLoader.setLumiScaleMode(sclOpts.lumiMode);
mTPCCorrMapsLoader.setCheckCTPIDCConsistency(sclOpts.checkCTPIDCconsistency);
}
~TrackingStudySpec() final = default;
void init(InitContext& ic) final;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ struct CorrectionMapsLoaderGloOpts {
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
bool enableMShapeCorrection = false;
bool requestCTPLumi = true; //< request CTP Lumi regardless of what is used for corrections scaling
bool checkCTPIDCconsistency = true; //< check the selected CTP or IDC scaling source being consistent with mean scaler of the map

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

static void requestCCDBInputs(std::vector<o2::framework::InputSpec>& inputs, std::vector<o2::framework::ConfigParamSpec>& options, const CorrectionMapsLoaderGloOpts& gloOpts);
Expand Down
21 changes: 21 additions & 0 deletions Detectors/TPC/calibration/src/CorrectionMapsLoader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ void CorrectionMapsLoader::addGlobalOptions(std::vector<ConfigParamSpec>& option
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)"}});
addOption(options, ConfigParamSpec{"enable-M-shape-correction", o2::framework::VariantType::Bool, false, {"Enable M-shape distortion correction"}});
addOption(options, ConfigParamSpec{"disable-ctp-lumi-request", o2::framework::VariantType::Bool, false, {"do not request CTP lumi (regardless what is used for corrections)"}});
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"}});
}

//________________________________________________________
Expand All @@ -148,6 +149,7 @@ CorrectionMapsLoaderGloOpts CorrectionMapsLoader::parseGlobalOptions(const o2::f
tpcopt.lumiMode = opts.get<int>("corrmap-lumi-mode");
tpcopt.enableMShapeCorrection = opts.get<bool>("enable-M-shape-correction");
tpcopt.requestCTPLumi = !opts.get<bool>("disable-ctp-lumi-request");
tpcopt.checkCTPIDCconsistency = !opts.get<bool>("disable-lumi-type-consistency-check");
if (!tpcopt.requestCTPLumi && tpcopt.lumiType == 1) {
LOGP(fatal, "Scaling with CTP Lumi is requested but this input is disabled");
}
Expand Down Expand Up @@ -192,6 +194,9 @@ bool CorrectionMapsLoader::accountCCDBInputs(const ConcreteDataMatcher& matcher,
} else if (getLumiScaleType() == 2) {
mapMeanRate = mCorrMap->getIDC();
}
if (mCheckCTPIDCConsistency) {
checkMeanScaleConsistency(mapMeanRate, mCorrMap->getCTP2IDCFallBackThreshold());
}
if (getMeanLumiOverride() == 0 && mapMeanRate > 0.) {
setMeanLumi(mapMeanRate, false);
}
Expand All @@ -218,6 +223,9 @@ bool CorrectionMapsLoader::accountCCDBInputs(const ConcreteDataMatcher& matcher,
} else if (getLumiScaleType() == 2) {
mapRefMeanRate = mCorrMapRef->getIDC();
}
if (mCheckCTPIDCConsistency) {
checkMeanScaleConsistency(mapRefMeanRate, mCorrMapRef->getCTP2IDCFallBackThreshold());
}
if (getMeanLumiRefOverride() == 0) {
setMeanLumiRef(mapRefMeanRate);
}
Expand Down Expand Up @@ -328,4 +336,17 @@ void CorrectionMapsLoader::updateInverse()
}
}

void CorrectionMapsLoader::checkMeanScaleConsistency(float meanLumi, float threshold) const
{
if (getLumiScaleType() == 1) {
if (meanLumi < threshold) {
LOGP(fatal, "CTP Lumi scaling source is requested, but the map mean scale {} is below the threshold {}", meanLumi, threshold);
}
} else if (getLumiScaleType() == 2) {
if (meanLumi > threshold) {
LOGP(fatal, "IDC scaling source is requested, but the map mean scale {} is above the threshold {}", meanLumi, threshold);
}
}
}

#endif // #ifndef GPUCA_GPUCODE_DEVICE
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class TPCCalibPadGainTracksDevice : public o2::framework::Task
}
mTPCCorrMapsLoader.setLumiScaleType(sclOpts.lumiType);
mTPCCorrMapsLoader.setLumiScaleMode(sclOpts.lumiMode);
mTPCCorrMapsLoader.setCheckCTPIDCConsistency(sclOpts.checkCTPIDCconsistency);
}

void init(o2::framework::InitContext& ic) final
Expand Down
1 change: 1 addition & 0 deletions Detectors/TPC/workflow/src/RecoWorkflow.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ framework::WorkflowSpec getWorkflow(CompletionPolicyData* policyData, std::vecto
cfg.runTPCTracking = true;
cfg.lumiScaleType = sclOpts.lumiType;
cfg.lumiScaleMode = sclOpts.lumiMode;
cfg.checkCTPIDCconsistency = sclOpts.checkCTPIDCconsistency;
cfg.enableMShape = sclOpts.enableMShapeCorrection;
cfg.enableCTPLumi = sclOpts.requestCTPLumi;
cfg.decompressTPC = decompressTPC;
Expand Down
1 change: 1 addition & 0 deletions Detectors/TPC/workflow/src/TPCRefitter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class TPCRefitterSpec final : public Task
{
mTPCCorrMapsLoader.setLumiScaleType(sclOpts.lumiType);
mTPCCorrMapsLoader.setLumiScaleMode(sclOpts.lumiMode);
mTPCCorrMapsLoader.setCheckCTPIDCConsistency(sclOpts.checkCTPIDCconsistency);
}
~TPCRefitterSpec() final = default;
void init(InitContext& ic) final;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class TRDGlobalTracking : public o2::framework::Task
{
mTPCCorrMapsLoader.setLumiScaleType(sclOpts.lumiType);
mTPCCorrMapsLoader.setLumiScaleMode(sclOpts.lumiMode);
mTPCCorrMapsLoader.setCheckCTPIDCConsistency(sclOpts.checkCTPIDCconsistency);
}
~TRDGlobalTracking() override = default;
void init(o2::framework::InitContext& ic) final;
Expand Down
4 changes: 4 additions & 0 deletions GPU/TPCFastTransformation/CorrectionMapsHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ class CorrectionMapsHelper
}
}

void setCheckCTPIDCConsistency(bool v) { mCheckCTPIDCConsistency = v; }
bool getCheckCTPIDCConsistency() const { return mCheckCTPIDCConsistency; }

GPUd() float getInstLumiCTP() const { return mInstLumiCTP; }
GPUd() float getInstLumi() const { return mInstLumi; }
GPUd() float getMeanLumi() const { return mMeanLumi; }
Expand Down Expand Up @@ -181,6 +184,7 @@ class CorrectionMapsHelper
float mInstCTPLumiOverride = -1.f; // optional value to override inst lumi from CTP
bool mEnableMShape = false; ///< use v shape correction
bool mScaleInverse{false}; // if set to false the inverse correction is already scaled and will not scaled again
bool mCheckCTPIDCConsistency{true}; // check of selected CTP or IDC scaling source being consistent with the map
o2::gpu::TPCFastTransform* mCorrMap{nullptr}; // current transform
o2::gpu::TPCFastTransform* mCorrMapRef{nullptr}; // reference transform
o2::gpu::TPCFastTransform* mCorrMapMShape{nullptr}; // correction map for v-shape distortions on A-side
Expand Down
1 change: 1 addition & 0 deletions GPU/Workflow/include/GPUWorkflow/GPUWorkflowSpec.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class GPURecoWorkflowSpec : public o2::framework::Task
struct Config {
int32_t itsTriggerType = 0;
int32_t lumiScaleMode = 0;
bool checkCTPIDCconsistency = true;
bool enableMShape = false;
bool enableCTPLumi = false;
int32_t enableDoublePipeline = 0;
Expand Down
1 change: 1 addition & 0 deletions GPU/Workflow/src/GPUWorkflowTPC.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ void GPURecoWorkflowSpec::initFunctionTPCCalib(InitContext& ic)
mCalibObjects.mFastTransformHelper->setLumiScaleType(mSpecConfig.lumiScaleType);
mCalibObjects.mFastTransformHelper->setCorrMapMShape(mCalibObjects.mFastTransformMShape.get());
mCalibObjects.mFastTransformHelper->setLumiScaleMode(mSpecConfig.lumiScaleMode);
mCalibObjects.mFastTransformHelper->setCheckCTPIDCConsistency(mSpecConfig.checkCTPIDCconsistency);
mCalibObjects.mFastTransformHelper->enableMShapeCorrection(mSpecConfig.enableMShape);
if (mSpecConfig.outputTracks) {
mCalibObjects.mFastTransformHelper->init(ic);
Expand Down