31#ifndef GPUCA_GPUCODE_DEVICE
51 const int maxDumRep = 5;
61 LOGP(alarm,
"Previous TF lumi used to substitute dummy input is empty, warning {} of {}", ++dumRep, maxDumRep);
71 float tpcScaler = pc.
inputs().
get<
float>(
"tpcscaler");
75 LOGP(info,
"Setting M-Shape map");
105 LOG(fatal) <<
"Correction mode unknown! Choose either 0 (default) or 1 (derivative map) for flag corrmap-lumi-mode.";
109 addInput(inputs, {
"CTPLumi",
"CTP",
"LUMI", 0, Lifetime::Timeframe});
149 tpcopt.
lumiMode = opts.
get<
int>(
"corrmap-lumi-mode");
154 LOGP(fatal,
"Scaling with CTP Lumi is requested but this input is disabled");
162 if (std::find(inputs.begin(), inputs.end(), isp) == inputs.end()) {
163 inputs.emplace_back(isp);
170 if (std::find(options.begin(), options.end(), osp) == options.end()) {
171 options.emplace_back(osp);
185 LOGP(info,
"CorrMap mean lumi rate is overridden to {}",
mCorrMap->getLumi());
188 LOGP(info,
"CorrMap mean IDC rate is overridden to {}",
mCorrMap->getIDC());
191 float mapMeanRate = 0;
203 LOGP(
debug,
"MeanLumiOverride={} MeanLumiMap={} -> meanLumi = {}",
getMeanLumiOverride(), mapMeanRate, getMeanLumi());
214 LOGP(info,
"CorrMapRef mean lumi rate is overridden to {}",
mCorrMapRef->getLumi());
217 LOGP(info,
"CorrMapRef mean IDC rate is overridden to {}",
mCorrMapRef->getIDC());
220 float mapRefMeanRate = 0;
258 const std::array<std::string, 3> lumiS{
"OFF",
"CTP",
"TPC scaler"};
259 if (scaleType >= lumiS.size()) {
260 LOGP(fatal,
"Wrong corrmap-lumi-mode provided!");
263 LOGP(info,
"TPC correction map params updated: SP corrections: {} (corr.map scaling type={}, override values: lumiMean={} lumiRefMean={} lumiScaleMode={}), CTP Lumi: source={} lumiInstOverride={} , LumiInst scale={} ",
273 if (getLumiScaleMode() < 0) {
274 LOGP(fatal,
"TPC correction lumi scaling mode is not set");
277 bool foundCTP =
false, foundTPCScl =
false, foundMShape =
false;
278 for (
const auto& route : inputRouts) {
279 if (route.matcher ==
InputSpec{
"CTPLumi",
"CTP",
"LUMI", 0, Lifetime::Timeframe}) {
287 setLumiCTPAvailable(foundCTP);
288 enableMShapeCorrection(foundMShape);
289 if ((getLumiScaleType() == 1 && !foundCTP) || (getLumiScaleType() == 2 && !foundTPCScl)) {
290 LOGP(fatal,
"Lumi scaling source {}({}) is not available for TPC correction", getLumiScaleType(), getLumiScaleType() == 1 ?
"CTP" :
"TPCScaler");
293 if ((getLumiScaleMode() == 1) || (getLumiScaleMode() == 2)) {
294 mScaleInverse = !(ic.options().get<
bool>(
"recalculate-inverse-correction"));
296 mScaleInverse =
true;
298 const int nthreadsInv = (ic.options().get<
int>(
"nthreads-inverse-correction"));
325 LOGP(info,
"Recalculating the inverse correction");
330 scaling.emplace_back(1);
335 LOGP(info,
"Reinitializing inverse correction with lumi scale mode {} not supported for now",
mLumiScaleMode);
342 if (meanLumi < threshold) {
343 LOGP(fatal,
"CTP Lumi scaling source is requested, but the map mean scale {} is below the threshold {}", meanLumi, threshold);
346 if (meanLumi > threshold) {
347 LOGP(fatal,
"IDC scaling source is requested, but the map mean scale {} is above the threshold {}", meanLumi, threshold);
Simple interface to the CDB manager.
Implementation of the parameter class for the CorrectionMapsLoader options.
Helper class to access load maps from CCDB.
class to create TPC fast space charge correction
static const CorrMapParam & Instance()
T get(const char *key) const
ServiceRegistryRef services()
InputRecord & inputs()
The inputs associated with this processing context.
void setInstCTPLumiOverride(float f)
void setCorrMapMShape(o2::gpu::TPCFastTransform *m)
void setLumiScaleType(int32_t v)
void setMeanLumiRefOverride(float f)
void setLumiScaleMode(int32_t v)
void setCorrMapRef(o2::gpu::TPCFastTransform *m)
float mMeanLumiRefOverride
o2::gpu::TPCFastTransform * mCorrMap
float mInstCTPLumiOverride
void setMeanLumiRef(float v, bool report=false)
float getMeanLumiRefOverride() const
int32_t getLumiScaleType() const
void setUpdatedMapMShape()
bool getLumiCTPAvailable() const
void setInstLumi(float v, bool report=false)
bool mCheckCTPIDCConsistency
void setInstLumiCTP(float v)
bool getUseMShapeCorrection() const
void enableMShapeCorrection(bool v)
void setLumiCTPAvailable(bool v)
void setMeanLumiOverride(float f)
void setMeanLumi(float v, bool report=false)
o2::gpu::TPCFastTransform * mCorrMapRef
bool canUseCorrections() const
float getMeanLumiOverride() const
void setCorrMap(std::unique_ptr< o2::gpu::TPCFastTransform > &&m)
void extractCCDBInputs(o2::framework::ProcessingContext &pc)
void updateVDrift(float vdriftCorr, float vdrifRef, float driftTimeOffset=0)
static void addGlobalOptions(std::vector< o2::framework::ConfigParamSpec > &options)
bool accountCCDBInputs(const o2::framework::ConcreteDataMatcher &matcher, void *obj)
static void addOptions(std::vector< o2::framework::ConfigParamSpec > &options)
static void requestCCDBInputs(std::vector< o2::framework::InputSpec > &inputs, std::vector< o2::framework::ConfigParamSpec > &options, const CorrectionMapsLoaderGloOpts &gloOpts)
void init(o2::framework::InitContext &ic)
static void addOption(std::vector< o2::framework::ConfigParamSpec > &options, o2::framework::ConfigParamSpec &&osp)
std::unique_ptr< o2::gpu::TPCFastTransform > mCorrMapMShape
void checkMeanScaleConsistency(float meanLumi, float threshold) const
recalculate inverse correction
void copySettings(const CorrectionMapsLoader &src)
static CorrectionMapsLoaderGloOpts parseGlobalOptions(const o2::framework::ConfigParamRegistry &opts)
static void addInput(std::vector< o2::framework::InputSpec > &inputs, o2::framework::InputSpec &&isp)
void initInverse(o2::gpu::TPCFastSpaceChargeCorrection &correction, bool prn)
initialise inverse transformation
void setNthreads(int n)
_______________ Settings ________________________
void setNthreadsToMaximum()
sets number of threads to N cpu cores
static TPCFastSpaceChargeCorrectionHelper * instance()
Singleton.
constexpr o2::header::DataOrigin gDataOriginTPC
Defining PrimaryVertex explicitly as messageable.
std::vector< ConfigParamSpec > ccdbParamSpec(std::string const &path, int runDependent, std::vector< CCDBMetadata > metadata={}, int qrate=0)
Global TPC definitions and constants.
const std::unordered_map< CDBType, const std::string > CDBTypeMap
Storage name in CCDB for each calibration and parameter type.
@ CalCorrMapMC
Cluster correction map (high IR rate distortions) for MC.
@ CalCorrMapRef
Cluster correction reference map (static distortions)
@ CalCorrMap
Cluster correction map (high IR rate distortions)
bool enableMShapeCorrection
int lumiType
what estimator to used for corrections scaling: 0: no scaling, 1: CTP, 2: IDC
bool checkCTPIDCconsistency
int lumiMode
what corrections method to use: 0: classical scaling, 1: Using of the derivative map,...
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"