Skip to content

Commit 5441a24

Browse files
matthias-kleinersawenzel
authored andcommitted
Enable fetching matLUT only if needed
1 parent 0888029 commit 5441a24

6 files changed

Lines changed: 26 additions & 21 deletions

File tree

Detectors/TPC/workflow/include/TPCWorkflow/CalibdEdxSpec.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@
1717
#define O2_TPC_TPCCALIBDEDXSPEC_H_
1818

1919
#include "Framework/DataProcessorSpec.h"
20+
#include "DetectorsBase/Propagator.h"
2021

2122
using namespace o2::framework;
2223

2324
namespace o2::tpc
2425
{
2526

2627
/// create a processor spec
27-
o2::framework::DataProcessorSpec getCalibdEdxSpec();
28+
o2::framework::DataProcessorSpec getCalibdEdxSpec(const o2::base::Propagator::MatCorrType matType);
2829

2930
} // namespace o2::tpc
3031

Detectors/TPC/workflow/include/TPCWorkflow/CalibratordEdxSpec.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@
1717
#define O2_TPC_TPCCALIBRATORDEDXSPEC_H_
1818

1919
#include "Framework/DataProcessorSpec.h"
20+
#include "DetectorsBase/Propagator.h"
2021

2122
using namespace o2::framework;
2223

2324
namespace o2::tpc
2425
{
2526

2627
/// create a processor spec
27-
o2::framework::DataProcessorSpec getCalibratordEdxSpec();
28+
o2::framework::DataProcessorSpec getCalibratordEdxSpec(const o2::base::Propagator::MatCorrType matType);
2829

2930
} // namespace o2::tpc
3031

Detectors/TPC/workflow/src/CalibdEdxSpec.cxx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace o2::tpc
3838
class CalibdEdxDevice : public Task
3939
{
4040
public:
41-
CalibdEdxDevice(std::shared_ptr<o2::base::GRPGeomRequest> req) : mCCDBRequest(req) {}
41+
CalibdEdxDevice(std::shared_ptr<o2::base::GRPGeomRequest> req, const o2::base::Propagator::MatCorrType matType) : mCCDBRequest(req), mMatType(matType) {}
4242

4343
void init(framework::InitContext& ic) final
4444
{
@@ -55,7 +55,6 @@ class CalibdEdxDevice : public Task
5555
const auto maxdEdx = ic.options().get<float>("max-dedx");
5656
const auto angularBins = ic.options().get<int>("angularbins");
5757
const auto fitSnp = ic.options().get<bool>("fit-snp");
58-
auto materialType = static_cast<o2::base::Propagator::MatCorrType>(ic.options().get<int>("material-type"));
5958

6059
mDumpToFile = ic.options().get<int>("file-dump");
6160

@@ -65,7 +64,7 @@ class CalibdEdxDevice : public Task
6564
mCalib->set1DFitThreshold(minEntries1D);
6665
mCalib->set2DFitThreshold(minEntries2D);
6766
mCalib->setElectronCut(fitThreshold, fitPasses, fitThresholdLowFactor);
68-
mCalib->setMaterialType(materialType);
67+
mCalib->setMaterialType(mMatType);
6968
}
7069

7170
void finaliseCCDB(o2::framework::ConcreteDataMatcher& matcher, void* obj) final
@@ -117,14 +116,16 @@ class CalibdEdxDevice : public Task
117116
}
118117

119118
std::shared_ptr<o2::base::GRPGeomRequest> mCCDBRequest;
119+
const o2::base::Propagator::MatCorrType mMatType{};
120120
int mDumpToFile{};
121121
uint64_t mRunNumber{0}; ///< processed run number
122122
uint64_t mTimeStampStart{0}; ///< time stamp for first TF for CCDB output
123123
std::unique_ptr<CalibdEdx> mCalib;
124124
};
125125

