Skip to content

Commit 0b3fa30

Browse files
TPC: Fix usage of derivative map for scaling of space-charge corrections (#12264)
* TPC: Fix usage of derivative map for scaling of space-charge corrections - add option to override lumi of reference map (reference map can be the derivative map) - changing definition of scaling when using the derivative map: The derivative map is defined as "map_high_IR - map_low_IR". The stored lumi of the derivative map should correspond to "<Lumi_high_IR> - <Lumi_low_IR>" - Changing condition when scaling is used: for the derivative map the scaling is negative, when the inst_lumi < mean_lumi * Helper to handle global scaling options, extend to all wfs with TPC corrections * Move CorrectionMapsLoader device options to TPCCorrMap.. configurable Former options --corrmap-lumi-mean, --corrmap-lumi-inst, --corrmap-lumi-ref, --ctp-lumi-factor, --ctp-lumi-source are moved to new configurable param CorrMapParam as TPCCorrMap.lumiMean, lumiInst, lumiMeanRef, lumiInstFactor and ctpLumiSource respectively. The object is not loaded from the CCDB (default uploaded) and can be modified from the command line as a usial configurable param. The dpl-workflow.sh parses TPC_CORR_SCALING env var. which is now a mix of options --lumi-type <0,1,2>, --corrmap-lumi-mode <0,1> abd TPCCorrMap... settings, e.g. TPCCorrMap=--lumi-type 2 --corrmap-lumi-mode 1 TPCCorrMap.lumiInstFactor=3.141 --------- Co-authored-by: shahoian <ruben.shahoyan@cern.ch>
1 parent 1170977 commit 0b3fa30

39 files changed

Lines changed: 320 additions & 133 deletions

Detectors/Align/Workflow/include/AlignmentWorkflow/BarrelAlignmentSpec.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,17 @@ using namespace o2::framework;
2121

2222
namespace o2
2323
{
24+
namespace tpc
25+
{
26+
struct CorrectionMapsLoaderGloOpts;
27+
}
28+
2429
namespace align
2530
{
2631

2732
/// create a processor spec
2833
framework::DataProcessorSpec getBarrelAlignmentSpec(o2::dataformats::GlobalTrackID::mask_t srcMP, o2::dataformats::GlobalTrackID::mask_t src,
29-
o2::detectors::DetID::mask_t dets, o2::detectors::DetID::mask_t skipDetClusters, bool enableCosmic, int postproc, bool useMC, int lumiType);
34+
o2::detectors::DetID::mask_t dets, o2::detectors::DetID::mask_t skipDetClusters, bool enableCosmic, int postproc, bool useMC, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts);
3035

3136
} // namespace align
3237
} // namespace o2

Detectors/Align/Workflow/src/BarrelAlignmentSpec.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ void BarrelAlignmentSpec::endOfStream(EndOfStreamContext& ec)
358358
mDBGOut.reset();
359359
}
360360

361-
DataProcessorSpec getBarrelAlignmentSpec(GTrackID::mask_t srcMP, GTrackID::mask_t src, DetID::mask_t dets, DetID::mask_t skipDetClusters, bool enableCosmic, int postprocess, bool useMC, int lumiType)
361+
DataProcessorSpec getBarrelAlignmentSpec(GTrackID::mask_t srcMP, GTrackID::mask_t src, DetID::mask_t dets, DetID::mask_t skipDetClusters, bool enableCosmic, int postprocess, bool useMC, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts)
362362
{
363363
std::vector<OutputSpec> outputs;
364364
auto dataRequest = std::make_shared<DataRequest>();
@@ -383,7 +383,7 @@ DataProcessorSpec getBarrelAlignmentSpec(GTrackID::mask_t srcMP, GTrackID::mask_
383383
}
384384
if (src[DetID::TPC] && !skipDetClusters[DetID::TPC]) {
385385
o2::tpc::VDriftHelper::requestCCDBInputs(dataRequest->inputs);
386-
o2::tpc::CorrectionMapsLoader::requestCCDBInputs(dataRequest->inputs, opts, lumiType);
386+
o2::tpc::CorrectionMapsLoader::requestCCDBInputs(dataRequest->inputs, opts, sclOpts);
387387
loadTPCCalib = true;
388388
}
389389
}

