CMS 3D CMS Logo

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