CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
CachingSeedCleanerBySharedInput Class Reference

#include <CachingSeedCleanerBySharedInput.h>

Inheritance diagram for CachingSeedCleanerBySharedInput:
RedundantSeedCleaner

Public Member Functions

virtual void add (const Trajectory *traj)
 
 CachingSeedCleanerBySharedInput ()
 
virtual void done ()
 Tells the cleaner that the seeds are finished, and so it can clear any cache it has. More...
 
virtual bool good (const TrajectorySeed *seed)
 Returns true if the seed is not overlapping with another trajectory. More...
 
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. More...
 
virtual ~CachingSeedCleanerBySharedInput ()
 
- Public Member Functions inherited from RedundantSeedCleaner
void clean (const std::vector< TrajectorySeed > &, std::vector< TrajectorySeed > &)
 clean More...
 
void define (std::vector< TrajectorySeed > &)
 collection definition More...
 
 RedundantSeedCleaner ()
 constructor More...
 
virtual ~RedundantSeedCleaner ()
 
 ~RedundantSeedCleaner ()
 destructor More...
 

Private Attributes

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

Detailed Description

Merge of SeedCleanerBySharedInput and CachingSeedCleanerByHitPosition

Definition at line 8 of file CachingSeedCleanerBySharedInput.h.

Constructor & Destructor Documentation

CachingSeedCleanerBySharedInput::CachingSeedCleanerBySharedInput ( )
inline

Definition at line 22 of file CachingSeedCleanerBySharedInput.h.

23  /*,comps_(0), tracks_(0), calls_(0)*/ {}
RedundantSeedCleaner()
constructor
std::vector< Trajectory::RecHitContainer > theVault
boost::unordered_multimap< uint32_t, unsigned short > theCache
virtual CachingSeedCleanerBySharedInput::~CachingSeedCleanerBySharedInput ( )
inlinevirtual

Definition at line 24 of file CachingSeedCleanerBySharedInput.h.

References theCache, and theVault.

24 { theVault.clear(); theCache.clear(); }
std::vector< Trajectory::RecHitContainer > theVault
boost::unordered_multimap< uint32_t, unsigned short > theCache

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 cond::rpcobgas::detid, matplotRender::t, theCache, and theVault.

27  {
28  typedef Trajectory::RecHitContainer::const_iterator TI;
29  unsigned short idx = theVault.size();
30  theVault.resize(idx+1);
31  // a vector of shared pointers....
33  (*trj).validRecHits(hits);
34  // std::sort(hits.begin(),hits.end(),
35  // boost::bind(&TrackingRecHit::geographicalId(),_1));
36 
37  uint32_t detid;
38  for (TI t = hits.begin(), te = hits.end(); t != te; ++t) {
39  // if ((*t)->isValid()) { // they are valid!
40  detid = (*t)->geographicalId().rawId();
41  if (detid) theCache.insert(std::pair<uint32_t, unsigned short>(detid, idx));
42  }
43 }
TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer
Definition: Trajectory.h:43
std::vector< Trajectory::RecHitContainer > theVault
boost::unordered_multimap< uint32_t, unsigned short > theCache
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.

14  {
15  //edm::LogInfo("CachingSeedCleanerBySharedInput") << " Calls: " << calls_ << ", Tracks: " << tracks_ <<", Comps: " << comps_ << " Vault: " << theVault.size() << ".";
16  //calls_ = comps_ = tracks_ = 0;
17  theVault.clear(); theCache.clear();
18 
19  //don't, at least we'll not copy vector by value!
20 
21  // std::vector<Trajectory::RecHitContainer> swapper;
22  //swapper.swap(theVault); // this should clean the vault even more
23 }
std::vector< Trajectory::RecHitContainer > theVault
boost::unordered_multimap< uint32_t, unsigned short > theCache
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, cond::rpcobgas::detid, first, newFWLiteAna::found, prof2calltree::last, min, TrajectorySeed::nHits(), TrajectorySeed::recHits(), matplotRender::t, theCache, and theVault.

45  {
46  if (seed->nHits()==0){ return true; }
47 
49  typedef Trajectory::RecHitContainer::const_iterator TI;
50  TrajectorySeed::range range = seed->recHits();
51 
52  SI first = range.first, last = range.second, curr;
53  uint32_t detid = first->geographicalId().rawId();
54 
55  //std::multimap<uint32_t, unsigned short>::const_iterator it, end = theCache.end();
56  typedef boost::unordered_multimap<uint32_t, unsigned short>::const_iterator IT;
57  IT it; std::pair<IT,IT> itrange;
58 
59 
60  //calls_++;
61  //for (it = theCache.find(detid); (it != end) && (it->first == detid); ++it) {
62  for (itrange = theCache.equal_range(detid), it = itrange.first; it != itrange.second; ++it) {
63  assert(it->first == detid);
64  //tracks_++;
65 
66  // seeds are limited to the first 4 hits in trajectory...
67  int ext = std::min(4,int(theVault[it->second].size()));
68  TI te = theVault[it->second].begin()+ext;
69  // TI te = theVault[it->second].end();
70 
71  TI ts = theVault[it->second].begin();
72  TI t = ts;
73  for (curr = first; curr != last; ++curr) {
74  bool found = false;
75  // for (TI t = ts; t != te; ++t) {
76  for (;t != te; ++t) {
77  //comps_++;
78  if ( curr->sharesInput((**t).hit(),TrackingRecHit::all) ) { found = true; ++t; break; }
79  }
80  if (!found) break;
81  }
82  if (curr == last) return false;
83  }
84  return true;
85 }
#define min(a, b)
Definition: mlp_lapack.h:161
recHitContainer::const_iterator const_iterator
std::pair< const_iterator, const_iterator > range
std::vector< Trajectory::RecHitContainer > theVault
std::vector< LinkConnSpec >::const_iterator IT
bool first
Definition: L1TdeRCT.cc:79
boost::unordered_multimap< uint32_t, unsigned short > theCache
range recHits() const
unsigned int nHits() const
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.

10  {
11  theVault.clear(); theCache.clear();
12 }
std::vector< Trajectory::RecHitContainer > theVault
boost::unordered_multimap< uint32_t, unsigned short > theCache

Member Data Documentation

boost::unordered_multimap<uint32_t, unsigned short> CachingSeedCleanerBySharedInput::theCache
private
std::vector<Trajectory::RecHitContainer> CachingSeedCleanerBySharedInput::theVault
private