CMS 3D CMS Logo

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

#include <CosmicHitPairGeneratorFromLayerPair.h>

Public Member Functions

 CosmicHitPairGeneratorFromLayerPair (const LayerWithHits *inner, const LayerWithHits *outer, const TrackerGeometry &)
 
void hitPairs (const TrackingRegion &ar, OrderedHitPairs &ap)
 
const LayerWithHitsinnerLayer () const
 
const LayerWithHitsouterLayer () const
 
 ~CosmicHitPairGeneratorFromLayerPair ()
 

Private Attributes

const DetLayerinnerlay
 
const DetLayerouterlay
 
const LayerWithHitstheInnerLayer
 
const LayerWithHitstheOuterLayer
 
const TrackerGeometrytrackerGeometry
 

Detailed Description

Definition at line 15 of file CosmicHitPairGeneratorFromLayerPair.h.

Constructor & Destructor Documentation

◆ CosmicHitPairGeneratorFromLayerPair()

CosmicHitPairGeneratorFromLayerPair::CosmicHitPairGeneratorFromLayerPair ( const LayerWithHits inner,
const LayerWithHits outer,
const TrackerGeometry geom 
)

◆ ~CosmicHitPairGeneratorFromLayerPair()

CosmicHitPairGeneratorFromLayerPair::~CosmicHitPairGeneratorFromLayerPair ( )

Definition at line 19 of file CosmicHitPairGeneratorFromLayerPair.cc.

19 {}

Member Function Documentation

◆ hitPairs()

void CosmicHitPairGeneratorFromLayerPair::hitPairs ( const TrackingRegion ar,
OrderedHitPairs ap 
)

Definition at line 21 of file CosmicHitPairGeneratorFromLayerPair.cc.

References funct::abs(), Options::const, LayerWithHits::layer(), LayerWithHits::recHits(), mps_fire::result, theInnerLayer, theOuterLayer, and funct::true.