126-
DataProcessorSpec getCalibdEdxSpec()
126+
DataProcessorSpec getCalibdEdxSpec(const o2::base::Propagator::MatCorrType matType)
127127
{
128+
const bool enableAskMatLUT = matType == o2::base::Propagator::MatCorrType::USEMatCorrLUT;
128129
std::vector<OutputSpec> outputs;
129130
outputs.emplace_back(ConcreteDataTypeMatcher{o2::calibration::Utils::gDataOriginCDBPayload, "TPC_CalibdEdx"}, Lifetime::Sporadic);
130131
outputs.emplace_back(ConcreteDataTypeMatcher{o2::calibration::Utils::gDataOriginCDBWrapper, "TPC_CalibdEdx"}, Lifetime::Sporadic);
@@ -133,7 +134,7 @@ DataProcessorSpec getCalibdEdxSpec()
133134
false, // GRPECS=true
134135
false, // GRPLHCIF
135136
true, // GRPMagField
136-
true, // askMatLUT
137+
enableAskMatLUT, // askMatLUT
137138
o2::base::GRPGeomRequest::None, // geometry
138139
inputs,
139140
true,
@@ -143,7 +144,7 @@ DataProcessorSpec getCalibdEdxSpec()
143144
"tpc-calib-dEdx",
144145
inputs,
145146
outputs,
146-
adaptFromTask<CalibdEdxDevice>(ccdbRequest),
147+
adaptFromTask<CalibdEdxDevice>(ccdbRequest, matType),
147148
Options{
148149
{"min-entries-sector", VariantType::Int, 1000, {"min entries per GEM stack to enable sector by sector correction. Below this value we only perform one fit per ROC type (IROC, OROC1, ...; no side nor sector information)."}},
149150
{"min-entries-1d", VariantType::Int, 10000, {"minimum entries per stack to fit 1D correction"}},
@@ -158,8 +159,7 @@ DataProcessorSpec getCalibdEdxSpec()
158159
{"angularbins", VariantType::Int, 36, {"number of angular bins: Tgl and Snp"}},
159160
{"fit-snp", VariantType::Bool, false, {"enable Snp correction"}},
160161

161-
{"file-dump", VariantType::Int, 0, {"directly dump calibration to file"}},
162-
{"material-type", VariantType::Int, 2, {"Type for the material buget during track propagation: 0=None, 1=Geo, 2=LUT"}}}};
162+
{"file-dump", VariantType::Int, 0, {"directly dump calibration to file"}}}};
163163
}
164164

165165
} // namespace o2::tpc

Detectors/TPC/workflow/src/CalibratordEdxSpec.cxx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#include "TPCWorkflow/ProcessingHelpers.h"
3333
#include "DetectorsBase/GRPGeomHelper.h"
3434
#include "TPCBase/CDBInterface.h"
35-
#include "DetectorsBase/Propagator.h"
3635

3736
using namespace o2::framework;
3837

@@ -42,7 +41,7 @@ namespace o2::tpc
4241
class CalibratordEdxDevice : public Task
4342
{
4443
public:
45-
CalibratordEdxDevice(std::shared_ptr<o2::base::GRPGeomRequest> req) : mCCDBRequest(req) {}
44+
CalibratordEdxDevice(std::shared_ptr<o2::base::GRPGeomRequest> req, const o2::base::Propagator::MatCorrType matType) : mCCDBRequest(req), mMatType(matType) {}
4645
void init(framework::InitContext& ic) final
4746
{
4847
o2::base::GRPGeomHelper::instance().setRequest(mCCDBRequest);
@@ -64,7 +63,6 @@ class CalibratordEdxDevice : public Task
6463
const auto fitSnp = ic.options().get<bool>("fit-snp");
6564

6665
const auto dumpData = ic.options().get<bool>("file-dump");
67-
auto materialType = static_cast<o2::base::Propagator::MatCorrType>(ic.options().get<int>("material-type"));
6866

6967
mCalibrator = std::make_unique<tpc::CalibratordEdx>();
7068
mCalibrator->setHistParams(dEdxBins, mindEdx, maxdEdx, angularBins, fitSnp);
@@ -74,7 +72,7 @@ class CalibratordEdxDevice : public Task
7472
mCalibrator->setSlotLength(slotLength);
7573
mCalibrator->setMaxSlotsDelay(maxDelay);
7674
mCalibrator->setElectronCut({fitThreshold, fitPasses, fitThresholdLowFactor});
77-
mCalibrator->setMaterialType(materialType);
75+
mCalibrator->setMaterialType(mMatType);
7876

7977
if (dumpData) {
8078
mCalibrator->enableDebugOutput("calibratordEdx.root");
@@ -130,12 +128,14 @@ class CalibratordEdxDevice : public Task
130128
}
131129

132130
std::unique_ptr<CalibratordEdx> mCalibrator;
131+
const o2::base::Propagator::MatCorrType mMatType{};
133132
std::shared_ptr<o2::base::GRPGeomRequest> mCCDBRequest;
134133
uint64_t mRunNumber{0}; ///< processed run number
135134
};
136135

137-
DataProcessorSpec getCalibratordEdxSpec()
136+
DataProcessorSpec getCalibratordEdxSpec(const o2::base::Propagator::MatCorrType matType)
138137
{
138+
const bool enableAskMatLUT = matType == o2::base::Propagator::MatCorrType::USEMatCorrLUT;
139139
std::vector<OutputSpec> outputs;
140140
outputs.emplace_back(ConcreteDataTypeMatcher{o2::calibration::Utils::gDataOriginCDBPayload, "TPC_CalibdEdx"}, Lifetime::Sporadic);
141141
outputs.emplace_back(ConcreteDataTypeMatcher{o2::calibration::Utils::gDataOriginCDBWrapper, "TPC_CalibdEdx"}, Lifetime::Sporadic);
@@ -144,7 +144,7 @@ DataProcessorSpec getCalibratordEdxSpec()
144144
true, // GRPECS=true
145145
false, // GRPLHCIF
146146
true, // GRPMagField
147-
true, // askMatLUT
147+
enableAskMatLUT, // askMatLUT
148148
o2::base::GRPGeomRequest::None, // geometry
149149
inputs,
150150
true,
@@ -153,7 +153,7 @@ DataProcessorSpec getCalibratordEdxSpec()
153153
"tpc-calibrator-dEdx",
154154
inputs,
155155
outputs,
156-
adaptFromTask<CalibratordEdxDevice>(ccdbRequest),
156+
adaptFromTask<CalibratordEdxDevice>(ccdbRequest, matType),
157157
Options{
158158
{"tf-per-slot", VariantType::UInt32, 6000u, {"number of TFs per calibration time slot"}},
159159
{"max-delay", VariantType::UInt32, 10u, {"number of slots in past to consider"}},
@@ -172,8 +172,7 @@ DataProcessorSpec getCalibratordEdxSpec()
172172
{"angularbins", VariantType::Int, 36, {"number of angular bins: Tgl and Snp"}},
173173
{"fit-snp", VariantType::Bool, false, {"enable Snp correction"}},
174174

175-
{"file-dump", VariantType::Bool, false, {"directly dump calibration to file"}},
176-
{"material-type", VariantType::Int, 2, {"Type for the material buget during track propagation: 0=None, 1=Geo, 2=LUT"}}}};
175+
{"file-dump", VariantType::Bool, false, {"directly dump calibration to file"}}}};
177176
}
178177

