CMS 3D CMS Logo

TrajSeedMatcher.h
Go to the documentation of this file.
1 #ifndef RecoEgamma_EgammaElectronAlgos_TrajSeedMatcher_h
2 #define RecoEgamma_EgammaElectronAlgos_TrajSeedMatcher_h
3 
4 //******************************************************************************
5 //
6 // Part of the refactorisation of of the E/gamma pixel matching for 2017 pixels
7 // This refactorisation converts the monolithic approach to a series of
8 // independent producer modules, with each modules performing a specific
9 // job as recommended by the 2017 tracker framework
10 //
11 //
12 // The module is based of PixelHitMatcher (the seed based functions) but
13 // extended to match on an arbitary number of hits rather than just doublets.
14 // It is also aware of how many layers the supercluster trajectory passed through
15 // and uses that information to determine how many hits to require
16 // Other than that, its a direct port and follows what PixelHitMatcher did
17 //
18 //
19 // Author : Sam Harper (RAL), 2017
20 //
21 //*******************************************************************************
22 
24 
27 
38 
42 
43 namespace edm {
44  class ConsumesCollector;
45  class EventSetup;
47  class ParameterSet;
49 } // namespace edm
50 
52 class TrackingRecHit;
53 
55 public:
56  struct SCHitMatch {
57  const DetId detId = 0;
62  const float et = 0.f;
63  const float eta = 0.f;
64  const float phi = 0.f;
65  const int charge = 0;
66  const int nrClus = 0;
67  };
68 
69  struct MatchInfo {
70  const DetId detId;
71  const float dRZPos;
72  const float dRZNeg;
73  const float dPhiPos;
74  const float dPhiNeg;
75  };
76 
77  struct SeedWithInfo {
79  const std::vector<MatchInfo> matchInfos;
80  const int nrValidLayers;
81  };
82 
83  class MatchingCuts {
84  public:
86  virtual ~MatchingCuts() {}
87  virtual bool operator()(const SCHitMatch& scHitMatch) const = 0;
88  };
89 
90  class MatchingCutsV1 : public MatchingCuts {
91  public:
92  explicit MatchingCutsV1(const edm::ParameterSet& pset);
93  bool operator()(const SCHitMatch& scHitMatch) const override;
94 
95  private:
96  float getDRZCutValue(const float scEt, const float scEta) const;
97 
98  private:
99  const double dPhiMax_;
100  const double dRZMax_;
101  const double dRZMaxLowEtThres_;
102  const std::vector<double> dRZMaxLowEtEtaBins_;
103  const std::vector<double> dRZMaxLowEt_;
104  };
105 
106  class MatchingCutsV2 : public MatchingCuts {
107  public:
108  explicit MatchingCutsV2(const edm::ParameterSet& pset);
109  bool operator()(const SCHitMatch& scHitMatch) const override;
110 
111  private:
112  size_t getBinNr(float eta) const;
113  float getCutValue(float et, float highEt, float highEtThres, float lowEtGrad) const {
114  return highEt + std::min(0.f, et - highEtThres) * lowEtGrad;
115  }
116 
117  private:
119  std::vector<double> dRZHighEt_, dRZHighEtThres_, dRZLowEtGrad_;
120  std::vector<double> etaBins_;
121  };
122 
123 public:
124  struct Configuration {
126 
131 
132  const bool useRecoVertex;
133  const bool enableHitSkipping;
136 
137  //these two variables determine how hits we require
138  //based on how many valid layers we had
139  //right now we always need atleast two hits
140  //also highly dependent on the seeds you pass in
141  //which also require a given number of hits
142  const std::vector<unsigned int> minNrHits;
143  const std::vector<int> minNrHitsValidLayerBins;
144 
145  const std::vector<std::unique_ptr<MatchingCuts> > matchingCuts;
146  };
147 
149  math::XYZPoint const& vprim,
150  Configuration const& cfg,
151  edm::EventSetup const& iSetup,
153  ~TrajSeedMatcher() = default;
154 
156 
157  std::vector<TrajSeedMatcher::SeedWithInfo> operator()(const GlobalPoint& candPos, const float energy);
158 
159 private:
160  std::vector<SCHitMatch> processSeed(const TrajectorySeed& seed,
161  const GlobalPoint& candPos,
162  const float energy,
163  const TrajectoryStateOnSurface& initialTrajState);
164 
165  static float getZVtxFromExtrapolation(const GlobalPoint& primeVtxPos,
166  const GlobalPoint& hitPos,
167  const GlobalPoint& candPos);
168 
170  const TrajectoryStateOnSurface& initialState,
172 
174  const FreeTrajectoryState& initialState,
175  const GlobalPoint& point,
177 
178  TrajectoryStateOnSurface makeTrajStateOnSurface(const GlobalPoint& pos, const float energy, const int charge) const;
179  void clearCache();
180 
182  const SCHitMatch& hit1, const SCHitMatch& hit2, const GlobalPoint& candPos, const float energy, const int charge);
183 
184  int getNrValidLayersAlongTraj(const DetId& hitId, const TrajectoryStateOnSurface& hitTrajState) const;
185 
186  bool layerHasValidHits(const DetLayer& layer,
187  const TrajectoryStateOnSurface& hitSurState,
188  const Propagator& propToLayerFromState) const;
189 
190  size_t getNrHitsRequired(const int nrValidLayers) const;
191 
192  inline auto ftsFromVertexToPoint(GlobalPoint const& point, GlobalPoint const& vertex, float energy, int charge) const {
193  //parameterised b-fields may not be valid for entire detector, just tracker volume
194  //however need we ecal so we auto select based on the position
195  bool useMagFieldParam = cfg_.useParamMagFieldIfDefined && magFieldParam_.isDefined(point);
196  auto const& magneticField = useMagFieldParam ? magFieldParam_ : magField_;
198  }
199 
200 private:
201  static constexpr float kElectronMass_ = 0.000511;
202 
205 
207 
213 
216 
217  std::unordered_map<int, TrajectoryStateOnSurface> trajStateFromVtxPosChargeCache_;
218  std::unordered_map<int, TrajectoryStateOnSurface> trajStateFromVtxNegChargeCache_;
219 
222 };
223 
224 #endif
TrajSeedMatcher::MatchingCutsV2::getBinNr
size_t getBinNr(float eta) const
Definition: TrajSeedMatcher.cc:447
TrajectoryStateOnSurface.h
TrajSeedMatcher::seeds_
TrajectorySeedCollection const & seeds_
Definition: TrajSeedMatcher.h:203
TrajSeedMatcher::MatchInfo
Definition: TrajSeedMatcher.h:69
TrajSeedMatcher::getZVtxFromExtrapolation
static float getZVtxFromExtrapolation(const GlobalPoint &primeVtxPos, const GlobalPoint &hitPos, const GlobalPoint &candPos)
Definition: TrajSeedMatcher.cc:245
TrajSeedMatcher::layerHasValidHits
bool layerHasValidHits(const DetLayer &layer, const TrajectoryStateOnSurface &hitSurState, const Propagator &propToLayerFromState) const
Definition: TrajSeedMatcher.cc:345
TrajSeedMatcher::clearCache
void clearCache()
Definition: TrajSeedMatcher.cc:299
TrajSeedMatcher::MatchingCuts
Definition: TrajSeedMatcher.h:83
MeasurementTrackerEvent.h
TrajectorySeedCollection
std::vector< TrajectorySeed > TrajectorySeedCollection
Definition: TrajectorySeedCollection.h:6
TrajSeedMatcher::detLayerGeom_
DetLayerGeometry const & detLayerGeom_
Definition: TrajSeedMatcher.h:212
ESHandle.h
TrajSeedMatcher::MatchingCutsV2::getCutValue
float getCutValue(float et, float highEt, float highEtThres, float lowEtGrad) const
Definition: TrajSeedMatcher.h:113
DetLayer
Definition: DetLayer.h:21
TrajSeedMatcher::trajStateFromVtxPosChargeCache_
std::unordered_map< int, TrajectoryStateOnSurface > trajStateFromVtxPosChargeCache_
Definition: TrajSeedMatcher.h:217
TrajSeedMatcher::MatchingCutsV2::dRZHighEtThres_
std::vector< double > dRZHighEtThres_
Definition: TrajSeedMatcher.h:119
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
min
T min(T a, T b)
Definition: MathUtil.h:58
TrajSeedMatcher::Configuration::requireExactMatchCount
const bool requireExactMatchCount
Definition: TrajSeedMatcher.h:134
TrajSeedMatcher::MatchInfo::dRZNeg
const float dRZNeg
Definition: TrajSeedMatcher.h:72
TrajSeedMatcher::MatchingCutsV1::dRZMaxLowEtThres_
const double dRZMaxLowEtThres_
Definition: TrajSeedMatcher.h:101
edm
HLT enums.
Definition: AlignableModifier.h:19
MagneticField::isDefined
virtual bool isDefined(const GlobalPoint &) const
True if the point is within the region where the concrete field.
Definition: MagneticField.h:40
pos
Definition: PixelAliasList.h:18
TrajSeedMatcher::SeedWithInfo
Definition: TrajSeedMatcher.h:77
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
TrajSeedMatcher::Configuration::useRecoVertex
const bool useRecoVertex
Definition: TrajSeedMatcher.h:132
TrajSeedMatcher::MatchingCutsV1::dRZMax_
const double dRZMax_
Definition: TrajSeedMatcher.h:100
TrajSeedMatcher::MatchingCutsV2::etaBins_
std::vector< double > etaBins_
Definition: TrajSeedMatcher.h:120
TrajSeedMatcher::makePSetDescription
static edm::ParameterSetDescription makePSetDescription()
Definition: TrajSeedMatcher.cc:118
TrajSeedMatcher::getNrHitsRequired
size_t getNrHitsRequired(const int nrValidLayers) const
Definition: TrajSeedMatcher.cc:367
TrajSeedMatcher::backwardPropagator_
PropagatorWithMaterial backwardPropagator_
Definition: TrajSeedMatcher.h:215
TrajSeedMatcher::MatchingCutsV2::dPhiHighEtThres_
std::vector< double > dPhiHighEtThres_
Definition: TrajSeedMatcher.h:118
NavigationSchool
Definition: NavigationSchool.h:18
HLT_FULL_cff.magneticField
magneticField
Definition: HLT_FULL_cff.py:348
TrajSeedMatcher::MatchingCutsV2::MatchingCutsV2
MatchingCutsV2(const edm::ParameterSet &pset)
Definition: TrajSeedMatcher.cc:411
TrajSeedMatcher::magField_
MagneticField const & magField_
Definition: TrajSeedMatcher.h:208
gedPhotons_cfi.highEt
highEt
Definition: gedPhotons_cfi.py:50
TrajSeedMatcher::SCHitMatch::hit
const TrackingRecHit & hit
Definition: TrajSeedMatcher.h:61
TrajSeedMatcher::trajStateFromPointNegChargeCache_
IntGlobalPointPairUnorderedMap< TrajectoryStateOnSurface > trajStateFromPointNegChargeCache_
Definition: TrajSeedMatcher.h:221
TrajSeedMatcher::SCHitMatch::hitPos
const GlobalPoint hitPos
Definition: TrajSeedMatcher.h:58
TrajSeedMatcher::getTrajStateFromVtx
const TrajectoryStateOnSurface & getTrajStateFromVtx(const TrackingRecHit &hit, const TrajectoryStateOnSurface &initialState, const PropagatorWithMaterial &propagator)
Definition: TrajSeedMatcher.cc:257
fileCollector.seed
seed
Definition: fileCollector.py:127
TrajSeedMatcher::Configuration::useParamMagFieldIfDefined
const bool useParamMagFieldIfDefined
Definition: TrajSeedMatcher.h:135
TrajSeedMatcher::Configuration
Definition: TrajSeedMatcher.h:124
Propagator
Definition: Propagator.h:44
DetId
Definition: DetId.h:17
TrajSeedMatcher::measTkEvt_
MeasurementTrackerEvent const & measTkEvt_
Definition: TrajSeedMatcher.h:210
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
PropagatorWithMaterial
Definition: PropagatorWithMaterial.h:25
trackingTools::ftsFromVertexToPoint
FreeTrajectoryState ftsFromVertexToPoint(MagneticField const &magField, GlobalPoint const &xmeas, GlobalPoint const &xvert, float momentum, TrackCharge charge)
Definition: ftsFromVertexToPoint.cc:17
TrajSeedMatcher::MatchingCutsV1::operator()
bool operator()(const SCHitMatch &scHitMatch) const override
Definition: TrajSeedMatcher.cc:387
TrajSeedMatcher::magFieldParam_
MagneticField const & magFieldParam_
Definition: TrajSeedMatcher.h:209
TrajSeedMatcher::ftsFromVertexToPoint
auto ftsFromVertexToPoint(GlobalPoint const &point, GlobalPoint const &vertex, float energy, int charge) const
Definition: TrajSeedMatcher.h:192
TrackCandidateProducer_cfi.propagator
propagator
Definition: TrackCandidateProducer_cfi.py:17
TrajSeedMatcher::Configuration::paramMagFieldToken
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > paramMagFieldToken
Definition: TrajSeedMatcher.h:128
utils.h
TrajSeedMatcher::SCHitMatch::dRZ
const float dRZ
Definition: TrajSeedMatcher.h:59
TrajSeedMatcher::SCHitMatch::detId
const DetId detId
Definition: TrajSeedMatcher.h:57
TrajSeedMatcher::cfg_
Configuration const & cfg_
Definition: TrajSeedMatcher.h:206
TrajSeedMatcher::MatchingCutsV2::dPhiLowEtGrad_
std::vector< double > dPhiLowEtGrad_
Definition: TrajSeedMatcher.h:118
PVValHelper::eta
Definition: PVValidationHelpers.h:70
TrajSeedMatcher::MatchingCutsV1
Definition: TrajSeedMatcher.h:90
TrajSeedMatcher::MatchingCutsV2::dPhiHighEt_
std::vector< double > dPhiHighEt_
Definition: TrajSeedMatcher.h:118
TrajSeedMatcher::MatchInfo::dPhiPos
const float dPhiPos
Definition: TrajSeedMatcher.h:73
IdealMagneticFieldRecord.h
TrajSeedMatcher::Configuration::matchingCuts
const std::vector< std::unique_ptr< MatchingCuts > > matchingCuts
Definition: TrajSeedMatcher.h:145
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
TrajSeedMatcher::SCHitMatch::eta
const float eta
Definition: TrajSeedMatcher.h:63
TrajSeedMatcher::MatchingCuts::MatchingCuts
MatchingCuts()
Definition: TrajSeedMatcher.h:85
TrajSeedMatcher::MatchingCuts::operator()
virtual bool operator()(const SCHitMatch &scHitMatch) const =0
Point3DBase< float, GlobalTag >
TrajSeedMatcher::Configuration::minNrHits
const std::vector< unsigned int > minNrHits
Definition: TrajSeedMatcher.h:142
TrajSeedMatcher::MatchingCutsV2::dRZHighEt_
std::vector< double > dRZHighEt_
Definition: TrajSeedMatcher.h:119
TrajSeedMatcher::trajStateFromPointPosChargeCache_
IntGlobalPointPairUnorderedMap< TrajectoryStateOnSurface > trajStateFromPointPosChargeCache_
Definition: TrajSeedMatcher.h:220
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
InitialStep_cff.seeds
seeds
Definition: InitialStep_cff.py:231
bphysicsOniaDQM_cfi.vertex
vertex
Definition: bphysicsOniaDQM_cfi.py:7
MeasurementTrackerEvent
Definition: MeasurementTrackerEvent.h:16
edm::ParameterSet
Definition: ParameterSet.h:47
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
TrajSeedMatcher
Definition: TrajSeedMatcher.h:54
TrajSeedMatcher::~TrajSeedMatcher
~TrajSeedMatcher()=default
ParameterSet
Definition: Functions.h:16
TrajSeedMatcher::Configuration::magFieldToken
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken
Definition: TrajSeedMatcher.h:127
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
TrajSeedMatcher::SeedWithInfo::nrValidLayers
const int nrValidLayers
Definition: TrajSeedMatcher.h:80
TrajSeedMatcher::SeedWithInfo::seed
const TrajectorySeed & seed
Definition: TrajSeedMatcher.h:78
PropagatorWithMaterial.h
RecoGeometryRecord.h
TrajSeedMatcher::MatchingCutsV1::getDRZCutValue
float getDRZCutValue(const float scEt, const float scEta) const
Definition: TrajSeedMatcher.cc:398
DetLayerGeometry
Definition: DetLayerGeometry.h:18
TrajSeedMatcher::MatchingCutsV1::dRZMaxLowEtEtaBins_
const std::vector< double > dRZMaxLowEtEtaBins_
Definition: TrajSeedMatcher.h:102
TrajSeedMatcher::getNrValidLayersAlongTraj
int getNrValidLayersAlongTraj(const SCHitMatch &hit1, const SCHitMatch &hit2, const GlobalPoint &candPos, const float energy, const int charge)
Definition: TrajSeedMatcher.cc:306
TrajSeedMatcher::Configuration::enableHitSkipping
const bool enableHitSkipping
Definition: TrajSeedMatcher.h:133
TrajSeedMatcher::MatchInfo::detId
const DetId detId
Definition: TrajSeedMatcher.h:70
TrajSeedMatcher::MatchingCutsV2
Definition: TrajSeedMatcher.h:106
TrajSeedMatcher::kElectronMass_
static constexpr float kElectronMass_
Definition: TrajSeedMatcher.h:201
IntGlobalPointPairUnorderedMap
std::unordered_map< std::pair< int, GlobalPoint >, T, HashIntGlobalPointPair > IntGlobalPointPairUnorderedMap
Definition: utils.h:20
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
MagneticField.h
edm::EventSetup
Definition: EventSetup.h:58
ftsFromVertexToPoint.h
cc
TrajSeedMatcher::makeTrajStateOnSurface
TrajectoryStateOnSurface makeTrajStateOnSurface(const GlobalPoint &pos, const float energy, const int charge) const
Definition: TrajSeedMatcher.cc:292
TrajSeedMatcher::MatchInfo::dRZPos
const float dRZPos
Definition: TrajSeedMatcher.h:71
TrajectorySeedCollection.h
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord >
GlobalDetLayerGeometry.h
looper.cfg
cfg
Definition: looper.py:297
TrajSeedMatcher::MatchingCutsV1::MatchingCutsV1
MatchingCutsV1(const edm::ParameterSet &pset)
Definition: TrajSeedMatcher.cc:375
TrackingRecHit
Definition: TrackingRecHit.h:21
TrajSeedMatcher::MatchingCuts::~MatchingCuts
virtual ~MatchingCuts()
Definition: TrajSeedMatcher.h:86
TrajSeedMatcher::SCHitMatch::et
const float et
Definition: TrajSeedMatcher.h:62
TrajSeedMatcher::getTrajStateFromPoint
const TrajectoryStateOnSurface & getTrajStateFromPoint(const TrackingRecHit &hit, const FreeTrajectoryState &initialState, const GlobalPoint &point, const PropagatorWithMaterial &propagator)
Definition: TrajSeedMatcher.cc:274
TrajSeedMatcher::vprim_
const GlobalPoint vprim_
Definition: TrajSeedMatcher.h:204
HLT_FULL_cff.measTkEvt
measTkEvt
Definition: HLT_FULL_cff.py:15292
TrajSeedMatcher::MatchingCutsV2::dRZLowEtGrad_
std::vector< double > dRZLowEtGrad_
Definition: TrajSeedMatcher.h:119
TrajSeedMatcher::Configuration::minNrHitsValidLayerBins
const std::vector< int > minNrHitsValidLayerBins
Definition: TrajSeedMatcher.h:143
ConfigurationDescriptions
TrajSeedMatcher::Configuration::Configuration
Configuration(const edm::ParameterSet &pset, edm::ConsumesCollector &&cc)
Definition: TrajSeedMatcher.cc:83
FreeTrajectoryState
Definition: FreeTrajectoryState.h:27
TrajSeedMatcher::MatchingCutsV1::dRZMaxLowEt_
const std::vector< double > dRZMaxLowEt_
Definition: TrajSeedMatcher.h:103
TrajSeedMatcher::MatchingCutsV2::operator()
bool operator()(const SCHitMatch &scHitMatch) const override
Definition: TrajSeedMatcher.cc:434
DetId.h
TrajSeedMatcher::operator()
std::vector< TrajSeedMatcher::SeedWithInfo > operator()(const GlobalPoint &candPos, const float energy)
Definition: TrajSeedMatcher.cc:156
TrajSeedMatcher::SCHitMatch
Definition: TrajSeedMatcher.h:56
TrajSeedMatcher::SCHitMatch::dPhi
const float dPhi
Definition: TrajSeedMatcher.h:60
TrajSeedMatcher::SeedWithInfo::matchInfos
const std::vector< MatchInfo > matchInfos
Definition: TrajSeedMatcher.h:79
TrajSeedMatcher::SCHitMatch::phi
const float phi
Definition: TrajSeedMatcher.h:64
TrajSeedMatcher::SCHitMatch::nrClus
const int nrClus
Definition: TrajSeedMatcher.h:66
TrajSeedMatcher::TrajSeedMatcher
TrajSeedMatcher(TrajectorySeedCollection const &seeds, math::XYZPoint const &vprim, Configuration const &cfg, edm::EventSetup const &iSetup, MeasurementTrackerEvent const &measTkEvt)
Definition: TrajSeedMatcher.cc:102
Point3D.h
ParameterSetDescription
TrajectorySeed
Definition: TrajectorySeed.h:18
TrajSeedMatcher::MatchInfo::dPhiNeg
const float dPhiNeg
Definition: TrajSeedMatcher.h:74
TrajSeedMatcher::MatchingCutsV1::dPhiMax_
const double dPhiMax_
Definition: TrajSeedMatcher.h:99
TrajSeedMatcher::Configuration::navSchoolToken
const edm::ESGetToken< NavigationSchool, NavigationSchoolRecord > navSchoolToken
Definition: TrajSeedMatcher.h:129
TrajSeedMatcher::Configuration::detLayerGeomToken
const edm::ESGetToken< DetLayerGeometry, RecoGeometryRecord > detLayerGeomToken
Definition: TrajSeedMatcher.h:130
EventSetup
NavigationSchool.h
TrajSeedMatcher::SCHitMatch::charge
const int charge
Definition: TrajSeedMatcher.h:65
NavigationSchoolRecord.h
point
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
MagneticField
Definition: MagneticField.h:19
TrajSeedMatcher::processSeed
std::vector< SCHitMatch > processSeed(const TrajectorySeed &seed, const GlobalPoint &candPos, const float energy, const TrajectoryStateOnSurface &initialTrajState)
Definition: TrajSeedMatcher.cc:195
GlobalPoint.h
TrajSeedMatcher::forwardPropagator_
PropagatorWithMaterial forwardPropagator_
Definition: TrajSeedMatcher.h:214
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
TrajSeedMatcher::trajStateFromVtxNegChargeCache_
std::unordered_map< int, TrajectoryStateOnSurface > trajStateFromVtxNegChargeCache_
Definition: TrajSeedMatcher.h:218
hit
Definition: SiStripHitEffFromCalibTree.cc:88
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
TrajSeedMatcher::navSchool_
NavigationSchool const & navSchool_
Definition: TrajSeedMatcher.h:211