CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Attributes
StripCompactDigiSimLinks Class Reference

#include <StripCompactDigiSimLinks.h>

Classes

class  Filler
 
struct  HitRecord
 
struct  RevLink
 
struct  TrackRecord
 

Public Types

typedef std::pair< EncodedEventId, unsigned int > key_type
 
typedef boost::sub_range< const std::vector< HitRecord > > Links
 
typedef Links value_type
 

Public Member Functions

Links getLinks (const key_type &key) const
 
std::map< uint32_t, std::vector< RevLink > > makeReverseMap () const
 Make the map in the reverse direction. SLOW! call it only once. More...
 
Links operator[] (const key_type &key) const
 
 StripCompactDigiSimLinks ()
 Empty constructor, for ROOT persistence. More...
 
 StripCompactDigiSimLinks (const Filler &filler)
 This is the real constructor you will use. More...
 
void swap (StripCompactDigiSimLinks &other)
 
 ~StripCompactDigiSimLinks ()
 

Private Attributes

std::vector< HitRecordhitRecords_
 
std::vector< TrackRecordtrackRecords_
 

Detailed Description

Definition at line 11 of file StripCompactDigiSimLinks.h.

Member Typedef Documentation

◆ key_type

typedef std::pair<EncodedEventId, unsigned int> StripCompactDigiSimLinks::key_type

Definition at line 17 of file StripCompactDigiSimLinks.h.

◆ Links

typedef boost::sub_range<const std::vector<HitRecord> > StripCompactDigiSimLinks::Links

Definition at line 25 of file StripCompactDigiSimLinks.h.

◆ value_type

Definition at line 26 of file StripCompactDigiSimLinks.h.

Constructor & Destructor Documentation

◆ StripCompactDigiSimLinks() [1/2]

StripCompactDigiSimLinks::StripCompactDigiSimLinks ( )
inline

Empty constructor, for ROOT persistence.

Definition at line 14 of file StripCompactDigiSimLinks.h.

14 {}

◆ ~StripCompactDigiSimLinks()

StripCompactDigiSimLinks::~StripCompactDigiSimLinks ( )
inline

Definition at line 15 of file StripCompactDigiSimLinks.h.

15 {}

◆ StripCompactDigiSimLinks() [2/2]

StripCompactDigiSimLinks::StripCompactDigiSimLinks ( const Filler filler)

This is the real constructor you will use.

Definition at line 17 of file StripCompactDigiSimLinks.cc.

17  {
18  trackRecords_.reserve(filler.keySize());
19  hitRecords_.reserve(filler.dataSize());
20  for (auto const &pair : filler.storage()) {
21  trackRecords_.push_back(TrackRecord(pair.first, hitRecords_.size()));
22  hitRecords_.insert(hitRecords_.end(), pair.second.begin(), pair.second.end());
23  }
24 }

References trigObjTnPSource_cfi::filler, hitRecords_, and trackRecords_.

Member Function Documentation

◆ getLinks()

StripCompactDigiSimLinks::Links StripCompactDigiSimLinks::getLinks ( const key_type key) const

Definition at line 5 of file StripCompactDigiSimLinks.cc.

5  {
6  std::vector<TrackRecord>::const_iterator last = trackRecords_.end();
7  std::vector<TrackRecord>::const_iterator match = std::lower_bound(trackRecords_.begin(), last, key);
8  if ((match != last) && (*match == key)) {
9  // std::vector<TrackRecord>::const_iterator next = match+1;
10  unsigned int end = (match + 1 == last ? hitRecords_.size() : (match + 1)->start);
11  return Links(hitRecords_.begin() + match->start, hitRecords_.begin() + end);
12  } else {
13  return Links(hitRecords_.end(), hitRecords_.end());
14  }
15 }

References mps_fire::end, hitRecords_, crabWrapper::key, dqmdumpme::last, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, match(), and trackRecords_.

Referenced by operator[]().

◆ makeReverseMap()

std::map< uint32_t, std::vector< StripCompactDigiSimLinks::RevLink > > StripCompactDigiSimLinks::makeReverseMap ( ) const

Make the map in the reverse direction. SLOW! call it only once.

Definition at line 41 of file StripCompactDigiSimLinks.cc.

41  {
42  std::map<uint32_t, std::vector<StripCompactDigiSimLinks::RevLink> > ret;
43  typedef std::vector<TrackRecord>::const_iterator trk_it;
44  typedef std::vector<HitRecord>::const_iterator hit_it;
45  hit_it hstart = hitRecords_.begin(), ith = hstart;
46  for (trk_it itt = trackRecords_.begin(), endt = trackRecords_.end(); itt != endt; ++itt) {
47  hit_it edh = (itt + 1 != endt ? hstart + (itt + 1)->start : hitRecords_.end());
48  for (; ith < edh; ++ith) {
49  ret[ith->detId].push_back(RevLink(*itt, *ith));
50  }
51  }
52  return ret;
53 }

References hitRecords_, runTheMatrix::ret, and trackRecords_.

◆ operator[]()

Links StripCompactDigiSimLinks::operator[] ( const key_type key) const
inline

Definition at line 35 of file StripCompactDigiSimLinks.h.

35 { return getLinks(key); }

References getLinks(), and crabWrapper::key.

◆ swap()

void StripCompactDigiSimLinks::swap ( StripCompactDigiSimLinks other)
inline

Definition at line 28 of file StripCompactDigiSimLinks.h.

28  {
29  using std::swap;
30  swap(trackRecords_, other.trackRecords_);
31  swap(hitRecords_, other.hitRecords_);
32  }

References hitRecords_, trackingPlots::other, std::swap(), and trackRecords_.

Member Data Documentation

◆ hitRecords_

std::vector<HitRecord> StripCompactDigiSimLinks::hitRecords_
private

◆ trackRecords_

std::vector<TrackRecord> StripCompactDigiSimLinks::trackRecords_
private

These MUST be sorted at the same time by key and by start The rule is enforced by allowing to create this only through a Filler

Definition at line 89 of file StripCompactDigiSimLinks.h.

Referenced by getLinks(), makeReverseMap(), StripCompactDigiSimLinks(), and swap().

runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:542
start
Definition: start.py:1
dqmdumpme.last
last
Definition: dqmdumpme.py:56
std::swap
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition: DataFrameContainer.h:209
mps_fire.end
end
Definition: mps_fire.py:242
trackingPlots.other
other
Definition: trackingPlots.py:1460
pfDeepBoostedJetPreprocessParams_cfi.lower_bound
lower_bound
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:15
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
crabWrapper.key
key
Definition: crabWrapper.py:19