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;
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;
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;