Skip to content

Commit 0759d95

Browse files
committed
TPC SCD calib: add configurable params
1 parent 4be8768 commit 0759d95

14 files changed

Lines changed: 171 additions & 158 deletions

File tree

Detectors/GlobalTrackingWorkflow/tpcinterpolationworkflow/include/TPCInterpolationWorkflow/TPCInterpolationSpec.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
#include "DataFormatsTPC/Constants.h"
1818
#include "SpacePoints/TrackInterpolation.h"
19-
#include "SpacePoints/TrackResiduals.h"
2019
#include "Framework/DataProcessorSpec.h"
2120
#include "Framework/Task.h"
2221
#include "TStopwatch.h"
@@ -38,7 +37,7 @@ namespace tpc
3837
class TPCInterpolationDPL : public Task
3938
{
4039
public:
41-
TPCInterpolationDPL(std::shared_ptr<o2::globaltracking::DataRequest> dr, std::shared_ptr<o2::base::GRPGeomRequest> gr, bool useMC, bool processITSTPConly, bool writeUnfiltered, bool sendTrackData) : mDataRequest(dr), mGGCCDBRequest(gr), mUseMC(useMC), mProcessITSTPConly(processITSTPConly), mWriteUnfiltered(writeUnfiltered), mSendTrackData(sendTrackData) {}
40+
TPCInterpolationDPL(std::shared_ptr<o2::globaltracking::DataRequest> dr, std::shared_ptr<o2::base::GRPGeomRequest> gr, bool useMC, bool processITSTPConly, bool sendTrackData) : mDataRequest(dr), mGGCCDBRequest(gr), mUseMC(useMC), mProcessITSTPConly(processITSTPConly), mSendTrackData(sendTrackData) {}
4241
~TPCInterpolationDPL() override = default;
4342
void init(InitContext& ic) final;
4443
void run(ProcessingContext& pc) final;
@@ -48,19 +47,17 @@ class TPCInterpolationDPL : public Task
4847
private:
4948
void updateTimeDependentParams(ProcessingContext& pc);
5049
o2::tpc::TrackInterpolation mInterpolation; ///< track interpolation engine
51-
o2::tpc::TrackResiduals mResidualProcessor; ///< conversion and avg. distortion map creation engine
5250
std::shared_ptr<o2::globaltracking::DataRequest> mDataRequest; ///< steers the input
5351
std::shared_ptr<o2::base::GRPGeomRequest> mGGCCDBRequest;
5452
o2::tpc::VDriftHelper mTPCVDriftHelper{};
5553
bool mUseMC{false}; ///< MC flag
5654
bool mProcessITSTPConly{false}; ///< should also tracks without outer point (ITS-TPC only) be processed?
57-
bool mWriteUnfiltered{false}; ///< whether or not the unfiltered residuals should be sent out in addition to filtered ones
5855
bool mSendTrackData{false}; ///< if true, not only the clusters but also corresponding track data will be sent
5956
TStopwatch mTimer;
6057
};
6158

6259
/// create a processor spec
63-
framework::DataProcessorSpec getTPCInterpolationSpec(o2::dataformats::GlobalTrackID::mask_t src, bool useMC, bool processITSTPConly, bool writeResiduals, bool sendTrackData);
60+
framework::DataProcessorSpec getTPCInterpolationSpec(o2::dataformats::GlobalTrackID::mask_t src, bool useMC, bool processITSTPConly, bool sendTrackData);
6461

6562
} // namespace tpc
6663
} // namespace o2

Detectors/GlobalTrackingWorkflow/tpcinterpolationworkflow/include/TPCInterpolationWorkflow/TPCResidualWriterSpec.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace tpc
2222
{
2323

2424
/// create a processor spec
25-
framework::DataProcessorSpec getTPCResidualWriterSpec(bool writeUnfiltered, bool writeTrackData);
25+
framework::DataProcessorSpec getTPCResidualWriterSpec(bool writeTrackData);
2626

2727
} // namespace tpc
2828
} // namespace o2

Detectors/GlobalTrackingWorkflow/tpcinterpolationworkflow/src/TPCInterpolationSpec.cxx

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "DataFormatsGlobalTracking/RecoContainerCreateTracksVariadic.h"
2828
#include "DetectorsCommonDataFormats/DetID.h"
2929
#include "SpacePoints/SpacePointsCalibParam.h"
30+
#include "SpacePoints/SpacePointsCalibConfParam.h"
3031

