CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
CachingSeedCleanerBySharedInput Class Referencefinal

#include <CachingSeedCleanerBySharedInput.h>

Inheritance diagram for CachingSeedCleanerBySharedInput:
RedundantSeedCleaner

Public Member Functions

void add (const Trajectory *traj) override
 Informs the cleaner that a new trajectory has been made, in case the cleaner keeps a local collection of those tracks (i.e. in a map) More...
 
 CachingSeedCleanerBySharedInput (unsigned int numHitsForSeedCleaner=4, bool onlyPixelHits=false)
 
void done () override
 Tells the cleaner that the seeds are finished, and so it can clear any cache it has. More...
 
bool good (const TrajectorySeed *seed) override
 Returns true if the seed is not overlapping with another trajectory. More...
 
void init (const std::vector< Trajectory > *vect) override
 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...
 
- 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

std::unordered_multimap< unsigned int, unsigned int > theCache
 
int theNumHitsForSeedCleaner
 
bool theOnlyPixelHits
 
std::vector< Trajectory::RecHitContainertheVault
 

Detailed Description

Merge of SeedCleanerBySharedInput and CachingSeedCleanerByHitPosition

Definition at line 8 of file CachingSeedCleanerBySharedInput.h.

Constructor & Destructor Documentation

◆ CachingSeedCleanerBySharedInput()

CachingSeedCleanerBySharedInput::CachingSeedCleanerBySharedInput ( unsigned int  numHitsForSeedCleaner = 4,
bool  onlyPixelHits = false 
)
inline

Member Function Documentation

◆ add()

void CachingSeedCleanerBySharedInput::add ( const Trajectory traj)
overridevirtual

Informs the cleaner that a new trajectory has been made, in case the cleaner keeps a local collection of those tracks (i.e. in a map)

Implements RedundantSeedCleaner.

Definition at line 23 of file CachingSeedCleanerBySharedInput.cc.

23  {
24  unsigned int idx = theVault.size();
25  theVault.resize(idx + 1);
26  // a vector of shared pointers....
27  auto &hits = theVault.back();
28  (*trj).validRecHits(hits);
29 
30  for (auto const &h : hits) {
31  auto detid = h->geographicalId().rawId();
32 
33  //For seeds that are made only of pixel hits, it is pointless to store the
34  //information about hits on other sub-detector of the trajectory.
35  if (theOnlyPixelHits && h->geographicalId().subdetId() != PixelSubdetector::PixelBarrel &&
36  h->geographicalId().subdetId() != PixelSubdetector::PixelEndcap)
37  continue;
38  if (detid)
39  theCache.insert(std::pair<uint32_t, unsigned int>(detid, idx));
40  }
41 }

References hfClusterShapes_cfi::hits, training_settings::idx, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, theCache, theOnlyPixelHits, and theVault.

Referenced by counter.Counter::register().

◆ done()

void CachingSeedCleanerBySharedInput::done ( )
overridevirtual

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

Implements RedundantSeedCleaner.

Definition at line 16 of file CachingSeedCleanerBySharedInput.cc.

16  {
17  //edm::LogInfo("CachingSeedCleanerBySharedInput") << " Calls: " << calls_ << ", Tracks: " << tracks_ <<", Comps: " << comps_ << " Vault: " << theVault.size() << ".";
18  //calls_ = comps_ = tracks_ = 0;
19  theVault.clear();
20  theCache.clear();
21 }

References theCache, and theVault.

◆ good()

bool CachingSeedCleanerBySharedInput::good ( const TrajectorySeed seed)
overridevirtual

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

Implements RedundantSeedCleaner.

Definition at line 43 of file CachingSeedCleanerBySharedInput.cc.

