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;
74 return hit.detId < detId;
78 return detId < hit.detId;
82 typedef std::pair<TrackQuality::Layer::SubDet, short int>
DetLayer;
105 layer=tTopo->
layer(detId);
144 associatorPSet_(config.getParameter<edm::
ParameterSet>(
"hitAssociator"))
157 std::vector<MatchedHit> matchedHits;
164 DetId detId = (*hit)->geographicalId();
169 if (!(*hit)->isValid())
171 MatchedHit matchedHit;
172 matchedHit.detId = detId;
173 matchedHit.simTrackId = NonMatchedTrackId;
175 switch ((*hit)->getType())
189 matchedHits.push_back(matchedHit);
194 std::vector<SimHitIdpr> simIds =
associator_->associateHitId(**
hit);
199 MatchedHit matchedHit;
200 matchedHit.detId = detId;
201 matchedHit.simTrackId = NonMatchedTrackId;
204 matchedHits.push_back(matchedHit);
209 for (std::vector<SimHitIdpr>::const_iterator
i = simIds.begin();
210 i != simIds.end(); ++
i)
212 MatchedHit matchedHit;
213 matchedHit.detId = detId;
214 matchedHit.simTrackId =
i->first;
215 matchedHit.collision =
i->second;
223 matchedHits.push_back(matchedHit);
228 std::stable_sort(matchedHits.begin(), matchedHits.end());
232 #warning "This file has been modified just to get it to compile without any regard as to whether it still functions as intended"
233 #ifdef REMOVED_JUST_TO_GET_IT_TO_COMPILE__THIS_CODE_NEEDS_TO_BE_CHECKED
235 for (SimParticleTrail::const_iterator track = spt.begin();
236 track != spt.end(); ++track)
239 for (std::vector<PSimHit>::const_iterator
hit =
240 (*track)->pSimHit_begin();
241 hit != (*track)->pSimHit_end(); ++
hit)
243 MatchedHit matchedHit;
244 matchedHit.detId =
DetId(
hit->detUnitId());
245 matchedHit.simTrackId =
hit->trackId();
246 matchedHit.collision =
hit->eventId();
249 std::pair<std::vector<MatchedHit>::iterator,
250 std::vector<MatchedHit>::iterator>
251 range = std::equal_range(
253 matchedHits.begin() +
size,
257 if (range.first == range.second)
260 matchedHit.recHitId = -1;
261 matchedHits.push_back(matchedHit);
266 std::vector<MatchedHit>::iterator
pos =
267 std::lower_bound(range.first,
272 if (pos != range.second)
274 if (range.second - range.first > 1)
284 std::stable_sort(matchedHits.begin(), matchedHits.end());
287 typedef std::multimap<DetLayer, const MatchedHit*> LayerHitMap;
288 LayerHitMap layerHitMap;
291 for (std::vector<MatchedHit>::const_iterator
hit = matchedHits.begin();
292 hit != matchedHits.end();)
295 const MatchedHit *best = 0;
302 statePriorities[
hit->state] > statePriorities[best->state] ||
303 best->simTrackId == NonMatchedTrackId)
309 while (
hit != matchedHits.end() &&
310 hit->detId == best->detId);
313 if (best->simTrackId != NonMatchedTrackId ||
316 layerHitMap.insert(std::make_pair(
323 #ifdef DEBUG_TRACK_QUALITY
324 std::cout <<
"---------------------" << std::endl;
327 for (LayerHitMap::const_iterator
hit = layerHitMap.begin();
328 hit != layerHitMap.end(); ++
hit)
330 #ifdef DEBUG_TRACK_QUALITY
332 <<
"detLayer (" <<
hit->first.first <<
", " <<
hit->first.second <<
")"
333 <<
" [" << (uint32_t)
hit->second->detId <<
"] sim(" << (
int)
hit->second->simTrackId <<
")"
334 <<
" hit(" <<
hit->second->recHitId <<
") -> " <<
hit->second->state << std::endl;
355 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.