39 const uint32_t NonMatchedTrackId = (uint32_t)-1;
49 if (detId < other.detId)
51 else if (detId > other.detId)
53 else if (collision < other.collision)
55 else if (other.collision < collision)
58 return simTrackId < other.simTrackId;
61 bool operator==(
const MatchedHit &other)
const {
62 return detId == other.detId && collision == other.collision && simTrackId == other.simTrackId;
77 typedef std::pair<TrackQuality::Layer::SubDet, short int>
DetLayer;
94 switch (detId.
det()) {
96 layer = tTopo->
layer(detId);
141 std::vector<MatchedHit> matchedHits;
146 DetId detId = (*hit)->geographicalId();
151 if (!(*hit)->isValid()) {
152 MatchedHit matchedHit;
153 matchedHit.detId = detId;
154 matchedHit.simTrackId = NonMatchedTrackId;
156 switch ((*hit)->getType()) {
169 matchedHits.push_back(matchedHit);
174 std::vector<SimHitIdpr> simIds =
associator_->associateHitId(**
hit);
177 if (simIds.empty()) {
178 MatchedHit matchedHit;
179 matchedHit.detId = detId;
180 matchedHit.simTrackId = NonMatchedTrackId;
183 matchedHits.push_back(matchedHit);
188 for (std::vector<SimHitIdpr>::const_iterator
i = simIds.begin();
i != simIds.end(); ++
i) {
189 MatchedHit matchedHit;
190 matchedHit.detId = detId;
191 matchedHit.simTrackId =
i->first;
192 matchedHit.collision =
i->second;
200 matchedHits.push_back(matchedHit);
205 std::stable_sort(matchedHits.begin(), matchedHits.end());
208 std::stable_sort(matchedHits.begin(), matchedHits.end());
211 typedef std::multimap<DetLayer, const MatchedHit *> LayerHitMap;
212 LayerHitMap layerHitMap;
215 for (std::vector<MatchedHit>::const_iterator
hit = matchedHits.begin();
hit != matchedHits.end();) {
217 const MatchedHit *best =
nullptr;
222 if (!best || statePriorities[
hit->state] > statePriorities[best->state] ||
223 best->simTrackId == NonMatchedTrackId) {
227 }
while (
hit != matchedHits.end() &&
hit->detId == best->detId);
230 if (best->simTrackId != NonMatchedTrackId || best->state !=
Layer::Missed) {
231 layerHitMap.insert(std::make_pair(
getDetLayer(best->detId, tTopo), best));
237 #ifdef DEBUG_TRACK_QUALITY 238 std::cout <<
"---------------------" << std::endl;
241 for (LayerHitMap::const_iterator
hit = layerHitMap.begin();
hit != layerHitMap.end(); ++
hit) {
242 #ifdef DEBUG_TRACK_QUALITY 243 std::cout <<
"detLayer (" <<
hit->first.first <<
", " <<
hit->first.second <<
")" 244 <<
" [" << (uint32_t)
hit->second->detId <<
"] sim(" << (
int)
hit->second->simTrackId <<
")" 245 <<
" hit(" <<
hit->second->recHitId <<
") -> " <<
hit->second->state << std::endl;
250 if (!layer ||
hit->first.first != layer->
subDet ||
hit->first.second != layer->
layer) {
263 layer->
hits.push_back(newHit);
std::vector< TrackingParticleRef > SimParticleTrail
std::unique_ptr< TrackerHitAssociator > associator_
std::pair< TrackQuality::Layer::SubDet, short int > DetLayer
TrackerHitAssociator::Config trackerHitAssociatorConfig_
int layer() const
Return the layer number.
void evaluate(SimParticleTrail const &, reco::TrackBaseRef const &, const TrackerTopology *tTopo)
Compute information about the track reconstruction quality.
bool operator==(const QGLikelihoodParameters &lhs, const QGLikelihoodCategory &rhs)
Test if parameters are compatible with category.
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
DetLayer getDetLayer(DetId detId, const TrackerTopology *tTopo)
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
const Layer & layer(unsigned int index) const
Return information about the given layer by index.
std::vector< Layer > layers_
unsigned int layer(const DetId &id) const
bool operator<(DTCELinkId const &lhs, DTCELinkId const &rhs)
void newEvent(const edm::Event &, const edm::EventSetup &)
Pre-process event information (for accessing reconstruction information)
TrackQuality(const edm::ParameterSet &, edm::ConsumesCollector &iC)
Constructor by pset.
static const int statePriorities[]
constexpr Detector det() const
get the detector field from this detid
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.