CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions

TrajectoryCleanerBySharedSeeds Class Reference

#include <TrajectoryCleanerBySharedSeeds.h>

Inheritance diagram for TrajectoryCleanerBySharedSeeds:
TrajectoryCleaner

List of all members.

Public Types

typedef std::vector< Trajectory * > TrajectoryPointerContainer

Public Member Functions

virtual void clean (TrajectoryPointerContainer &) const
void clean (std::vector< Trajectory > &trajs) const
 TrajectoryCleanerBySharedSeeds (const edm::ParameterSet &iConfig)
virtual ~TrajectoryCleanerBySharedSeeds ()

Private Member Functions

bool sameSeed (const TrajectorySeed &s1, const TrajectorySeed &s2) const

Detailed Description

Definition at line 8 of file TrajectoryCleanerBySharedSeeds.h.


Member Typedef Documentation

Reimplemented from TrajectoryCleaner.

Definition at line 11 of file TrajectoryCleanerBySharedSeeds.h.


Constructor & Destructor Documentation

TrajectoryCleanerBySharedSeeds::TrajectoryCleanerBySharedSeeds ( const edm::ParameterSet iConfig) [inline]

Definition at line 13 of file TrajectoryCleanerBySharedSeeds.h.

{};
virtual TrajectoryCleanerBySharedSeeds::~TrajectoryCleanerBySharedSeeds ( ) [inline, virtual]

Definition at line 14 of file TrajectoryCleanerBySharedSeeds.h.

{};

Member Function Documentation

void TrajectoryCleanerBySharedSeeds::clean ( TrajectoryPointerContainer ) const [virtual]

Implements TrajectoryCleaner.

Definition at line 39 of file TrajectoryCleanerBySharedSeeds.cc.

{
}
void TrajectoryCleanerBySharedSeeds::clean ( std::vector< Trajectory > &  trajs) const [virtual]

Reimplemented from TrajectoryCleaner.

Definition at line 45 of file TrajectoryCleanerBySharedSeeds.cc.

References LogTrace.

{
  if(trajs.size() == 0) return;

  // Best track
  unsigned int best = 0;

  // Track are assumed to come in seed blocks
  for(unsigned int actual = 1; actual < trajs.size(); actual++)
  {
    if(sameSeed(trajs[best].seed(), trajs[actual].seed()))
    {
      // Track to remove 
      unsigned int remove;

      // remove track with lower number of found hits, higher chi2
      if(trajs[best].foundHits() != trajs[actual].foundHits())
      {
        if(trajs[best].foundHits()  > trajs[actual].foundHits())
          remove = actual;
        else { remove = best; best = actual; }
      }
      else
      {
        if(trajs[best].chiSquared() < trajs[actual].chiSquared())
          remove = actual;
        else { remove = best; best = actual; }
      }

      trajs[remove].invalidate();
    }    
  }

  LogTrace("TrajectoryCleanerBySharedSeeds") << "  [TrajecCleaner] cleaned trajs : 1/" << trajs.size()
                                             << " (with " << trajs[best].measurements().size() << " hits)" << std::endl;
}
bool TrajectoryCleanerBySharedSeeds::sameSeed ( const TrajectorySeed s1,
const TrajectorySeed s2 
) const [private]

Definition at line 14 of file TrajectoryCleanerBySharedSeeds.cc.

References TrackingRecHit::all, TrajectorySeed::nHits(), diffTwoXMLs::r1, diffTwoXMLs::r2, and TrajectorySeed::recHits().

{
  if(s1.nHits()==0 && s2.nHits()==0) return false;
  if(s1.nHits() != s2.nHits()) return false;

  TrajectorySeed::range r1 = s1.recHits();
  TrajectorySeed::range r2 = s2.recHits();

  TrajectorySeed::const_iterator h1 = r1.first;
  TrajectorySeed::const_iterator h2 = r2.first;

  do
  {
    if(!(h1->sharesInput(&(*h2),TrackingRecHit::all)))
      return false;

    h1++; h2++;
  }
  while(h1 != s1.recHits().second && 
        h2 != s2.recHits().second);

  return true;
}