Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Quality for PixelTracks. Improve Patatrack duplicate & ambiguity resolution #33889

Merged
merged 65 commits into from
Jun 18, 2021
Merged
Show file tree
Hide file tree
Changes from 58 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
624b3f6
define first level quality
VinInn Apr 17, 2021
d2cdb1f
implement a 0 order quality for patatracks
VinInn Apr 17, 2021
928a938
code format
VinInn Apr 17, 2021
3f74004
fix references to loose
VinInn Apr 17, 2021
eefdc4c
fix quality critera in duplicate killer
VinInn Apr 17, 2021
45035ed
add passthrough for quads
VinInn Apr 18, 2021
1e5e7b9
fix DQM
VinInn Apr 18, 2021
160a1ff
first step toward quality in MTV and DQM
VinInn Apr 19, 2021
9cd0761
fix MTV config
VinInn Apr 20, 2021
ca89c9b
fix validation and DQM
VinInn Apr 20, 2021
3b9760d
remove obsolete file
VinInn Apr 20, 2021
c32a065
more fix
VinInn Apr 20, 2021
143c4e5
start working (running(
VinInn Apr 20, 2021
3a71b2d
new classification
VinInn Apr 21, 2021
d0fc835
fix mtv classification
VinInn Apr 21, 2021
1c7a7c7
remove masking from Tformula
VinInn Apr 21, 2021
0e13c3e
make quality inclusive, fix PV plots
VinInn Apr 22, 2021
073ef2d
add full combi
VinInn Apr 24, 2021
a63bfcd
make compatibility eta dependent
VinInn Apr 24, 2021
194995d
back to 05
VinInn Apr 25, 2021
f0cdb9f
Merged PxTkQuality from repository VinInn with cms-merge-topic
VinInn Apr 25, 2021
918f6f4
factorize reject flag
VinInn Apr 25, 2021
d9926bd
make dup pass through configurable
VinInn Apr 25, 2021
de3fe29
speed up conversion
VinInn Apr 25, 2021
8ea1882
add reserve
VinInn Apr 25, 2021
f5cc6fc
add kernel to mark triplets sharing n-hit with quads
VinInn Apr 25, 2021
e3ab482
invoke new sharedHit cleaners
VinInn Apr 25, 2021
1f6962f
remove shared killer, add eta cut for duplicates
VinInn Apr 26, 2021
6087acf
code format
VinInn Apr 26, 2021
03ca0af
introduce new early duplicate quality
VinInn Apr 26, 2021
960da82
use local variable
VinInn Apr 26, 2021
e8ea1f1
count loose tracks
VinInn Apr 28, 2021
f19662d
use info on shared hits in amb-resolution
VinInn Apr 28, 2021
52dd9ca
new baseline
VinInn Apr 29, 2021
e295dcb
use error
VinInn Apr 29, 2021
36e2069
new baseline, to be optimized
VinInn Apr 30, 2021
98ec6de
Merged PxTkQuality from repository VinInn with cms-merge-topic
VinInn May 1, 2021
664d11e
fix include in vertex finder
VinInn May 1, 2021
f95ddab
remove dr plots
VinInn May 1, 2021
19e56c6
account for discarded in MTV
VinInn May 2, 2021
710fd59
speed up error comp
VinInn May 3, 2021
e6362aa
code format
VinInn May 3, 2021
b2fac62
Merged PxTkQuality from repository VinInn with cms-merge-topic
VinInn May 4, 2021
3e2ed5d
remove second combinatorial
VinInn May 5, 2021
bb9134a
split triplet cleaning
VinInn May 5, 2021
1dac7d4
new baseline
VinInn May 6, 2021
e1678db
code format
VinInn May 6, 2021
e218ec9
code clean-up
VinInn May 7, 2021
32b5f6c
Merged PxTkQuality from repository VinInn with cms-merge-topic
VinInn May 8, 2021
cc1d0ab
merge to master
VinInn May 13, 2021
4919203
Merged PxTkQuality from repository VinInn with cms-merge-topic
VinInn May 13, 2021
b1390de
remove references to nshared
VinInn May 15, 2021
3ed9c75
use tip as score
VinInn May 16, 2021
6dba445
remove dbg print
VinInn May 17, 2021
2b1c2c5
Merged PxTkQuality from repository VinInn with cms-merge-topic
VinInn May 26, 2021
7eabf51
allow choice of alternate implmentation at run time
VinInn May 26, 2021
a7f2bf5
code format
VinInn May 26, 2021
0c593cb
use preprocessor directive to select TrackDR
VinInn May 29, 2021
cf2ae9c
make python3 happy
VinInn May 29, 2021
0e11b7f
addressing some pedantic comments
VinInn May 29, 2021
288e95f
code format
VinInn May 29, 2021
c0a32d3
Merged PxTkQuality from repository VinInn with cms-merge-topic
VinInn Jun 6, 2021
e9a19bf
obey higher directive
VinInn Jun 6, 2021
5b16eb6
Merged PxTkQuality from repository VinInn with cms-merge-topic
VinInn Jun 6, 2021
02ba022
roll back to verify if HLT tau is affected
VinInn Jun 7, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions CUDADataFormats/Track/interface/TrackSoAHeterogeneousT.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
#ifndef CUDADataFormats_Track_TrackHeterogeneousT_H
#define CUDADataFormats_Track_TrackHeterogeneousT_H

#include <string>
#include <algorithm>

#include "CUDADataFormats/Track/interface/TrajectoryStateSoAT.h"
#include "HeterogeneousCore/CUDAUtilities/interface/HistoContainer.h"

#include "CUDADataFormats/Common/interface/HeterogeneousSoA.h"

namespace pixelTrack {
enum class Quality : uint8_t { bad = 0, dup, loose, strict, tight, highPurity };
}
constexpr uint32_t qualitySize{7};
enum class Quality : uint8_t { bad = 0, edup, dup, loose, strict, tight, highPurity, notQuality = qualitySize };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could be made directly

Suggested change
constexpr uint32_t qualitySize{7};
enum class Quality : uint8_t { bad = 0, edup, dup, loose, strict, tight, highPurity, notQuality = qualitySize };
enum class Quality : uint8_t { bad = 0, edup, dup, loose, strict, tight, highPurity, qualitySize };

so that qualitySize does not need to be kept automatically in sync.

Or, if a separate variable is needed, at least

Suggested change
constexpr uint32_t qualitySize{7};
enum class Quality : uint8_t { bad = 0, edup, dup, loose, strict, tight, highPurity, notQuality = qualitySize };
enum class Quality : uint8_t { bad = 0, edup, dup, loose, strict, tight, highPurity, notQuality };
constexpr uint32_t qualitySize = Quality::notQuality;

that this requires that notQuality is always the last one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was in doubt and decided to keep it separate.
I think I have a static_assert somewhere

const std::string qualityName[qualitySize]{"bad", "edup", "dup", "loose", "strict", "tight", "highPurity"};
inline Quality qualityByName(std::string const &name) {
auto qp = std::find(qualityName, qualityName + qualitySize, name) - qualityName;
return static_cast<Quality>(qp);
}
} // namespace pixelTrack

template <int32_t S>
class TrackSoAHeterogeneousT {
Expand Down
5 changes: 5 additions & 0 deletions CUDADataFormats/Track/test/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<use name="HeterogeneousCore/CUDAUtilities"/>

<bin file="TrackSoAHeterogeneous_t.cpp">
<use name="eigen"/>
<flags CXXFLAGS="-g -DGPU_DEBUG"/>
</bin>

<bin file="TrajectoryStateSOA_t.cpp" name="cpuTrajectoryStateSOA_t">
<use name="eigen"/>
<flags CXXFLAGS="-g -DGPU_DEBUG"/>
Expand Down
21 changes: 21 additions & 0 deletions CUDADataFormats/Track/test/TrackSoAHeterogeneous_t.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include "CUDADataFormats/Track/interface/TrackSoAHeterogeneousT.h"

#include <iostream>
#include <cassert>

int main() {
// test quality

auto q = pixelTrack::qualityByName("tight");
assert(pixelTrack::Quality::tight == q);
q = pixelTrack::qualityByName("toght");
assert(pixelTrack::Quality::notQuality == q);

for (uint32_t i = 0; i < pixelTrack::qualitySize; ++i) {
auto const qt = static_cast<pixelTrack::Quality>(i);
auto q = pixelTrack::qualityByName(pixelTrack::qualityName[i]);
assert(qt == q);
}

return 0;
}
94 changes: 66 additions & 28 deletions DQM/TrackingMonitorSource/python/pixelTracksMonitoring_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
pixelTracksMonitor.beamSpot = 'offlineBeamSpot'
pixelTracksMonitor.primaryVertex = 'pixelVertices'
pixelTracksMonitor.pvNDOF = 1
pixelTracksMonitor.doAllPlots = True
pixelTracksMonitor.doAllPlots = False
pixelTracksMonitor.doLumiAnalysis = True
pixelTracksMonitor.doProfilesVsLS = True
pixelTracksMonitor.doDCAPlots = True
Expand All @@ -26,27 +26,54 @@
cut = cms.string("")
)

pixelTracksPt0to1 = _trackSelector.clone(cut = "pt >= 0 & pt < 1 ")
pixelTracksPt1 = _trackSelector.clone(cut = "pt >= 1 ")
from DQM.TrackingMonitorSource.TrackCollections2monitor_cff import highPurityPV0p1 as _highPurityPV0p1
pixelTracksPV0p1 = _highPurityPV0p1.clone(
src = "pixelTracks",
quality = "",
vertexTag = "goodPixelVertices"
)
quality = {
"L" : "loose",
"T" : "tight",
"HP" : "highPurity",
}

pixelTracksMonitorPt0to1 = pixelTracksMonitor.clone(
TrackProducer = "pixelTracksPt0to1",
FolderName = "Tracking/PixelTrackParameters/pt_0to1"
)
pixelTracksMonitorPt1 = pixelTracksMonitor.clone(
TrackProducer = "pixelTracksPt1",
FolderName = "Tracking/PixelTrackParameters/pt_1"
)
pixelTracksMonitorPV0p1 = pixelTracksMonitor.clone(
TrackProducer = "pixelTracksPV0p1",
FolderName = "Tracking/PixelTrackParameters/dzPV0p1"
)
for key,value in quality.items():
label = "pixelTrks"+key
# print label
cutstring = "quality('" + value + "')"
# print cutstring
if label not in globals():
locals()[label] = _trackSelector.clone( cut = cutstring )
locals()[label].setLabel(label)
else :
print label,"already configured"

for key,value in quality.items():
label = "pixelTrksMonitor"+key
locals()[label] = pixelTracksMonitor.clone(
TrackProducer = "pixelTrks"+key,
FolderName = "Tracking/PixelTrackParameters/"+value
)
locals()[label].setLabel(label)

ntuplet = {
'3' : "3Hits", # ==3
'4' : "4Hits" # >=4
}
for kN,vN in ntuplet.items():
for key,value in quality.items():
label = "pixelTrks" + vN + key
# print label

cutstring = "numberOfValidHits == " + kN + " & quality('" + value + "')"
# print cutstring
locals()[label] = _trackSelector.clone( cut = cutstring )
locals()[label].setLabel(label)

for kN,vN in ntuplet.items():
for key,value in quality.items():
label = "pixelTrks" + vN + "Monitor" + key
# print label
locals()[label] = pixelTracksMonitor.clone(
TrackProducer = "pixelTrks" + vN + key,
FolderName = "Tracking/PixelTrackParameters/" + vN + "/" + value
)
locals()[label].setLabel(label)


from CommonTools.ParticleFlow.goodOfflinePrimaryVertices_cfi import goodOfflinePrimaryVertices as _goodOfflinePrimaryVertices
Expand All @@ -62,16 +89,27 @@

pixelTracksMonitoringTask = cms.Task(
goodPixelVertices,
pixelTracksPt0to1,
pixelTracksPt1,
pixelTracksPV0p1,
)

for category in ["pixelTrks", "pixelTrks3Hits", "pixelTrks4Hits"]:
for key in quality:
label = category+key
# print label
pixelTracksMonitoringTask.add(locals()[label])

allPixelTracksMonitoring = cms.Sequence()
for category in ["pixelTrksMonitor", "pixelTrks3HitsMonitor", "pixelTrks4HitsMonitor" ]:
for key in quality:
label = category+key
# print label
allPixelTracksMonitoring += locals()[label]

pixelTracksMonitoring = cms.Sequence(
pixelTracksMonitor +
pixelTracksMonitorPt0to1 +
pixelTracksMonitorPt1 +
pixelTracksMonitorPV0p1 +
allPixelTracksMonitoring +
pixelVertexResolution,
pixelTracksMonitoringTask
)




68 changes: 45 additions & 23 deletions RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,38 +15,60 @@
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "Geometry/Records/interface/TrackerTopologyRcd.h"

#include "PixelTrackProducer.h"
#include "FWCore/Framework/interface/stream/EDProducer.h"
#include "RecoPixelVertexing/PixelTrackFitting/interface/PixelTrackReconstruction.h"
#include "Geometry/Records/interface/TrackerTopologyRcd.h"
#include "storeTracks.h"

#include "FWCore/PluginManager/interface/ModuleDef.h"
#include "FWCore/Framework/interface/MakerMacros.h"

namespace edm {
class Event;
class EventSetup;
class ParameterSet;
class ConfigurationDescriptions;
} // namespace edm
class TrackerTopology;

using namespace pixeltrackfitting;
using edm::ParameterSet;

PixelTrackProducer::PixelTrackProducer(const ParameterSet& cfg) : theReconstruction(cfg, consumesCollector()) {
edm::LogInfo("PixelTrackProducer") << " construction...";
produces<reco::TrackCollection>();
produces<TrackingRecHitCollection>();
produces<reco::TrackExtraCollection>();
}
class PixelTrackProducer : public edm::stream::EDProducer<> {
public:
explicit PixelTrackProducer(const edm::ParameterSet& cfg)
: theReconstruction(cfg, consumesCollector()), htTopoToken_(esConsumes()) {
edm::LogInfo("PixelTrackProducer") << " construction...";
produces<reco::TrackCollection>();
produces<TrackingRecHitCollection>();
produces<reco::TrackExtraCollection>();
}

~PixelTrackProducer() override {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
~PixelTrackProducer() override {}
~PixelTrackProducer() override = default;

should automatically include the proper noexcept specification


static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;

PixelTrackProducer::~PixelTrackProducer() {}
desc.add<std::string>("passLabel", "pixelTracks"); // What is this? It is not used anywhere in this code.
PixelTrackReconstruction::fillDescriptions(desc);

void PixelTrackProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
descriptions.add("pixelTracks", desc);
}

desc.add<std::string>("passLabel", "pixelTracks"); // What is this? It is not used anywhere in this code.
PixelTrackReconstruction::fillDescriptions(desc);
void produce(edm::Event& ev, const edm::EventSetup& es) override {
LogDebug("PixelTrackProducer, produce") << "event# :" << ev.id();

descriptions.add("pixelTracks", desc);
}
TracksWithTTRHs tracks;
theReconstruction.run(tracks, ev, es);
auto htTopo = es.getData(htTopoToken_);

void PixelTrackProducer::produce(edm::Event& ev, const edm::EventSetup& es) {
LogDebug("PixelTrackProducer, produce") << "event# :" << ev.id();
// store tracks
storeTracks(ev, tracks, htTopo);
}

TracksWithTTRHs tracks;
theReconstruction.run(tracks, ev, es);
edm::ESHandle<TrackerTopology> httopo;
es.get<TrackerTopologyRcd>().get(httopo);
private:
PixelTrackReconstruction theReconstruction;
const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> htTopoToken_;
};

// store tracks
storeTracks(ev, tracks, *httopo);
}
DEFINE_FWK_MODULE(PixelTrackProducer);
29 changes: 0 additions & 29 deletions RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackProducer.h

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class PixelTrackProducerFromSoA : public edm::global::EDProducer<> {
const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> ttTopoToken_;

int32_t const minNumberOfHits_;
pixelTrack::Quality const minQuality_;
};