3132
using namespace o2::framework;
3233
using namespace o2::globaltracking;
@@ -40,9 +41,6 @@ namespace tpc
4041

4142
void TPCInterpolationDPL::init(InitContext& ic)
4243
{
43-
if (mWriteUnfiltered) {
44-
mInterpolation.setWriteUnfiltered();
45-
}
4644
//-------- init geometry and field --------//
4745
mTimer.Stop();
4846
mTimer.Reset();
@@ -57,9 +55,7 @@ void TPCInterpolationDPL::updateTimeDependentParams(ProcessingContext& pc)
5755
if (!initOnceDone) { // this params need to be queried only once
5856
initOnceDone = true;
5957
// other init-once stuff
60-
6158
mInterpolation.init();
62-
mResidualProcessor.init(false, o2::base::Propagator::Instance()->getNominalBz()); // initialize but skip the binning which is needed only later
6359
}
6460
// we may have other params which need to be queried regularly
6561
if (mTPCVDriftHelper.isUpdated()) {
@@ -87,6 +83,7 @@ void TPCInterpolationDPL::run(ProcessingContext& pc)
8783
RecoContainer recoData;
8884
recoData.collectData(pc, *mDataRequest.get());
8985
updateTimeDependentParams(pc);
86+
const auto& param = SpacePointsCalibConfParam::Instance();
9087

9188
// load the input tracks
9289
std::vector<o2::globaltracking::RecoContainer::GlobalIDSet> gidTables;
@@ -95,7 +92,7 @@ void TPCInterpolationDPL::run(ProcessingContext& pc)
9592
std::vector<GTrackID> gids;
9693
bool processITSTPConly = mProcessITSTPConly; // so that the flag can be used inside the lambda
9794
// the creator goes from most complete track (ITS-TPC-TRD-TOF) to least complete one (ITS-TPC)
98-
auto creator = [&gidTables, &seeds, &trkTimes, &recoData, &processITSTPConly, &gids](auto& _tr, GTrackID _origID, float t0, float tErr) {
95+
auto creator = [&gidTables, &seeds, &trkTimes, &recoData, &processITSTPConly, &gids, &param](auto& _tr, GTrackID _origID, float t0, float tErr) {
9996
if constexpr (std::is_base_of_v<o2::track::TrackParCov, std::decay_t<decltype(_tr)>>) {
10097
bool trackGood = true;
10198
bool hasOuterPoint = false;
@@ -111,7 +108,7 @@ void TPCInterpolationDPL::run(ProcessingContext& pc)
111108
const auto itsTrk = &recoData.getITSTrack(gidTable[GTrackID::ITS]);
112109
const auto tpcTrk = &recoData.getTPCTrack(gidTable[GTrackID::TPC]);
113110
// apply track quality cuts
114-
if (itsTrk->getChi2() / itsTrk->getNumberOfClusters() > param::MaxITSChi2 || tpcTrk->getChi2() / tpcTrk->getNClusterReferences() > param::MaxTPCChi2) {
111+
if (itsTrk->getChi2() / itsTrk->getNumberOfClusters() > param.maxITSChi2 || tpcTrk->getChi2() / tpcTrk->getNClusterReferences() > param.maxTPCChi2) {
115112
// reduced chi2 cut is the same for all track types
116113
trackGood = false;
117114
}
@@ -120,11 +117,11 @@ void TPCInterpolationDPL::run(ProcessingContext& pc)
120117
if (!processITSTPConly) {
121118
return true;
122119
}
123-
if (itsTrk->getNumberOfClusters() < param::MinITSNClsNoOuterPoint || tpcTrk->getNClusterReferences() < param::MinTPCNClsNoOuterPoint) {
120+
if (itsTrk->getNumberOfClusters() < param.minITSNClsNoOuterPoint || tpcTrk->getNClusterReferences() < param.minTPCNClsNoOuterPoint) {
124121
trackGood = false;
125122
}
126123
} else {
127-
if (itsTrk->getNumberOfClusters() < param::MinITSNCls || tpcTrk->getNClusterReferences() < param::MinTPCNCls) {
124+
if (itsTrk->getNumberOfClusters() < param.minITSNCls || tpcTrk->getNClusterReferences() < param.minTPCNCls) {
128125
trackGood = false;
129126
}
130127
}
@@ -151,7 +148,7 @@ void TPCInterpolationDPL::run(ProcessingContext& pc)
151148
mTimer.Stop();
152149
LOGF(info, "TPC interpolation timing: Cpu: %.3e Real: %.3e s", mTimer.CpuTime(), mTimer.RealTime());
153150

154-
if (mWriteUnfiltered) {
151+
if (param.writeUnfiltered) {
155152
// these are the residuals and tracks before outlier rejection; they are not used in production
156153
pc.outputs().snapshot(Output{"GLO", "TPCINT_RES", 0, Lifetime::Timeframe}, mInterpolation.getClusterResidualsUnfiltered());
157154
if (mSendTrackData) {
@@ -172,7 +169,7 @@ void TPCInterpolationDPL::endOfStream(EndOfStreamContext& ec)
172169
mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
173170
}
174171

175-
DataProcessorSpec getTPCInterpolationSpec(GTrackID::mask_t src, bool useMC, bool processITSTPConly, bool writeUnfiltered, bool sendTrackData)
172+
DataProcessorSpec getTPCInterpolationSpec(GTrackID::mask_t src, bool useMC, bool processITSTPConly, bool sendTrackData)
176173
{
177174
auto dataRequest = std::make_shared<DataRequest>();
178175
std::vector<OutputSpec> outputs;
@@ -193,7 +190,7 @@ DataProcessorSpec getTPCInterpolationSpec(GTrackID::mask_t src, bool useMC, bool
193190
dataRequest->inputs,
194191
true);
195192
o2::tpc::VDriftHelper::requestCCDBInputs(dataRequest->inputs);
196-
if (writeUnfiltered) {
193+
if (SpacePointsCalibConfParam::Instance().writeUnfiltered) {
197194
outputs.emplace_back("GLO", "TPCINT_TRK", 0, Lifetime::Timeframe);
198195
outputs.emplace_back("GLO", "TPCINT_RES", 0, Lifetime::Timeframe);
199196
}
@@ -204,7 +201,7 @@ DataProcessorSpec getTPCInterpolationSpec(GTrackID::mask_t src, bool useMC, bool
204201
"tpc-track-interpolation",
205202
dataRequest->inputs,
206203
outputs,
207-
AlgorithmSpec{adaptFromTask<TPCInterpolationDPL>(dataRequest, ggRequest, useMC, processITSTPConly, writeUnfiltered, sendTrackData)},
204+
AlgorithmSpec{adaptFromTask<TPCInterpolationDPL>(dataRequest, ggRequest, useMC, processITSTPConly, sendTrackData)},
208205
Options{}};
209206
}
210207

Detectors/GlobalTrackingWorkflow/tpcinterpolationworkflow/src/TPCResidualWriterSpec.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include "SpacePoints/TrackInterpolation.h"
1717
#include "SpacePoints/TrackResiduals.h"
18+
#include "SpacePoints/SpacePointsCalibConfParam.h"
1819
#include "TPCInterpolationWorkflow/TPCResidualWriterSpec.h"
1920
#include "DataFormatsCTP/LumiInfo.h"
2021
#include "DPLUtils/MakeRootTreeWriterSpec.h"
@@ -28,9 +29,9 @@ namespace tpc
2829
template <typename T>
2930
using BranchDefinition = MakeRootTreeWriterSpec::BranchDefinition<T>;
3031

31-
DataProcessorSpec getTPCResidualWriterSpec(bool writeUnfiltered, bool writeTrackData)
32+
DataProcessorSpec getTPCResidualWriterSpec(bool writeTrackData)
3233
{
33-
34+
bool writeUnfiltered = SpacePointsCalibConfParam::Instance().writeUnfiltered;
3435
return MakeRootTreeWriterSpec("tpc-residuals-writer",
3536
"o2residuals_tpc.root",
3637
"residualsTPC",

Detectors/GlobalTrackingWorkflow/tpcinterpolationworkflow/src/tpc-interpolation-workflow.cxx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
3939
{"disable-mc", VariantType::Bool, false, {"disable MC propagation even if available"}},
4040
{"enable-itsonly", VariantType::Bool, false, {"process tracks without outer point (ITS-TPC only)"}},
4141
{"tracking-sources", VariantType::String, std::string{GID::ALL}, {"comma-separated list of sources to use for tracking"}},
42-
{"write-unfiltered", VariantType::Bool, false, {"write unfiltered residuals"}},
4342
{"send-track-data", VariantType::Bool, false, {"Send also the track information to the aggregator"}},
4443
{"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}};
4544
o2::raw::HBFUtilsInitializer::addConfigOption(options);
@@ -74,14 +73,13 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
7473
auto useMC = !configcontext.options().get<bool>("disable-mc");
7574
useMC = false; // force disabling MC as long as it is not implemented
7675
auto processITSTPConly = configcontext.options().get<bool>("enable-itsonly");
77-
auto writeUnfilteredResiduals = configcontext.options().get<bool>("write-unfiltered");
7876
auto sendTrackData = configcontext.options().get<bool>("send-track-data");
7977
GID::mask_t src = allowedSources & GID::getSourcesMask(configcontext.options().get<std::string>("tracking-sources"));
8078
LOG(info) << "Data sources: " << GID::getSourcesNames(src);
8179

82-
specs.emplace_back(o2::tpc::getTPCInterpolationSpec(src, useMC, processITSTPConly, writeUnfilteredResiduals, sendTrackData));
80+
specs.emplace_back(o2::tpc::getTPCInterpolationSpec(src, useMC, processITSTPConly, sendTrackData));
8381
if (!configcontext.options().get<bool>("disable-root-output")) {
84-
specs.emplace_back(o2::tpc::getTPCResidualWriterSpec(writeUnfilteredResiduals, sendTrackData));
82+
specs.emplace_back(o2::tpc::getTPCResidualWriterSpec(sendTrackData));
8583
}
8684

8785
o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, src, src, src, useMC);

Detectors/TPC/calibration/SpacePoints/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ o2_add_library(SpacePoints
1414
src/TrackResiduals.cxx
1515
src/TrackInterpolation.cxx
1616
src/ResidualAggregator.cxx
17+
src/SpacePointsCalibConfParam.cxx
1718
PUBLIC_LINK_LIBRARIES O2::DataFormatsTPC
1819
O2::CommonUtils
1920
O2::TPCBase
@@ -31,4 +32,5 @@ o2_target_root_dictionary(SpacePoints
3132
HEADERS include/SpacePoints/TrackResiduals.h
3233
include/SpacePoints/TrackInterpolation.h
3334
include/SpacePoints/ResidualAggregator.h
35+
include/SpacePoints/SpacePointsCalibConfParam.h
3436
LINKDEF src/SpacePointCalibLinkDef.h)
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
/// \author ole.schmidt@cern.ch
13+
14+
#ifndef ALICEO2_SCDCALIB_PARAMS_H
15+
#define ALICEO2_SCDCALIB_PARAMS_H
16+
17+
#include "CommonUtils/ConfigurableParam.h"
18+
#include "CommonUtils/ConfigurableParamHelper.h"
19+
20+
namespace o2
21+
{
22+
namespace tpc
23+
{
24+
25+
// These are configurable params for Primary Vertexer
26+
struct SpacePointsCalibConfParam : public o2::conf::ConfigurableParamHelper<SpacePointsCalibConfParam> {
27+
28+
// define track cuts for track interpolation
29+
int minTPCNCls = 70; ///< min number of TPC clusters
30+
int minTPCNClsNoOuterPoint = 50; ///< min number of TPC clusters if no hit in TRD or TOF exists
31+
float maxTPCChi2 = 4.f; ///< cut on TPC reduced chi2
32+
int minITSNCls = 4; ///< min number of ITS clusters
33+
int minITSNClsNoOuterPoint = 6; ///< min number of ITS clusters if no hit in TRD or TOF exists
34+
float maxITSChi2 = 20.f; ///< cut on ITS reduced chi2
35+
36+
// other settings for track interpolation
37+
float sigYZ2TOF{.75f}; ///< for now assume cluster error for TOF equal for all clusters in both Y and Z
38+
float maxSnp{.85f}; ///< max snp when propagating tracks
39+
float maxStep{2.f}; ///< maximum step for propagation
40+
41+
// parameters for outlier rejection
42+
bool writeUnfiltered{false}; ///< if set, all residuals and track parameters will be aggregated and dumped additionally without outlier rejection
43+
int nMALong{15}; ///< number of points to be used for moving average (long range)
44+
int nMAShort{3}; ///< number of points to be used for estimation of distance from local line (short range)
45+
float maxRejFrac{.15f}; ///< if the fraction of rejected clusters of a track is higher, the full track is invalidated
46+
float maxRMSLong{.8f}; ///< maximum variance of the cluster residuals wrt moving avarage for a track to be considered
47+
int minNCl = 30; ///< min number of clusters in a track to be used for calibration
48+
float maxQ2Pt = 3.f; ///< max fitted q/pt for a track to be used for calibration
49+
float maxDevHelixY = .3f; ///< max deviation in Y for clusters wrt helix fit
50+
float maxDevHelixZ = .3f; ///< max deviation in Z for clusters wrt helix fit
51+
int minNumberOfAcceptedResiduals = 30; ///< min number of accepted residuals for
52+
float maxStdDevMA = 25.f; ///< max cluster std. deviation (Y^2 + Z^2) wrt moving average to accept
53+
54+
// settings for voxel residuals extraction
55+
int minEntriesPerVoxel = 15; ///< minimum number of points in voxel for processing
56+
float LTMCut = .75f; ///< fraction op points to keep when trimming input data
57+
float minFracLTM = .5f; ///< minimum fraction of points to keep when trimming data to fit expected sigma
58+
float minValidVoxFracDrift = .5f; ///< if more than this fraction of bins are bad for one pad row the whole pad row is declared bad
59+
int minGoodXBinsToCover = 3; ///< minimum number of consecutive good bins, otherwise bins are declared bad
60+
int maxBadXBinsToCover = 4; ///< a lower number of consecutive bad X bins will not be declared bad
61+
float maxFracBadRowsPerSector = .4f; ///< maximum fraction of bad rows before whole sector is masked
62+
float maxFitErrY2 = 1.f; ///< maximum fit error for Y2
63+
float maxFitErrX2 = 9.f; ///< maximum fit error for X2
64+
float maxFitCorrXY = .95f; ///< maximum fit correlation for x and y
65+
float maxSigY = 1.1f; ///< maximum sigma for y of the voxel
66+
float maxSigZ = .7f; ///< maximum sigma for z of the voxel
67+
float maxGaussStdDev = 5.f; ///< maximum number of sigmas to be considered for gaussian kernel smoothing
68+
69+
O2ParamDef(SpacePointsCalibConfParam, "scdcalib");
70+
};
71+
72+
} // namespace tpc
73+
} // end namespace o2
74+
75+
#endif // ALICEO2_SCDCALIB_PARAMS_H

Detectors/TPC/calibration/SpacePoints/include/SpacePoints/SpacePointsCalibParam.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -61,25 +61,6 @@ static constexpr float MaxTgSlp = 1.f; ///< max value for phi and lambda angles
6161
// miscellaneous
6262
static constexpr float sEps = 1e-6f; ///< small number for float comparisons
6363

64-
// define track cuts for track interpolation
65-
static constexpr int MinTPCNCls = 70; ///< min number of TPC clusters
66-
static constexpr int MinTPCNClsNoOuterPoint = 50; ///< min number of TPC clusters if no hit in TRD or TOF exists
67-
static constexpr float MaxTPCChi2 = 4.f; ///< cut on TPC reduced chi2
68-
static constexpr int MinITSNCls = 4; ///< min number of ITS clusters
69-
static constexpr int MinITSNClsNoOuterPoint = 6; ///< min number of ITS clusters if no hit in TRD or TOF exists
70-
static constexpr float MaxITSChi2 = 4.f; ///< cut on ITS reduced chi2
71-
72-
// parameters for conversion of Run 2 residual trees
73-
static constexpr float InvalidR = 10.f; ///< clusters with a radius smaller than this are neglected
74-
static constexpr float InvalidRes = -900.f; ///< clusters with a residual smaller than this are neglected
75-
static constexpr int MinNCl = 30; ///< min number of clusters in a track to be used for calibration
76-
static constexpr float MaxQ2Pt = 3.f; ///< max fitted q/pt for a track to be used for calibration
77-
static constexpr float Bz = -5.0077936f; ///< hard-coded B-field for the moment to compare with results from AliRoot
78-
static constexpr float MaxDevHelixY = .3f; ///< max deviation in Y for clusters wrt helix fit
79-
static constexpr float MaxDevHelixZ = .3f; ///< max deviation in Z for clusters wrt helix fit
80-
static constexpr int MinNumberOfAcceptedResiduals = 30; ///< min number of accepted residuals for
81-
static constexpr float mMaxStdDevMA = 25.f; ///< max cluster std. deviation (Y^2 + Z^2) wrt moving average to accept
82-
8364
} // namespace param
8465
} // namespace tpc
8566
} // namespace o2

0 commit comments

Comments
 (0)