Detectors/Align/Workflow/src/barrel-alignment-workflow.cxx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "TPCReaderWorkflow/TrackReaderSpec.h"
2020
#include "TPCReaderWorkflow/ClusterReaderSpec.h"
2121
#include "TPCWorkflow/ClusterSharingMapSpec.h"
22+
#include "TPCCalibration/CorrectionMapsLoader.h"
2223
#include "TOFWorkflowIO/ClusterReaderSpec.h"
2324
#include "TOFWorkflowIO/TOFMatchedReaderSpec.h"
2425
#include "TOFWorkflowIO/ClusterReaderSpec.h"
@@ -55,9 +56,9 @@ void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
5556
{"enable-tpc-tracks", VariantType::Bool, false, {"allow reading TPC tracks"}},
5657
{"enable-tpc-clusters", VariantType::Bool, false, {"allow reading TPC clusters (will trigger TPC tracks reading)"}},
5758
{"enable-cosmic", VariantType::Bool, false, {"enable cosmic tracks)"}},
58-
{"lumi-type", o2::framework::VariantType::Int, 0, {"1 = require CTP lumi for TPC correction scaling, 2 = require TPC scalers for TPC correction scaling"}},
5959
{"postprocessing", VariantType::Int, 0, {"postprocessing bits: 1 - extract alignment objects, 2 - check constraints, 4 - print mpParams/Constraints, 8 - relabel pede results"}},
6060
{"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}};
61+
o2::tpc::CorrectionMapsLoader::addGlobalOptions(options);
6162
o2::raw::HBFUtilsInitializer::addConfigOption(options);
6263
std::swap(workflowOptions, options);
6364
}
@@ -91,7 +92,6 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
9192
bool loadTPCTracks = configcontext.options().get<bool>("enable-tpc-tracks");
9293
bool enableCosmic = configcontext.options().get<bool>("enable-cosmic");
9394
bool useMC = configcontext.options().get<bool>("enable-mc");
94-
auto lumiType = configcontext.options().get<int>("lumi-type");
9595

9696
DetID::mask_t dets = allowedDets & DetID::getMask(configcontext.options().get<std::string>("detectors"));
9797
DetID::mask_t skipDetClusters; // optionally skip automatically loaded clusters
@@ -101,7 +101,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
101101
if (dets[DetID::TPC]) {
102102
loadTPCClusters = loadTPCTracks = true;
103103
}
104-
104+
auto sclOpt = o2::tpc::CorrectionMapsLoader::parseGlobalOptions(configcontext.options());
105105
if (!postprocess) { // this part is needed only if the data should be read
106106
if (GID::includesDet(DetID::ITS, src)) {
107107
src |= GID::getSourceMask(GID::ITS);
@@ -140,14 +140,14 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
140140
}
141141
LOG(info) << "adding TOF request";
142142
}
143-
if (lumiType == 1) {
143+
if (sclOpt.lumiType == 1) {
144144
src = src | GID::getSourcesMask("CTP");
145145
}
146146
// write the configuration used for the workflow
147147
o2::conf::ConfigurableParam::writeINI("o2_barrel_alignment_configuration.ini");
148148
}
149149

