CMS 3D CMS Logo

StripCompactDigiSimLinks.h
Go to the documentation of this file.
1 #ifndef SimDataFormats_TrackerDigiSimLink_interface_StripCompactDigiSimLinks_h
2 #define SimDataFormats_TrackerDigiSimLink_interface_StripCompactDigiSimLinks_h
3 
4 #include <map>
5 #include <algorithm>
6 #include <boost/cstdint.hpp>
7 #include <boost/range.hpp>
9 
11 public:
15 
16  typedef std::pair<EncodedEventId, unsigned int> key_type;
17  struct HitRecord {
18  HitRecord() {}
19  HitRecord(uint32_t detid, uint16_t first, uint16_t size) : detId(detid), firstStrip(first), nStrips(size) {}
20  uint32_t detId;
21  uint16_t firstStrip;
22  uint16_t nStrips;
23  };
24  typedef boost::sub_range<const std::vector<HitRecord> > Links;
25  typedef Links value_type;
26 
28  using std::swap;
31  }
32 
33  Links getLinks(const key_type &key) const;
34  Links operator[](const key_type &key) const { return getLinks(key); }
35 
36  class Filler {
37  public:
38  Filler() : storage_(), num_keys_(0), num_values_(0) {}
39 
40  // out of line destructor to avoid code bloat
41  ~Filler();
42 
43  void insert(const key_type &key, const HitRecord &record);
44 
45  typedef std::map<key_type, std::vector<HitRecord> > Map;
46  const Map &storage() const { return storage_; }
47 
48  unsigned int keySize() const { return num_keys_; }
49  unsigned int dataSize() const { return num_values_; }
50 
51  private:
52  Map storage_;
53  unsigned int num_keys_;
54  unsigned int num_values_;
55  };
58 
59  struct TrackRecord {
61  TrackRecord(key_type k, unsigned int offset) : key(k), start(offset) {}
62  key_type key;
63  unsigned int start; // first index in HitRecord
64  //unsigned int length;
65  inline bool operator<(const TrackRecord &other) const { return key < other.key; }
66  inline bool operator<(const key_type &otherKey) const { return key < otherKey; }
67  inline bool operator==(const key_type &otherKey) const { return key == otherKey; }
68  };
69 
70  struct RevLink {
72  : eventId(track.key.first),
73  simTrackId(track.key.second),
75  lastStrip(hit.firstStrip + hit.nStrips - 1) {}
77  unsigned int simTrackId;
78  uint16_t firstStrip;
79  uint16_t lastStrip;
80  };
81 
83  std::map<uint32_t, std::vector<RevLink> > makeReverseMap() const;
84 
85 private:
88  std::vector<TrackRecord> trackRecords_;
89 
90  std::vector<HitRecord> hitRecords_;
91 };
92 
94 #endif
size
Write out results.
Definition: start.py:1
JetCorrectorParameters::Record record
Definition: classes.h:7
U second(std::pair< T, U > const &p)
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
Definition: HCMethods.h:50
int k[5][pyjets_maxn]
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121