43  {
44  if (seed->nHits() == 0) {
45  return true;
46  }
47 
48  auto range = seed->recHits();
49 
50  auto first = range.first;
51  auto last = range.second;
52  auto detid = first->geographicalId().rawId();
53 
54  //calls_++;
55  auto itrange = theCache.equal_range(detid);
56  for (auto it = itrange.first; it != itrange.second; ++it) {
57  assert(it->first == detid);
58  //tracks_++;
59 
60  // seeds are limited to the first "theNumHitsForSeedCleaner" hits in trajectory...
61  int ext = std::min(theNumHitsForSeedCleaner, int(theVault[it->second].size()));
62  auto ts = theVault[it->second].begin();
63  auto te = ts + ext;
64  auto t = ts;
65  auto curr = first;
66  for (; curr != last; ++curr) {
67  bool found = false;
68  for (; t != te; ++t) {
69  //comps_++;
70  if (curr->sharesInput((**t).hit(), TrackingRecHit::all)) {
71  found = true;
72  ++t;
73  break;
74  }
75  }
76  if (!found)
77  break;
78  }
79  if (curr == last)
80  return false;
81  }
82  return true;
83 }

References TrackingRecHit::all, cms::cuda::assert(), dqmdumpme::first, newFWLiteAna::found, dqmdumpme::last, min(), FastTimerService_cff::range, SurveyInfoScenario_cff::seed, OrderedSet::t, theCache, theNumHitsForSeedCleaner, and theVault.

◆ init()

void CachingSeedCleanerBySharedInput::init ( const std::vector< Trajectory > *  vect)
overridevirtual

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 11 of file CachingSeedCleanerBySharedInput.cc.

11  {
12  theVault.clear();
13  theCache.clear();
14 }

References theCache, and theVault.

Member Data Documentation

◆ theCache

std::unordered_multimap<unsigned int, unsigned int> CachingSeedCleanerBySharedInput::theCache
private

Definition at line 26 of file CachingSeedCleanerBySharedInput.h.

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

◆ theNumHitsForSeedCleaner

int CachingSeedCleanerBySharedInput::theNumHitsForSeedCleaner
private

Definition at line 28 of file CachingSeedCleanerBySharedInput.h.

Referenced by good().

◆ theOnlyPixelHits

bool CachingSeedCleanerBySharedInput::theOnlyPixelHits
private

Definition at line 29 of file CachingSeedCleanerBySharedInput.h.

Referenced by add().

◆ theVault

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

Definition at line 25 of file CachingSeedCleanerBySharedInput.h.

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

ext
Definition: memstream.h:15
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
PixelSubdetector::PixelEndcap
Definition: PixelSubdetector.h:11
PixelSubdetector::PixelBarrel
Definition: PixelSubdetector.h:11
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
min
T min(T a, T b)
Definition: MathUtil.h:58
cms::cuda::assert
assert(be >=bs)
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
training_settings.idx
idx
Definition: training_settings.py:16
dqmdumpme.first
first
Definition: dqmdumpme.py:55
dqmdumpme.last
last
Definition: dqmdumpme.py:56
h
OrderedSet.t
t
Definition: OrderedSet.py:90
CachingSeedCleanerBySharedInput::theOnlyPixelHits
bool theOnlyPixelHits
Definition: CachingSeedCleanerBySharedInput.h:29
TrackingRecHit::all
Definition: TrackingRecHit.h:59
CachingSeedCleanerBySharedInput::theVault
std::vector< Trajectory::RecHitContainer > theVault
Definition: CachingSeedCleanerBySharedInput.h:25
CachingSeedCleanerBySharedInput::theCache
std::unordered_multimap< unsigned int, unsigned int > theCache
Definition: CachingSeedCleanerBySharedInput.h:26
HLT_FULL_cff.numHitsForSeedCleaner
numHitsForSeedCleaner
Definition: HLT_FULL_cff.py:107400
CachingSeedCleanerBySharedInput::theNumHitsForSeedCleaner
int theNumHitsForSeedCleaner
Definition: CachingSeedCleanerBySharedInput.h:28
SurveyInfoScenario_cff.seed
seed
Definition: SurveyInfoScenario_cff.py:295