CMS 3D CMS Logo

Public Member Functions | Private Attributes

CachingSeedCleanerByHitPosition Class Reference

#include <CachingSeedCleanerByHitPosition.h>

Inheritance diagram for CachingSeedCleanerByHitPosition:
RedundantSeedCleaner

List of all members.

Public Member Functions

virtual void add (const Trajectory *traj)
 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 int > 
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.

                                     : RedundantSeedCleaner(), theVault(), theCache()
                                            /*, comps_(0), tracks_(0), calls_(0)*/ {}
virtual CachingSeedCleanerByHitPosition::~CachingSeedCleanerByHitPosition ( ) [inline, virtual]

Definition at line 22 of file CachingSeedCleanerByHitPosition.h.

References theCache, and theVault.

{ 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 cond::rpcobgas::detid, UserOptions_cff::idx, Trajectory::recHits(), lumiQTWidget::t, theCache, and theVault.

                                                               {
    typedef Trajectory::RecHitContainer::const_iterator TI;
    unsigned int idx = theVault.size();
    Trajectory::RecHitContainer hits = trj->recHits();
    theVault.push_back(hits);

    uint32_t detid;
    for (TI t = hits.begin(), te = hits.end(); t != te; ++t) {
        if ((*t)->isValid()) {
            detid = (*t)->geographicalId().rawId();
            if (detid) theCache.insert(std::pair<uint32_t, unsigned int>(detid, idx));
        }
    }
}
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.

                                           { 
    //edm::LogInfo("CachingSeedCleanerByHitPosition") << " Calls: " << calls_ << ", Tracks: " << tracks_ <<", Comps: " << comps_ << " Vault: " << theVault.size() << ".";
    //calls_ = comps_ = tracks_ = 0;

    theVault.clear(); theCache.clear();

    std::vector<Trajectory::RecHitContainer> swapper;
    swapper.swap(theVault); // this should clean the vault even more
}
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 cond::rpcobgas::detid, end, RecHitComparatorByPosition::equals(), first, newFWLiteAna::found, prof2calltree::last, TrajectorySeed::recHits(), lumiQTWidget::t, theCache, and theVault.

                                                                     {
    static RecHitComparatorByPosition comp;
    typedef TrajectorySeed::const_iterator SI;
    typedef Trajectory::RecHitContainer::const_iterator TI;
    TrajectorySeed::range range = seed->recHits();

    SI first = range.first, last = range.second, curr;
    uint32_t detid = first->geographicalId().rawId();
    
    std::multimap<uint32_t, unsigned int>::const_iterator it, end = theCache.end();

    //calls_++;
    for (it = theCache.find(detid); (it != end) && (it->first == detid); ++it) {
        //tracks_++;
        TI ts = theVault[it->second].begin(), te = theVault[it->second].end();
        for (curr = first; curr != last; ++curr) {
            bool found = false;
            for (TI t = ts; t != te; ++t) {
                //comps_++;
                if (comp.equals(&(*curr), &(**t))) { found = true; break; }
            }
            if (!found) break;
        }
        if (curr == last) return false;
    }
    return true;
}
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.

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

Member Data Documentation

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