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_
 
PixelMatchStartLayers startLayers
 
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 162 of file PixelHitMatcher.h.

Member Typedef Documentation

Definition at line 166 of file PixelHitMatcher.h.

Definition at line 168 of file PixelHitMatcher.h.

Definition at line 167 of file PixelHitMatcher.h.

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

Definition at line 172 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  startLayers(),
28  prop1stLayer(nullptr), prop2ndLayer(nullptr),theGeometricSearchTracker(nullptr),theTrackerEvent(nullptr),theTracker(nullptr),vertex_(0.),
30  {
33  }
BarrelMeasurementEstimator meas2ndBLayer
BarrelMeasurementEstimator meas1stBLayer
PropagatorWithMaterial * prop1stLayer
rMaxI
intermediate region SC in EB and 2nd hits in PXF
const MeasurementTrackerEvent * theTrackerEvent
PixelMatchStartLayers startLayers
const GeometricSearchTracker * theGeometricSearchTracker
ForwardMeasurementEstimator meas2ndFLayer
PropagatorWithMaterial * prop2ndLayer
ForwardMeasurementEstimator meas1stFLayer
void setRRangeI(float rmin, float rmax)
const MeasurementTracker * theTracker
PixelHitMatcher::~PixelHitMatcher ( )
virtual

Definition at line 35 of file PixelHitMatcher.cc.

36  {
37  delete prop1stLayer ;
38  delete prop2ndLayer ;
39  }
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 245 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(), normalized_phi(), 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().

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

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

References compatibleSeeds().

Referenced by ElectronSeedGenerator::seedsFromThisCluster().

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

Definition at line 88 of file PixelHitMatcher.cc.

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

Definition at line 91 of file PixelHitMatcher.cc.

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

Definition at line 41 of file PixelHitMatcher.cc.

Referenced by ElectronSeedGenerator::seedsFromThisCluster().

42  {
43  meas1stBLayer.setPhiRange(dummyphi1min,dummyphi1max) ;
44  meas1stFLayer.setPhiRange(dummyphi1min,dummyphi1max) ;
45  }
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 47 of file PixelHitMatcher.cc.

Referenced by ElectronSeedGenerator::seedsFromThisCluster().

48  {
49  meas1stBLayer.setZRange(zmin1,zmax1) ;
50  meas1stFLayer.setRRange(zmin1,zmax1) ;
51  }
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 53 of file PixelHitMatcher.cc.

Referenced by ElectronSeedGenerator::seedsFromThisCluster().

54  {
55  meas2ndBLayer.setPhiRange(dummyphi2minB,dummyphi2maxB) ;
56  meas2ndFLayer.setPhiRange(dummyphi2minF,dummyphi2maxF) ;
57  }
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 68 of file PixelHitMatcher.cc.

References alongMomentum, ResonanceBuilder::mass, and oppositeToMomentum.

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

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

Definition at line 62 of file PixelHitMatcher.cc.

References setES().

Referenced by ElectronSeedGenerator::run().

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

Definition at line 59 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 235 of file PixelHitMatcher.h.

RecHitContainer PixelHitMatcher::hitsInTrack
private

Definition at line 212 of file PixelHitMatcher.h.

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

Definition at line 234 of file PixelHitMatcher.h.

BarrelMeasurementEstimator PixelHitMatcher::meas1stBLayer
private

Definition at line 216 of file PixelHitMatcher.h.

ForwardMeasurementEstimator PixelHitMatcher::meas1stFLayer
private

Definition at line 218 of file PixelHitMatcher.h.

BarrelMeasurementEstimator PixelHitMatcher::meas2ndBLayer
private

Definition at line 217 of file PixelHitMatcher.h.

ForwardMeasurementEstimator PixelHitMatcher::meas2ndFLayer
private

Definition at line 219 of file PixelHitMatcher.h.

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

Definition at line 214 of file PixelHitMatcher.h.

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

Definition at line 215 of file PixelHitMatcher.h.

PropagatorWithMaterial* PixelHitMatcher::prop1stLayer
private

Definition at line 221 of file PixelHitMatcher.h.

PropagatorWithMaterial* PixelHitMatcher::prop2ndLayer
private

Definition at line 222 of file PixelHitMatcher.h.

bool PixelHitMatcher::searchInTIDTEC_
private

Definition at line 232 of file PixelHitMatcher.h.

PixelMatchStartLayers PixelHitMatcher::startLayers
private

Definition at line 220 of file PixelHitMatcher.h.

const GeometricSearchTracker* PixelHitMatcher::theGeometricSearchTracker
private

Definition at line 223 of file PixelHitMatcher.h.

LayerMeasurements PixelHitMatcher::theLayerMeasurements
private

Definition at line 226 of file PixelHitMatcher.h.

const MagneticField* PixelHitMatcher::theMagField
private

Definition at line 227 of file PixelHitMatcher.h.

const MeasurementTracker* PixelHitMatcher::theTracker
private

Definition at line 225 of file PixelHitMatcher.h.

const MeasurementTrackerEvent* PixelHitMatcher::theTrackerEvent
private

Definition at line 224 of file PixelHitMatcher.h.

const TrackerGeometry* PixelHitMatcher::theTrackerGeometry
private

Definition at line 228 of file PixelHitMatcher.h.

bool PixelHitMatcher::useRecoVertex_
private

Definition at line 233 of file PixelHitMatcher.h.

float PixelHitMatcher::vertex_
private

Definition at line 230 of file PixelHitMatcher.h.