CMS 3D CMS Logo

CosmicHitPairGeneratorFromLayerPair.h
Go to the documentation of this file.
1 #ifndef CosmicHitPairGeneratorFromLayerPair_h
2 #define CosmicHitPairGeneratorFromLayerPair_h
3 
11 class DetLayer;
12 class TrackingRegion;
13 class LayerWithHits;
15 public:
17  bool operator()(const OrderedHitPair& h1, const OrderedHitPair& h2) {
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  }
34 
35 private:
37 };
39 public:
41  const LayerWithHits* outer,
42  const edm::EventSetup& iSetup);
44 
45  // virtual OrderedHitPairs hitPairs( const TrackingRegion& region,const edm::EventSetup& iSetup ) {
46  // return HitPairGenerator::hitPairs(region, iSetup);
47  // }
48  void hitPairs(const TrackingRegion& ar, OrderedHitPairs& ap, const edm::EventSetup& iSetup);
49 
50  const LayerWithHits* innerLayer() const { return theInnerLayer; }
51  const LayerWithHits* outerLayer() const { return theOuterLayer; }
52 
53 private:
60 };
61 
62 #endif
const TransientTrackingRecHitBuilder * TTRHbuilder
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
bool operator()(const OrderedHitPair &h1, const OrderedHitPair &h2)
T y() const
Definition: PV3DBase.h:60
OuterRecHit outer() const
CompareHitPairsY(const edm::EventSetup &iSetup)
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
T get() const
Definition: EventSetup.h:73
const TrackerGeomDet * idToDet(DetId) const override
DetId geographicalId() const