CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
CompareHitPairsY Class Reference

#include <CosmicHitPairGeneratorFromLayerPair.h>

Public Member Functions

 CompareHitPairsY (const edm::EventSetup &iSetup)
 
bool operator() (const OrderedHitPair &h1, const OrderedHitPair &h2)
 

Private Attributes

edm::ESHandle< TrackerGeometrytracker
 

Detailed Description

Definition at line 14 of file CosmicHitPairGeneratorFromLayerPair.h.

Constructor & Destructor Documentation

CompareHitPairsY::CompareHitPairsY ( const edm::EventSetup iSetup)
inline

Member Function Documentation

bool CompareHitPairsY::operator() ( const OrderedHitPair h1,
const OrderedHitPair h2 
)
inline

Definition at line 17 of file CosmicHitPairGeneratorFromLayerPair.h.

References funct::abs(), TrackingRecHit::geographicalId(), TrackerGeometry::idToDet(), OrderedHitPair::inner(), TrackingRecHit::localPosition(), OrderedHitPair::outer(), GeomDet::toGlobal(), tracker, PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

17  {
18  const TrackingRecHit* trh1i = h1.inner()->hit();
19  const TrackingRecHit* trh2i = h2.inner()->hit();
20  const TrackingRecHit* trh1o = h1.outer()->hit();
21  const TrackingRecHit* trh2o = h2.outer()->hit();
22  GlobalPoint in1p = tracker->idToDet(trh1i->geographicalId())->surface().toGlobal(trh1i->localPosition());
23  GlobalPoint in2p = tracker->idToDet(trh2i->geographicalId())->surface().toGlobal(trh2i->localPosition());
24  GlobalPoint ou1p = tracker->idToDet(trh1o->geographicalId())->surface().toGlobal(trh1o->localPosition());
25  GlobalPoint ou2p = tracker->idToDet(trh2o->geographicalId())->surface().toGlobal(trh2o->localPosition());
26  if (ou1p.y() * ou2p.y() < 0)
27  return ou1p.y() > ou2p.y();
28  else {
29  float dist1 = 100 * std::abs(ou1p.z() - in1p.z()) - std::abs(ou1p.y()) - 0.1 * std::abs(in1p.y());
30  float dist2 = 100 * std::abs(ou2p.z() - in2p.z()) - std::abs(ou2p.y()) - 0.1 * std::abs(in2p.y());
31  return dist1 < dist2;
32  }
33  }
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
T y() const
Definition: PV3DBase.h:60
OuterRecHit outer() const
InnerRecHit inner() const
T z() const
Definition: PV3DBase.h:61
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual LocalPoint localPosition() const =0
edm::ESHandle< TrackerGeometry > tracker
const TrackerGeomDet * idToDet(DetId) const override
DetId geographicalId() const

Member Data Documentation

edm::ESHandle<TrackerGeometry> CompareHitPairsY::tracker
private

Definition at line 36 of file CosmicHitPairGeneratorFromLayerPair.h.

Referenced by CompareHitPairsY(), and operator()().