PixelTrackProducerFromSoA::PixelTrackProducerFromSoA(const edm::ParameterSet &iConfig)
Expand All @@ -72,7 +73,16 @@ PixelTrackProducerFromSoA::PixelTrackProducerFromSoA(const edm::ParameterSet &iC
hmsToken_(consumes<HMSstorage>(iConfig.getParameter<edm::InputTag>("pixelRecHitLegacySrc"))),
idealMagneticFieldToken_(esConsumes()),
ttTopoToken_(esConsumes()),
minNumberOfHits_(iConfig.getParameter<int>("minNumberOfHits")) {
minNumberOfHits_(iConfig.getParameter<int>("minNumberOfHits")),
minQuality_(pixelTrack::qualityByName(iConfig.getParameter<std::string>("minQuality"))) {
if (minQuality_ == pixelTrack::Quality::notQuality) {
throw cms::Exception("PixelTrackConfiguration")
<< iConfig.getParameter<std::string>("minQuality") + " is not a pixelTrack::Quality";
}
if (minQuality_ < pixelTrack::Quality::dup) {
throw cms::Exception("PixelTrackConfiguration")
<< iConfig.getParameter<std::string>("minQuality") + " not supported";
}
produces<reco::TrackCollection>();
produces<TrackingRecHitCollection>();
produces<reco::TrackExtraCollection>();
Expand All @@ -85,13 +95,23 @@ void PixelTrackProducerFromSoA::fillDescriptions(edm::ConfigurationDescriptions
desc.add<edm::InputTag>("trackSrc", edm::InputTag("pixelTracksSoA"));
desc.add<edm::InputTag>("pixelRecHitLegacySrc", edm::InputTag("siPixelRecHitsPreSplittingLegacy"));
desc.add<int>("minNumberOfHits", 0);

desc.add<std::string>("minQuality", "loose");
descriptions.addWithDefaultLabel(desc);
}

void PixelTrackProducerFromSoA::produce(edm::StreamID streamID,
edm::Event &iEvent,
const edm::EventSetup &iSetup) const {
// enum class Quality : uint8_t { bad = 0, edup, dup, loose, strict, tight, highPurity };
reco::TrackBase::TrackQuality recoQuality[] = {reco::TrackBase::undefQuality,
reco::TrackBase::undefQuality,
reco::TrackBase::discarded,
reco::TrackBase::loose,
reco::TrackBase::tight,
reco::TrackBase::tight,
reco::TrackBase::highPurity};
assert(reco::TrackBase::highPurity == recoQuality[int(pixelTrack::Quality::highPurity)]);

// std::cout << "Converting gpu helix in reco tracks" << std::endl;

auto indToEdmP = std::make_unique<IndToEdm>();
Expand Down Expand Up @@ -137,6 +157,8 @@ void PixelTrackProducerFromSoA::produce(edm::StreamID streamID,
auto const &hitIndices = tsoa.hitIndices;
auto maxTracks = tsoa.stride();

tracks.reserve(maxTracks);

int32_t nt = 0;

for (int32_t it = 0; it < maxTracks; ++it) {
Expand All @@ -145,7 +167,7 @@ void PixelTrackProducerFromSoA::produce(edm::StreamID streamID,
break; // this is a guard: maybe we need to move to nTracks...
indToEdm.push_back(-1);
auto q = quality[it];
if (q != pixelTrack::Quality::loose)
if (q < minQuality_)
continue;
if (nHits < minNumberOfHits_)
continue;
Expand Down Expand Up @@ -192,6 +214,18 @@ void PixelTrackProducerFromSoA::produce(edm::StreamID streamID,
math::XYZVector mom(pp.x(), pp.y(), pp.z());

auto track = std::make_unique<reco::Track>(chi2, ndof, pos, mom, gp.charge(), CurvilinearTrajectoryError(mo));

// bad and edup not supported as fit not present or not reliable
auto tkq = recoQuality[int(q)];
track->setQuality(tkq);
// loose,tight and HP are inclusive
if (reco::TrackBase::highPurity == tkq) {
track->setQuality(reco::TrackBase::tight);
track->setQuality(reco::TrackBase::loose);
} else if (reco::TrackBase::tight == tkq) {
track->setQuality(reco::TrackBase::loose);
}
track->setQuality(tkq);
// filter???
tracks.emplace_back(track.release(), hits);
}
Expand Down
5 changes: 0 additions & 5 deletions RecoPixelVertexing/PixelTrackFitting/plugins/SealModule.cc

This file was deleted.

Loading