CMS 3D CMS Logo

CosmicHitPairGeneratorFromLayerPair.cc
Go to the documentation of this file.
11 
12 using namespace std;
13 // typedef TransientTrackingRecHit::ConstRecHitPointer TkHitPairsCachedHit;
14 
16  const LayerWithHits* inner,
17  const LayerWithHits* outer,
18  // LayerCacheType* layerCache,
19  const edm::EventSetup& iSetup)
20  : TTRHbuilder(nullptr),
21  trackerGeometry(nullptr),
22  //theLayerCache(*layerCache),
23  theOuterLayer(outer),
24  theInnerLayer(inner) {
27  trackerGeometry = tracker.product();
28 }
32  const edm::EventSetup& iSetup) {
33  // static int NSee = 0; static int Ntry = 0; static int Nacc = 0;
34 
35  typedef OrderedHitPair::InnerRecHit InnerHit;
36  typedef OrderedHitPair::OuterRecHit OuterHit;
37 
38  if (theInnerLayer->recHits().empty())
39  return;
40 
41  if (theOuterLayer->recHits().empty())
42  return;
43  // const DetLayer* innerlay=theOuterLayer->layer();
44  // const BarrelDetLayer *pippo=dynamic_cast<const BarrelDetLayer*>(theOuterLayer->layer());
45 
46  // ************ Daniele
47 
48  const DetLayer* blay1;
49  const DetLayer* blay2;
50  blay1 = dynamic_cast<const BarrelDetLayer*>(theInnerLayer->layer());
51  blay2 = dynamic_cast<const BarrelDetLayer*>(theOuterLayer->layer());
52 
53  bool seedfromoverlaps = false;
54  bool InTheBarrel = false;
55  bool InTheForward = false;
56  if (blay1 && blay2) {
57  InTheBarrel = true;
58  } else
59  InTheForward = true;
60 
61  if (InTheBarrel) {
62  float radius1 = dynamic_cast<const BarrelDetLayer*>(theInnerLayer->layer())->specificSurface().radius();
63  float radius2 = dynamic_cast<const BarrelDetLayer*>(theOuterLayer->layer())->specificSurface().radius();
64  seedfromoverlaps = (abs(radius1 - radius2) < 0.1) ? true : false;
65  }
66 
67  vector<OrderedHitPair> allthepairs;
68  std::string builderName = "WithTrackAngle";
70  iSetup.get<TransientRecHitRecord>().get(builderName, builder);
71 
72  for (auto ohh = theOuterLayer->recHits().begin(); ohh != theOuterLayer->recHits().end(); ohh++) {
73  for (auto ihh = theInnerLayer->recHits().begin(); ihh != theInnerLayer->recHits().end(); ihh++) {
74  auto oh = static_cast<BaseTrackerRecHit const* const>(*ohh);
75  auto ih = static_cast<BaseTrackerRecHit const* const>(*ihh);
76 
77  float z_diff = ih->globalPosition().z() - oh->globalPosition().z();
78  float inny = ih->globalPosition().y();
79  float outy = oh->globalPosition().y();
80  float innx = ih->globalPosition().x();
81  float outx = oh->globalPosition().x();
82  ;
83  float dxdy = abs((outx - innx) / (outy - inny));
84  float DeltaR = oh->globalPosition().perp() - ih->globalPosition().perp();
85  ;
86 
87  if (InTheBarrel &&
88  (abs(z_diff) < 30) // && (outy > 0.) && (inny > 0.)
89  //&&((abs(inny-outy))<30)
90  && (dxdy < 2) && (inny * outy > 0) && (abs(DeltaR) > 0)) {
91  // cout << " ******** sono dentro inthebarrel *********** " << endl;
92  if (seedfromoverlaps) {
93  //this part of code works for MTCC
94  // for the other geometries must be verified
95  //Overlaps in the difference in z is decreased and the difference in phi is
96  //less than 0.05
97  if ((DeltaR < 0) && (abs(z_diff) < 18) &&
98  (abs(ih->globalPosition().phi() - oh->globalPosition().phi()) < 0.05) && (dxdy < 2))
99  result.push_back(OrderedHitPair(ih, oh));
100  } else
101  result.push_back(OrderedHitPair(ih, oh));
102  }
103  if (InTheForward && (abs(z_diff) > 1.)) {
104  // cout << " ******** sono dentro intheforward *********** " << endl;
105  result.push_back(OrderedHitPair(ih, oh));
106  }
107  }
108  }
109 
110  // stable_sort(allthepairs.begin(),allthepairs.end(),CompareHitPairsY(iSetup));
111  // //Seed from overlaps are saved only if
112  // //no others have been saved
113 
114  // if (allthepairs.size()>0) {
115  // if (seedfromoverlaps) {
116  // if (result.size()==0) result.push_back(allthepairs[0]);
117  // }
118  // else result.push_back(allthepairs[0]);
119  // }
120 }
OrderedHitPairs
Definition: OrderedHitPairs.h:8
LayerWithHits::layer
const DetLayer * layer() const
Definition: LayerWithHits.h:35
MessageLogger.h
ESHandle.h
DetLayer
Definition: DetLayer.h:21
CosmicHitPairGeneratorFromLayerPair::~CosmicHitPairGeneratorFromLayerPair
~CosmicHitPairGeneratorFromLayerPair()
Definition: CosmicHitPairGeneratorFromLayerPair.cc:29
TransientRecHitRecord.h
OrderedHitPair.h
CosmicHitPairGeneratorFromLayerPair::theInnerLayer
const LayerWithHits * theInnerLayer
Definition: CosmicHitPairGeneratorFromLayerPair.h:57
TransientRecHitRecord
Definition: TransientRecHitRecord.h:14
CosmicHitPairGeneratorFromLayerPair::CosmicHitPairGeneratorFromLayerPair
CosmicHitPairGeneratorFromLayerPair(const LayerWithHits *inner, const LayerWithHits *outer, const edm::EventSetup &iSetup)
Definition: CosmicHitPairGeneratorFromLayerPair.cc:15
OrderedHitPair::OuterRecHit
SeedingHitSet::ConstRecHitPointer OuterRecHit
Definition: OrderedHitPair.h:8
TkTransientTrackingRecHitBuilder.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
SurfaceOrientation::inner
Definition: Surface.h:19
CosmicHitPairGeneratorFromLayerPair::trackerGeometry
const TrackerGeometry * trackerGeometry
Definition: CosmicHitPairGeneratorFromLayerPair.h:55
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:16
edm::ESHandle< TrackerGeometry >
CosmicHitPairGeneratorFromLayerPair::hitPairs
void hitPairs(const TrackingRegion &ar, OrderedHitPairs &ap, const edm::EventSetup &iSetup)
Definition: CosmicHitPairGeneratorFromLayerPair.cc:30
PbPb_ZMuSkimMuonDPG_cff.tracker
tracker
Definition: PbPb_ZMuSkimMuonDPG_cff.py:60
LayerWithHits::recHits
const std::vector< const TrackingRecHit * > & recHits() const
return the recHits of the Layer
Definition: LayerWithHits.h:32
funct::true
true
Definition: Factorize.h:173
TrackerDigiGeometryRecord.h
DeltaR
Definition: DeltaR.py:1
HLT_FULL_cff.region
region
Definition: HLT_FULL_cff.py:88286
BarrelDetLayer.h
edm::EventSetup
Definition: EventSetup.h:58
get
#define get
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
std
Definition: JetResolutionObject.h:76
OrderedHitPair::InnerRecHit
SeedingHitSet::ConstRecHitPointer InnerRecHit
Definition: OrderedHitPair.h:9
DetLayer.h
TrackingRegion
Definition: TrackingRegion.h:41
mps_fire.result
result
Definition: mps_fire.py:311
TrackingRegion.h
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
CosmicHitPairGeneratorFromLayerPair.h
SurfaceOrientation::outer
Definition: Surface.h:19
OrderedHitPair
Definition: OrderedHitPair.h:6
CosmicHitPairGeneratorFromLayerPair::theOuterLayer
const LayerWithHits * theOuterLayer
Definition: CosmicHitPairGeneratorFromLayerPair.h:56
LayerWithHits
Definition: LayerWithHits.h:12