Skip to content

Commit 9755ce1

Browse files
committed
Changes in TPC residuals validation
The meaning of the scdcalib.writeUnfiltered (default: false) ConfigurableParam has changed. If set to true, tracks that do not pass the validateTrack check will no longer be discarded but will instead be stored in the standard unbinned residuals data. The int8_t TrackData::filterFlag field provides the status of the validation check: -1: no validation check was requested; 0: validation passed; >0: reason for failing validation (see the validateTrack method). A new ConfigurableParam, scdcalib.writeValidationData (default: false), has been added. If set to true, the TrackValidationData object, together with the corresponding TrackData, will be written to a dedicated debug tree, "valdata", in "track_interpolation_dbg.root" (or "track_interpolation_dbg_<lane>.root" when multiple lanes are used). If a track passes validation but some residuals are flagged as bad, the new ConfigurableParam scdcalib.keepRejectedResiduals (default: false) allows these residuals to be written to the unbinned residuals tree with the bool UnbinnedResid::rejected flag set (previously, such residuals were discarded).
1 parent 507a6f0 commit 9755ce1

8 files changed

Lines changed: 403 additions & 261 deletions

File tree

Detectors/GlobalTrackingWorkflow/tpcinterpolationworkflow/src/TPCInterpolationSpec.cxx

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "SpacePoints/SpacePointsCalibConfParam.h"
3333
#include "Framework/ConfigParamRegistry.h"
3434
#include "Framework/ControlService.h"
35+
#include "Framework/DeviceSpec.h"
3536

3637
using namespace o2::framework;
3738
using namespace o2::globaltracking;
@@ -55,6 +56,9 @@ void TPCInterpolationDPL::init(InitContext& ic)
5556
if (mProcessSeeds && mSources != mSourcesMap) {
5657
LOG(fatal) << "process-seeds option is not compatible with using different track sources for vDrift and map extraction";
5758
}
59+
int lane = ic.services().get<const o2::framework::DeviceSpec>().inputTimesliceId;
60+
int maxLanes = ic.services().get<const o2::framework::DeviceSpec>().maxInputTimeslices;
61+
mInterpolation.setLane(lane, maxLanes);
5862
}
5963

6064
void TPCInterpolationDPL::updateTimeDependentParams(ProcessingContext& pc)
@@ -136,13 +140,6 @@ void TPCInterpolationDPL::run(ProcessingContext& pc)
136140
mInterpolation.process();
137141
mTimer.Stop();
138142
LOGF(info, "TPC interpolation timing: Cpu: %.3e Real: %.3e s", mTimer.CpuTime(), mTimer.RealTime());
139-
if (SpacePointsCalibConfParam::Instance().writeUnfiltered) {
140-
// these are the residuals and tracks before outlier rejection; they are not used in production
141-
pc.outputs().snapshot(Output{"GLO", "TPCINT_RES", 0}, mInterpolation.getClusterResidualsUnfiltered());
142-
if (mSendTrackData) {
143-
pc.outputs().snapshot(Output{"GLO", "TPCINT_TRK", 0}, mInterpolation.getReferenceTracksUnfiltered());
144-
}
145-
}
146143
pc.outputs().snapshot(Output{"GLO", "UNBINNEDRES", 0}, mInterpolation.getClusterResiduals());
147144
pc.outputs().snapshot(Output{"GLO", "DETINFORES", 0}, mInterpolation.getClusterResidualsDetInfo());
148145
pc.outputs().snapshot(Output{"GLO", "TRKREFS", 0}, mInterpolation.getTrackDataCompact());
@@ -157,6 +154,7 @@ void TPCInterpolationDPL::run(ProcessingContext& pc)
157154

