Skip to content

Commit fc2b9e4

Browse files
committed
Optionally skip PV validation by interacting BC
1 parent 49824b6 commit fc2b9e4

File tree

4 files changed

+52
-24
lines changed

4 files changed

+52
-24
lines changed

Detectors/GlobalTrackingWorkflow/src/PrimaryVertexingSpec.cxx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,12 @@ void PrimaryVertexingSpec::run(ProcessingContext& pc)
161161
}
162162

163163
mTimer.Stop();
164-
LOGP(info, "Found {} PVs, Time CPU/Real:{:.3f}/{:.3f} (DBScan: {:.4f}, Finder:{:.4f}, MADSel:{:.4f}, Rej.Debris:{:.4f}, Reattach:{:.4f}) | {} trials for {} TZ-clusters, max.trials: {}, Slowest TZ-cluster: {} ms of mult {}",
164+
LOGP(info, "Found {} PVs, Time CPU/Real:{:.3f}/{:.3f} (DBScan: {:.4f}, Finder:{:.4f}, MADSel:{:.4f}, Rej.Debris:{:.4f}, Reattach:{:.4f}) | {} trials for {} TZ-clusters, max.trials: {}, Slowest TZ-cluster: {} ms of mult {} | NInitial:{}, Rejections: NoFilledBC:{}, NoIntCand:{}, Debris:{}, Quality:{}, ITSOnly:{}",
165165
vertices.size(), mTimer.CpuTime() - timeCPU0, mTimer.RealTime() - timeReal0,
166-
mVertexer.getTimeDBScan().CpuTime(), mVertexer.getTimeVertexing().CpuTime(), mVertexer.getTimeMADSel().CpuTime(), mVertexer.getTimeDebris().CpuTime(), mVertexer.getTimeReAttach().CpuTime(),
167-
mVertexer.getTotTrials(), mVertexer.getNTZClusters(), mVertexer.getMaxTrialsPerCluster(),
168-
mVertexer.getLongestClusterTimeMS(), mVertexer.getLongestClusterMult());
166+
mVertexer.getTimeDBScan().CpuTime(), mVertexer.getTimeVertexing().CpuTime(), mVertexer.getTimeMADSel().CpuTime(), mVertexer.getTimeDebris().CpuTime(),
167+
mVertexer.getTimeReAttach().CpuTime(), mVertexer.getTotTrials(), mVertexer.getNTZClusters(), mVertexer.getMaxTrialsPerCluster(),
168+
mVertexer.getLongestClusterTimeMS(), mVertexer.getLongestClusterMult(), mVertexer.getNIniFound(),
169+
mVertexer.getNKilledBCValid(), mVertexer.getNKilledIntCand(), mVertexer.getNKilledDebris(), mVertexer.getNKilledQuality(), mVertexer.getNKilledITSOnly());
169170
}
170171

171172
void PrimaryVertexingSpec::endOfStream(EndOfStreamContext& ec)

Detectors/Vertexing/include/DetectorsVertexing/PVertexer.h

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,12 @@ class PVertexer
119119
auto getMaxTrialsPerCluster() const { return mMaxTrialPerCluster; }
120120
auto getLongestClusterMult() const { return mLongestClusterMult; }
121121
auto getLongestClusterTimeMS() const { return mLongestClusterTimeMS; }
122+
auto getNKilledBCValid() const { return mNKilledBCValid; }
123+
auto getNKilledIntCand() const { return mNKilledIntCand; }
124+
auto getNKilledDebris() const { return mNKilledDebris; }
125+
auto getNKilledQuality() const { return mNKilledQuality; }
126+
auto getNKilledITSOnly() const { return mNKilledITSOnly; }
127+
auto getNIniFound() const { return mNIniFound; }
122128

