CMS 3D CMS Logo

FakeCPE.h
Go to the documentation of this file.
1 #ifndef RecoLocalTracker_Cluster_Parameter_Estimator_Fake_H
2 #define RecoLocalTracker_Cluster_Parameter_Estimator_Fake_H
3 
6 
8 
11 
12 #include <cstdint>
13 #include <unordered_map>
14 
16 
17 class FakeCPE {
18 public:
19  using LocalValues = std::pair<LocalPoint, LocalError>;
20 
21  // store position and error for each cluster...
22  class Map {
23  public:
24  using LocalValues = std::pair<LocalPoint, LocalError>;
25  void clear() { m_map.clear(); }
26  void error(const GeomDetUnit& gd) const {
27  edm::LogError("FakeCPE") << "hit not found in det " << gd.geographicalId().rawId();
28  }
29  template <typename Cluster>
30  void add(const Cluster& cluster, const GeomDetUnit& gd, LocalValues const& lv) {
31  m_map[encode(cluster, gd)] = lv;
32  }
33 
34  template <typename Cluster>
35  LocalValues const& get(const Cluster& cluster, const GeomDetUnit& gd) const {
36  auto p = m_map.find(encode(cluster, gd));
37  if (p != m_map.end()) {
38  return (*p).second;
39  }
40  error(gd);
41  return dummy;
42  }
43 
44  static uint64_t encode(const SiPixelCluster& cluster, const GeomDetUnit& det) {
45  uint64_t u1 = det.geographicalId().rawId();
46  uint64_t u2 = cluster.minPixelRow();
47  uint64_t u3 = cluster.minPixelCol();
48  return (u1 << 32) | (u2 << 16) | u3;
49  }
50  static uint64_t encode(const SiStripCluster& cluster, const GeomDetUnit& det) {
51  uint64_t u1 = det.geographicalId().rawId();
52  uint64_t u2 = cluster.firstStrip();
53  return (u1 << 32) | u2;
54  }
55 
56  private:
57  std::unordered_map<uint64_t, LocalValues> m_map;
59  };
60 
61  Map& map() { return m_map; }
62  Map const& map() const { return m_map; }
63 
64 private:
66 };
67 
68 #endif
SiPixelCluster::minPixelCol
int minPixelCol() const
Definition: SiPixelCluster.h:144
MessageLogger.h
GeomDet
Definition: GeomDet.h:27
FakeCPE::Map::LocalValues
std::pair< LocalPoint, LocalError > LocalValues
Definition: FakeCPE.h:24
FakeCPE::Map::dummy
LocalValues dummy
Definition: FakeCPE.h:58
FakeCPE::Map::add
void add(const Cluster &cluster, const GeomDetUnit &gd, LocalValues const &lv)
Definition: FakeCPE.h:30
FakeCPE::m_map
Map m_map
Definition: FakeCPE.h:65
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
SiPixelCluster.h
FakeCPE::LocalValues
std::pair< LocalPoint, LocalError > LocalValues
Definition: FakeCPE.h:19
SiPixelCluster
Pixel cluster – collection of neighboring pixels above threshold.
Definition: SiPixelCluster.h:28
SiStripCluster::firstStrip
uint16_t firstStrip() const
Definition: SiStripCluster.h:46
FakeCPE::Map::encode
static uint64_t encode(const SiStripCluster &cluster, const GeomDetUnit &det)
Definition: FakeCPE.h:50
LocalError.h
SiPixelCluster::minPixelRow
int minPixelRow() const
Definition: SiPixelCluster.h:142
FakeCPE::map
Map const & map() const
Definition: FakeCPE.h:62
FakeCPE::Map::clear
void clear()
Definition: FakeCPE.h:25
GeomDet::geographicalId
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
FakeCPE::Map::m_map
std::unordered_map< uint64_t, LocalValues > m_map
Definition: FakeCPE.h:57
SiStripCluster.h
FakeCPE
Definition: FakeCPE.h:17
FakeCPE::Map::error
void error(const GeomDetUnit &gd) const
Definition: FakeCPE.h:26
testProducerWithPsetDescEmpty_cfi.u3
u3
Definition: testProducerWithPsetDescEmpty_cfi.py:50
testProducerWithPsetDescEmpty_cfi.u1
u1
Definition: testProducerWithPsetDescEmpty_cfi.py:49
FakeCPE::Map::get
LocalValues const & get(const Cluster &cluster, const GeomDetUnit &gd) const
Definition: FakeCPE.h:35
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
FakeCPE::map
Map & map()
Definition: FakeCPE.h:61
GeomDet.h
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
LocalPoint.h
FakeCPE::Map::encode
static uint64_t encode(const SiPixelCluster &cluster, const GeomDetUnit &det)
Definition: FakeCPE.h:44
cond::uint64_t
unsigned long long uint64_t
Definition: Time.h:13
MetAnalyzer.u2
u2
Definition: MetAnalyzer.py:61
SiStripCluster
Definition: SiStripCluster.h:8
FakeCPE::Map
Definition: FakeCPE.h:22