CMS 3D CMS Logo

CachingSeedCleanerByHitPosition Class Reference

#include <RecoTracker/CkfPattern/interface/CachingSeedCleanerByHitPosition.h>

Inheritance diagram for CachingSeedCleanerByHitPosition:

RedundantSeedCleaner

List of all members.

Public Member Functions

virtual void add (const Trajectory *traj)
 In this implementation, it does nothing.
 CachingSeedCleanerByHitPosition ()
virtual void done ()
 Tells the cleaner that the seeds are finished, and so it can clear any cache it has.
virtual bool good (const TrajectorySeed *seed)
 Returns true if the seed is not overlapping with another trajectory.
virtual void init (const std::vector< Trajectory > *vect)
 Provides the cleaner a pointer to the vector where trajectories are stored, in case it does not want to keep a local collection of trajectories.
virtual ~CachingSeedCleanerByHitPosition ()

Private Attributes

std::multimap< uint32_t,
unsigned short > 
theCache
std::vector
< Trajectory::RecHitContainer
theVault


Detailed Description

Definition at line 6 of file CachingSeedCleanerByHitPosition.h.


Constructor & Destructor Documentation

CachingSeedCleanerByHitPosition::CachingSeedCleanerByHitPosition (  )  [inline]

Definition at line 20 of file CachingSeedCleanerByHitPosition.h.

00020                                      : RedundantSeedCleaner(), theVault(), theCache()
00021                                             /*, comps_(0), tracks_(0), calls_(0)*/ {}

virtual CachingSeedCleanerByHitPosition::~CachingSeedCleanerByHitPosition (  )  [inline, virtual]

Definition at line 22 of file CachingSeedCleanerByHitPosition.h.

References theCache, and theVault.

00022 { theVault.clear(); theCache.clear(); }


Member Function Documentation

void CachingSeedCleanerByHitPosition::add ( const Trajectory traj  )  [virtual]

In this implementation, it does nothing.

Implements RedundantSeedCleaner.

Definition at line 23 of file CachingSeedCleanerByHitPosition.cc.

References Trajectory::recHits(), t, te, theCache, and theVault.

00023                                                                {
00024     typedef Trajectory::RecHitContainer::const_iterator TI;
00025     unsigned short idx = theVault.size();
00026     Trajectory::RecHitContainer hits = trj->recHits();
00027     theVault.push_back(hits);
00028 
00029     uint32_t detid;
00030     for (TI t = hits.begin(), te = hits.end(); t != te; ++t) {
00031         if ((*t)->isValid()) {
00032             detid = (*t)->geographicalId().rawId();
00033             if (detid) theCache.insert(std::pair<uint32_t, unsigned short>(detid, idx));
00034         }
00035     }
00036 }

void CachingSeedCleanerByHitPosition::done (  )  [virtual]

Tells the cleaner that the seeds are finished, and so it can clear any cache it has.

Implements RedundantSeedCleaner.

Definition at line 11 of file CachingSeedCleanerByHitPosition.cc.

References theCache, and theVault.

00011                                            { 
00012     //edm::LogInfo("CachingSeedCleanerByHitPosition") << " Calls: " << calls_ << ", Tracks: " << tracks_ <<", Comps: " << comps_ << " Vault: " << theVault.size() << ".";
00013     //calls_ = comps_ = tracks_ = 0;
00014 
00015     theVault.clear(); theCache.clear();
00016 
00017     std::vector<Trajectory::RecHitContainer> swapper;
00018     swapper.swap(theVault); // this should clean the vault even more
00019 }

bool CachingSeedCleanerByHitPosition::good ( const TrajectorySeed seed  )  [virtual]

Returns true if the seed is not overlapping with another trajectory.

Implements RedundantSeedCleaner.

Definition at line 38 of file CachingSeedCleanerByHitPosition.cc.

References end, RecHitComparatorByPosition::equals(), first, it, prof2calltree::last, range, TrajectorySeed::recHits(), t, te, theCache, and theVault.

00038                                                                      {
00039     static RecHitComparatorByPosition comp;
00040     typedef TrajectorySeed::const_iterator SI;
00041     typedef Trajectory::RecHitContainer::const_iterator TI;
00042     TrajectorySeed::range range = seed->recHits();
00043 
00044     SI first = range.first, last = range.second, curr;
00045     uint32_t detid = first->geographicalId().rawId();
00046     
00047     std::multimap<uint32_t, unsigned short>::const_iterator it, end = theCache.end();
00048 
00049     //calls_++;
00050     for (it = theCache.find(detid); (it != end) && (it->first == detid); ++it) {
00051         //tracks_++;
00052         TI ts = theVault[it->second].begin(), te = theVault[it->second].end();
00053         for (curr = first; curr != last; ++curr) {
00054             bool found = false;
00055             for (TI t = ts; t != te; ++t) {
00056                 //comps_++;
00057                 if (comp.equals(&(*curr), &(**t))) { found = true; break; }
00058             }
00059             if (!found) break;
00060         }
00061         if (curr == last) return false;
00062     }
00063     return true;
00064 }

void CachingSeedCleanerByHitPosition::init ( const std::vector< Trajectory > *  vect  )  [virtual]

Provides the cleaner a pointer to the vector where trajectories are stored, in case it does not want to keep a local collection of trajectories.

Implements RedundantSeedCleaner.

Definition at line 7 of file CachingSeedCleanerByHitPosition.cc.

References theCache, and theVault.

00007                                                                             { 
00008     theVault.clear(); theCache.clear();
00009 }


Member Data Documentation

std::multimap<uint32_t, unsigned short> CachingSeedCleanerByHitPosition::theCache [private]

Definition at line 25 of file CachingSeedCleanerByHitPosition.h.

Referenced by add(), done(), good(), init(), and ~CachingSeedCleanerByHitPosition().

std::vector<Trajectory::RecHitContainer> CachingSeedCleanerByHitPosition::theVault [private]

Definition at line 24 of file CachingSeedCleanerByHitPosition.h.

Referenced by add(), done(), good(), init(), and ~CachingSeedCleanerByHitPosition().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:15:36 2009 for CMSSW by  doxygen 1.5.4