CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PixelTrackCleanerBySharedHits.cc
Go to the documentation of this file.
2 
7 
8 using namespace std;
9 using namespace reco;
10 using namespace pixeltrackfitting;
11 
13 {}
14 
16 {}
17 
19  const TrackerTopology *tTopo)
20 {
21  typedef std::vector<const TrackingRecHit *> RecHits;
22  trackOk.clear();
23 
24  LogDebug("PixelTrackCleanerBySharedHits") << "Cleanering tracks" << "\n";
25  int size = trackHitPairs.size();
26  for (int i = 0; i < size; i++) trackOk.push_back(true);
27 
28  for (iTrack1 = 0; iTrack1 < size; iTrack1++)
29  {
30  track1 = trackHitPairs.at(iTrack1).first;
31  const RecHits& recHits1 = trackHitPairs.at(iTrack1).second;
32 
33  if (!trackOk.at(iTrack1)) continue;
34 
35  for (iTrack2 = iTrack1 + 1; iTrack2 < size; iTrack2++)
36  {
37  if (!trackOk.at(iTrack1) || !trackOk.at(iTrack2)) continue;
38 
39  track2 = trackHitPairs.at(iTrack2).first;
40  const RecHits& recHits2 = trackHitPairs.at(iTrack2).second;
41 
42  int commonRecHits = 0;
43  for (int iRecHit1 = 0; iRecHit1 < (int)recHits1.size(); iRecHit1++)
44  {
45  for (int iRecHit2 = 0; iRecHit2 < (int)recHits2.size(); iRecHit2++)
46  {
47  if (recHitsAreEqual(recHits1.at(iRecHit1), recHits2.at(iRecHit2))) commonRecHits++;
48  }
49  }
50  if (commonRecHits > 1) cleanTrack();
51  }
52  }
53 
54  vector<TrackWithRecHits> cleanedTracks;
55 
56  for (int i = 0; i < size; i++)
57  {
58  if (trackOk.at(i)) cleanedTracks.push_back(trackHitPairs.at(i));
59  else delete trackHitPairs.at(i).first;
60  }
61  return cleanedTracks;
62 }
63 
64 
66 {
67  if (track1->pt() > track2->pt()) trackOk.at(iTrack2) = false;
68  else trackOk.at(iTrack1) = false;
69 }
70 
71 
73 {
74  if (recHit1->geographicalId() != recHit2->geographicalId()) return false;
75  LocalPoint pos1 = recHit1->localPosition();
76  LocalPoint pos2 = recHit2->localPosition();
77  return ((pos1.x() == pos2.x()) && (pos1.y() == pos2.y()));
78 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
T y() const
Definition: PV3DBase.h:63
PixelTrackCleanerBySharedHits(const edm::ParameterSet &cfg)
virtual TracksWithRecHits cleanTracks(const TracksWithRecHits &tracksWithRecHits, const TrackerTopology *tTopo)
bool recHitsAreEqual(const TrackingRecHit *recHit1, const TrackingRecHit *recHit2)
DetId geographicalId() const
T x() const
Definition: PV3DBase.h:62
virtual LocalPoint localPosition() const =0
tuple size
Write out results.
pixeltrackfitting::TracksWithRecHits TracksWithRecHits