21  {
22  // static int NSee = 0; static int Ntry = 0; static int Nacc = 0;
23 
24  typedef OrderedHitPair::InnerRecHit InnerHit;
25  typedef OrderedHitPair::OuterRecHit OuterHit;
26 
27  if (theInnerLayer->recHits().empty())
28  return;
29 
30  if (theOuterLayer->recHits().empty())
31  return;
32  // const DetLayer* innerlay=theOuterLayer->layer();
33  // const BarrelDetLayer *pippo=dynamic_cast<const BarrelDetLayer*>(theOuterLayer->layer());
34 
35  // ************ Daniele
36 
37  const DetLayer* blay1;
38  const DetLayer* blay2;
39  blay1 = dynamic_cast<const BarrelDetLayer*>(theInnerLayer->layer());
40  blay2 = dynamic_cast<const BarrelDetLayer*>(theOuterLayer->layer());
41 
42  bool seedfromoverlaps = false;
43  bool InTheBarrel = false;
44  bool InTheForward = false;
45  if (blay1 && blay2) {
46  InTheBarrel = true;
47  } else
48  InTheForward = true;
49 
50  if (InTheBarrel) {
51  float radius1 = dynamic_cast<const BarrelDetLayer*>(theInnerLayer->layer())->specificSurface().radius();
52  float radius2 = dynamic_cast<const BarrelDetLayer*>(theOuterLayer->layer())->specificSurface().radius();
53  seedfromoverlaps = (abs(radius1 - radius2) < 0.1) ? true : false;
54  }
55 
56  vector<OrderedHitPair> allthepairs;
57 
58  for (auto ohh = theOuterLayer->recHits().begin(); ohh != theOuterLayer->recHits().end(); ohh++) {
59  for (auto ihh = theInnerLayer->recHits().begin(); ihh != theInnerLayer->recHits().end(); ihh++) {
60  auto oh = static_cast<BaseTrackerRecHit const* const>(*ohh);
61  auto ih = static_cast<BaseTrackerRecHit const* const>(*ihh);
62 
63  float z_diff = ih->globalPosition().z() - oh->globalPosition().z();
64  float inny = ih->globalPosition().y();
65  float outy = oh->globalPosition().y();
66  float innx = ih->globalPosition().x();
67  float outx = oh->globalPosition().x();
68  ;
69  float dxdy = abs((outx - innx) / (outy - inny));
70  float DeltaR = oh->globalPosition().perp() - ih->globalPosition().perp();
71  ;
72 
73  if (InTheBarrel &&
74  (abs(z_diff) < 30) // && (outy > 0.) && (inny > 0.)
75  //&&((abs(inny-outy))<30)
76  && (dxdy < 2) && (inny * outy > 0) && (abs(DeltaR) > 0)) {
77  // cout << " ******** sono dentro inthebarrel *********** " << endl;
78  if (seedfromoverlaps) {
79  //this part of code works for MTCC
80  // for the other geometries must be verified
81  //Overlaps in the difference in z is decreased and the difference in phi is
82  //less than 0.05
83  if ((DeltaR < 0) && (abs(z_diff) < 18) &&
84  (abs(ih->globalPosition().phi() - oh->globalPosition().phi()) < 0.05) && (dxdy < 2))
85  result.push_back(OrderedHitPair(ih, oh));
86  } else
87  result.push_back(OrderedHitPair(ih, oh));
88  }
89  if (InTheForward && (abs(z_diff) > 1.)) {
90  // cout << " ******** sono dentro intheforward *********** " << endl;
91  result.push_back(OrderedHitPair(ih, oh));
92  }
93  }
94  }
95 
96  /*
97  // uncomment if the sort operation below needs to be called
98  class CompareHitPairsY {
99  public:
100  CompareHitPairsY(const TrackerGeometry& t): tracker{&t} {}
101  bool operator()(const OrderedHitPair& h1, const OrderedHitPair& h2) {
102  const TrackingRecHit* trh1i = h1.inner()->hit();
103  const TrackingRecHit* trh2i = h2.inner()->hit();
104  const TrackingRecHit* trh1o = h1.outer()->hit();
105  const TrackingRecHit* trh2o = h2.outer()->hit();
106  GlobalPoint in1p = tracker->idToDet(trh1i->geographicalId())->surface().toGlobal(trh1i->localPosition());
107  GlobalPoint in2p = tracker->idToDet(trh2i->geographicalId())->surface().toGlobal(trh2i->localPosition());
108  GlobalPoint ou1p = tracker->idToDet(trh1o->geographicalId())->surface().toGlobal(trh1o->localPosition());
109  GlobalPoint ou2p = tracker->idToDet(trh2o->geographicalId())->surface().toGlobal(trh2o->localPosition());
110  if (ou1p.y() * ou2p.y() < 0)
111  return ou1p.y() > ou2p.y();
112  else {
113  float dist1 = 100 * std::abs(ou1p.z() - in1p.z()) - std::abs(ou1p.y()) - 0.1 * std::abs(in1p.y());
114  float dist2 = 100 * std::abs(ou2p.z() - in2p.z()) - std::abs(ou2p.y()) - 0.1 * std::abs(in2p.y());
115  return dist1 < dist2;
116  }
117  }
118 
119  private:
120  const TrackerGeometry* tracker;
121  };
122  stable_sort(allthepairs.begin(),allthepairs.end(),CompareHitPairsY(*trackerGeometry));
123  //Seed from overlaps are saved only if
124  //no others have been saved
125 
126  if (allthepairs.size()>0) {
127  if (seedfromoverlaps) {
128  if (result.size()==0) result.push_back(allthepairs[0]);
129  }
130  else result.push_back(allthepairs[0]);
131  }
132 */
133 }
Definition: DeltaR.py:1
SeedingHitSet::ConstRecHitPointer InnerRecHit
Definition: OrderedHitPair.h:9
const DetLayer * layer() const
Definition: LayerWithHits.h:35
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const std::vector< const TrackingRecHit * > & recHits() const
return the recHits of the Layer
Definition: LayerWithHits.h:32
SeedingHitSet::ConstRecHitPointer OuterRecHit
Definition: OrderedHitPair.h:8

◆ innerLayer()

const LayerWithHits* CosmicHitPairGeneratorFromLayerPair::innerLayer ( ) const
inline

Definition at line 25 of file CosmicHitPairGeneratorFromLayerPair.h.

References theInnerLayer.

◆ outerLayer()

const LayerWithHits* CosmicHitPairGeneratorFromLayerPair::outerLayer ( ) const
inline

Definition at line 26 of file CosmicHitPairGeneratorFromLayerPair.h.

References theOuterLayer.

Member Data Documentation

◆ innerlay

const DetLayer* CosmicHitPairGeneratorFromLayerPair::innerlay
private

Definition at line 32 of file CosmicHitPairGeneratorFromLayerPair.h.

◆ outerlay

const DetLayer* CosmicHitPairGeneratorFromLayerPair::outerlay
private

Definition at line 33 of file CosmicHitPairGeneratorFromLayerPair.h.

◆ theInnerLayer

const LayerWithHits* CosmicHitPairGeneratorFromLayerPair::theInnerLayer
private

Definition at line 31 of file CosmicHitPairGeneratorFromLayerPair.h.

Referenced by hitPairs(), and innerLayer().

◆ theOuterLayer

const LayerWithHits* CosmicHitPairGeneratorFromLayerPair::theOuterLayer
private

Definition at line 30 of file CosmicHitPairGeneratorFromLayerPair.h.

Referenced by hitPairs(), and outerLayer().

◆ trackerGeometry

const TrackerGeometry* CosmicHitPairGeneratorFromLayerPair::trackerGeometry
private

Definition at line 29 of file CosmicHitPairGeneratorFromLayerPair.h.