179178
} // namespace o2::tpc

Detectors/TPC/workflow/src/tpc-calib-dEdx.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ void customize(std::vector<ConfigParamSpec>& workflowOptions)
1919
std::vector<ConfigParamSpec> options{
2020
{"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings (e.g.: 'TPCCalibPedestal.FirstTimeBin=10;...')"}},
2121
{"configFile", VariantType::String, "", {"configuration file for configurable parameters"}},
22+
{"material-type", VariantType::Int, 2, {"Type for the material budget during track propagation: 0=None, 1=Geo, 2=LUT"}},
2223
};
2324

2425
std::swap(workflowOptions, options);
@@ -33,7 +34,8 @@ WorkflowSpec defineDataProcessing(ConfigContext const& config)
3334
o2::conf::ConfigurableParam::updateFromFile(config.options().get<std::string>("configFile"));
3435
o2::conf::ConfigurableParam::updateFromString(config.options().get<std::string>("configKeyValues"));
3536
o2::conf::ConfigurableParam::writeINI("o2tpccalibration_configuration.ini");
37+
auto materialType = static_cast<o2::base::Propagator::MatCorrType>(config.options().get<int>("material-type"));
3638

3739
using namespace o2::tpc;
38-
return WorkflowSpec{getCalibdEdxSpec()};
40+
return WorkflowSpec{getCalibdEdxSpec(materialType)};
3941
}

Detectors/TPC/workflow/src/tpc-calibrator-dEdx.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ void customize(std::vector<ConfigParamSpec>& workflowOptions)
1919
std::vector<ConfigParamSpec> options{
2020
{"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings (e.g.: 'TPCCalibPedestal.FirstTimeBin=10;...')"}},
2121
{"configFile", VariantType::String, "", {"configuration file for configurable parameters"}},
22+
{"material-type", VariantType::Int, 2, {"Type for the material budget during track propagation: 0=None, 1=Geo, 2=LUT"}},
2223
};
2324

2425
std::swap(workflowOptions, options);
@@ -33,7 +34,8 @@ WorkflowSpec defineDataProcessing(ConfigContext const& config)
3334
o2::conf::ConfigurableParam::updateFromFile(config.options().get<std::string>("configFile"));
3435
o2::conf::ConfigurableParam::updateFromString(config.options().get<std::string>("configKeyValues"));
3536
o2::conf::ConfigurableParam::writeINI("o2tpccalibration_configuration.ini");
37+
auto materialType = static_cast<o2::base::Propagator::MatCorrType>(config.options().get<int>("material-type"));
3638

3739
using namespace o2::tpc;
38-
return WorkflowSpec{getCalibratordEdxSpec()};
40+
return WorkflowSpec{getCalibratordEdxSpec(materialType)};
3941
}

0 commit comments

Comments
 (0)