Skip to content

Commit d808360

Browse files
committed
Add more cut parameters for track selection
- fix ITS-TPC outlier rejection - less verbose log output for map creation
1 parent 58a7688 commit d808360

7 files changed

Lines changed: 44 additions & 27 deletions

File tree

Detectors/GlobalTrackingWorkflow/tpcinterpolationworkflow/src/TPCInterpolationSpec.cxx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,16 @@ void TPCInterpolationDPL::run(ProcessingContext& pc)
124124
// ITS and TPC track is always needed. At this stage ITS afterburner tracks are also rejected
125125
return true;
126126
}
127-
if (gidTable[GTrackID::TRD].isIndexSet() || gidTable[GTrackID::TOF].isIndexSet()) {
127+
if (gidTable[GTrackID::TRD].isIndexSet()) {
128+
// TRD specific cuts
129+
const auto& trdTrk = recoData.getITSTPCTRDTrack<o2::trd::TrackTRD>(gidTable[GTrackID::ITSTPCTRD]);
130+
if (trdTrk.getNtracklets() < param.minTRDNTrklts) {
131+
trackGood = false;
132+
}
133+
hasOuterPoint = true;
134+
}
135+
if (gidTable[GTrackID::TOF].isIndexSet()) {
136+
// TOF specific cuts (if any)
128137
hasOuterPoint = true;
129138
}
130139
const auto itstpcTrk = &recoData.getTPCITSTrack(gidTable[GTrackID::ITSTPC]);
@@ -143,6 +152,9 @@ void TPCInterpolationDPL::run(ProcessingContext& pc)
143152
if (itsTrk->getNumberOfClusters() < param.minITSNClsNoOuterPoint || tpcTrk->getNClusterReferences() < param.minTPCNClsNoOuterPoint) {
144153
trackGood = false;
145154
}
155+
if (itsTrk->getPt() < param.minPtNoOuterPoint) {
156+
trackGood = false;
157+
}
146158
} else {
147159
if (itsTrk->getNumberOfClusters() < param.minITSNCls || tpcTrk->getNClusterReferences() < param.minTPCNCls) {
148160
trackGood = false;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@ struct SpacePointsCalibConfParam : public o2::conf::ConfigurableParamHelper<Spac
3636
int minTRDNTrklts = 3; ///< min number of TRD space points
3737
float maxITSChi2 = 20.f; ///< cut on ITS reduced chi2
3838
float maxTRDChi2 = 10.f; ///< cut on TRD reduced chi2
39+
float minPtNoOuterPoint = 0.8f; ///< minimum pt for ITS-TPC tracks to be considered for extrapolation
3940

4041
// other settings for track interpolation
4142
float sigYZ2TOF{.75f}; ///< for now assume cluster error for TOF equal for all clusters in both Y and Z
4243
float maxSnp{.85f}; ///< max snp when propagating tracks
4344
float maxStep{2.f}; ///< maximum step for propagation
45+
bool debugTRDTOF{false}; ///< if true, ITS-TPC-TRD-TOF tracks and their seeding ITS-TPC-TRD track will both be interpolated and their residuals stored
4446

4547
// steering of map creation after the residuals have already been written to file
4648
bool writeBinnedResiduals{false}; ///< when creating the map from unbinned residuals store the binned residuals together with the voxel results

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,6 @@ struct TrackDataCompact {
101101
struct TrackData {
102102
o2::dataformats::GlobalTrackID gid{}; ///< global track ID for seeding track
103103
o2::track::TrackPar par{}; ///< ITS track at inner TPC radius
104-
// FIXME remove x, alpha and p once we have a new production where all that information is stored in par
105-
float x{}; ///< track X position
106-
float alpha{}; ///< track alpha angle
107-
std::array<float, o2::track::kNParams> p{}; ///< track parameters
108104
float chi2TPC{}; ///< chi2 of TPC track
109105
float chi2ITS{}; ///< chi2 of ITS track
110106
float chi2TRD{}; ///< chi2 of TRD track
@@ -113,7 +109,7 @@ struct TrackData {
113109
unsigned short nTrkltsTRD{}; ///< number of attached TRD tracklets
114110
unsigned short clAvailTOF{}; ///< whether or not track seed has a matched TOF cluster
115111
o2::dataformats::RangeReference<> clIdx{}; ///< index of first cluster residual and total number of cluster residuals of this track
116-
ClassDefNV(TrackData, 4);
112+
ClassDefNV(TrackData, 5);
117113
};
118114

119115
/// \class TrackInterpolation

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ class TrackResiduals
141141
/// \param scZ Scale factor to increase smoothing bandwidth at sector edges in Z
142142
void setKernelType(KernelType kernel = KernelType::Epanechnikov, float bwX = 2.1f, float bwP = 2.1f, float bwZ = 1.7f, float scX = 1.f, float scP = 1.f, float scZ = 1.f);
143143

144+
/// Setting the flag to true for a given dimension will enable smoothing with a 2nd order polynomial.
145+
/// Otherwise a first order polynomial will be used (default along z/x, since the bins are large)
146+
void setSmoothPol2(int dim, bool flag) { mSmoothPol2[dim] = flag; }
147+
144148
// -------------------------------------- I/O --------------------------------------------------
145149

146150
std::vector<LocalResid>& getLocalResVec() { return mLocalResidualsIn; }

Detectors/TPC/calibration/SpacePoints/macro/staticMapCreator.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ bool revalidateTrack(const TrackData& trk, const SpacePointsCalibConfParam& para
105105

106106
if (params.cutOnDCA) {
107107
auto propagator = o2::base::Propagator::Instance();
108-
o2::track::TrackPar trkPar(trk.x, trk.alpha, trk.p);
109-
// o2::track::TrackPar trkPar = trk.par; // for the next version of o2::tpc::TrackData where its stored as TrackPar directly
108+
// o2::track::TrackPar trkPar(trk.x, trk.alpha, trk.p); // use this line, in case ClassDef version of TrackData < 4
109+
o2::track::TrackPar trkPar = trk.par;
110110
if (!propagator->propagateToX(trkPar, 0, propagator->getNominalBz())) {
111111
return false;
112112
}

Detectors/TPC/calibration/SpacePoints/src/TrackInterpolation.cxx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,8 @@ void TrackInterpolation::process(const o2::globaltracking::RecoContainer& inp, c
8484

8585
// to obtain ITS-TPC-TRD-TOF track from ITS-TPC-TRD track we fill the trkMap
8686
std::unordered_map<GTrackID, int> trkMap;
87-
for (int iTrk = 0; iTrk < nSeeds; ++iTrk) {
87+
for (int iTrk = 0; iTrk < trkCounters.at(GTrackID::Source::ITSTPCTRDTOF); ++iTrk) {
8888
const auto& gidTable = (*mGIDtables)[iTrk];
89-
if (!(gidTable[GTrackID::TRD].isIndexSet() && gidTable[GTrackID::TOF].isIndexSet())) {
90-
// no more ITS-TPC-TRD-TOF tracks
91-
break;
92-
}
9389
trkMap.emplace(std::make_pair(gidTable[GTrackID::ITSTPCTRD], iTrk));
9490
}
9591

@@ -119,7 +115,14 @@ void TrackInterpolation::process(const o2::globaltracking::RecoContainer& inp, c
119115
break;
120116
}
121117
if (auto search = trkMap.find((*mGIDs)[iSeed]); search != trkMap.end()) {
122-
globalTracksToCheck.push_back(search->second);
118+
// for this ITS-TPC-TRD track we also have a match in TOF
119+
if (mParams->debugTRDTOF) {
120+
// process the ITS-TPC-TRD-TOF track later, in addition to the ITS-TPC-TRD track
121+
globalTracksToCheck.push_back(search->second);
122+
} else {
123+
interpolateTrack(search->second);
124+
continue;
125+
}
123126
}
124127
if (gids[trackIndices[iSeed]].includesDet(DetID::TRD) || gids[trackIndices[iSeed]].includesDet(DetID::TOF)) {
125128
interpolateTrack(trackIndices[iSeed]);
@@ -130,8 +133,7 @@ void TrackInterpolation::process(const o2::globaltracking::RecoContainer& inp, c
130133
// irrespective of the number of tracks already processed, interpolate the ITS-TPC-TRD-TOF tracks
131134
// which belong to the ITS-TPC-TRD tracks that were already processed, to allow their analysis
132135
// offline
133-
// Q: Or should we for these tracks just skip the ITS-TPC-TRD part and do only ITS-TPC-TRD-TOF?
134-
// might still be interesting to compare the two?
136+
// the globalTracksToCheck vector is only filled in case mParams->debugTRDTOF == true
135137
LOGP(info, "Processing {} ITS-TPC-TRD-TOF tracks for which the ITS-TPC-TRD track was already done", globalTracksToCheck.size());
136138
for (auto iTrk : globalTracksToCheck) {
137139
interpolateTrack(iTrk);
@@ -375,7 +377,7 @@ void TrackInterpolation::extrapolateTrack(int iSeed)
375377
}
376378
TPCClusterResiduals res;
377379
res.setDY(y - trkWork.getY());
378-
res.setDY(z - trkWork.getZ());
380+
res.setDZ(z - trkWork.getZ());
379381
res.setY(trkWork.getY());
380382
res.setZ(trkWork.getZ());
381383
res.setSnp(trkWork.getSnp());
@@ -594,7 +596,7 @@ bool TrackInterpolation::outlierFiltering(const TrackData& trk, TrackParams& par
594596
}
595597
float rmsLong = checkResiduals(trk, params, clsRes);
596598
if (static_cast<float>(params.flagRej.count()) / clsRes.size() > mParams->maxRejFrac) {
597-
LOG(debug) << "Skipping track with too many clusters rejected: " << static_cast<float>(params.flagRej.count()) / clsRes.size();
599+
LOGP(debug, "Skipping track with too many clusters rejected: {} out of {}", params.flagRej.count(), clsRes.size());
598600
return false;
599601
}
600602
if (rmsLong > mParams->maxRMSLong) {
@@ -647,6 +649,7 @@ float TrackInterpolation::checkResiduals(const TrackData& trk, TrackParams& para
647649
}
648650
if (nAccY < mParams->minNumberOfAcceptedResiduals || nAccZ < mParams->minNumberOfAcceptedResiduals) {
649651
// mask all clusters
652+
LOGP(debug, "Accepted {} clusters for dY {} clusters for dZ, but required at least {} for both", nAccY, nAccZ, mParams->minNumberOfAcceptedResiduals);
650653
params.flagRej.set();
651654
return 0.f;
652655
}

Detectors/TPC/calibration/SpacePoints/src/TrackResiduals.cxx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -447,9 +447,8 @@ void TrackResiduals::processSectorResiduals(int iSec)
447447
void TrackResiduals::processVoxelResiduals(std::vector<float>& dy, std::vector<float>& dz, std::vector<float>& tg, VoxRes& resVox)
448448
{
449449
int nPoints = dy.size();
450-
// LOG(debug) << "processing voxel residuals for vox " << getGlbVoxBin(resVox.bvox) << " with " << nPoints << " points";
451450
if (nPoints < mParams->minEntriesPerVoxel) {
452-
LOG(info) << "voxel " << getGlbVoxBin(resVox.bvox) << " is skipped due to too few entries (" << nPoints << " < " << mParams->minEntriesPerVoxel << ")";
451+
LOG(debug) << "voxel " << getGlbVoxBin(resVox.bvox) << " is skipped due to too few entries (" << nPoints << " < " << mParams->minEntriesPerVoxel << ")";
453452
return;
454453
} else {
455454
LOGF(debug, "Processing voxel %i with %i entries", getGlbVoxBin(resVox.bvox), nPoints);
@@ -509,8 +508,8 @@ int TrackResiduals::validateVoxels(int iSec)
509508
{
510509
// apply voxel validation cuts
511510
// return number of good voxels for given sector
512-
int cntMasked = 0; // number of voxels masked due to fit error and / or distribution sigmas
513-
int cntInvalid = 0; // number of voxels which were invalid before + masked ones
511+
int cntMasked = 0; // number of voxels masked for any reason (either low statistics or bad fit)
512+
int cntLowStat = 0; // number of voxels which were not processed due to too low statistics
514513
mXBinsIgnore[iSec].reset();
515514
std::vector<VoxRes>& secData = mVoxelResults[iSec];
516515

@@ -524,6 +523,9 @@ int TrackResiduals::validateVoxels(int iSec)
524523
for (int iz = 0; iz < mNZ2XBins; ++iz) {
525524
int binGlb = getGlbVoxBin(ix, ip, iz);
526525
VoxRes& resVox = secData[binGlb];
526+
if ((resVox.flags & DistDone) == 0) {
527+
++cntLowStat;
528+
}
527529
bool voxelOK = (resVox.flags & DistDone) && !(resVox.flags & Masked);
528530
if (voxelOK) {
529531
// check fit errors
@@ -539,14 +541,11 @@ int TrackResiduals::validateVoxels(int iSec)
539541
voxelOK = false;
540542
++cntMaskedSigma;
541543
}
542-
if (!voxelOK) {
543-
++cntMasked;
544-
}
545544
}
546545
if (voxelOK) {
547546
++cntValid;
548547
} else {
549-
++cntInvalid;
548+
++cntMasked;
550549
resVox.flags |= Masked;
551550
}
552551
} // loop over Z
@@ -627,7 +626,8 @@ int TrackResiduals::validateVoxels(int iSec)
627626
}
628627
//
629628
int nMaskedRows = mXBinsIgnore[iSec].count();
630-
LOG(info) << "sector " << iSec << ": voxel stat: masked: " << cntMasked << " invalid: " << cntInvalid - cntMasked;
629+
LOGP(info, "Sector {}: out of {} voxels {} are masked. {} (low stat), {} (invalid fit) and {} (raw distrib sigma)",
630+
iSec, mNVoxPerSector, cntMasked, cntLowStat, cntMaskedFit, cntMaskedSigma);
631631
//
632632
return mNXBins - nMaskedRows;
633633
}

0 commit comments

Comments
 (0)