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});
148 tpcopt.
lumiMode = opts.
get<
int>(
"corrmap-lumi-mode");
152 LOGP(fatal,
"Scaling with CTP Lumi is requested but this input is disabled");
160 if (std::find(inputs.begin(), inputs.end(), isp) == inputs.end()) {
161 inputs.emplace_back(isp);
168 if (std::find(options.begin(), options.end(), osp) == options.end()) {
169 options.emplace_back(osp);
218 const std::array<std::string, 3> lumiS{
"OFF",
"CTP",
"TPC scaler"};
219 if (scaleType >= lumiS.size()) {
220 LOGP(fatal,
"Wrong lumi-scale-type provided!");
223 LOGP(info,
"TPC correction map params updated: SP corrections: {} (corr.map scaling type={}, override values: lumiMean={} lumiRefMean={} lumiScaleMode={}), CTP Lumi: source={} lumiInstOverride={} , LumiInst scale={} ",
233 if (getLumiScaleMode() < 0) {
234 LOGP(fatal,
"TPC correction lumi scaling mode is not set");
237 bool foundCTP =
false, foundTPCScl =
false, foundMShape =
false;
238 for (
const auto& route : inputRouts) {
239 if (route.matcher ==
InputSpec{
"CTPLumi",
"CTP",
"LUMI", 0, Lifetime::Timeframe}) {
247 setLumiCTPAvailable(foundCTP);
248 enableMShapeCorrection(foundMShape);
249 if ((getLumiScaleType() == 1 && !foundCTP) || (getLumiScaleType() == 2 && !foundTPCScl)) {
250 LOGP(fatal,
"Lumi scaling source {}({}) is not available for TPC correction", getLumiScaleType(), getLumiScaleType() == 1 ?
"CTP" :
"TPCScaler");
253 if ((getLumiScaleMode() == 1) || (getLumiScaleMode() == 2)) {
254 mScaleInverse = !(ic.options().get<
bool>(
"recalculate-inverse-correction"));
256 mScaleInverse =
true;
258 const int nthreadsInv = (ic.options().get<
int>(
"nthreads-inverse-correction"));
285 LOGP(info,
"Recalculating the inverse correction");
290 scaling.emplace_back(1);
295 LOGP(info,
"Reinitializing inverse correction with lumi scale mode {} not supported for now",
mLumiScaleMode);
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)
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)
recalculate inverse correction
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 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
int lumiMode
what corrections method to use: 0: classical scaling, 1: Using of the derivative map,...
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"