228 float SCl_phi = xmeas.
phi();
230 int charge = int(fcharge);
232 vector<pair<RecHitWithDist, ConstRecHitPointer> >
result;
233 LogDebug(
"") <<
"[PixelHitMatcher::compatibleHits] entering .. ";
235 vector<TrajectoryMeasurement> validMeasurements;
236 vector<TrajectoryMeasurement> invalidMeasurements;
238 typedef vector<TrajectoryMeasurement>::const_iterator aMeas;
243 typedef vector<const BarrelDetLayer*>::const_iterator BarrelLayerIterator;
251 if (tsos.isValid()) {
252 vector<TrajectoryMeasurement> pixelMeasurements =
256 LogDebug(
"") <<
"[PixelHitMatcher::compatibleHits] nbr of hits compatible with extrapolation to first layer: " << pixelMeasurements.size();
257 for (aMeas
m=pixelMeasurements.begin();
m!=pixelMeasurements.end();
m++){
258 if (
m->recHit()->isValid()) {
259 float localDphi =
normalized_phi(SCl_phi-
m->forwardPredictedState().globalPosition().phi()) ;
260 if(
std::abs(localDphi)>2.5)
continue;
261 CLHEP::Hep3Vector prediction(
m->forwardPredictedState().globalPosition().x(),
262 m->forwardPredictedState().globalPosition().y(),
263 m->forwardPredictedState().globalPosition().z());
264 LogDebug(
"") <<
"[PixelHitMatcher::compatibleHits] compatible hit position " <<
m->recHit()->globalPosition();
265 LogDebug(
"") <<
"[PixelHitMatcher::compatibleHits] predicted position " <<
m->forwardPredictedState().globalPosition();
268 validMeasurements.push_back(*
m);
270 LogDebug(
"") <<
"[PixelHitMatcher::compatibleHits] Found a rechit in layer ";
275 else LogDebug(
"") <<
"Could not downcast!!";
283 vector<TrajectoryMeasurement> pixel2Measurements =
287 for (aMeas
m=pixel2Measurements.begin();
m!=pixel2Measurements.end();
m++){
288 if (
m->recHit()->isValid()) {
289 float localDphi =
normalized_phi(SCl_phi-
m->forwardPredictedState().globalPosition().phi()) ;
290 if(
std::abs(localDphi)>2.5)
continue;
291 CLHEP::Hep3Vector prediction(
m->forwardPredictedState().globalPosition().x(),
292 m->forwardPredictedState().globalPosition().y(),
293 m->forwardPredictedState().globalPosition().z());
295 LogDebug(
"") <<
"[PixelHitMatcher::compatibleHits] compatible hit position " <<
m->recHit()->globalPosition() << endl;
296 LogDebug(
"") <<
"[PixelHitMatcher::compatibleHits] predicted position " <<
m->forwardPredictedState().globalPosition() << endl;
298 validMeasurements.push_back(*
m);
299 LogDebug(
"") <<
"[PixelHitMatcher::compatibleHits] Found a rechit in layer ";
304 else LogDebug(
"") <<
"Could not downcast!!";
312 typedef vector<const ForwardDetLayer*>::const_iterator ForwardLayerIterator;
313 ForwardLayerIterator flayer;
316 if (tsosfwd.isValid()) {
318 for (
int i=0;
i<2;
i++) {
321 if (
i==0 && xmeas.
z() < -100. )
continue;
322 if (
i==1 && xmeas.
z() > 100. )
continue;
324 vector<TrajectoryMeasurement> pixelMeasurements =
328 for (aMeas
m=pixelMeasurements.begin();
m!=pixelMeasurements.end();
m++){
329 if (
m->recHit()->isValid()) {
330 float localDphi =
normalized_phi(SCl_phi-
m->forwardPredictedState().globalPosition().phi());
331 if(
std::abs(localDphi)>2.5)
continue;
332 CLHEP::Hep3Vector prediction(
m->forwardPredictedState().globalPosition().x(),
333 m->forwardPredictedState().globalPosition().y(),
334 m->forwardPredictedState().globalPosition().z());
337 validMeasurements.push_back(*
m);
345 vector<TrajectoryMeasurement> pixel2Measurements =
349 for (aMeas
m=pixel2Measurements.begin();
m!=pixel2Measurements.end();
m++){
350 if (
m->recHit()->isValid()) {
351 float localDphi =
normalized_phi(SCl_phi-
m->forwardPredictedState().globalPosition().phi()) ;
352 if(
std::abs(localDphi)>2.5)
continue;
353 CLHEP::Hep3Vector prediction(
m->forwardPredictedState().globalPosition().x(),
354 m->forwardPredictedState().globalPosition().y(),
355 m->forwardPredictedState().globalPosition().z());
358 validMeasurements.push_back(*
m);
367 for (
unsigned i=0;
i<validMeasurements.size();
i++){
377 validMeasurements[
i].recHit()->localPosition()).
z();
378 double pxHit1x = validMeasurements[
i].recHit()->det()->surface().toGlobal(
379 validMeasurements[
i].recHit()->localPosition()).x();
380 double pxHit1y = validMeasurements[
i].recHit()->det()->surface().toGlobal(
381 validMeasurements[
i].recHit()->localPosition()).y();
382 double r1diff = (pxHit1x-vprim.
x())*(pxHit1x-vprim.
x()) + (pxHit1y-vprim.
y())*(pxHit1y-vprim.
y());
384 double r2diff = (xmeas.
x()-pxHit1x)*(xmeas.
x()-pxHit1x) + (xmeas.
y()-pxHit1y)*(xmeas.
y()-pxHit1y);
386 zVertex = pxHit1z - r1diff*(xmeas.
z()-pxHit1z)/r2diff;
398 GlobalPoint hitPos( validMeasurements[
i].recHit()->det()->surface().toGlobal( validMeasurements[
i].recHit()->localPosition() ) ) ;
405 vector<CLHEP::Hep3Vector> predictions = secondHit.predictionInNextLayers();
407 for (
unsigned it = 0; it < predictions.size(); it++)
pred2Meas.push_back(predictions[it]);
413 if(!secondHit.measurementsInNextLayers().empty()){
414 for(
unsigned int shit=0; shit<secondHit.measurementsInNextLayers().size(); shit++)
423 pxrh = secondHit.measurementsInNextLayers()[shit].recHit();
425 pair<RecHitWithDist,ConstRecHitPointer> compatiblePair = pair<RecHitWithDist,ConstRecHitPointer>(rh,pxrh) ;
426 result.push_back(compatiblePair);
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) 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.
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
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
virtual const BoundCylinder & specificSurface() const final
Extension of the interface.
const GeometricSearchTracker * theGeometricSearchTracker
std::vector< CLHEP::Hep3Vector > pred2Meas
ForwardMeasurementEstimator meas2ndFLayer
PropagatorWithMaterial * prop2ndLayer
ForwardMeasurementEstimator meas1stFLayer