150-
specs.emplace_back(o2::align::getBarrelAlignmentSpec(srcMP, src, dets, skipDetClusters, enableCosmic, postprocess, useMC, lumiType));
150+
specs.emplace_back(o2::align::getBarrelAlignmentSpec(srcMP, src, dets, skipDetClusters, enableCosmic, postprocess, useMC, sclOpt));
151151
// RS FIXME: check which clusters are really needed
152152
if (!postprocess) {
153153
GID::mask_t dummy;

Detectors/GlobalTrackingWorkflow/include/GlobalTrackingWorkflow/CosmicsMatchingSpec.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,16 @@ using namespace o2::framework;
2020

2121
namespace o2
2222
{
23+
namespace tpc
24+
{
25+
struct CorrectionMapsLoaderGloOpts;
26+
}
27+
2328
namespace globaltracking
2429
{
2530

2631
/// create a processor spec
27-
framework::DataProcessorSpec getCosmicsMatchingSpec(o2::dataformats::GlobalTrackID::mask_t src, bool useMC, int lumiType);
32+
framework::DataProcessorSpec getCosmicsMatchingSpec(o2::dataformats::GlobalTrackID::mask_t src, bool useMC, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts);
2833

2934
} // namespace globaltracking
3035
} // namespace o2

Detectors/GlobalTrackingWorkflow/include/GlobalTrackingWorkflow/SecondaryVertexingSpec.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,16 @@
2020

2121
namespace o2
2222
{
23+
namespace tpc
24+
{
25+
struct CorrectionMapsLoaderGloOpts;
26+
}
27+
2328
namespace vertexing
2429
{
2530

2631
/// create a processor spec
27-
o2::framework::DataProcessorSpec getSecondaryVertexingSpec(o2::dataformats::GlobalTrackID::mask_t src, bool enableCasc, bool enable3body, bool enableStrangenesTracking, bool useMC, int lumiType);
32+
o2::framework::DataProcessorSpec getSecondaryVertexingSpec(o2::dataformats::GlobalTrackID::mask_t src, bool enableCasc, bool enable3body, bool enableStrangenesTracking, bool useMC, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts);
2833

2934
} // namespace vertexing
3035
} // namespace o2

Detectors/GlobalTrackingWorkflow/include/GlobalTrackingWorkflow/TOFMatcherSpec.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,15 @@ using namespace o2::framework;
2121

2222
namespace o2
2323
{
24+
namespace tpc
25+
{
26+
struct CorrectionMapsLoaderGloOpts;
27+
}
2428
namespace globaltracking
2529
{
2630

2731
/// create a processor spec
28-
framework::DataProcessorSpec getTOFMatcherSpec(o2::dataformats::GlobalTrackID::mask_t src, bool useMC, bool useFIT, bool tpcRefit, bool strict, float extratolerancetrd, bool pushMatchable, int lumiType);
32+
framework::DataProcessorSpec getTOFMatcherSpec(o2::dataformats::GlobalTrackID::mask_t src, bool useMC, bool useFIT, bool tpcRefit, bool strict, float extratolerancetrd, bool pushMatchable, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts);
2933

3034
} // namespace globaltracking
3135
} // namespace o2

Detectors/GlobalTrackingWorkflow/include/GlobalTrackingWorkflow/TPCITSMatchingSpec.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,14 @@ using namespace o2::framework;
2020

2121
namespace o2
2222
{
23+
namespace tpc
24+
{
25+
struct CorrectionMapsLoaderGloOpts;
26+
}
2327
namespace globaltracking
2428
{
2529
/// create a processor spec
26-
framework::DataProcessorSpec getTPCITSMatchingSpec(o2::dataformats::GlobalTrackID::mask_t src, bool useFT0, bool calib, bool skipTPCOnly, bool useMC, int lumiType);
30+
framework::DataProcessorSpec getTPCITSMatchingSpec(o2::dataformats::GlobalTrackID::mask_t src, bool useFT0, bool calib, bool skipTPCOnly, bool useMC, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts);
2731

2832
} // namespace globaltracking
2933
} // namespace o2

Detectors/GlobalTrackingWorkflow/src/CosmicsMatchingSpec.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ void CosmicsMatchingSpec::endOfStream(EndOfStreamContext& ec)
172172
mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
173173
}
174174

