CMS 3D CMS Logo

PixelTrackReconstruction.cc
Go to the documentation of this file.
2 
9 
11 
13 
15 
18 
22 
24 
25 #include <vector>
26 
27 using namespace pixeltrackfitting;
28 using edm::ParameterSet;
29 
32  : theHitSetsToken(iC.consumes<RegionsSeedingHitSets>(cfg.getParameter<edm::InputTag>("SeedingHitSets"))),
33  theFitterToken(iC.consumes<PixelFitter>(cfg.getParameter<edm::InputTag>("Fitter"))),
34  theCleanerName(cfg.getParameter<std::string>("Cleaner"))
35 {
36  edm::InputTag filterTag = cfg.getParameter<edm::InputTag>("Filter");
37  if(filterTag.label() != "") {
38  theFilterToken = iC.consumes<PixelTrackFilter>(filterTag);
39  }
40 }
41 
43 {
44 }
45 
47  desc.add<edm::InputTag>("SeedingHitSets", edm::InputTag("pixelTracksHitTriplets"));
48  desc.add<edm::InputTag>("Fitter", edm::InputTag("pixelFitterByHelixProjections"));
49  desc.add<edm::InputTag>("Filter", edm::InputTag("pixelTrackFilterByKinematics"));
50  desc.add<std::string>("Cleaner", "pixelTrackCleanerBySharedHits");
51 }
52 
54 {
56  ev.getByToken(theHitSetsToken, hhitSets);
57  const auto& hitSets = *hhitSets;
58 
60  ev.getByToken(theFitterToken, hfitter);
61  const auto& fitter = *hfitter;
62 
63  const PixelTrackFilter *filter = nullptr;
66  ev.getByToken(theFilterToken, hfilter);
67  filter = hfilter.product();
68  }
69 
70  std::vector<const TrackingRecHit *> hits;hits.reserve(4);
71  for(const auto& regionHitSets: hitSets) {
72  const TrackingRegion& region = regionHitSets.region();
73 
74  for(const SeedingHitSet& tuplet: regionHitSets) {
76  auto nHits = tuplet.size(); hits.resize(nHits);
77  for (unsigned int iHit = 0; iHit < nHits; ++iHit) hits[iHit] = tuplet[iHit];
78 
79  // fitting
80  std::unique_ptr<reco::Track> track = fitter.run(hits, region);
81  if (!track) continue;
82 
83  if (filter) {
84  if (!(*filter)(track.get(), hits)) {
85  continue;
86  }
87  }
88 
89  // add tracks
90  tracks.emplace_back(track.release(), tuplet);
91  }
92  }
93 
94  // skip ovelrapped tracks
95  if(!theCleanerName.empty()) {
97  es.get<PixelTrackCleaner::Record>().get(theCleanerName, hcleaner);
98  const auto& cleaner = *hcleaner;
99  if(cleaner.fast())
100  cleaner.cleanTracks(tracks);
101  else
102  tracks = PixelTrackCleanerWrapper(&cleaner).clean(tracks);
103  }
104 }
T getParameter(std::string const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
pixeltrackfitting::TracksWithTTRHs clean(const pixeltrackfitting::TracksWithTTRHs &initialT_TTRHs) const
edm::EDGetTokenT< PixelTrackFilter > theFilterToken
bool ev
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)
T const * product() const
Definition: Handle.h:81
const T & get() const
Definition: EventSetup.h:58
std::string const & label() const
Definition: InputTag.h:36
HLT enums.
bool isUninitialized() const
Definition: EDGetToken.h:73
static void fillDescriptions(edm::ParameterSetDescription &desc)
edm::EDGetTokenT< RegionsSeedingHitSets > theHitSetsToken
edm::EDGetTokenT< PixelFitter > theFitterToken