CMS 3D CMS Logo

MkFitHitIndexMap.h
Go to the documentation of this file.
1 #ifndef RecoTracker_MkFit_MkFitHitIndexMap_h
2 #define RecoTracker_MkFit_MkFitHitIndexMap_h
3 
5 
6 #include <vector>
7 
8 class TrackingRecHit;
9 
16 public:
17  // This class holds the index and layer of a hit in the hit data
18  // structure passed to mkFit
19  class MkFitHit {
20  public:
21  MkFitHit() = default;
22  explicit MkFitHit(int i, int l) : index_{i}, layer_{l} {}
23 
24  int index() const { return index_; }
25  int layer() const { return layer_; }
26 
27  private:
28  int index_ = -1;
29  int layer_ = -1;
30  };
31 
32  MkFitHitIndexMap() = default;
33 
38 
45  void increaseLayerSize(int layer, size_t additionalSize);
46 
56 
58  const MkFitHit& mkFitHit(edm::ProductID id, size_t clusterIndex) const;
59 
61  const TrackingRecHit* hitPtr(MkFitHit hit) const { return mkFitToCMSSW_.at(hit.layer()).at(hit.index()).ptr; }
62 
64  size_t clusterIndex(MkFitHit hit) const { return mkFitToCMSSW_.at(hit.layer()).at(hit.index()).clusterIndex; }
65 
66 private:
67  // Helper struct to map (edm::ProductID, cluster index) to MkFitHit
71  std::vector<MkFitHit> mkFitHits; // indexed by cluster index
72  };
73 
74  // Helper struct to map MkFitHit to (TrackingRecHit *, cluster index)
75  struct CMSSWHit {
76  CMSSWHit() = default;
77  explicit CMSSWHit(const TrackingRecHit* p, size_t i) : ptr{p}, clusterIndex{i} {}
78  const TrackingRecHit* ptr = nullptr;
79  size_t clusterIndex = 0;
80  };
81 
82  std::vector<ClusterToMkFitHit> cmsswToMkFit_; // mapping from CMSSW(ProductID, cluster index) -> mkFit(index, layer)
83  std::vector<std::vector<CMSSWHit> > mkFitToCMSSW_; // reverse mapping, mkFit(layer, index) -> CMSSW hit
84 };
85 
86 #endif
MkFitHitIndexMap::ClusterToMkFitHit::ClusterToMkFitHit
ClusterToMkFitHit(edm::ProductID id)
Definition: MkFitHitIndexMap.h:69
MkFitHitIndexMap::CMSSWHit::CMSSWHit
CMSSWHit()=default
mps_fire.i
i
Definition: mps_fire.py:428
MkFitHitIndexMap::mkFitToCMSSW_
std::vector< std::vector< CMSSWHit > > mkFitToCMSSW_
Definition: MkFitHitIndexMap.h:83
MkFitHitIndexMap::CMSSWHit
Definition: MkFitHitIndexMap.h:75
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
MkFitHitIndexMap::clusterIndex
size_t clusterIndex(MkFitHit hit) const
Get CMSSW cluster index (currently used only for debugging)
Definition: MkFitHitIndexMap.h:64
MkFitHitIndexMap::ClusterToMkFitHit::productID
edm::ProductID productID
Definition: MkFitHitIndexMap.h:70
MkFitHitIndexMap::resizeByClusterIndex
void resizeByClusterIndex(edm::ProductID id, size_t clusterIndex)
Definition: MkFitHitIndexMap.cc:22
MkFitHitIndexMap::CMSSWHit::ptr
const TrackingRecHit * ptr
Definition: MkFitHitIndexMap.h:78
MkFitHitIndexMap::hitPtr
const TrackingRecHit * hitPtr(MkFitHit hit) const
Get CMSSW hit pointer.
Definition: MkFitHitIndexMap.h:61
MkFitHitIndexMap::increaseLayerSize
void increaseLayerSize(int layer, size_t additionalSize)
Definition: MkFitHitIndexMap.cc:26
MkFitHitIndexMap::MkFitHitIndexMap
MkFitHitIndexMap()=default
MkFitHitIndexMap::MkFitHit::MkFitHit
MkFitHit()=default
ProductID.h
MkFitHitIndexMap::mkFitHit
const MkFitHit & mkFitHit(edm::ProductID id, size_t clusterIndex) const
Get mkFit hit index and layer.
Definition: MkFitHitIndexMap.cc:51
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
MkFitHitIndexMap::MkFitHit::index_
int index_
Definition: MkFitHitIndexMap.h:28
MkFitHitIndexMap::insert
void insert(edm::ProductID id, size_t clusterIndex, MkFitHit hit, const TrackingRecHit *hitPtr)
Definition: MkFitHitIndexMap.cc:33
MkFitHitIndexMap::ClusterToMkFitHit
Definition: MkFitHitIndexMap.h:68
MkFitHitIndexMap::cmsswToMkFit_
std::vector< ClusterToMkFitHit > cmsswToMkFit_
Definition: MkFitHitIndexMap.h:82
MkFitHitIndexMap::ClusterToMkFitHit::mkFitHits
std::vector< MkFitHit > mkFitHits
Definition: MkFitHitIndexMap.h:71
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
TrackingRecHit
Definition: TrackingRecHit.h:21
MkFitHitIndexMap
Definition: MkFitHitIndexMap.h:15
MkFitHitIndexMap::MkFitHit::layer_
int layer_
Definition: MkFitHitIndexMap.h:29
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
MkFitHitIndexMap::MkFitHit::index
int index() const
Definition: MkFitHitIndexMap.h:24
MkFitHitIndexMap::MkFitHit::MkFitHit
MkFitHit(int i, int l)
Definition: MkFitHitIndexMap.h:22
MkFitHitIndexMap::CMSSWHit::clusterIndex
size_t clusterIndex
Definition: MkFitHitIndexMap.h:79
MkFitHitIndexMap::MkFitHit
Definition: MkFitHitIndexMap.h:19
MkFitHitIndexMap::MkFitHit::layer
int layer() const
Definition: MkFitHitIndexMap.h:25
MkFitHitIndexMap::CMSSWHit::CMSSWHit
CMSSWHit(const TrackingRecHit *p, size_t i)
Definition: MkFitHitIndexMap.h:77
edm::ProductID
Definition: ProductID.h:27
hit
Definition: SiStripHitEffFromCalibTree.cc:88