Skip to content

Commit 0b5d4db

Browse files
committed
Update track selection for track interpolation
1 parent 961e594 commit 0b5d4db

6 files changed

Lines changed: 51 additions & 16 deletions

File tree

Detectors/GlobalTrackingWorkflow/tpcinterpolationworkflow/src/TPCInterpolationSpec.cxx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,13 @@ void TPCInterpolationDPL::run(ProcessingContext& pc)
155155
gids.push_back(_origID);
156156
trkCounters[_origID.getSource()] += 1;
157157
}
158-
return true;
158+
if (gidTable[GTrackID::TRD].isIndexSet() && gidTable[GTrackID::TOF].isIndexSet()) {
159+
// for ITS-TPC-TRD-TOF tracks we are interested also in the ITS-TPC-TRD part
160+
// we want to have both available, so return false for the full barrell tracks
161+
return false;
162+
} else {
163+
return true;
164+
}
159165
} else {
160166
return false;
161167
}

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,21 @@ struct SpacePointsCalibConfParam : public o2::conf::ConfigurableParamHelper<Spac
3535
int minITSNClsNoOuterPoint = 6; ///< min number of ITS clusters if no hit in TRD or TOF exists
3636
int minTRDNTrklts = 3; ///< min number of TRD space points
3737
float maxITSChi2 = 20.f; ///< cut on ITS reduced chi2
38+
float maxTRDChi2 = 10.f; ///< cut on TRD reduced chi2
3839

3940
// other settings for track interpolation
4041
float sigYZ2TOF{.75f}; ///< for now assume cluster error for TOF equal for all clusters in both Y and Z
4142
float maxSnp{.85f}; ///< max snp when propagating tracks
4243
float maxStep{2.f}; ///< maximum step for propagation
4344

4445
// steering of map creation after the residuals have already been written to file
46+
bool writeBinnedResiduals{false}; ///< when creating the map from unbinned residuals store the binned residuals together with the voxel results
4547
bool useTrackData{false}; ///< if we have the track data available, we can redefine the above cuts for the map creation, e.g. minTPCNCls etc
48+
bool timeFilter{false}; ///< consider only residuals as input from TFs with a specific time range specified via startTimeMS and endTimeMS
49+
long startTimeMS{0L}; ///< the start of the time range in MS
50+
long endTimeMS{1999999999999L}; ///< the end of the time range in MS
51+
bool cutOnDCA{true}; ///< when creating the map from unbinned residuals cut on DCA estimated from ITS outer parameter
52+
float maxDCA = 10.f; ///< DCA cut value in cm
4653

