CMS 3D CMS Logo

CachingSeedCleanerBySharedInput Class Reference

Merge of SeedCleanerBySharedInput and CachingSeedCleanerByHitPosition. More...

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

Inheritance diagram for CachingSeedCleanerBySharedInput:

RedundantSeedCleaner

List of all members.

Public Member Functions

virtual void add (const Trajectory *traj)
 In this implementation, it does nothing.
 CachingSeedCleanerBySharedInput ()
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 ~CachingSeedCleanerBySharedInput ()

Private Attributes

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


Detailed Description

Merge of SeedCleanerBySharedInput and CachingSeedCleanerByHitPosition.

Definition at line 7 of file CachingSeedCleanerBySharedInput.h.


Constructor & Destructor Documentation

CachingSeedCleanerBySharedInput::CachingSeedCleanerBySharedInput (  )  [inline]

Definition at line 21 of file CachingSeedCleanerBySharedInput.h.

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

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

Definition at line 23 of file CachingSeedCleanerBySharedInput.h.

References theCache, and theVault.

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


Member Function Documentation

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

In this implementation, it does nothing.

Implements RedundantSeedCleaner.

Definition at line 27 of file CachingSeedCleanerBySharedInput.cc.

References t, te, theCache, and theVault.

00027                                                                {
00028     typedef Trajectory::RecHitContainer::const_iterator TI;
00029     unsigned short idx = theVault.size();
00030     theVault.resize(idx+1);
00031     // a vector of shared pointers....
00032     Trajectory::ConstRecHitContainer & hits = theVault.back();
00033     (*trj).validRecHits(hits);
00034     //    std::sort(hits.begin(),hits.end(),
00035     //        boost::bind(&TrackingRecHit::geographicalId(),_1));
00036     
00037     uint32_t detid;
00038     for (TI t = hits.begin(), te = hits.end(); t != te; ++t) {
00039       //    if ((*t)->isValid()) {   // they are valid!
00040       detid = (*t)->geographicalId().rawId();
00041       if (detid) theCache.insert(std::pair<uint32_t, unsigned short>(detid, idx));
00042     }
00043 }

void CachingSeedCleanerBySharedInput::done (  )  [virtual]

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

Implements RedundantSeedCleaner.

Definition at line 14 of file CachingSeedCleanerBySharedInput.cc.

References theCache, and theVault.

00014                                            { 
00015     //edm::LogInfo("CachingSeedCleanerBySharedInput") << " Calls: " << calls_ << ", Tracks: " << tracks_ <<", Comps: " << comps_ << " Vault: " << theVault.size() << ".";
00016     //calls_ = comps_ = tracks_ = 0;
00017     theVault.clear(); theCache.clear();
00018 
00019     //don't, at least we'll not copy vector by value!
00020 
00021     //    std::vector<Trajectory::RecHitContainer> swapper;
00022     //swapper.swap(theVault); // this should clean the vault even more
00023 }

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

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

Implements RedundantSeedCleaner.

Definition at line 45 of file CachingSeedCleanerBySharedInput.cc.

References TrackingRecHit::all, end, first, it, prof2calltree::last, min, TrajectorySeed::nHits(), range, TrajectorySeed::recHits(), t, te, theCache, and theVault.

00045                                                                      {
00046   if (seed->nHits()==0){    return true; }
00047 
00048     typedef TrajectorySeed::const_iterator SI;
00049     typedef Trajectory::RecHitContainer::const_iterator TI;
00050     TrajectorySeed::range range = seed->recHits();
00051 
00052     SI first = range.first, last = range.second, curr;
00053     uint32_t detid = first->geographicalId().rawId();
00054     
00055     std::multimap<uint32_t, unsigned short>::const_iterator it, end = theCache.end();
00056 
00057     //calls_++;
00058     for (it = theCache.find(detid); (it != end) && (it->first == detid); ++it) {
00059       //tracks_++;
00060       
00061       // seeds are limited to the first 4 hits in trajectory...
00062       int ext = std::min(4,int(theVault[it->second].size()));
00063       TI te =  theVault[it->second].begin()+ext;
00064       //    TI  te = theVault[it->second].end();
00065       
00066       TI ts = theVault[it->second].begin();
00067       TI t = ts;
00068       for (curr = first; curr != last; ++curr) {
00069         bool found = false;
00070         // for (TI t = ts; t != te; ++t) {
00071         for (;t != te; ++t) {
00072           //comps_++;
00073           if ( curr->sharesInput((**t).hit(),TrackingRecHit::all) ) { found = true; ++t; break; }
00074         }
00075         if (!found) break;
00076       }
00077       if (curr == last) return false;
00078     }
00079     return true;
00080 }

void CachingSeedCleanerBySharedInput::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 10 of file CachingSeedCleanerBySharedInput.cc.

References theCache, and theVault.

00010                                                                             { 
00011     theVault.clear(); theCache.clear();
00012 }


Member Data Documentation

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

Definition at line 26 of file CachingSeedCleanerBySharedInput.h.

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

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

Definition at line 25 of file CachingSeedCleanerBySharedInput.h.

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


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