CMS 3D CMS Logo

StripCompactDigiSimLinks.cc
Go to the documentation of this file.
2 
3 #include <algorithm>
4 
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 }
16 
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 }
25 
27 
30  Filler::Map::iterator it = storage_.find(key);
31  if (it == storage_.end()) {
32  storage_.insert(std::make_pair(key, std::vector<HitRecord>(1, record)));
33  num_keys_++;
34  num_values_++;
35  } else {
36  it->second.push_back(record);
37  num_values_++;
38  }
39 }
40 
41 std::map<uint32_t, std::vector<StripCompactDigiSimLinks::RevLink> > StripCompactDigiSimLinks::makeReverseMap() const {
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 }
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:543
start
Definition: start.py:1
dqmdumpme.last
last
Definition: dqmdumpme.py:56
mps_fire.end
end
Definition: mps_fire.py:242
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
AlCaHarvesting_cff.record
record
Definition: AlCaHarvesting_cff.py:42
crabWrapper.key
key
Definition: crabWrapper.py:19