CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 <vector>
7 #include <boost/range.hpp>
9 #include <cstdint>
10 
12 public:
16 
17  typedef std::pair<EncodedEventId, unsigned int> key_type;
18  struct HitRecord {
19  HitRecord() {}
20  HitRecord(uint32_t detid, uint16_t first, uint16_t size) : 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 
52  private:
54  unsigned int num_keys_;
55  unsigned int num_values_;
56  };
58  StripCompactDigiSimLinks(const Filler &filler);
59 
60  struct TrackRecord {
62  TrackRecord(key_type k, unsigned int offset) : key(k), start(offset) {}
64  unsigned int start; // first index in HitRecord
65  //unsigned int length;
66  inline bool operator<(const TrackRecord &other) const { return key < other.key; }
67  inline bool operator<(const key_type &otherKey) const { return key < otherKey; }
68  inline bool operator==(const key_type &otherKey) const { return key == otherKey; }
69  };
70 
71  struct RevLink {
73  : eventId(track.key.first),
74  simTrackId(track.key.second),
76  lastStrip(hit.firstStrip + hit.nStrips - 1) {}
78  unsigned int simTrackId;
79  uint16_t firstStrip;
80  uint16_t lastStrip;
81  };
82 
84  std::map<uint32_t, std::vector<RevLink> > makeReverseMap() const;
85 
86 private:
89  std::vector<TrackRecord> trackRecords_;
90 
91  std::vector<HitRecord> hitRecords_;
92 };
93 
95 #endif
tuple nStrips
1.2 is to make the matching window safely the two nearest strips 0.35 is the size of an ME0 chamber i...
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:117
U second(std::pair< T, U > const &p)
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
tuple key
prepare the HTCondor submission files and eventually submit them
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119
tuple size
Write out results.