CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
PixelHitMatcher Class Reference

#include <PixelHitMatcher.h>

Public Types

typedef TransientTrackingRecHit::ConstRecHitPointer ConstRecHitPointer
 
typedef TransientTrackingRecHit::RecHitContainer RecHitContainer
 
typedef TransientTrackingRecHit::RecHitPointer RecHitPointer
 
typedef ROOT::Math::PositionVector3D< ROOT::Math::CylindricalEta3D< double > > REPPoint
 

Public Member Functions

std::vector< std::pair< RecHitWithDist, ConstRecHitPointer > > compatibleHits (const GlobalPoint &xmeas, const GlobalPoint &vprim, float energy, float charge, const TrackerTopology *tTopo, const NavigationSchool &navigationSchool)
 
std::vector< SeedWithInfocompatibleSeeds (const std::vector< const TrajectorySeedCollection * > &seedsV, const GlobalPoint &xmeas, const GlobalPoint &vprim, float energy, float charge)
 
float getVertex ()
 
 PixelHitMatcher (float phi1min, float phi1max, float phi2minB, float phi2maxB, float phi2minF, float phi2maxF, float z2minB, float z2maxB, float r2minF, float r2maxF, float rMinI, float rMaxI, bool searchInTIDTEC)
 
std::vector< CLHEP::Hep3Vector > predicted1Hits ()
 
std::vector< CLHEP::Hep3Vector > predicted2Hits ()
 
void set1stLayer (float dummyphi1min, float dummyphi1max)
 
void set1stLayerZRange (float zmin1, float zmax1)
 
void set2ndLayer (float dummyphi2minB, float dummyphi2maxB, float dummyphi2minF, float dummyphi2maxF)
 
void setES (const MagneticField *, const MeasurementTracker *theMeasurementTracker, const TrackerGeometry *trackerGeometry)
 
void setEvent (const MeasurementTrackerEvent &event)
 
void setUseRecoVertex (bool val)
 
virtual ~PixelHitMatcher ()
 

Private Attributes

std::vector< GlobalPointhit_gp_map_
 
RecHitContainer hitsInTrack
 
std::unordered_map< std::pair< const GeomDet *, GlobalPoint >, TrajectoryStateOnSurfacemapTsos2_fast_
 
BarrelMeasurementEstimator meas1stBLayer
 
ForwardMeasurementEstimator meas1stFLayer
 
BarrelMeasurementEstimator meas2ndBLayer
 
ForwardMeasurementEstimator meas2ndFLayer
 
std::vector< CLHEP::Hep3Vector > pred1Meas
 
std::vector< CLHEP::Hep3Vector > pred2Meas
 
PropagatorWithMaterialprop1stLayer
 
PropagatorWithMaterialprop2ndLayer
 
bool searchInTIDTEC_
 
const GeometricSearchTrackertheGeometricSearchTracker
 
LayerMeasurements theLayerMeasurements
 
const MagneticFieldtheMagField
 
const MeasurementTrackertheTracker
 
const MeasurementTrackerEventtheTrackerEvent
 
const TrackerGeometrytheTrackerGeometry
 
bool useRecoVertex_
 
float vertex_
 

Detailed Description

Description: Class to match an ECAL cluster to the pixel hits. Two compatible hits in the pixel layers are required.

Implementation: future redesign

Definition at line 154 of file PixelHitMatcher.h.

Member Typedef Documentation

Definition at line 158 of file PixelHitMatcher.h.

Definition at line 160 of file PixelHitMatcher.h.

Definition at line 159 of file PixelHitMatcher.h.

typedef ROOT::Math::PositionVector3D<ROOT::Math::CylindricalEta3D<double> > PixelHitMatcher::REPPoint

Definition at line 164 of file PixelHitMatcher.h.

Constructor & Destructor Documentation

PixelHitMatcher::PixelHitMatcher ( float  phi1min,
float  phi1max,
float  phi2minB,
float  phi2maxB,
float  phi2minF,
float  phi2maxF,
float  z2minB,
float  z2maxB,
float  r2minF,
float  r2maxF,
float  rMinI,
float  rMaxI,
bool  searchInTIDTEC 
)

Definition at line 20 of file PixelHitMatcher.cc.