123129
TStopwatch& getTimeDBScan() { return mTimeDBScan; }
124130
TStopwatch& getTimeVertexing() { return mTimeVertexing; }
@@ -184,9 +190,7 @@ class PVertexer
184190
float mDBScanDeltaT = 0.; ///< deltaT cut for DBScan check
185191
float mDBSMaxZ2InvCorePoint = 0; ///< inverse of max sigZ^2 of the track which can be core point in the DBScan
186192
bool mValidateWithIR = false; ///< require vertex validation with InteractionCandidates (if available)
187-
188-
o2::InteractionRecord mStartIR{0, 0}; ///< IR corresponding to the start of the TF
189-
193+
o2::InteractionRecord mStartIR{0, 0}; ///< IR corresponding to the start of the TF
190194
// structure for the vertex refit
191195
o2d::VertexBase mVtxRefitOrig{}; ///< original vertex whose tracks are refitted
192196
std::vector<int> mRefitTrackIDs{}; ///< dummy IDs for refitted tracks
@@ -201,6 +205,12 @@ class PVertexer
201205
static constexpr float kHugeF = 1.e12; ///< very large float
202206
static constexpr float kAlmost0F = 1e-12; ///< tiny float
203207
static constexpr double kAlmost0D = 1e-16; ///< tiny double
208+
int mNIniFound = 0;
209+
int mNKilledBCValid = 0;
210+
int mNKilledIntCand = 0;
211+
int mNKilledDebris = 0;
212+
int mNKilledQuality = 0;
213+
int mNKilledITSOnly = 0;
204214
size_t mNTZClustersIni = 0;
205215
size_t mTotTrials = 0;
206216
size_t mMaxTrialPerCluster = 0;

Detectors/Vertexing/include/DetectorsVertexing/PVertexerParams.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ struct PVertexerParams : public o2::conf::ConfigurableParamHelper<PVertexerParam
102102
float nSigmaTimeCut = 4.; ///< eliminate vertex if there is no FT0 or BC signal within this cut
103103
float timeBiasMS = 0; ///< relative bias in ms to add to TPCITS-based time stamp
104104
//
105+
bool doBCValidation = true; ///< apply validation by interacting BC compatible with the vertex time span
106+
//
105107
// stopping condition params
106108
float maxChi2Mean = 10.; ///< max mean chi2 of vertex to accept
107109
int minTracksPerVtx = 2; ///< min N tracks per vertex

