test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 (TrajectorySeedCollection *seeds, 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 >
, TrajectoryStateOnSurface
mapTsos2_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(),
29  searchInTIDTEC_(searchInTIDTEC), useRecoVertex_(false)
30  {
31  meas1stFLayer.setRRangeI(rMinI,rMaxI) ;
32  meas2ndFLayer.setRRangeI(rMinI,rMaxI) ;
33  }
BarrelMeasurementEstimator meas2ndBLayer
BarrelMeasurementEstimator meas1stBLayer
PropagatorWithMaterial * prop1stLayer
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 244 of file PixelHitMatcher.cc.

References funct::abs(), barePhi(), RecoTauCleanerPlugins::charge, FTSFromVertexToPointFactory::get(), i, TrajectoryStateOnSurface::isValid(), LogDebug, visualization-live-secondInstance_cfg::m, PixelMatchNextLayers::measurementsInNextLayers(), FreeTrajectoryState::momentum(), normalized_phi(), PV3DBase< T, PVType, FrameType >::phi(), phi(), FreeTrajectoryState::position(), PixelMatchNextLayers::predictionInNextLayers(), mps_fire::result, BarrelDetLayer::specificSurface(), mathSSE::sqrt(), GeometricSearchDet::surface(), Surface::toGlobal(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

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

Definition at line 100 of file PixelHitMatcher.cc.

References RecoTauCleanerPlugins::charge, funct::cos(), HLT_25ns10e33_v2_cff::distance, dt, GeomDet::gdetIndex(), FTSFromVertexToPointFactory::get(), TrajectoryStateOnSurface::globalParameters(), i, TrajectoryStateOnSurface::isValid(), FreeTrajectoryState::momentum(), PV3DBase< T, PVType, FrameType >::perp(), GlobalTrajectoryParameters::position(), FreeTrajectoryState::position(), mps_fire::result, fileCollector::seed, mathSSE::sqrt(), DetId::subdetId(), GeomDet::surface(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

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

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.

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.

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.

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 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.

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.

60  { useRecoVertex_ = val ; }

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.