24  : //zmin1 and zmax1 are dummy at this moment, set from beamspot later
25  meas1stBLayer(phi1min,phi1max,0.,0.), meas2ndBLayer(phi2minB,phi2maxB,z2minB,z2maxB),
26  meas1stFLayer(phi1min,phi1max,0.,0.), meas2ndFLayer(phi2minF,phi2maxF,r2minF,r2maxF),
27  prop1stLayer(nullptr), prop2ndLayer(nullptr),theGeometricSearchTracker(nullptr),theTrackerEvent(nullptr),theTracker(nullptr),vertex_(0.),
29  {
32  }
BarrelMeasurementEstimator meas2ndBLayer
BarrelMeasurementEstimator meas1stBLayer
PropagatorWithMaterial * prop1stLayer
rMaxI
intermediate region SC in EB and 2nd hits in PXF
const MeasurementTrackerEvent * theTrackerEvent
const GeometricSearchTracker * theGeometricSearchTracker
ForwardMeasurementEstimator meas2ndFLayer
PropagatorWithMaterial * prop2ndLayer
ForwardMeasurementEstimator meas1stFLayer
void setRRangeI(float rmin, float rmax)
const MeasurementTracker * theTracker
PixelHitMatcher::~PixelHitMatcher ( )
virtual

Definition at line 34 of file PixelHitMatcher.cc.

35  {
36  delete prop1stLayer ;
37  delete prop2ndLayer ;
38  }
PropagatorWithMaterial * prop1stLayer
PropagatorWithMaterial * prop2ndLayer

Member Function Documentation

vector< pair< RecHitWithDist, PixelHitMatcher::ConstRecHitPointer > > PixelHitMatcher::compatibleHits ( const GlobalPoint xmeas,
const GlobalPoint vprim,
float  energy,
float  charge,
const TrackerTopology tTopo,
const NavigationSchool navigationSchool 
)

Definition at line 243 of file PixelHitMatcher.cc.

References funct::abs(), barePhi(), ALCARECOTkAlJpsiMuMu_cff::charge, FTSFromVertexToPointFactory::get(), mps_fire::i, createfilelist::int, TrajectoryStateOnSurface::isValid(), LogDebug, funct::m, PixelMatchNextLayers::measurementsInNextLayers(), FreeTrajectoryState::momentum(), normalizedPhi(), PV3DBase< T, PVType, FrameType >::phi(), FreeTrajectoryState::position(), PixelMatchNextLayers::predictionInNextLayers(), rpcPointValidation_cfi::recHit, mps_fire::result, BarrelDetLayer::specificSurface(), mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::z(), and CombinatorialSeedGeneratorForCosmicsRegionalReconstruction_cfi::zVertex.

Referenced by compatibleSeeds(), and ElectronSeedGenerator::seedsFromThisCluster().