158155
void TPCInterpolationDPL::endOfStream(EndOfStreamContext& ec)
159156
{
157+
mInterpolation.finalize();
160158
LOGF(info, "TPC residuals extraction total timing: Cpu: %.3e Real: %.3e s in %d slots",
161159
mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
162160
}
@@ -183,12 +181,6 @@ DataProcessorSpec getTPCInterpolationSpec(GTrackID::mask_t srcCls, GTrackID::mas
183181
dataRequest->inputs,
184182
true);
185183
o2::tpc::VDriftHelper::requestCCDBInputs(dataRequest->inputs);
186-
if (SpacePointsCalibConfParam::Instance().writeUnfiltered) {
187-
outputs.emplace_back("GLO", "TPCINT_TRK", 0, Lifetime::Timeframe);
188-
if (sendTrackData) {
189-
outputs.emplace_back("GLO", "TPCINT_RES", 0, Lifetime::Timeframe);
190-
}
191-
}
192184
outputs.emplace_back("GLO", "UNBINNEDRES", 0, Lifetime::Timeframe);
193185
outputs.emplace_back("GLO", "DETINFORES", 0, Lifetime::Timeframe);
194186
outputs.emplace_back("GLO", "TRKREFS", 0, Lifetime::Timeframe);

Detectors/GlobalTrackingWorkflow/tpcinterpolationworkflow/src/TPCResidualWriterSpec.cxx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ DataProcessorSpec getTPCResidualWriterSpec(bool writeTrackData, bool debugOutput
3535
return MakeRootTreeWriterSpec("tpc-residuals-writer",
3636
"o2residuals_tpc.root",
3737
"residualsTPC",
38-
BranchDefinition<std::vector<TrackData>>{InputSpec{"tracksUnfiltered", "GLO", "TPCINT_TRK", 0}, "tracksUnfiltered", ((writeUnfiltered && writeTrackData) ? 1 : 0)},
39-
BranchDefinition<std::vector<TPCClusterResiduals>>{InputSpec{"residualsUnfiltered", "GLO", "TPCINT_RES", 0}, "residualsUnfiltered", (writeUnfiltered ? 1 : 0)},
4038
BranchDefinition<std::vector<UnbinnedResid>>{InputSpec{"residuals", "GLO", "UNBINNEDRES"}, "residuals"},
4139
BranchDefinition<std::vector<DetInfoResid>>{InputSpec{"detInfo", "GLO", "DETINFORES"}, "detInfo"},
4240
BranchDefinition<std::vector<TrackDataCompact>>{InputSpec{"trackRefs", "GLO", "TRKREFS"}, "trackRefs"},

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ struct SpacePointsCalibConfParam : public o2::conf::ConfigurableParamHelper<Spac
6363

6464
// parameters for outlier rejection
6565
bool skipOutlierFiltering{false}; ///< if set, the outlier filtering will not be applied at all
66-
bool writeUnfiltered{false}; ///< if set, all residuals and track parameters will be aggregated and dumped additionally without outlier rejection
66+
bool writeUnfiltered{false}; ///< if set, tracks failing validation will be kept with filterFlag>0 giving the reason of rejection
67+
bool keepRejectedResiduals{false}; ///< if set, keep rejected residuals setting rejected flag
6768
int nMALong{15}; ///< number of points to be used for moving average (long range)
6869
int nMAShort{3}; ///< number of points to be used for estimation of distance from local line (short range)
6970
float maxRejFrac{.15f}; ///< if the fraction of rejected clusters of a track is higher, the full track is invalidated
@@ -74,6 +75,7 @@ struct SpacePointsCalibConfParam : public o2::conf::ConfigurableParamHelper<Spac
7475
float maxDevHelixZ = .3f; ///< max deviation in Z for clusters wrt helix fit
7576
int minNumberOfAcceptedResiduals = 30; ///< min number of accepted residuals for
7677
float maxStdDevMA = 25.f; ///< max cluster std. deviation (Y^2 + Z^2) wrt moving average to accept
78+
bool writeValidationData = false; ///< write track validation data for debugging
7779

7880
// settings for voxel residuals extraction
7981
bool isBfieldZero = false; ///< for B=0 we set the radial distortions to zero and don't fit dy vs tgSlp

0 commit comments

Comments
 (0)