CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
18  iSetup.get<TrackerDigiGeometryRecord>().get(tracker);};
19  bool operator()( const OrderedHitPair& h1,
20  const OrderedHitPair& h2)
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  }
37  private:
39  };
41 
42 public:
43 
44 
46  const LayerWithHits* inner,
47  const LayerWithHits* outer,
48  const edm::EventSetup& iSetup);
50 
51 // virtual OrderedHitPairs hitPairs( const TrackingRegion& region,const edm::EventSetup& iSetup ) {
52 // return HitPairGenerator::hitPairs(region, iSetup);
53 // }
54  void hitPairs( const TrackingRegion& ar, OrderedHitPairs & ap, const edm::EventSetup& iSetup);
55 
56  const LayerWithHits* innerLayer() const { return theInnerLayer; }
57  const LayerWithHits* outerLayer() const { return theOuterLayer; }
58 
59 private:
66 
67 };
68 
69 #endif
const TransientTrackingRecHitBuilder * TTRHbuilder
bool operator()(const OrderedHitPair &h1, const OrderedHitPair &h2)
T y() const
Definition: PV3DBase.h:63
OuterRecHit outer() const
CompareHitPairsY(const edm::EventSetup &iSetup)
InnerRecHit inner() const
T z() const
Definition: PV3DBase.h:64
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::ESHandle< TrackerGeometry > tracker
const T & get() const
Definition: EventSetup.h:56
void hitPairs(const TrackingRegion &ar, OrderedHitPairs &ap, const edm::EventSetup &iSetup)
DetId geographicalId() const
virtual LocalPoint localPosition() const =0
CosmicHitPairGeneratorFromLayerPair(const LayerWithHits *inner, const LayerWithHits *outer, const edm::EventSetup &iSetup)