248  {
249  float SCl_phi = xmeas.phi();
250 
251  int charge = int(fcharge);
252  // return all compatible RecHit pairs (vector< TSiPixelRecHit>)
253  vector<pair<RecHitWithDist, ConstRecHitPointer> > result;
254  LogDebug("") << "[PixelHitMatcher::compatibleHits] entering .. ";
255 
256  vector<TrajectoryMeasurement> validMeasurements;
257  vector<TrajectoryMeasurement> invalidMeasurements;
258 
259  typedef vector<TrajectoryMeasurement>::const_iterator aMeas;
260 
261  pred1Meas.clear();
262  pred2Meas.clear();
263 
264  auto firstLayer = theGeometricSearchTracker->pixelBarrelLayers().begin();
265 
267 
269  TrajectoryStateOnSurface tsos(fts, *bpb(fts.position(), fts.momentum()));
270 
271  if (tsos.isValid()) {
272  vector<TrajectoryMeasurement> pixelMeasurements =
273  theLayerMeasurements.measurements(**firstLayer,tsos,
275 
276  LogDebug("") <<"[PixelHitMatcher::compatibleHits] nbr of hits compatible with extrapolation to first layer: " << pixelMeasurements.size();
277  for (aMeas m=pixelMeasurements.begin(); m!=pixelMeasurements.end(); m++){
278  if (m->recHit()->isValid()) {
279  float localDphi = normalizedPhi(SCl_phi-m->forwardPredictedState().globalPosition().barePhi()) ;
280  if(std::abs(localDphi)>2.5)continue;
281  CLHEP::Hep3Vector prediction(m->forwardPredictedState().globalPosition().x(),
282  m->forwardPredictedState().globalPosition().y(),
283  m->forwardPredictedState().globalPosition().z());
284  LogDebug("") << "[PixelHitMatcher::compatibleHits] compatible hit position " << m->recHit()->globalPosition();
285  LogDebug("") << "[PixelHitMatcher::compatibleHits] predicted position " << m->forwardPredictedState().globalPosition();
286  pred1Meas.push_back( prediction);
287 
288  validMeasurements.push_back(*m);
289 
290  LogDebug("") <<"[PixelHitMatcher::compatibleHits] Found a rechit in layer ";
291  const BarrelDetLayer *bdetl = dynamic_cast<const BarrelDetLayer *>(*firstLayer);
292  if (bdetl) {
293  LogDebug("") <<" with radius "<<bdetl->specificSurface().radius();
294  }
295  else LogDebug("") <<"Could not downcast!!";
296  }
297  }
298 
299 
300  // check if there are compatible 1st hits in the second layer
301  firstLayer++;
302 
303  vector<TrajectoryMeasurement> pixel2Measurements =
304  theLayerMeasurements.measurements(**firstLayer,tsos,
306 
307  for (aMeas m=pixel2Measurements.begin(); m!=pixel2Measurements.end(); m++){
308  if (m->recHit()->isValid()) {
309  float localDphi = normalizedPhi(SCl_phi-m->forwardPredictedState().globalPosition().barePhi()) ;
310  if(std::abs(localDphi)>2.5)continue;
311  CLHEP::Hep3Vector prediction(m->forwardPredictedState().globalPosition().x(),
312  m->forwardPredictedState().globalPosition().y(),
313  m->forwardPredictedState().globalPosition().z());
314  pred1Meas.push_back( prediction);
315  LogDebug("") << "[PixelHitMatcher::compatibleHits] compatible hit position " << m->recHit()->globalPosition() << endl;
316  LogDebug("") << "[PixelHitMatcher::compatibleHits] predicted position " << m->forwardPredictedState().globalPosition() << endl;
317 
318  validMeasurements.push_back(*m);
319  LogDebug("") <<"[PixelHitMatcher::compatibleHits] Found a rechit in layer ";
320  const BarrelDetLayer *bdetl = dynamic_cast<const BarrelDetLayer *>(*firstLayer);
321  if (bdetl) {
322  LogDebug("") <<" with radius "<<bdetl->specificSurface().radius();
323  }
324  else LogDebug("") <<"Could not downcast!!";
325  }
326 
327  }
328  }
329 
330 
331  // check if there are compatible 1st hits the forward disks
332 
333  TrajectoryStateOnSurface tsosfwd(fts, *bpb(fts.position(), fts.momentum()));
334  if (tsosfwd.isValid()) {
335 
336  for (int i=0; i<2; i++) {
337  auto flayer = i == 0 ? theGeometricSearchTracker->posPixelForwardLayers().begin()
339 
340  if (i==0 && xmeas.z() < -100. ) continue;
341  if (i==1 && xmeas.z() > 100. ) continue;
342 
343  vector<TrajectoryMeasurement> pixelMeasurements =
344  theLayerMeasurements.measurements(**flayer, tsosfwd,
346 
347  for (aMeas m=pixelMeasurements.begin(); m!=pixelMeasurements.end(); m++){
348  if (m->recHit()->isValid()) {
349  float localDphi = normalizedPhi(SCl_phi-m->forwardPredictedState().globalPosition().barePhi());
350  if(std::abs(localDphi)>2.5)continue;
351  CLHEP::Hep3Vector prediction(m->forwardPredictedState().globalPosition().x(),
352  m->forwardPredictedState().globalPosition().y(),
353  m->forwardPredictedState().globalPosition().z());
354  pred1Meas.push_back( prediction);
355 
356  validMeasurements.push_back(*m);
357  }
358  }
359 
360  //check if there are compatible 1st hits the outer forward disks
361  if (searchInTIDTEC_) {
362  flayer++;
363 
364  vector<TrajectoryMeasurement> pixel2Measurements =
365  theLayerMeasurements.measurements(**flayer, tsosfwd,
367 
368  for (aMeas m=pixel2Measurements.begin(); m!=pixel2Measurements.end(); m++){
369  if (m->recHit()->isValid()) {
370  float localDphi = normalizedPhi(SCl_phi-m->forwardPredictedState().globalPosition().barePhi()) ;
371  if(std::abs(localDphi)>2.5)continue;
372  CLHEP::Hep3Vector prediction(m->forwardPredictedState().globalPosition().x(),
373  m->forwardPredictedState().globalPosition().y(),
374  m->forwardPredictedState().globalPosition().z());
375  pred1Meas.push_back( prediction);
376 
377  validMeasurements.push_back(*m);
378  }
379  // else{std::cout<<" hit non valid "<<std::endl; }
380  } //end 1st hit in outer f disk
381  }
382  }
383  }
384 
385  // now we have the vector of all valid measurements of the first point
386  for (unsigned i=0; i<validMeasurements.size(); i++){
387 
388  const DetLayer * newLayer = theGeometricSearchTracker->detLayer(validMeasurements[i].recHit()->det()->geographicalId());
389 
390  double zVertex ;
391  if (!useRecoVertex_)
392  {
393  // we don't know the z vertex position, get it from linear extrapolation
394  // compute the z vertex from the cluster point and the found pixel hit
395  double pxHit1z = validMeasurements[i].recHit()->det()->surface().toGlobal(
396  validMeasurements[i].recHit()->localPosition()).z();
397  double pxHit1x = validMeasurements[i].recHit()->det()->surface().toGlobal(
398  validMeasurements[i].recHit()->localPosition()).x();
399  double pxHit1y = validMeasurements[i].recHit()->det()->surface().toGlobal(
400  validMeasurements[i].recHit()->localPosition()).y();
401  double r1diff = (pxHit1x-vprim.x())*(pxHit1x-vprim.x()) + (pxHit1y-vprim.y())*(pxHit1y-vprim.y());
402  r1diff=sqrt(r1diff);
403  double r2diff = (xmeas.x()-pxHit1x)*(xmeas.x()-pxHit1x) + (xmeas.y()-pxHit1y)*(xmeas.y()-pxHit1y);
404  r2diff=sqrt(r2diff);
405  zVertex = pxHit1z - r1diff*(xmeas.z()-pxHit1z)/r2diff;
406  }
407  else
408  {
409  // here we use the reco vertex z position
410  zVertex = vprim.z();
411  }
412 
413  if (i==0)
414  { vertex_ = zVertex; }
415 
416  GlobalPoint vertexPred(vprim.x(),vprim.y(),zVertex) ;
417  GlobalPoint hitPos( validMeasurements[i].recHit()->det()->surface().toGlobal( validMeasurements[i].recHit()->localPosition() ) ) ;
418 
419  FreeTrajectoryState secondFTS = FTSFromVertexToPointFactory::get(*theMagField, hitPos, vertexPred, energy, charge);
420 
421  PixelMatchNextLayers secondHit(&theLayerMeasurements, newLayer, secondFTS,
423  tTopo,navigationSchool,searchInTIDTEC_);
424  vector<CLHEP::Hep3Vector> predictions = secondHit.predictionInNextLayers();
425 
426  for (unsigned it = 0; it < predictions.size(); it++) pred2Meas.push_back(predictions[it]);
427 
428  // we may get more than one valid second measurements here even for single electrons:
429  // two hits from the same layer/disk (detector overlap) or from the loop over the
430  // next layers in EPMatchLoopNextLayers. Take only the 1st hit.
431 
432  if(!secondHit.measurementsInNextLayers().empty()){
433  for(unsigned int shit=0; shit<secondHit.measurementsInNextLayers().size(); shit++)
434  {
435  float dphi = normalizedPhi(pred1Meas[i].phi()-validMeasurements[i].recHit()->globalPosition().barePhi()) ;
436  if (std::abs(dphi)<2.5)
437  {
438  ConstRecHitPointer pxrh = validMeasurements[i].recHit();
439  RecHitWithDist rh(pxrh,dphi);
440 
441  // pxrh = secondHit.measurementsInNextLayers()[0].recHit();
442  pxrh = secondHit.measurementsInNextLayers()[shit].recHit();
443 
444  pair<RecHitWithDist,ConstRecHitPointer> compatiblePair = pair<RecHitWithDist,ConstRecHitPointer>(rh,pxrh) ;
445  result.push_back(compatiblePair);
446  break;
447  }
448  }
449  }
450  }
451  return result;
452 }
#define LogDebug(id)
T barePhi() const
std::vector< TrajectoryMeasurement > measurements(const DetLayer &layer, const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
BarrelMeasurementEstimator meas2ndBLayer
static FreeTrajectoryState get(MagneticField const &magField, GlobalPoint const &xmeas, GlobalPoint const &xvert, float momentum, TrackCharge charge)
BarrelMeasurementEstimator meas1stBLayer
std::vector< ForwardDetLayer const * > const & posPixelForwardLayers() const
PropagatorWithMaterial * prop1stLayer
constexpr T normalizedPhi(T phi)
Definition: normalizedPhi.h:9
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
std::vector< CLHEP::Hep3Vector > pred1Meas
T y() const
Definition: PV3DBase.h:63
virtual const BoundCylinder & specificSurface() const final
Extension of the interface.
std::vector< ForwardDetLayer const * > const & negPixelForwardLayers() const
TransientTrackingRecHit::ConstRecHitPointer ConstRecHitPointer
T sqrt(T t)
Definition: SSEVec.h:18
T z() const
Definition: PV3DBase.h:64
LayerMeasurements theLayerMeasurements
const MagneticField * theMagField
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const DetLayer * detLayer(const DetId &id) const
obsolete method. Use idToLayer() instead.
std::vector< BarrelDetLayer const * > const & pixelBarrelLayers() const
GlobalVector momentum() const
GlobalPoint position() const
const GeometricSearchTracker * theGeometricSearchTracker
std::vector< CLHEP::Hep3Vector > pred2Meas
ForwardMeasurementEstimator meas2ndFLayer
PropagatorWithMaterial * prop2ndLayer
ForwardMeasurementEstimator meas1stFLayer
T x() const
Definition: PV3DBase.h:62
std::vector< SeedWithInfo > PixelHitMatcher::compatibleSeeds ( const std::vector< const TrajectorySeedCollection * > &  seedsV,
const GlobalPoint xmeas,
const GlobalPoint vprim,
float  energy,
float  charge 
)

Definition at line 98 of file PixelHitMatcher.cc.

References ALCARECOTkAlJpsiMuMu_cff::charge, compatibleHits(), funct::cos(), SoftLeptonByDistance_cfi::distance, dt, GeomDet::gdetIndex(), FTSFromVertexToPointFactory::get(), TrajectoryStateOnSurface::globalParameters(), hcalSimParameters_cfi::he, hfClusterShapes_cfi::hits, mps_fire::i, globals_cff::id1, globals_cff::id2, createfilelist::int, TrajectoryStateOnSurface::isValid(), FreeTrajectoryState::momentum(), PV3DBase< T, PVType, FrameType >::perp(), GlobalTrajectoryParameters::position(), FreeTrajectoryState::position(), mps_fire::result, SimDataFormats::CaloAnalysis::sc, SurveyInfoScenario_cff::seed, mathSSE::sqrt(), DetId::subdetId(), GeomDet::surface(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::z(), and CombinatorialSeedGeneratorForCosmicsRegionalReconstruction_cfi::zVertex.

Referenced by getVertex(), and ElectronSeedGenerator::seedsFromThisCluster().

100  {
101  typedef std::unordered_map<const GeomDet *, TrajectoryStateOnSurface> DetTsosAssoc;
102  typedef std::unordered_map<std::pair<const GeomDet*,GlobalPoint>, TrajectoryStateOnSurface> PosTsosAssoc;
103  const int charge = int(fcharge) ;
104 
105  // auto xmeas_phi = xmeas.barePhi();
106  auto xmeas_r = xmeas.perp();
107 
108  const float phicut = std::cos(2.5);
109 
110 
113  TrajectoryStateOnSurface tsos(fts, *bpb(fts.position(), fts.momentum()));
114 
115  std::vector<SeedWithInfo> result ;
116  unsigned int allSeedsSize = 0;
117  for (auto const sc : seedsV) allSeedsSize += sc->size();
118 
119  mapTsos2_fast_.clear();
120  mapTsos2_fast_.reserve(allSeedsSize) ;
121 
122  // std::vector<TrajectoryStateOnSurface> vTsos(theTrackerGeometry->dets().size());
123  // TrajectoryStateOnSurface vTsos[theTrackerGeometry->dets().size()];
124 
125  auto ndets = theTrackerGeometry->dets().size();
126 
127  int iTsos[ndets];
128  for ( auto & i : iTsos) i=-1;
129  std::vector<TrajectoryStateOnSurface> vTsos; vTsos.reserve(allSeedsSize);
130 
131  for (const auto seeds : seedsV) {
132  for(const auto& seed : *seeds) {
133  hit_gp_map_.clear();
134  if( seed.nHits() > 9 ) {
135  edm::LogWarning("GsfElectronAlgo|UnexpectedSeed") <<"We cannot deal with seeds having more than 9 hits." ;
136  continue;
137  }
138 
139  const TrajectorySeed::range& hits = seed.recHits();
140  // cache the global points
141 
142  for( auto it = hits.first; it != hits.second; ++it ) {
143  hit_gp_map_.emplace_back(it->globalPosition());
144  }
145 
146  //iterate on the hits
147  auto he = hits.second -1;
148  for( auto it1 = hits.first; it1 < he; ++it1 ) {
149  if( !it1->isValid() ) continue;
150  auto idx1 = std::distance(hits.first,it1);
151  const DetId id1 = it1->geographicalId();
152  const GeomDet *geomdet1 = it1->det();
153 
154  auto ix1 = geomdet1->gdetIndex();
155 
156  /* VI: this generates regression (other cut is just in phi). in my opinion it is safe and makes sense
157  auto away = geomdet1->position().basicVector().dot(xmeas.basicVector()) <0;
158  if (away) continue;
159  */
160 
161  const GlobalPoint& hit1Pos = hit_gp_map_[idx1];
162  auto dt = hit1Pos.x()*xmeas.x()+hit1Pos.y()*xmeas.y();
163  if (dt<0) continue;
164  if (dt<phicut*(xmeas_r*hit1Pos.perp())) continue;
165 
166  if(iTsos[ix1]<0) {
167  iTsos[ix1] = vTsos.size();
168  vTsos.push_back(prop1stLayer->propagate(tsos,geomdet1->surface()));
169  }
170  auto tsos1 = &vTsos[iTsos[ix1]];
171 
172  if( !tsos1->isValid() ) continue;
173  std::pair<bool, double> est = ( id1.subdetId() % 2 ?
174  meas1stBLayer.estimate(vprim, *tsos1, hit1Pos) :
175  meas1stFLayer.estimate(vprim, *tsos1, hit1Pos) );
176  if( !est.first ) continue;
177  EleRelPointPair pp1(hit1Pos,tsos1->globalParameters().position(),vprim);
178  const math::XYZPoint relHit1Pos(hit1Pos-vprim), relTSOSPos(tsos1->globalParameters().position() - vprim);
179  const int subDet1 = id1.subdetId();
180  const float dRz1 = ( id1.subdetId()%2 ? pp1.dZ() : pp1.dPerp() );
181  const float dPhi1 = pp1.dPhi();
182  // setup our vertex
183  double zVertex;
184  if (!useRecoVertex_) {
185  // we don't know the z vertex position, get it from linear extrapolation
186  // compute the z vertex from the cluster point and the found pixel hit
187  const double pxHit1z = hit1Pos.z();
188  const double pxHit1x = hit1Pos.x();
189  const double pxHit1y = hit1Pos.y();
190  const double r1diff = std::sqrt( (pxHit1x-vprim.x())*(pxHit1x-vprim.x()) +
191  (pxHit1y-vprim.y())*(pxHit1y-vprim.y()) );
192  const double r2diff = std::sqrt( (xmeas.x()-pxHit1x)*(xmeas.x()-pxHit1x) +
193  (xmeas.y()-pxHit1y)*(xmeas.y()-pxHit1y) );
194  zVertex = pxHit1z - r1diff*(xmeas.z()-pxHit1z)/r2diff;
195  } else {
196  // here use rather the reco vertex z position
197  zVertex = vprim.z();
198  }
199  GlobalPoint vertex(vprim.x(),vprim.y(),zVertex);
200  FreeTrajectoryState fts2 = FTSFromVertexToPointFactory::get(*theMagField, hit1Pos, vertex, energy, charge) ;
201  // now find the matching hit
202  for( auto it2 = it1+1; it2 != hits.second; ++it2 ) {
203  if( !it2->isValid() ) continue;
204  auto idx2 = std::distance(hits.first,it2);
205  const DetId id2 = it2->geographicalId();
206  const GeomDet *geomdet2 = it2->det();
207  const std::pair<const GeomDet *,GlobalPoint> det_key(geomdet2,hit1Pos);
208  const TrajectoryStateOnSurface* tsos2;
209  auto tsos2_itr = mapTsos2_fast_.find(det_key);
210  if( tsos2_itr != mapTsos2_fast_.end() ) {
211  tsos2 = &(tsos2_itr->second);
212  } else {
213  auto empl_result =
214  mapTsos2_fast_.emplace(det_key,prop2ndLayer->propagate(fts2,geomdet2->surface()));
215  tsos2 = &(empl_result.first->second);
216  }
217  if( !tsos2->isValid() ) continue;
218  const GlobalPoint& hit2Pos = hit_gp_map_[idx2];
219  std::pair<bool,double> est2 = ( id2.subdetId()%2 ?
220  meas2ndBLayer.estimate(vertex, *tsos2,hit2Pos) :
221  meas2ndFLayer.estimate(vertex, *tsos2,hit2Pos) );
222  if (est2.first) {
223  EleRelPointPair pp2(hit2Pos,tsos2->globalParameters().position(),vertex) ;
224  const int subDet2 = id2.subdetId();
225  const float dRz2 = (subDet2%2==1)?pp2.dZ():pp2.dPerp();
226  const float dPhi2 = pp2.dPhi();
227  const unsigned char hitsMask = (1<<idx1)|(1<<idx2);
228  result.push_back(SeedWithInfo(seed,hitsMask,subDet2,dRz2,dPhi2,subDet1,dRz1,dPhi1)) ;
229  }
230  }// inner loop on hits
231  }// outer loop on hits
232  }// loop on seeds
233  }//loop on vector of seeds
234  mapTsos2_fast_.clear() ;
235 
236  return result ;
237  }
float dt
Definition: AMPTWrapper.h:126
BarrelMeasurementEstimator meas2ndBLayer
static FreeTrajectoryState get(MagneticField const &magField, GlobalPoint const &xmeas, GlobalPoint const &xvert, float momentum, TrackCharge charge)
std::pair< bool, double > estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const override
T perp() const
Definition: PV3DBase.h:72
BarrelMeasurementEstimator meas1stBLayer
int gdetIndex() const
Definition: GeomDet.h:103
PropagatorWithMaterial * prop1stLayer
T y() const
Definition: PV3DBase.h:63
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
std::vector< GlobalPoint > hit_gp_map_
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
T sqrt(T t)
Definition: SSEVec.h:18
T z() const
Definition: PV3DBase.h:64
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
const MagneticField * theMagField
std::pair< const_iterator, const_iterator > range
GlobalVector momentum() const
Definition: DetId.h:18
GlobalPoint position() const
const GlobalTrajectoryParameters & globalParameters() const
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:53
ForwardMeasurementEstimator meas2ndFLayer
PropagatorWithMaterial * prop2ndLayer
ForwardMeasurementEstimator meas1stFLayer
std::pair< bool, double > estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const override
T x() const
Definition: PV3DBase.h:62
std::unordered_map< std::pair< const GeomDet *, GlobalPoint >, TrajectoryStateOnSurface > mapTsos2_fast_
const TrackerGeometry * theTrackerGeometry
float PixelHitMatcher::getVertex ( )

Definition at line 92 of file PixelHitMatcher.cc.

References compatibleSeeds().

Referenced by ElectronSeedGenerator::seedsFromThisCluster().

93  { return vertex_ ; }
vector< CLHEP::Hep3Vector > PixelHitMatcher::predicted1Hits ( )

Definition at line 86 of file PixelHitMatcher.cc.

87  { return pred1Meas ; }
std::vector< CLHEP::Hep3Vector > pred1Meas
vector< CLHEP::Hep3Vector > PixelHitMatcher::predicted2Hits ( )

Definition at line 89 of file PixelHitMatcher.cc.

90  { return pred2Meas ; }
std::vector< CLHEP::Hep3Vector > pred2Meas
void PixelHitMatcher::set1stLayer ( float  dummyphi1min,
float  dummyphi1max 
)

Definition at line 40 of file PixelHitMatcher.cc.

Referenced by ElectronSeedGenerator::seedsFromThisCluster().

41  {
42  meas1stBLayer.setPhiRange(dummyphi1min,dummyphi1max) ;
43  meas1stFLayer.setPhiRange(dummyphi1min,dummyphi1max) ;
44  }
BarrelMeasurementEstimator meas1stBLayer
void setPhiRange(float dummyphiMin, float dummyphiMax)
void setPhiRange(float dummyphiMin, float dummyphiMax)
ForwardMeasurementEstimator meas1stFLayer
void PixelHitMatcher::set1stLayerZRange ( float  zmin1,
float  zmax1 
)

Definition at line 46 of file PixelHitMatcher.cc.

Referenced by ElectronSeedGenerator::seedsFromThisCluster().

47  {
48  meas1stBLayer.setZRange(zmin1,zmax1) ;
49  meas1stFLayer.setRRange(zmin1,zmax1) ;
50  }
BarrelMeasurementEstimator meas1stBLayer
void setZRange(float zmin, float zmax)
ForwardMeasurementEstimator meas1stFLayer
void setRRange(float rmin, float rmax)
void PixelHitMatcher::set2ndLayer ( float  dummyphi2minB,
float  dummyphi2maxB,
float  dummyphi2minF,
float  dummyphi2maxF 
)

Definition at line 52 of file PixelHitMatcher.cc.

Referenced by ElectronSeedGenerator::seedsFromThisCluster().

53  {
54  meas2ndBLayer.setPhiRange(dummyphi2minB,dummyphi2maxB) ;
55  meas2ndFLayer.setPhiRange(dummyphi2minF,dummyphi2maxF) ;
56  }
BarrelMeasurementEstimator meas2ndBLayer
void setPhiRange(float dummyphiMin, float dummyphiMax)
ForwardMeasurementEstimator meas2ndFLayer
void setPhiRange(float dummyphiMin, float dummyphiMax)
void PixelHitMatcher::setES ( const MagneticField magField,
const MeasurementTracker theMeasurementTracker,
const TrackerGeometry trackerGeometry 
)

Definition at line 67 of file PixelHitMatcher.cc.

References alongMomentum, ResonanceBuilder::mass, and oppositeToMomentum.

Referenced by setEvent(), and ElectronSeedGenerator::setupES().

70  {
71  if (theMeasurementTracker)
72  {
73  theTracker = theMeasurementTracker;
74  theGeometricSearchTracker=theMeasurementTracker->geometricSearchTracker() ;
75  }
76 
77  theMagField = magField ;
78  theTrackerGeometry = trackerGeometry ;
79  float mass=.000511 ; // electron propagation
80  if (prop1stLayer) delete prop1stLayer ;
82  if (prop2ndLayer) delete prop2ndLayer ;
84  }
PropagatorWithMaterial * prop1stLayer
const MagneticField * theMagField
const GeometricSearchTracker * theGeometricSearchTracker
PropagatorWithMaterial * prop2ndLayer
const TrackerGeometry * theTrackerGeometry
const MeasurementTracker * theTracker
void PixelHitMatcher::setEvent ( const MeasurementTrackerEvent event)

Definition at line 61 of file PixelHitMatcher.cc.

References setES().

Referenced by ElectronSeedGenerator::run().

62  {
63  theTrackerEvent = & trackerData;
65  }
LayerMeasurements theLayerMeasurements
const MeasurementTrackerEvent * theTrackerEvent
const MeasurementTracker * theTracker
void PixelHitMatcher::setUseRecoVertex ( bool  val)

Definition at line 58 of file PixelHitMatcher.cc.

References heppy_batch::val.

Referenced by ElectronSeedGenerator::seedsFromThisCluster().

Member Data Documentation

std::vector<GlobalPoint> PixelHitMatcher::hit_gp_map_
private

Definition at line 226 of file PixelHitMatcher.h.

RecHitContainer PixelHitMatcher::hitsInTrack
private

Definition at line 204 of file PixelHitMatcher.h.

std::unordered_map<std::pair<const GeomDet*,GlobalPoint>, TrajectoryStateOnSurface> PixelHitMatcher::mapTsos2_fast_
private

Definition at line 225 of file PixelHitMatcher.h.

BarrelMeasurementEstimator PixelHitMatcher::meas1stBLayer
private

Definition at line 208 of file PixelHitMatcher.h.

ForwardMeasurementEstimator PixelHitMatcher::meas1stFLayer
private

Definition at line 210 of file PixelHitMatcher.h.

BarrelMeasurementEstimator PixelHitMatcher::meas2ndBLayer
private

Definition at line 209 of file PixelHitMatcher.h.

ForwardMeasurementEstimator PixelHitMatcher::meas2ndFLayer
private

Definition at line 211 of file PixelHitMatcher.h.

std::vector<CLHEP::Hep3Vector> PixelHitMatcher::pred1Meas
private

Definition at line 206 of file PixelHitMatcher.h.

std::vector<CLHEP::Hep3Vector> PixelHitMatcher::pred2Meas
private

Definition at line 207 of file PixelHitMatcher.h.

PropagatorWithMaterial* PixelHitMatcher::prop1stLayer
private

Definition at line 212 of file PixelHitMatcher.h.

PropagatorWithMaterial* PixelHitMatcher::prop2ndLayer
private

Definition at line 213 of file PixelHitMatcher.h.

bool PixelHitMatcher::searchInTIDTEC_
private

Definition at line 223 of file PixelHitMatcher.h.

const GeometricSearchTracker* PixelHitMatcher::theGeometricSearchTracker
private

Definition at line 214 of file PixelHitMatcher.h.

LayerMeasurements PixelHitMatcher::theLayerMeasurements
private

Definition at line 217 of file PixelHitMatcher.h.

const MagneticField* PixelHitMatcher::theMagField
private

Definition at line 218 of file PixelHitMatcher.h.

const MeasurementTracker* PixelHitMatcher::theTracker
private

Definition at line 216 of file PixelHitMatcher.h.

const MeasurementTrackerEvent* PixelHitMatcher::theTrackerEvent
private

Definition at line 215 of file PixelHitMatcher.h.

const TrackerGeometry* PixelHitMatcher::theTrackerGeometry
private

Definition at line 219 of file PixelHitMatcher.h.

bool PixelHitMatcher::useRecoVertex_
private

Definition at line 224 of file PixelHitMatcher.h.

float PixelHitMatcher::vertex_
private

Definition at line 221 of file PixelHitMatcher.h.