CMS 3D CMS Logo

PixelTrackReconstruction.cc
Go to the documentation of this file.
1 #include <vector>
2 
17 
18 using namespace pixeltrackfitting;
19 using edm::ParameterSet;
20 
22  : theHitSetsToken(iC.consumes<RegionsSeedingHitSets>(cfg.getParameter<edm::InputTag>("SeedingHitSets"))),
23  theFitterToken(iC.consumes<PixelFitter>(cfg.getParameter<edm::InputTag>("Fitter"))) {
24  edm::InputTag filterTag = cfg.getParameter<edm::InputTag>("Filter");
25  if (not filterTag.label().empty()) {
26  theFilterToken = iC.consumes<PixelTrackFilter>(filterTag);
27  }
28  std::string cleanerName = cfg.getParameter<std::string>("Cleaner");
29  if (not cleanerName.empty()) {
30  theCleanerToken = iC.esConsumes(edm::ESInputTag("", cleanerName));
31  }
32 }
33 
35 
37  desc.add<edm::InputTag>("SeedingHitSets", edm::InputTag("pixelTracksHitTriplets"));
38  desc.add<edm::InputTag>("Fitter", edm::InputTag("pixelFitterByHelixProjections"));
39  desc.add<edm::InputTag>("Filter", edm::InputTag("pixelTrackFilterByKinematics"));
40  desc.add<std::string>("Cleaner", "pixelTrackCleanerBySharedHits");
41 }
42 
45  ev.getByToken(theHitSetsToken, hhitSets);
46  const auto& hitSets = *hhitSets;
47 
49  ev.getByToken(theFitterToken, hfitter);
50  const auto& fitter = *hfitter;
51 
52  const PixelTrackFilter* filter = nullptr;
55  ev.getByToken(theFilterToken, hfilter);
56  filter = hfilter.product();
57  }
58 
59  std::vector<const TrackingRecHit*> hits;
60  hits.reserve(4);
61  for (const auto& regionHitSets : hitSets) {
62  const TrackingRegion& region = regionHitSets.region();
63 
64  for (const SeedingHitSet& tuplet : regionHitSets) {
66  auto nHits = tuplet.size();
67  hits.resize(nHits);
68  for (unsigned int iHit = 0; iHit < nHits; ++iHit)
69  hits[iHit] = tuplet[iHit];
70 
71  // fitting
72  std::unique_ptr<reco::Track> track = fitter.run(hits, region);
73  if (!track)
74  continue;
75 
76  if (filter) {
77  if (!(*filter)(track.get(), hits)) {
78  continue;
79  }
80  }
81  /* roll back to verify if HLT tau is affected
82  // all legacy tracks are "highPurity"
83  // setting all others bits as well (as in ckf)
84  track->setQuality(reco::TrackBase::loose);
85  track->setQuality(reco::TrackBase::tight);
86  track->setQuality(reco::TrackBase::highPurity);
87  */
88  // add tracks
89  tracks.emplace_back(track.release(), tuplet);
90  }
91  }
92 
93  // skip ovelrapped tracks
94  if (theCleanerToken.isInitialized()) {
95  const auto& cleaner = es.getData(theCleanerToken);
96  if (cleaner.fast())
97  cleaner.cleanTracks(tracks);
98  else
100  }
101 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
T const * product() const
Definition: Handle.h:70
constexpr bool isUninitialized() const noexcept
Definition: EDGetToken.h:104
edm::EDGetTokenT< PixelTrackFilter > theFilterToken
std::string const & label() const
Definition: InputTag.h:36
std::vector< TrackWithTTRHs > TracksWithTTRHs
pixeltrackfitting::TracksWithTTRHs clean(const pixeltrackfitting::TracksWithTTRHs &initialT_TTRHs) const
PixelTrackReconstruction(const edm::ParameterSet &conf, edm::ConsumesCollector &&iC)
void run(pixeltrackfitting::TracksWithTTRHs &tah, edm::Event &ev, const edm::EventSetup &es)
edm::ESGetToken< PixelTrackCleaner, PixelTrackCleaner::Record > theCleanerToken
HLT enums.
static void fillDescriptions(edm::ParameterSetDescription &desc)
TupleMultiplicity< TrackerTraits > const *__restrict__ uint32_t nHits
edm::EDGetTokenT< RegionsSeedingHitSets > theHitSetsToken
edm::EDGetTokenT< PixelFitter > theFitterToken