CMS 3D CMS Logo

PixelHitMatcher.h
Go to the documentation of this file.
1 #ifndef PIXELHITMATCHER_H
2 #define PIXELHITMATCHER_H
3 
4 // -*- C++ -*-
5 //
6 // Package: EgammaElectronAlgos
7 // Class: PixelHitMatcher
8 //
17 //
18 // Original Author: Ursula Berthon, Claude Charlot
19 // Created: Mon Mar 27 13:22:06 CEST 2006
20 //
21 //
22 
25 
30 
33 
37 
38 #include "CLHEP/Vector/ThreeVector.h"
39 #include <vector>
40 #include <unordered_map>
41 #include <limits>
42 
47 class MeasurementTracker;
49 class MagneticField;
51 class TrackerGeometry;
52 class TrackerTopology;
53 
54 namespace std{
55  template<>
56  struct hash<std::pair<const GeomDet*,GlobalPoint> > {
57  std::size_t operator()(const std::pair<const GeomDet*,GlobalPoint>& g) const {
58  auto h1 = std::hash<unsigned long long>()((unsigned long long)g.first);
59  unsigned long long k; memcpy(&k, &g.second,sizeof(k));
60  auto h2 = std::hash<unsigned long long>()(k);
61  return h1 ^ (h2 << 1);
62  }
63  };
64  template<>
65  struct equal_to<std::pair<const GeomDet*,GlobalPoint> > : public std::binary_function<std::pair<const GeomDet*,GlobalPoint>,std::pair<const GeomDet*,GlobalPoint>,bool> {
66  bool operator()(const std::pair<const GeomDet*,GlobalPoint>& a,
67  const std::pair<const GeomDet*,GlobalPoint>& b) const {
68  return (a.first == b.first) & (a.second == b.second);
69  }
70  };
71 }
72 
74  {
75  public :
76 
80 
81 
82  RecHitWithDist( ConstRecHitPointer rh, float & dphi )
83  : rh_(rh), dphi_(dphi)
84  {}
85 
86  ConstRecHitPointer recHit() const { return rh_ ; }
87  float dPhi() const { return dphi_ ; }
88 
89  void invert() { dphi_*=-1. ; }
90 
91  private :
92 
93  ConstRecHitPointer rh_ ;
94  float dphi_ ;
95 
96  } ;
97 
98 
100  {
101  public :
102 
106 
107  RecHitWithInfo( ConstRecHitPointer rh, int subDet =0,
110  : rh_(rh), subDet_(subDet), dRz_(dRz), dPhi_(dPhi)
111  {}
112 
113  ConstRecHitPointer recHit() const { return rh_; }
114  int subDet() const { return subDet_ ; }
115  float dRz() const { return dRz_ ; }
116  float dPhi() const { return dPhi_ ; }
117 
118  void invert() { dPhi_*=-1. ; }
119 
120  private:
121 
122  ConstRecHitPointer rh_;
123  int subDet_ ;
124  float dRz_ ;
125  float dPhi_ ;
126 
127  } ;
128 
130  {
131  public :
132 
133  SeedWithInfo( TrajectorySeed seed, unsigned char hitsMask, int subDet2, float dRz2, float dPhi2 , int subDet1, float dRz1, float dPhi1)
134  : seed_(seed), hitsMask_(hitsMask),
135  subDet2_(subDet2), dRz2_(dRz2), dPhi2_(dPhi2),
136  subDet1_(subDet1), dRz1_(dRz1), dPhi1_(dPhi1)
137  {}
138 
139  const TrajectorySeed & seed() const { return seed_ ; }
140  unsigned char hitsMask() const { return hitsMask_ ; }
141 
142  int subDet2() const { return subDet2_ ; }
143  float dRz2() const { return dRz2_ ; }
144  float dPhi2() const { return dPhi2_ ; }
145 
146  int subDet1() const { return subDet1_ ; }
147  float dRz1() const { return dRz1_ ; }
148  float dPhi1() const { return dPhi1_ ; }
149 
150  private :
151 
153  unsigned char hitsMask_ ;
154  int subDet2_ ;
155  float dRz2_ ;
156  float dPhi2_ ;
157  int subDet1_ ;
158  float dRz1_ ;
159  float dPhi1_ ;
160  } ;
161 
163  {
164  public :
165 
169  // Next typedef uses double in ROOT 6 rather than Double32_t due to a bug in ROOT 5,
170  // which otherwise would make ROOT5 files unreadable in ROOT6. This does not increase
171  // the size on disk, because due to the bug, double was actually stored on disk in ROOT 5.
172  typedef ROOT::Math::PositionVector3D<ROOT::Math::CylindricalEta3D<double> > REPPoint;
173 
175  ( float phi1min, float phi1max,
176  //float phi2min, float phi2max,
177  float phi2minB, float phi2maxB, float phi2minF, float phi2maxF,
178  float z2minB, float z2maxB, float r2minF, float r2maxF,
179  float rMinI, float rMaxI, bool searchInTIDTEC ) ;
180 
181  virtual ~PixelHitMatcher() ;
182  void setES( const MagneticField *, const MeasurementTracker * theMeasurementTracker, const TrackerGeometry * trackerGeometry ) ;
183 
184  void setEvent( const MeasurementTrackerEvent & event ) ;
185 
186  std::vector<SeedWithInfo>
187  compatibleSeeds
188  ( const std::vector<const TrajectorySeedCollection *>& seedsV, const GlobalPoint & xmeas,
189  const GlobalPoint & vprim, float energy, float charge ) ;
190 
191 
192  std::vector<std::pair<RecHitWithDist,ConstRecHitPointer> >
193  compatibleHits(const GlobalPoint& xmeas, const GlobalPoint& vprim,
194  float energy, float charge,
195  const TrackerTopology *tTopo,
196  const NavigationSchool& navigationSchool) ;
197 
198 
199  std::vector<CLHEP::Hep3Vector> predicted1Hits() ;
200  std::vector<CLHEP::Hep3Vector> predicted2Hits();
201 
202  void set1stLayer( float dummyphi1min, float dummyphi1max ) ;
203  void set1stLayerZRange( float zmin1, float zmax1 ) ;
204  //void set2ndLayer( float dummyphi2min, float dummyphi2max ) ;
205  void set2ndLayer( float dummyphi2minB, float dummyphi2maxB, float dummyphi2minF, float dummyphi2maxF ) ;
206 
207  float getVertex() ;
208  void setUseRecoVertex( bool val ) ;
209 
210  private :
211 
212  RecHitContainer hitsInTrack ;
213 
214  std::vector<CLHEP::Hep3Vector> pred1Meas ;
215  std::vector<CLHEP::Hep3Vector> pred2Meas ;
229 
230  float vertex_;
231 
234  std::unordered_map<std::pair<const GeomDet*,GlobalPoint>, TrajectoryStateOnSurface> mapTsos2_fast_;
235  std::vector<GlobalPoint> hit_gp_map_;
236 } ;
237 
238 #endif
239 
240 
241 
242 
243 
244 
245 
246 
TransientTrackingRecHit::RecHitPointer RecHitPointer
TransientTrackingRecHit::RecHitPointer RecHitPointer
int subDet() const
BarrelMeasurementEstimator meas2ndBLayer
RecHitWithInfo(ConstRecHitPointer rh, int subDet=0, float dRz=std::numeric_limits< float >::infinity(), float dPhi=std::numeric_limits< float >::infinity())
TransientTrackingRecHit::RecHitContainer RecHitContainer
ROOT::Math::PositionVector3D< ROOT::Math::CylindricalEta3D< double > > REPPoint
BarrelMeasurementEstimator meas1stBLayer
TrajectorySeed seed_
float dPhi() const
PropagatorWithMaterial * prop1stLayer
float dRz1() const
std::vector< CLHEP::Hep3Vector > pred1Meas
unsigned char hitsMask() const
float dRz2() const
std::vector< ConstRecHitPointer > RecHitContainer
TransientTrackingRecHit::RecHitContainer RecHitContainer
float dRz() const
SeedWithInfo(TrajectorySeed seed, unsigned char hitsMask, int subDet2, float dRz2, float dPhi2, int subDet1, float dRz1, float dPhi1)
ConstRecHitPointer rh_
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
TransientTrackingRecHit::ConstRecHitPointer ConstRecHitPointer
std::vector< GlobalPoint > hit_gp_map_
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
rMaxI
intermediate region SC in EB and 2nd hits in PXF
ConstRecHitPointer recHit() const
LayerMeasurements theLayerMeasurements
TransientTrackingRecHit::RecHitContainer RecHitContainer
const double infinity
const MagneticField * theMagField
const MeasurementTrackerEvent * theTrackerEvent
std::shared_ptr< TrackingRecHit const > RecHitPointer
int k[5][pyjets_maxn]
float dPhi1() const
float dPhi2() const
unsigned char hitsMask_
PixelMatchStartLayers startLayers
std::size_t operator()(const std::pair< const GeomDet *, GlobalPoint > &g) const
double b
Definition: hdecay.h:120
const GeometricSearchTracker * theGeometricSearchTracker
float dPhi() const
std::vector< CLHEP::Hep3Vector > pred2Meas
TransientTrackingRecHit::ConstRecHitPointer ConstRecHitPointer
ForwardMeasurementEstimator meas2ndFLayer
bool operator()(const std::pair< const GeomDet *, GlobalPoint > &a, const std::pair< const GeomDet *, GlobalPoint > &b) const
PropagatorWithMaterial * prop2ndLayer
ForwardMeasurementEstimator meas1stFLayer
double a
Definition: hdecay.h:121
ConstRecHitPointer rh_
TransientTrackingRecHit::ConstRecHitPointer ConstRecHitPointer
int subDet1() const
TransientTrackingRecHit::RecHitPointer RecHitPointer
int subDet2() const
const TrajectorySeed & seed() const
RecHitContainer hitsInTrack
ConstRecHitPointer recHit() const
std::unordered_map< std::pair< const GeomDet *, GlobalPoint >, TrajectoryStateOnSurface > mapTsos2_fast_
const TrackerGeometry * theTrackerGeometry
Definition: event.py:1
RecHitWithDist(ConstRecHitPointer rh, float &dphi)
const MeasurementTracker * theTracker