4754
// parameters for outlier rejection
4855
bool writeUnfiltered{false}; ///< if set, all residuals and track parameters will be aggregated and dumped additionally without outlier rejection

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ struct TrackDataCompact {
100100
/// Structure filled for each track with track quality information and a vector with TPCClusterResiduals
101101
struct TrackData {
102102
o2::dataformats::GlobalTrackID gid{}; ///< global track ID for seeding track
103-
// the track parameters are taken from the ITS track
103+
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
104105
float x{}; ///< track X position
105106
float alpha{}; ///< track alpha angle
106107
std::array<float, o2::track::kNParams> p{}; ///< track parameters
@@ -112,7 +113,7 @@ struct TrackData {
112113
unsigned short nTrkltsTRD{}; ///< number of attached TRD tracklets
113114
unsigned short clAvailTOF{}; ///< whether or not track seed has a matched TOF cluster
114115
o2::dataformats::RangeReference<> clIdx{}; ///< index of first cluster residual and total number of cluster residuals of this track
115-
ClassDefNV(TrackData, 3);
116+
ClassDefNV(TrackData, 4);
116117
};
117118

118119
/// \class TrackInterpolation

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,9 @@ class TrackResiduals
420420
/// Closes the file with the debug output.
421421
void closeOutputFile();
422422

423+
/// Allow to access the output file from outside
424+
TFile* getOutputFilePtr() { return mFileOut.get(); }
425+
423426
/// Set the voxel statistics directly from outside
424427
void setStats(const std::vector<TrackResiduals::VoxStats>& statsIn, int iSec);
425428

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

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,17 @@ void TrackInterpolation::process(const o2::globaltracking::RecoContainer& inp, c
8282
mTrackData.reserve(nSeeds);
8383
mClRes.reserve(nSeeds * param::NPadRows);
8484

85+
// to obtain ITS-TPC-TRD-TOF track from ITS-TPC-TRD track we fill the trkMap
86+
std::unordered_map<GTrackID, int> trkMap;
87+
for (int iTrk = 0; iTrk < nSeeds; ++iTrk) {
88+
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+
}
93+
trkMap.emplace(std::make_pair(gidTable[GTrackID::ITSTPCTRD], iTrk));
94+
}
95+
8596
// In case we have more input tracks available than are required per TF
8697
// we want to sample them. But we still prefer global ITS-TPC-TRD-TOF tracks
8798
// over ITS-TPC-TRD tracks and so on. So we have to shuffle the indices
@@ -92,6 +103,7 @@ void TrackInterpolation::process(const o2::globaltracking::RecoContainer& inp, c
92103
std::mt19937 g(rd());
93104
std::vector<int> trackIndices(nSeeds);
94105
std::iota(trackIndices.begin(), trackIndices.end(), 0);
106+
95107
std::shuffle(trackIndices.begin(), trackIndices.begin() + trkCounters.at(GTrackID::Source::ITSTPCTRDTOF), g);
96108
int nTracks = trkCounters.at(GTrackID::Source::ITSTPCTRDTOF);
97109
std::shuffle(trackIndices.begin() + nTracks, trackIndices.begin() + nTracks + trkCounters.at(GTrackID::Source::ITSTPCTRD), g);
@@ -100,17 +112,30 @@ void TrackInterpolation::process(const o2::globaltracking::RecoContainer& inp, c
100112
nTracks += trkCounters.at(GTrackID::Source::ITSTPCTOF);
101113
std::shuffle(trackIndices.begin() + nTracks, trackIndices.begin() + nTracks + trkCounters.at(GTrackID::Source::ITSTPC), g);
102114

103-
for (int iSeed = 0; iSeed < nSeeds; ++iSeed) {
115+
std::vector<int> globalTracksToCheck;
116+
for (int iSeed = trkCounters.at(GTrackID::Source::ITSTPCTRDTOF); iSeed < nSeeds; ++iSeed) {
104117
if (mMaxTracksPerTF >= 0 && mTrackDataCompact.size() >= mMaxTracksPerTF) {
105118
LOG(info) << "Maximum number of tracks per TF reached. Skipping the remaining " << nSeeds - iSeed << " tracks.";
106119
break;
107120
}
121+
if (auto search = trkMap.find((*mGIDs)[iSeed]); search != trkMap.end()) {
122+
globalTracksToCheck.push_back(search->second);
123+
}
108124
if (gids[trackIndices[iSeed]].includesDet(DetID::TRD) || gids[trackIndices[iSeed]].includesDet(DetID::TOF)) {
109125
interpolateTrack(trackIndices[iSeed]);
110126
} else {
111127
extrapolateTrack(trackIndices[iSeed]);
112128
}
113129
}
130+
// irrespective of the number of tracks already processed, interpolate the ITS-TPC-TRD-TOF tracks
131+
// which belong to the ITS-TPC-TRD tracks that were already processed, to allow their analysis
132+
// 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?
135+
LOGP(info, "Processing {} ITS-TPC-TRD-TOF tracks for which the ITS-TPC-TRD track was already done", globalTracksToCheck.size());
136+
for (auto iTrk : globalTracksToCheck) {
137+
interpolateTrack(iTrk);
138+
}
114139

115140
LOG(info) << "Could process " << mTrackData.size() << " tracks successfully";
116141
}
@@ -284,11 +309,7 @@ void TrackInterpolation::interpolateTrack(int iSeed)
284309
}
285310

286311
trackData.gid = (*mGIDs)[iSeed];
287-
trackData.x = (*mSeeds)[iSeed].getX();
288-
trackData.alpha = (*mSeeds)[iSeed].getAlpha();
289-
for (int i = 0; i < o2::track::kNParams; ++i) {
290-
trackData.p[i] = (*mSeeds)[iSeed].getParam(i);
291-
}
312+
trackData.par = (*mSeeds)[iSeed];
292313
trackData.chi2TRD = gidTable[GTrackID::TRD].isIndexSet() ? mRecoCont->getITSTPCTRDTrack<o2::trd::TrackTRD>(gidTable[GTrackID::ITSTPCTRD]).getChi2() : 0;
293314
trackData.chi2TPC = trkTPC.getChi2();
294315
trackData.chi2ITS = trkITS.getChi2();
@@ -365,11 +386,7 @@ void TrackInterpolation::extrapolateTrack(int iSeed)
365386
++nMeasurements;
366387
}
367388
trackData.gid = (*mGIDs)[iSeed];
368-
trackData.x = (*mSeeds)[iSeed].getX();
369-
trackData.alpha = (*mSeeds)[iSeed].getAlpha();
370-
for (int i = 0; i < o2::track::kNParams; ++i) {
371-
trackData.p[i] = (*mSeeds)[iSeed].getParam(i);
372-
}
389+
trackData.par = (*mSeeds)[iSeed];
373390
trackData.chi2TPC = trkTPC.getChi2();
374391
trackData.chi2ITS = trkITS.getChi2();
375392
trackData.nClsTPC = trkTPC.getNClusterReferences();
@@ -437,7 +454,7 @@ bool TrackInterpolation::compareToHelix(const TrackData& trk, TrackParams& param
437454
std::array<float, param::NPadRows> yLab;
438455
std::array<float, param::NPadRows> sPath;
439456

440-
float curvature = fabsf(trk.p[o2::track::ParLabels::kQ2Pt] * mBz * o2::constants::physics::LightSpeedCm2S * 1e-14f);
457+
float curvature = fabsf(trk.par.getQ2Pt() * mBz * o2::constants::physics::LightSpeedCm2S * 1e-14f);
441458
int secFirst = clsRes[0].sec;
442459
float phiSect = (secFirst + .5f) * o2::constants::math::SectorSpanRad;
443460
float snPhi = sin(phiSect);

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ void TrackResiduals::fillStats(int iSec)
334334
//______________________________________________________________________________
335335
void TrackResiduals::processSectorResiduals(int iSec)
336336
{
337+
LOGP(info, "Processing {} voxel residuals for sector {}", mLocalResidualsIn.size(), iSec);
337338
initResultsContainer(iSec);
338339
std::vector<unsigned short> binData;
339340
for (const auto& res : mLocalResidualsIn) {
@@ -451,7 +452,7 @@ void TrackResiduals::processVoxelResiduals(std::vector<float>& dy, std::vector<f
451452
LOG(info) << "voxel " << getGlbVoxBin(resVox.bvox) << " is skipped due to too few entries (" << nPoints << " < " << mParams->minEntriesPerVoxel << ")";
452453
return;
453454
} else {
454-
LOGF(info, "Processing voxel %i with %i entries", getGlbVoxBin(resVox.bvox), nPoints);
455+
LOGF(debug, "Processing voxel %i with %i entries", getGlbVoxBin(resVox.bvox), nPoints);
455456
}
456457
std::array<float, 7> zResults;
457458
resVox.flags = 0;

0 commit comments

Comments
 (0)