CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

PixelTrackCleanerBySharedHits Class Reference

#include <PixelTrackCleanerBySharedHits.h>

Inheritance diagram for PixelTrackCleanerBySharedHits:
PixelTrackCleaner

List of all members.

Public Types

typedef
pixeltrackfitting::TracksWithRecHits 
TracksWithRecHits

Public Member Functions

virtual TracksWithRecHits cleanTracks (const TracksWithRecHits &tracksWithRecHits)
 PixelTrackCleanerBySharedHits (const edm::ParameterSet &cfg)
virtual ~PixelTrackCleanerBySharedHits ()

Private Member Functions

void cleanTrack ()
bool recHitsAreEqual (const TrackingRecHit *recHit1, const TrackingRecHit *recHit2)

Private Attributes

int iTrack1
int iTrack2
reco::Tracktrack1
reco::Tracktrack2
std::vector< bool > trackOk

Detailed Description

Definition at line 15 of file PixelTrackCleanerBySharedHits.h.


Member Typedef Documentation

Reimplemented from PixelTrackCleaner.

Definition at line 22 of file PixelTrackCleanerBySharedHits.h.


Constructor & Destructor Documentation

PixelTrackCleanerBySharedHits::PixelTrackCleanerBySharedHits ( const edm::ParameterSet cfg)

Definition at line 13 of file PixelTrackCleanerBySharedHits.cc.

{}
PixelTrackCleanerBySharedHits::~PixelTrackCleanerBySharedHits ( ) [virtual]

Definition at line 16 of file PixelTrackCleanerBySharedHits.cc.

{}

Member Function Documentation

void PixelTrackCleanerBySharedHits::cleanTrack ( ) [private]

Definition at line 65 of file PixelTrackCleanerBySharedHits.cc.

{
  if (track1->pt() > track2->pt()) trackOk.at(iTrack2) = false;
  else trackOk.at(iTrack1) = false;
}
TracksWithRecHits PixelTrackCleanerBySharedHits::cleanTracks ( const TracksWithRecHits tracksWithRecHits) [virtual]

Implements PixelTrackCleaner.

Definition at line 19 of file PixelTrackCleanerBySharedHits.cc.

References i, LogDebug, and findQualityFiles::size.

{
  typedef std::vector<const TrackingRecHit *> RecHits;
  trackOk.clear();

  LogDebug("PixelTrackCleanerBySharedHits") << "Cleanering tracks" << "\n";
  int size = trackHitPairs.size();
  for (int i = 0; i < size; i++) trackOk.push_back(true);

  for (iTrack1 = 0; iTrack1 < size; iTrack1++)
  {
    track1 = trackHitPairs.at(iTrack1).first;
    const RecHits& recHits1 = trackHitPairs.at(iTrack1).second;

    if (!trackOk.at(iTrack1)) continue;

    for (iTrack2 = iTrack1 + 1; iTrack2 < size; iTrack2++)
    {
      if (!trackOk.at(iTrack1) || !trackOk.at(iTrack2)) continue;

      track2 = trackHitPairs.at(iTrack2).first;
      const RecHits& recHits2 = trackHitPairs.at(iTrack2).second;

      int commonRecHits = 0;
      for (int iRecHit1 = 0; iRecHit1 < (int)recHits1.size(); iRecHit1++)
      {
        for (int iRecHit2 = 0; iRecHit2 < (int)recHits2.size(); iRecHit2++)
        {
          if (recHitsAreEqual(recHits1.at(iRecHit1), recHits2.at(iRecHit2))) commonRecHits++;
        }
      }
      if (commonRecHits > 1) cleanTrack();
    }
  }

  vector<TrackWithRecHits> cleanedTracks;

  for (int i = 0; i < size; i++)
  {
    if (trackOk.at(i)) cleanedTracks.push_back(trackHitPairs.at(i));
    else delete trackHitPairs.at(i).first;
  }
  return cleanedTracks;
}
bool PixelTrackCleanerBySharedHits::recHitsAreEqual ( const TrackingRecHit recHit1,
const TrackingRecHit recHit2 
) [private]

Definition at line 72 of file PixelTrackCleanerBySharedHits.cc.

References TrackingRecHit::geographicalId(), TrackingRecHit::localPosition(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

{
  if (recHit1->geographicalId() != recHit2->geographicalId()) return false;
  LocalPoint pos1 = recHit1->localPosition();
  LocalPoint pos2 = recHit2->localPosition();
  return ((pos1.x() == pos2.x()) && (pos1.y() == pos2.y()));
}

Member Data Documentation

Definition at line 32 of file PixelTrackCleanerBySharedHits.h.

Definition at line 32 of file PixelTrackCleanerBySharedHits.h.

Definition at line 31 of file PixelTrackCleanerBySharedHits.h.

Definition at line 31 of file PixelTrackCleanerBySharedHits.h.

std::vector<bool> PixelTrackCleanerBySharedHits::trackOk [private]

Definition at line 30 of file PixelTrackCleanerBySharedHits.h.