250 float SCl_phi = xmeas.
phi();
254 vector<pair<RecHitWithDist, ConstRecHitPointer> >
result;
255 LogDebug(
"") <<
"[PixelHitMatcher::compatibleHits] entering .. ";
257 vector<TrajectoryMeasurement> validMeasurements;
258 vector<TrajectoryMeasurement> invalidMeasurements;
260 typedef vector<TrajectoryMeasurement>::const_iterator aMeas;
265 typedef vector<const BarrelDetLayer*>::const_iterator BarrelLayerIterator;
273 if (tsos.isValid()) {
274 vector<TrajectoryMeasurement> pixelMeasurements =
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();
290 validMeasurements.push_back(*
m);
292 LogDebug(
"") <<
"[PixelHitMatcher::compatibleHits] Found a rechit in layer ";
297 else LogDebug(
"") <<
"Could not downcast!!";
305 vector<TrajectoryMeasurement> pixel2Measurements =
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());
317 LogDebug(
"") <<
"[PixelHitMatcher::compatibleHits] compatible hit position " <<
m->recHit()->globalPosition() << endl;
318 LogDebug(
"") <<
"[PixelHitMatcher::compatibleHits] predicted position " <<
m->forwardPredictedState().globalPosition() << endl;
320 validMeasurements.push_back(*
m);
321 LogDebug(
"") <<
"[PixelHitMatcher::compatibleHits] Found a rechit in layer ";
326 else LogDebug(
"") <<
"Could not downcast!!";
334 typedef vector<const ForwardDetLayer*>::const_iterator ForwardLayerIterator;
335 ForwardLayerIterator flayer;
338 if (tsosfwd.isValid()) {
340 for (
int i=0;
i<2;
i++) {
343 if (
i==0 && xmeas.
z() < -100. )
continue;
344 if (
i==1 && xmeas.
z() > 100. )
continue;
346 vector<TrajectoryMeasurement> pixelMeasurements =
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());
359 validMeasurements.push_back(*
m);
367 vector<TrajectoryMeasurement> pixel2Measurements =
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());
380 validMeasurements.push_back(*
m);
389 for (
unsigned i=0;
i<validMeasurements.size();
i++){
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());
406 double r2diff = (xmeas.
x()-pxHit1x)*(xmeas.
x()-pxHit1x) + (xmeas.
y()-pxHit1y)*(xmeas.
y()-pxHit1y);
408 zVertex = pxHit1z - r1diff*(xmeas.
z()-pxHit1z)/r2diff;
420 GlobalPoint hitPos( validMeasurements[
i].
recHit()->det()->surface().toGlobal( validMeasurements[
i].
recHit()->localPosition() ) ) ;
427 vector<CLHEP::Hep3Vector> predictions = secondHit.predictionInNextLayers();
429 for (
unsigned it = 0; it < predictions.size(); it++)
pred2Meas.push_back(predictions[it]);
435 if(!secondHit.measurementsInNextLayers().empty()){
436 for(
unsigned int shit=0; shit<secondHit.measurementsInNextLayers().size(); shit++)
445 pxrh = secondHit.measurementsInNextLayers()[shit].recHit();
447 pair<RecHitWithDist,ConstRecHitPointer> compatiblePair = pair<RecHitWithDist,ConstRecHitPointer>(rh,pxrh) ;
448 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