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

Definition at line 16 of file CosmicHitPairGeneratorFromLayerPair.h.

References edm::EventSetup::get(), and tracker.

16  {
17 
18  iSetup.get<TrackerDigiGeometryRecord>().get(tracker);};
edm::ESHandle< TrackerGeometry > tracker
T get() const
Definition: EventSetup.h:63

Member Function Documentation

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

Definition at line 19 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().

21  {
22  const TrackingRecHit * trh1i = h1.inner()->hit();
23  const TrackingRecHit * trh2i = h2.inner()->hit();
24  const TrackingRecHit * trh1o = h1.outer()->hit();
25  const TrackingRecHit * trh2o = h2.outer()->hit();
26  GlobalPoint in1p=tracker->idToDet(trh1i->geographicalId())->surface().toGlobal(trh1i->localPosition());
27  GlobalPoint in2p=tracker->idToDet(trh2i->geographicalId())->surface().toGlobal(trh2i->localPosition());
28  GlobalPoint ou1p=tracker->idToDet(trh1o->geographicalId())->surface().toGlobal(trh1o->localPosition());
29  GlobalPoint ou2p=tracker->idToDet(trh2o->geographicalId())->surface().toGlobal(trh2o->localPosition());
30  if (ou1p.y()*ou2p.y()<0) return ou1p.y()>ou2p.y();
31  else{
32  float dist1=100*std::abs(ou1p.z()-in1p.z())-std::abs(ou1p.y())-0.1*std::abs(in1p.y());
33  float dist2=100*std::abs(ou2p.z()-in2p.z())-std::abs(ou2p.y())-0.1*std::abs(in2p.y());
34  return dist1 < dist2;
35  }
36  }
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:54
T y() const
Definition: PV3DBase.h:63
OuterRecHit outer() const
InnerRecHit inner() const
T z() const
Definition: PV3DBase.h:64
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 38 of file CosmicHitPairGeneratorFromLayerPair.h.

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