Detectors/Vertexing/src/PVertexer.cxx

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ int PVertexer::runVertexing(const gsl::span<o2d::GlobalTrackID> gids, const gsl:
4949
mMaxTrialPerCluster = 0;
5050
mLongestClusterTimeMS = 0;
5151
mLongestClusterMult = 0;
52+
mNIniFound = 0;
53+
mNKilledBCValid = 0;
54+
mNKilledIntCand = 0;
55+
mNKilledDebris = 0;
56+
mNKilledQuality = 0;
57+
mNKilledITSOnly = 0;
5258
mPoolDumpProduced = false;
5359

5460
std::vector<PVertex> verticesLoc;
@@ -82,6 +88,7 @@ int PVertexer::runVertexing(const gsl::span<o2d::GlobalTrackID> gids, const gsl:
8288
createMCLabels(lblTracks, trackIDs, v2tRefsLoc, lblVtxLoc);
8389
}
8490
#endif
91+
mNIniFound = verticesLoc.size();
8592

8693
if (mValidateWithIR && mPVParams->minNContributorsForIRcutIni >= 0) {
8794
applInteractionValidation(verticesLoc, vtTimeSortID, intCand, mPVParams->minNContributorsForIRcutIni);
@@ -126,6 +133,7 @@ int PVertexer::runVertexing(const gsl::span<o2d::GlobalTrackID> gids, const gsl:
126133
auto& vtx = verticesLoc[i];
127134
if (!setCompatibleIR(vtx)) {
128135
i = -1;
136+
mNKilledBCValid++;
129137
}
130138
}
131139
// do we need to validate by Int. records ?
@@ -576,6 +584,7 @@ void PVertexer::applyMADSelection(std::vector<PVertex>& vertices, std::vector<in
576584
dvec.clear();
577585
if (tmad > mPVParams->maxTMAD || tmad < mPVParams->minTMAD) {
578586
timeSort[ivt] = -1; // disable vertex
587+
mNKilledQuality++;
579588
LOGP(debug, "Killing vertex {} with TMAD {}, {} of {} killed", iv, tmad, ++nkill, nv);
580589
continue;
581590
}
@@ -590,6 +599,7 @@ void PVertexer::applyMADSelection(std::vector<PVertex>& vertices, std::vector<in
590599
float zmad = o2::math_utils::MAD2Sigma(dvec.size(), dvec.data());
591600
if (zmad > mPVParams->maxZMAD || zmad < mPVParams->minZMAD) {
592601
timeSort[ivt] = -1; // disable vertex
602+
mNKilledQuality++;
593603
LOGP(debug, "Killing vertex {} with ZMAD {}, {} of {} killed", iv, zmad, ++nkill, nv);
594604
continue;
595605
}
@@ -621,6 +631,7 @@ void PVertexer::applITSOnlyFractionCut(std::vector<PVertex>& vertices, std::vect
621631
float frac = nITS / float(trefs.getEntries());
622632
if (frac > mPVParams->maxITSOnlyFraction || frac < mPVParams->minITSOnlyFraction) {
623633
timeSort[ivt] = -1; // disable vertex
634+
mNKilledITSOnly++;
624635
}
625636
}
626637
}
@@ -669,6 +680,7 @@ void PVertexer::applInteractionValidation(std::vector<PVertex>& vertices, std::v
669680
}
670681
} else if (pv.getNContributors() >= minContrib) {
671682
timeSort[ivt] = -1; // discard
683+
mNKilledIntCand++;
672684
}
673685
}
674686
}
@@ -724,6 +736,7 @@ void PVertexer::reduceDebris(std::vector<PVertex>& vertices, std::vector<int>& t
724736
}
725737
if (rej) {
726738
timeSort[j] = -1;
739+
mNKilledDebris++;
727740
vtJ.setNContributors(0);
728741
}
729742
return false;
@@ -964,7 +977,7 @@ void PVertexer::setBunchFilling(const o2::BunchFilling& bf)
964977
bool PVertexer::setCompatibleIR(PVertex& vtx)
965978
{
966979
// assign compatible IRs accounting for the bunch filling scheme
967-
if (mClosestBunchAbove[0] < 0) { // empty or no BF was provided
980+
if (mClosestBunchAbove[0] < 0 && mPVParams->doBCValidation) { // empty or no BF was provided
968981
return false;
969982
}
970983
const auto& vtxT = vtx.getTimeStamp();
@@ -979,22 +992,24 @@ bool PVertexer::setCompatibleIR(PVertex& vtx)
979992
}
980993
irMax += o2::InteractionRecord(1.e3 * (t + rangeT)); // RS TODO: make sure that irMax does not exceed TF edge
981994
irMax++; // to account for rounding
982-
// restrict using bunch filling
983-
int bc = mClosestBunchAbove[irMin.bc];
984-
LOG(debug) << "irMin.bc = " << irMin.bc << " bcAbove = " << bc;
985-
if (bc < irMin.bc) {
986-
irMin.orbit++;
987-
}
988-
irMin.bc = bc;
989-
bc = mClosestBunchBelow[irMax.bc];
990-
LOG(debug) << "irMax.bc = " << irMax.bc << " bcBelow = " << bc;
991-
if (bc > irMax.bc) {
992-
if (irMax.orbit == 0) {
993-
return false;
994-
}
995-
irMax.orbit--;
996-
}
997-
irMax.bc = bc;
995+
if (mPVParams->doBCValidation) {
996+
// restrict using bunch filling
997+
int bc = mClosestBunchAbove[irMin.bc];
998+
LOG(debug) << "irMin.bc = " << irMin.bc << " bcAbove = " << bc;
999+
if (bc < irMin.bc) {
1000+
irMin.orbit++;
1001+
}
1002+
irMin.bc = bc;
1003+
bc = mClosestBunchBelow[irMax.bc];
1004+
LOG(debug) << "irMax.bc = " << irMax.bc << " bcBelow = " << bc;
1005+
if (bc > irMax.bc) {
1006+
if (irMax.orbit == 0) {
1007+
return false;
1008+
}
1009+
irMax.orbit--;
1010+
}
1011+
irMax.bc = bc;
1012+
}
9981013
vtx.setIRMin(irMin);
9991014
vtx.setIRMax(irMax);
10001015
if (irMin > irMax) {

0 commit comments

Comments
 (0)