CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
StripCompactDigiSimLinks.cc
Go to the documentation of this file.
2 
3 #include <algorithm>
4 #include <boost/foreach.hpp>
5 
6 
9 {
10  std::vector<TrackRecord>::const_iterator last = trackRecords_.end();
11  std::vector<TrackRecord>::const_iterator match = std::lower_bound(trackRecords_.begin(), last, key);
12  if ((match != last) && (*match == key)) {
13  // std::vector<TrackRecord>::const_iterator next = match+1;
14  unsigned int end = (match+1 == last ? hitRecords_.size() : (match+1)->start);
15  return Links(hitRecords_.begin()+match->start, hitRecords_.begin()+end);
16  } else {
17  return Links(hitRecords_.end(), hitRecords_.end());
18  }
19 }
20 
22 {
23  trackRecords_.reserve(filler.keySize());
24  hitRecords_.reserve(filler.dataSize());
25  BOOST_FOREACH( const Filler::Map::value_type &pair, filler.storage() ) {
26  trackRecords_.push_back(TrackRecord(pair.first, hitRecords_.size()));
27  hitRecords_.insert(hitRecords_.end(), pair.second.begin(), pair.second.end());
28  }
29 }
30 
32 }
33 
34 void
36 {
37  Filler::Map::iterator it = storage_.find(key);
38  if (it == storage_.end()) {
39  storage_.insert(std::make_pair(key, std::vector<HitRecord>(1,record)));
40  num_keys_++;
41  num_values_++;
42  } else {
43  it->second.push_back(record);
44  num_values_++;
45  }
46 }
47 
48 std::map<uint32_t, std::vector<StripCompactDigiSimLinks::RevLink> >
50 {
51  std::map<uint32_t, std::vector<StripCompactDigiSimLinks::RevLink> > ret;
52  typedef std::vector<TrackRecord>::const_iterator trk_it;
53  typedef std::vector<HitRecord>::const_iterator hit_it;
54  hit_it hstart = hitRecords_.begin(), ith = hstart;
55  for (trk_it itt = trackRecords_.begin(), endt = trackRecords_.end(); itt != endt; ++itt) {
56  hit_it edh = (itt+1 != endt ? hstart + (itt+1)->start : hitRecords_.end());
57  for (; ith < edh; ++ith) {
58  ret[ith->detId].push_back(RevLink(*itt, *ith));
59  }
60  }
61  return ret;
62 }
63 
tuple start
Check for commandline option errors.
Definition: dqm_diff.py:58
#define end
Definition: vmac.h:37
Container::value_type value_type
list key
Definition: combine.py:13
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6