251 float SCl_phi = xmeas.
phi();
255 vector<pair<RecHitWithDist, ConstRecHitPointer> >
result;
256 LogDebug(
"") <<
"[PixelHitMatcher::compatibleHits] entering .. ";
258 vector<TrajectoryMeasurement> validMeasurements;
259 vector<TrajectoryMeasurement> invalidMeasurements;
261 typedef vector<TrajectoryMeasurement>::const_iterator aMeas;
266 typedef vector<const BarrelDetLayer*>::const_iterator BarrelLayerIterator;
274 if (tsos.isValid()) {
275 vector<TrajectoryMeasurement> pixelMeasurements =
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();
291 validMeasurements.push_back(*
m);
293 LogDebug(
"") <<
"[PixelHitMatcher::compatibleHits] Found a rechit in layer ";
298 else LogDebug(
"") <<
"Could not downcast!!";
306 vector<TrajectoryMeasurement> pixel2Measurements =
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());
318 LogDebug(
"") <<
"[PixelHitMatcher::compatibleHits] compatible hit position " <<
m->recHit()->globalPosition() << endl;
319 LogDebug(
"") <<
"[PixelHitMatcher::compatibleHits] predicted position " <<
m->forwardPredictedState().globalPosition() << endl;
321 validMeasurements.push_back(*
m);
322 LogDebug(
"") <<
"[PixelHitMatcher::compatibleHits] Found a rechit in layer ";
327 else LogDebug(
"") <<
"Could not downcast!!";
335 typedef vector<const ForwardDetLayer*>::const_iterator ForwardLayerIterator;
336 ForwardLayerIterator flayer;
339 if (tsosfwd.isValid()) {
341 for (
int i=0;
i<2;
i++) {
344 if (
i==0 && xmeas.
z() < -100. )
continue;
345 if (
i==1 && xmeas.
z() > 100. )
continue;
347 vector<TrajectoryMeasurement> pixelMeasurements =
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());
360 validMeasurements.push_back(*
m);
368 vector<TrajectoryMeasurement> pixel2Measurements =
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());
381 validMeasurements.push_back(*
m);
390 for (
unsigned i=0;
i<validMeasurements.size();
i++){
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());
407 double r2diff = (xmeas.
x()-pxHit1x)*(xmeas.
x()-pxHit1x) + (xmeas.
y()-pxHit1y)*(xmeas.
y()-pxHit1y);
409 zVertex = pxHit1z - r1diff*(xmeas.
z()-pxHit1z)/r2diff;
421 GlobalPoint hitPos( validMeasurements[
i].
recHit()->det()->surface().toGlobal( validMeasurements[
i].
recHit()->localPosition() ) ) ;
428 vector<CLHEP::Hep3Vector> predictions = secondHit.predictionInNextLayers();
430 for (
unsigned it = 0; it < predictions.size(); it++)
pred2Meas.push_back(predictions[it]);
436 if(!secondHit.measurementsInNextLayers().empty()){
437 for(
unsigned int shit=0; shit<secondHit.measurementsInNextLayers().size(); shit++)
446 pxrh = secondHit.measurementsInNextLayers()[shit].recHit();
448 pair<RecHitWithDist,ConstRecHitPointer> compatiblePair = pair<RecHitWithDist,ConstRecHitPointer>(rh,pxrh) ;
449 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
PropagatorWithMaterial * prop1stLayer
Geom::Phi< T > phi() const
std::vector< CLHEP::Hep3Vector > pred1Meas
virtual const BoundCylinder & specificSurface() const final
Extension of the interface.
ForwardLayerIterator neg1stFLayer()
TransientTrackingRecHit::ConstRecHitPointer ConstRecHitPointer
BarrelLayerIterator firstBLayer()
RealType normalized_phi(RealType phi)
LayerMeasurements theLayerMeasurements
const MagneticField * theMagField
Abs< T >::type abs(const T &t)
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