249 float SCl_phi = xmeas.
phi();
253 vector<pair<RecHitWithDist, ConstRecHitPointer> >
result;
254 LogDebug(
"") <<
"[PixelHitMatcher::compatibleHits] entering .. ";
256 vector<TrajectoryMeasurement> validMeasurements;
257 vector<TrajectoryMeasurement> invalidMeasurements;
259 typedef vector<TrajectoryMeasurement>::const_iterator aMeas;
271 if (tsos.isValid()) {
272 vector<TrajectoryMeasurement> pixelMeasurements =
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();
288 validMeasurements.push_back(*
m);
290 LogDebug(
"") <<
"[PixelHitMatcher::compatibleHits] Found a rechit in layer ";
295 else LogDebug(
"") <<
"Could not downcast!!";
303 vector<TrajectoryMeasurement> pixel2Measurements =
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());
315 LogDebug(
"") <<
"[PixelHitMatcher::compatibleHits] compatible hit position " <<
m->recHit()->globalPosition() << endl;
316 LogDebug(
"") <<
"[PixelHitMatcher::compatibleHits] predicted position " <<
m->forwardPredictedState().globalPosition() << endl;
318 validMeasurements.push_back(*
m);
319 LogDebug(
"") <<
"[PixelHitMatcher::compatibleHits] Found a rechit in layer ";
324 else LogDebug(
"") <<
"Could not downcast!!";
334 if (tsosfwd.isValid()) {
336 for (
int i=0;
i<2;
i++) {
340 if (
i==0 && xmeas.
z() < -100. )
continue;
341 if (
i==1 && xmeas.
z() > 100. )
continue;
343 vector<TrajectoryMeasurement> pixelMeasurements =
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());
356 validMeasurements.push_back(*
m);
364 vector<TrajectoryMeasurement> pixel2Measurements =
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());
377 validMeasurements.push_back(*
m);
386 for (
unsigned i=0;
i<validMeasurements.size();
i++){
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());
403 double r2diff = (xmeas.
x()-pxHit1x)*(xmeas.
x()-pxHit1x) + (xmeas.
y()-pxHit1y)*(xmeas.
y()-pxHit1y);
405 zVertex = pxHit1z - r1diff*(xmeas.
z()-pxHit1z)/r2diff;
417 GlobalPoint hitPos( validMeasurements[
i].
recHit()->det()->surface().toGlobal( validMeasurements[
i].
recHit()->localPosition() ) ) ;
424 vector<CLHEP::Hep3Vector> predictions = secondHit.predictionInNextLayers();
426 for (
unsigned it = 0; it < predictions.size(); it++)
pred2Meas.push_back(predictions[it]);
432 if(!secondHit.measurementsInNextLayers().empty()){
433 for(
unsigned int shit=0; shit<secondHit.measurementsInNextLayers().size(); shit++)
442 pxrh = secondHit.measurementsInNextLayers()[shit].recHit();
444 pair<RecHitWithDist,ConstRecHitPointer> compatiblePair = pair<RecHitWithDist,ConstRecHitPointer>(rh,pxrh) ;
445 result.push_back(compatiblePair);
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)
Geom::Phi< T > phi() const
std::vector< CLHEP::Hep3Vector > pred1Meas
virtual const BoundCylinder & specificSurface() const final
Extension of the interface.
std::vector< ForwardDetLayer const * > const & negPixelForwardLayers() const
TransientTrackingRecHit::ConstRecHitPointer ConstRecHitPointer
LayerMeasurements theLayerMeasurements
const MagneticField * theMagField
Abs< T >::type abs(const T &t)
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