41 const uint32_t NonMatchedTrackId = (uint32_t)-1;
51 if (detId <
other.detId)
53 else if (detId >
other.detId)
55 else if (collision <
other.collision)
57 else if (
other.collision < collision)
60 return simTrackId <
other.simTrackId;
64 return detId ==
other.detId && collision ==
other.collision && simTrackId ==
other.simTrackId;
79 typedef std::pair<TrackQuality::Layer::SubDet, short int>
DetLayer;
96 switch (detId.
det()) {
98 layer = tTopo->
layer(detId);
143 std::vector<MatchedHit> matchedHits;
148 DetId detId = (*hit)->geographicalId();
153 if (!(*hit)->isValid()) {
154 MatchedHit matchedHit;
155 matchedHit.detId = detId;
156 matchedHit.simTrackId = NonMatchedTrackId;
158 switch ((*hit)->getType()) {
171 matchedHits.push_back(matchedHit);
176 std::vector<SimHitIdpr> simIds =
associator_->associateHitId(**
hit);
179 if (simIds.empty()) {
180 MatchedHit matchedHit;
181 matchedHit.detId = detId;
182 matchedHit.simTrackId = NonMatchedTrackId;
185 matchedHits.push_back(matchedHit);
190 for (std::vector<SimHitIdpr>::const_iterator
i = simIds.begin();
i != simIds.end(); ++
i) {
191 MatchedHit matchedHit;
192 matchedHit.detId = detId;
193 matchedHit.simTrackId =
i->first;
194 matchedHit.collision =
i->second;
202 matchedHits.push_back(matchedHit);
207 std::stable_sort(matchedHits.begin(), matchedHits.end());
210 std::stable_sort(matchedHits.begin(), matchedHits.end());
213 typedef std::multimap<DetLayer, const MatchedHit *> LayerHitMap;
214 LayerHitMap layerHitMap;
217 for (std::vector<MatchedHit>::const_iterator
hit = matchedHits.begin();
hit != matchedHits.end();) {
219 const MatchedHit *best =
nullptr;
225 best->simTrackId == NonMatchedTrackId) {
229 }
while (
hit != matchedHits.end() &&
hit->detId == best->detId);
232 if (best->simTrackId != NonMatchedTrackId || best->state !=
Layer::Missed) {
233 layerHitMap.insert(std::make_pair(
getDetLayer(best->detId, tTopo), best));
239 #ifdef DEBUG_TRACK_QUALITY
240 std::cout <<
"---------------------" << std::endl;
243 for (LayerHitMap::const_iterator
hit = layerHitMap.begin();
hit != layerHitMap.end(); ++
hit) {
244 #ifdef DEBUG_TRACK_QUALITY
245 std::cout <<
"detLayer (" <<
hit->first.first <<
", " <<
hit->first.second <<
")"
246 <<
" [" << (uint32_t)
hit->second->detId <<
"] sim(" << (
int)
hit->second->simTrackId <<
")"
247 <<
" hit(" <<
hit->second->recHitId <<
") -> " <<
hit->second->state << std::endl;