CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
95  const auto& cleaner = es.getData(theCleanerToken);
96  if (cleaner.fast())
97  cleaner.cleanTracks(tracks);
98  else
99  tracks = PixelTrackCleanerWrapper(&cleaner).clean(tracks);
100  }
101 }
tuple cfg
Definition: looper.py:296
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
pixeltrackfitting::TracksWithTTRHs clean(const pixeltrackfitting::TracksWithTTRHs &initialT_TTRHs) const
constexpr bool isUninitialized() const noexcept
Definition: EDGetToken.h:99
edm::EDGetTokenT< PixelTrackFilter > theFilterToken
auto const & tracks
cannot be loose
bool ev
bool getData(T &iHolder) const
Definition: EventSetup.h:128
std::vector< TrackWithTTRHs > TracksWithTTRHs
PixelTrackReconstruction(const edm::ParameterSet &conf, edm::ConsumesCollector &&iC)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void run(pixeltrackfitting::TracksWithTTRHs &tah, edm::Event &ev, const edm::EventSetup &es)
constexpr bool isInitialized() const noexcept
Definition: ESGetToken.h:72
T const * product() const
Definition: Handle.h:70
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ gpuPixelDoublets::CellNeighborsVector const gpuPixelDoublets::CellTracksVector const GPUCACell::OuterHitOfCell const int32_t nHits
edm::ESGetToken< PixelTrackCleaner, PixelTrackCleaner::Record > theCleanerToken
std::string const & label() const
Definition: InputTag.h:36
static void fillDescriptions(edm::ParameterSetDescription &desc)
edm::EDGetTokenT< RegionsSeedingHitSets > theHitSetsToken
edm::EDGetTokenT< PixelFitter > theFitterToken