40 static const uint32_t NonMatchedTrackId = (uint32_t)-1;
50 bool operator < (
const MatchedHit &other)
const
52 if (detId < other.detId)
54 else if (detId > other.detId)
56 else if (collision < other.collision)
58 else if (other.collision < collision)
61 return simTrackId < other.simTrackId;
66 return detId == other.detId &&
67 collision == other.collision &&
68 simTrackId == other.simTrackId;
83 typedef std::pair<TrackQuality::Layer::SubDet, short int>
DetLayer;
106 layer=tTopo->
layer(detId);
145 associatorPSet_(config.getParameter<edm::
ParameterSet>(
"hitAssociator"))
158 std::vector<MatchedHit> matchedHits;
165 DetId detId = (*hit)->geographicalId();
170 if (!(*hit)->isValid())
172 MatchedHit matchedHit;
173 matchedHit.detId = detId;
174 matchedHit.simTrackId = NonMatchedTrackId;
176 switch ((*hit)->getType())
190 matchedHits.push_back(matchedHit);
195 std::vector<SimHitIdpr> simIds =
associator_->associateHitId(**
hit);
200 MatchedHit matchedHit;
201 matchedHit.detId = detId;
202 matchedHit.simTrackId = NonMatchedTrackId;
205 matchedHits.push_back(matchedHit);
210 for (std::vector<SimHitIdpr>::const_iterator
i = simIds.begin();
211 i != simIds.end(); ++
i)
213 MatchedHit matchedHit;
214 matchedHit.detId = detId;
215 matchedHit.simTrackId =
i->first;
216 matchedHit.collision =
i->second;
224 matchedHits.push_back(matchedHit);
229 std::stable_sort(matchedHits.begin(), matchedHits.end());
235 #ifdef REMOVED_JUST_TO_GET_IT_TO_COMPILE__THIS_CODE_NEEDS_TO_BE_CHECKED
237 for (SimParticleTrail::const_iterator track = spt.begin();
238 track != spt.end(); ++track)
241 for (std::vector<PSimHit>::const_iterator
hit =
242 (*track)->pSimHit_begin();
243 hit != (*track)->pSimHit_end(); ++
hit)
245 MatchedHit matchedHit;
246 matchedHit.detId =
DetId(
hit->detUnitId());
247 matchedHit.simTrackId =
hit->trackId();
248 matchedHit.collision =
hit->eventId();
251 std::pair<std::vector<MatchedHit>::iterator,
252 std::vector<MatchedHit>::iterator>
253 range = std::equal_range(
255 matchedHits.begin() +
size,
259 if (range.first == range.second)
262 matchedHit.recHitId = -1;
263 matchedHits.push_back(matchedHit);
268 std::vector<MatchedHit>::iterator pos =
269 std::lower_bound(range.first,
274 if (pos != range.second)
276 if (range.second - range.first > 1)
286 std::stable_sort(matchedHits.begin(), matchedHits.end());
289 typedef std::multimap<DetLayer, const MatchedHit*> LayerHitMap;
290 LayerHitMap layerHitMap;
293 for (std::vector<MatchedHit>::const_iterator
hit = matchedHits.begin();
294 hit != matchedHits.end();)
297 const MatchedHit *best = 0;
304 statePriorities[
hit->state] > statePriorities[best->state] ||
305 best->simTrackId == NonMatchedTrackId)
311 while (
hit != matchedHits.end() &&
312 hit->detId == best->detId);
315 if (best->simTrackId != NonMatchedTrackId ||
318 layerHitMap.insert(std::make_pair(
325 #ifdef DEBUG_TRACK_QUALITY
326 std::cout <<
"---------------------" << std::endl;
329 for (LayerHitMap::const_iterator
hit = layerHitMap.begin();
330 hit != layerHitMap.end(); ++
hit)
332 #ifdef DEBUG_TRACK_QUALITY
334 <<
"detLayer (" <<
hit->first.first <<
", " <<
hit->first.second <<
")"
335 <<
" [" << (uint32_t)
hit->second->detId <<
"] sim(" << (
int)
hit->second->simTrackId <<
")"
336 <<
" hit(" <<
hit->second->recHitId <<
") -> " <<
hit->second->state << std::endl;
357 layer->
hits.push_back(newHit);
std::vector< TrackingParticleRef > SimParticleTrail
std::pair< TrackQuality::Layer::SubDet, short int > DetLayer
std::auto_ptr< TrackerHitAssociator > associator_
bool operator==(const CaloTower &t1, const CaloTower &t2)
TrackQuality(const edm::ParameterSet &)
Constructor by pset.
bool operator<(const FedChannelConnection &, const FedChannelConnection &)
void evaluate(SimParticleTrail const &, reco::TrackBaseRef const &, const TrackerTopology *tTopo)
Compute information about the track reconstruction quality.
DetLayer getDetLayer(DetId detId, const TrackerTopology *tTopo)
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
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
void newEvent(const edm::Event &, const edm::EventSetup &)
Pre-process event information (for accessing reconstruction information)
Detector det() const
get the detector field from this detid
tuple size
Write out results.
const edm::ParameterSet associatorPSet_
static const int statePriorities[]
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.