CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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) :
20  detId(detid), firstStrip(first), nStrips(size) {}
21  uint32_t detId;
22  uint16_t firstStrip;
23  uint16_t nStrips;
24  };
25  typedef boost::sub_range<const std::vector<HitRecord> > Links;
26  typedef Links value_type;
27 
29  using std::swap;
32  }
33 
34  Links getLinks(const key_type &key) const ;
35  Links operator[](const key_type &key) const { return getLinks(key); }
36 
37  class Filler {
38  public:
40 
41  // out of line destructor to avoid code bloat
42  ~Filler() ;
43 
44  void insert(const key_type &key, const HitRecord &record);
45 
46  typedef std::map<key_type, std::vector<HitRecord> > Map;
47  const Map & storage() const { return storage_; }
48 
49  unsigned int keySize() const { return num_keys_; }
50  unsigned int dataSize() const { return num_values_; }
51  private:
53  unsigned int num_keys_;
54  unsigned int num_values_;
55  };
57  StripCompactDigiSimLinks(const Filler &filler) ;
58 
59  struct TrackRecord {
61  TrackRecord(key_type k, unsigned int offset) : key(k), start(offset) {}
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 {
71  RevLink(const TrackRecord &track, const HitRecord &hit) :
72  eventId(track.key.first), simTrackId(track.key.second),
73  firstStrip(hit.firstStrip), lastStrip(hit.firstStrip+hit.nStrips-1) {}
75  unsigned int simTrackId;
76  uint16_t firstStrip;
77  uint16_t lastStrip;
78  };
79 
81  std::map<uint32_t, std::vector<RevLink> > makeReverseMap() const ;
82  private:
85  std::vector<TrackRecord> trackRecords_;
86 
87  std::vector<HitRecord> hitRecords_;
88 };
89 
91 #endif
void swap(ora::Record &rh, ora::Record &lh)
Definition: Record.h:70
JetCorrectorParameters::Record record
Definition: classes.h:7
U second(std::pair< T, U > const &p)
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
unsigned int offset(bool)
bool first
Definition: L1TdeRCT.cc:75
int k[5][pyjets_maxn]
double b
Definition: hdecay.h:120
list key
Definition: combine.py:13
double a
Definition: hdecay.h:121
tuple size
Write out results.