CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SiStripMatchedRecHit2D.h
Go to the documentation of this file.
1 #ifndef SiStripMatchedRecHit2D_H
2 #define SiStripMatchedRecHit2D_H
3 
5 
6 #include "TkCloner.h"
7 
9 public:
11 
14 
16  const LocalError& err,
17  GeomDet const& idet,
18  const SiStripRecHit2D* rMono,
19  const SiStripRecHit2D* rStereo)
20  : BaseTrackerRecHit(pos, err, idet, trackerHitRTTI::match),
21  clusterMono_(rMono->omniClusterRef()),
22  clusterStereo_(rStereo->omniClusterRef()) {}
23 
24  // by value, as they will not exists anymore...
27 
28  unsigned int stereoId() const { return rawId() + 1; }
29  unsigned int monoId() const { return rawId() + 2; }
30 
31  // (to be improved)
32  OmniClusterRef const& firstClusterRef() const override { return monoClusterRef(); }
33 
34  OmniClusterRef const& stereoClusterRef() const { return clusterStereo_; }
35  OmniClusterRef const& monoClusterRef() const { return clusterMono_; }
36  // Non const variants needed for cluster re-keying
39 
41  SiStripCluster const& monoCluster() const { return monoClusterRef().stripCluster(); }
42 
43  SiStripMatchedRecHit2D* clone() const override { return new SiStripMatchedRecHit2D(*this); }
44 #ifndef __GCCXML__
45  RecHitPointer cloneSH() const override { return std::make_shared<SiStripMatchedRecHit2D>(*this); }
46 #endif
47 
48  int dimension() const override { return 2; }
49  void getKfComponents(KfComponentsHolder& holder) const override { getKfComponents2D(holder); }
50 
51  bool sharesInput(const TrackingRecHit* other, SharedInputType what) const override;
52 
53  bool sharesInput(TrackerSingleRecHit const& other) const;
54 
55  std::vector<const TrackingRecHit*> recHits() const override;
56 
57  std::vector<TrackingRecHit*> recHits() override;
58 
59  bool canImproveWithTrack() const override { return true; }
60 
61 private:
62  // double dispatch
63  SiStripMatchedRecHit2D* clone_(TkCloner const& cloner, TrajectoryStateOnSurface const& tsos) const override {
64  return cloner(*this, tsos).release();
65  }
66 #ifndef __GCCXML__
67  RecHitPointer cloneSH_(TkCloner const& cloner, TrajectoryStateOnSurface const& tsos) const override {
68  return cloner.makeShared(*this, tsos);
69  }
70 #endif
71 
72 private:
74 };
75 
76 inline bool sharesClusters(SiStripMatchedRecHit2D const& h1,
77  SiStripMatchedRecHit2D const& h2,
79  bool mono = h1.monoClusterRef() == h2.monoClusterRef();
80  bool stereo = h1.stereoClusterRef() == h2.stereoClusterRef();
81 
82  return (what == TrackingRecHit::all) ? (mono && stereo) : (mono || stereo);
83 }
84 
85 #endif
SharedInputType
definition of equality via shared input
OmniClusterRef & stereoClusterRef()
unsigned int stereoId() const
bool canImproveWithTrack() const override
RecHitPointer cloneSH() const override
SiStripCluster const & monoCluster() const
OmniClusterRef const & stereoClusterRef() const
std::vector< const TrackingRecHit * > recHits() const override
Access to component RecHits (if any)
TrackingRecHit::ConstRecHitPointer makeShared(TrackingRecHit::ConstRecHitPointer const &hit, TrajectoryStateOnSurface const &tsos) const
Definition: TkCloner.h:24
OmniClusterRef const & firstClusterRef() const override
SiStripCluster const & stripCluster() const
SiStripMatchedRecHit2D * clone() const override
void getKfComponents2D(KfComponentsHolder &holder) const
bool sharesInput(const TrackingRecHit *other, SharedInputType what) const override
int dimension() const override
OmniClusterRef const & monoClusterRef() const
std::shared_ptr< TrackingRecHit const > RecHitPointer
SiStripRecHit2D stereoHit() const
OmniClusterRef & monoClusterRef()
SiStripRecHit2D monoHit() const
SiStripCluster const & stereoCluster() const
void getKfComponents(KfComponentsHolder &holder) const override
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
SiStripMatchedRecHit2D * clone_(TkCloner const &cloner, TrajectoryStateOnSurface const &tsos) const override
unsigned int monoId() const
RecHitPointer cloneSH_(TkCloner const &cloner, TrajectoryStateOnSurface const &tsos) const override
id_type rawId() const
bool sharesClusters(SiStripMatchedRecHit2D const &h1, SiStripMatchedRecHit2D const &h2, TrackingRecHit::SharedInputType what)
SiStripMatchedRecHit2D(const LocalPoint &pos, const LocalError &err, GeomDet const &idet, const SiStripRecHit2D *rMono, const SiStripRecHit2D *rStereo)