175-
DataProcessorSpec getCosmicsMatchingSpec(GTrackID::mask_t src, bool useMC, int lumiType)
175+
DataProcessorSpec getCosmicsMatchingSpec(GTrackID::mask_t src, bool useMC, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts)
176176
{
177177
std::vector<OutputSpec> outputs;
178178
Options opts{
@@ -198,7 +198,7 @@ DataProcessorSpec getCosmicsMatchingSpec(GTrackID::mask_t src, bool useMC, int l
198198
dataRequest->inputs,
199199
true);
200200
o2::tpc::VDriftHelper::requestCCDBInputs(dataRequest->inputs);
201-
o2::tpc::CorrectionMapsLoader::requestCCDBInputs(dataRequest->inputs, opts, lumiType);
201+
o2::tpc::CorrectionMapsLoader::requestCCDBInputs(dataRequest->inputs, opts, sclOpts);
202202

203203
return DataProcessorSpec{
204204
"cosmics-matcher",

Detectors/GlobalTrackingWorkflow/src/SecondaryVertexingSpec.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "TPCCalibration/CorrectionMapsLoader.h"
3434
#include "Framework/ConfigParamRegistry.h"
3535
#include "Framework/DeviceSpec.h"
36+
#include "TPCCalibration/CorrectionMapsLoader.h"
3637

3738
using namespace o2::framework;
3839

@@ -201,7 +202,7 @@ void SecondaryVertexingSpec::updateTimeDependentParams(ProcessingContext& pc)
201202
pc.inputs().get<o2::dataformats::MeanVertexObject*>("meanvtx");
202203
}
203204

204-
DataProcessorSpec getSecondaryVertexingSpec(GTrackID::mask_t src, bool enableCasc, bool enable3body, bool enableStrangenesTracking, bool useMC, int lumiType)
205+
DataProcessorSpec getSecondaryVertexingSpec(GTrackID::mask_t src, bool enableCasc, bool enable3body, bool enableStrangenesTracking, bool useMC, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts)
205206
{
206207
std::vector<OutputSpec> outputs;
207208
Options opts{
@@ -231,7 +232,7 @@ DataProcessorSpec getSecondaryVertexingSpec(GTrackID::mask_t src, bool enableCas
231232
true);
232233
if (src[GTrackID::TPC]) {
233234
o2::tpc::VDriftHelper::requestCCDBInputs(dataRequest->inputs);
234-
o2::tpc::CorrectionMapsLoader::requestCCDBInputs(dataRequest->inputs, opts, lumiType);
235+
o2::tpc::CorrectionMapsLoader::requestCCDBInputs(dataRequest->inputs, opts, sclOpts);
235236
}
236237
outputs.emplace_back("GLO", "V0S_IDX", 0, Lifetime::Timeframe); // found V0s indices
237238
outputs.emplace_back("GLO", "V0S", 0, Lifetime::Timeframe); // found V0s

Detectors/GlobalTrackingWorkflow/src/TOFMatcherSpec.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ void TOFMatcherSpec::endOfStream(EndOfStreamContext& ec)
237237
mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
238238
}
239239

240-
DataProcessorSpec getTOFMatcherSpec(GID::mask_t src, bool useMC, bool useFIT, bool tpcRefit, bool strict, float extratolerancetrd, bool pushMatchable, int lumiType)
240+
DataProcessorSpec getTOFMatcherSpec(GID::mask_t src, bool useMC, bool useFIT, bool tpcRefit, bool strict, float extratolerancetrd, bool pushMatchable, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts)
241241
{
242242
uint32_t ss = o2::globaltracking::getSubSpec(strict ? o2::globaltracking::MatchingType::Strict : o2::globaltracking::MatchingType::Standard);
243243
Options opts;
@@ -260,7 +260,7 @@ DataProcessorSpec getTOFMatcherSpec(GID::mask_t src, bool useMC, bool useFIT, bo
260260
dataRequest->inputs,
261261
true);
262262
o2::tpc::VDriftHelper::requestCCDBInputs(dataRequest->inputs);
263-
o2::tpc::CorrectionMapsLoader::requestCCDBInputs(dataRequest->inputs, opts, lumiType);
263+
o2::tpc::CorrectionMapsLoader::requestCCDBInputs(dataRequest->inputs, opts, sclOpts);
264264
std::vector<OutputSpec> outputs;
265265
if (GID::includesSource(GID::TPC, src)) {
266266
outputs.emplace_back(o2::header::gDataOriginTOF, "MTC_TPC", ss, Lifetime::Timeframe);

0 commit comments

Comments
 (0)