CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
HitPairGeneratorFromLayerPair Class Reference

#include <HitPairGeneratorFromLayerPair.h>

Public Types

typedef
SeedingLayerSetsHits::SeedingLayer 
Layer
 
typedef LayerHitMapCache LayerCacheType
 
typedef
SeedingLayerSetsHits::SeedingLayerSet 
Layers
 

Public Member Functions

HitDoublets doublets (const TrackingRegion &reg, const edm::Event &ev, const edm::EventSetup &es, Layers layers)
 
 HitPairGeneratorFromLayerPair (unsigned int inner, unsigned int outer, LayerCacheType *layerCache, unsigned int max=0)
 
void hitPairs (const TrackingRegion &reg, OrderedHitPairs &prs, const edm::Event &ev, const edm::EventSetup &es, Layers layers)
 
Layer innerLayer (const Layers &layers) const
 
Layer outerLayer (const Layers &layers) const
 
 ~HitPairGeneratorFromLayerPair ()
 

Private Attributes

const unsigned int theInnerLayer
 
LayerCacheTypetheLayerCache
 
const unsigned int theMaxElement
 
const unsigned int theOuterLayer
 

Detailed Description

Definition at line 11 of file HitPairGeneratorFromLayerPair.h.

Member Typedef Documentation

Definition at line 17 of file HitPairGeneratorFromLayerPair.h.

Definition at line 15 of file HitPairGeneratorFromLayerPair.h.

Definition at line 16 of file HitPairGeneratorFromLayerPair.h.

Constructor & Destructor Documentation

HitPairGeneratorFromLayerPair::HitPairGeneratorFromLayerPair ( unsigned int  inner,
unsigned int  outer,
LayerCacheType layerCache,
unsigned int  max = 0 
)
HitPairGeneratorFromLayerPair::~HitPairGeneratorFromLayerPair ( )

Definition at line 41 of file HitPairGeneratorFromLayerPair.cc.

41 {}

Member Function Documentation

HitDoublets HitPairGeneratorFromLayerPair::doublets ( const TrackingRegion reg,
const edm::Event ev,
const edm::EventSetup es,
Layers  layers 
)

Definition at line 90 of file HitPairGeneratorFromLayerPair.cc.

References HitDoublets::add(), HitRZCompatibility::algo(), b, TrackingRegion::checkRZ(), HitDoublets::clear(), constexpr, SiPixelRawToDigiRegional_cfi::deltaPhi, SeedingLayerSetsHits::SeedingLayer::detLayer(), RecHitsSortedInPhi::doubleRange(), RecHitsSortedInPhi::drphi, RecHitsSortedInPhi::du, RecHitsSortedInPhi::dv, PixelRecoRange< T >::empty(), RecHitsSortedInPhi::empty(), HitRZCompatibility::etaAlgo, i, innerLayer(), RecHitsSortedInPhi::isBarrel, j, LogDebug, PixelRecoRange< T >::max(), bookConverter::max, PixelRecoRange< T >::min(), nSigmaPhi, outerLayer(), HitRZCompatibility::rAlgo, HLT_25ns14e33_v3_cff::region, HitDoublets::reserve(), query::result, RecHitsSortedInPhi::rv(), HitDoublets::shrink_to_fit(), RecHitsSortedInPhi::size(), HitDoublets::size(), RecHitsSortedInPhi::theHits, theLayerCache, theMaxElement, RecHitsSortedInPhi::x, RecHitsSortedInPhi::y, RecHitsSortedInPhi::z, and HitRZCompatibility::zAlgo.

Referenced by hitPairs().

91  {
92 
93  typedef OrderedHitPair::InnerRecHit InnerHit;
94  typedef OrderedHitPair::OuterRecHit OuterHit;
96 
97  Layer innerLayerObj = innerLayer(layers);
98  Layer outerLayerObj = outerLayer(layers);
99 
100  const RecHitsSortedInPhi & innerHitsMap = theLayerCache(innerLayerObj, region, iEvent, iSetup);
101  if (innerHitsMap.empty()) return HitDoublets(innerHitsMap,innerHitsMap);
102 
103  const RecHitsSortedInPhi& outerHitsMap = theLayerCache(outerLayerObj, region, iEvent, iSetup);
104  if (outerHitsMap.empty()) return HitDoublets(innerHitsMap,outerHitsMap);
105 
106  HitDoublets result(innerHitsMap,outerHitsMap); result.reserve(std::max(innerHitsMap.size(),outerHitsMap.size()));
107 
108  InnerDeltaPhi deltaPhi(*outerLayerObj.detLayer(), *innerLayerObj.detLayer(), region, iSetup);
109 
110  // std::cout << "layers " << theInnerLayer.detLayer()->seqNum() << " " << outerLayer.detLayer()->seqNum() << std::endl;
111 
112  // constexpr float nSigmaRZ = std::sqrt(12.f);
113  constexpr float nSigmaPhi = 3.f;
114  for (int io = 0; io!=int(outerHitsMap.theHits.size()); ++io) {
115  Hit const & ohit = outerHitsMap.theHits[io].hit();
116  PixelRecoRange<float> phiRange = deltaPhi(outerHitsMap.x[io],
117  outerHitsMap.y[io],
118  outerHitsMap.z[io],
119  nSigmaPhi*outerHitsMap.drphi[io]
120  );
121 
122  if (phiRange.empty()) continue;
123 
124  const HitRZCompatibility *checkRZ = region.checkRZ(innerLayerObj.detLayer(), ohit, iSetup, outerLayerObj.detLayer(),
125  outerHitsMap.rv(io),outerHitsMap.z[io],
126  outerHitsMap.isBarrel ? outerHitsMap.du[io] : outerHitsMap.dv[io],
127  outerHitsMap.isBarrel ? outerHitsMap.dv[io] : outerHitsMap.du[io]
128  );
129  if(!checkRZ) continue;
130 
131  Kernels<HitZCheck,HitRCheck,HitEtaCheck> kernels;
132 
133  auto innerRange = innerHitsMap.doubleRange(phiRange.min(), phiRange.max());
134  LogDebug("HitPairGeneratorFromLayerPair")<<
135  "preparing for combination of: "<< innerRange[1]-innerRange[0]+innerRange[3]-innerRange[2]
136  <<" inner and: "<< outerHitsMap.theHits.size()<<" outter";
137  for(int j=0; j<3; j+=2) {
138  auto b = innerRange[j]; auto e=innerRange[j+1];
139  bool ok[e-b];
140  switch (checkRZ->algo()) {
142  std::get<0>(kernels).set(checkRZ);
143  std::get<0>(kernels)(b,e,innerHitsMap, ok);
144  break;
146  std::get<1>(kernels).set(checkRZ);
147  std::get<1>(kernels)(b,e,innerHitsMap, ok);
148  break;
150  std::get<2>(kernels).set(checkRZ);
151  std::get<2>(kernels)(b,e,innerHitsMap, ok);
152  break;
153  }
154  for (int i=0; i!=e-b; ++i) {
155  if (!ok[i]) continue;
156  if (theMaxElement!=0 && result.size() >= theMaxElement){
157  result.clear();
158  edm::LogError("TooManyPairs")<<"number of pairs exceed maximum, no pairs produced";
159  delete checkRZ;
160  return result;
161  }
162  result.add(b+i,io);
163  }
164  }
165  delete checkRZ;
166  }
167  LogDebug("HitPairGeneratorFromLayerPair")<<" total number of pairs provided back: "<<result.size();
168  result.shrink_to_fit();
169  return result;
170 }
#define LogDebug(id)
std::vector< HitWithPhi > theHits
int i
Definition: DBlmapReader.cc:9
std::vector< float > drphi
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
T max() const
std::vector< float > z
SeedingHitSet::ConstRecHitPointer InnerRecHit
bool empty() const
T min() const
#define constexpr
std::vector< float > x
Layer innerLayer(const Layers &layers) const
DoubleRange doubleRange(float phiMin, float phiMax) const
int iEvent
Definition: GenABIO.cc:230
tuple result
Definition: query.py:137
int j
Definition: DBlmapReader.cc:9
std::vector< float > y
std::size_t size() const
SeedingHitSet::ConstRecHitPointer Hit
BaseTrackerRecHit const * Hit
SeedingLayerSetsHits::SeedingLayer Layer
Layer outerLayer(const Layers &layers) const
double b
Definition: hdecay.h:120
std::vector< float > dv
float rv(int i) const
std::vector< float > du
SeedingHitSet::ConstRecHitPointer OuterRecHit
void HitPairGeneratorFromLayerPair::hitPairs ( const TrackingRegion reg,
OrderedHitPairs prs,
const edm::Event ev,
const edm::EventSetup es,
Layers  layers 
)

Definition at line 75 of file HitPairGeneratorFromLayerPair.cc.

References doublets(), i, HitDoublets::inner, HitDoublets::outer, OrderedHitPairs::size(), and theMaxElement.

77  {
78 
79  auto const & ds = doublets(region, iEvent, iSetup, layers);
80  for (std::size_t i=0; i!=ds.size(); ++i) {
81  result.push_back( OrderedHitPair( ds.hit(i,HitDoublets::inner),ds.hit(i,HitDoublets::outer) ));
82  }
83  if (theMaxElement!=0 && result.size() >= theMaxElement){
84  result.clear();
85  edm::LogError("TooManyPairs")<<"number of pairs exceed maximum, no pairs produced";
86  }
87 }
int i
Definition: DBlmapReader.cc:9
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
int iEvent
Definition: GenABIO.cc:230
tuple result
Definition: query.py:137
HitDoublets doublets(const TrackingRegion &reg, const edm::Event &ev, const edm::EventSetup &es, Layers layers)
Layer HitPairGeneratorFromLayerPair::innerLayer ( const Layers layers) const
inline

Definition at line 32 of file HitPairGeneratorFromLayerPair.h.

References theInnerLayer.

Referenced by doublets().

32 { return layers[theInnerLayer]; }
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
Layer HitPairGeneratorFromLayerPair::outerLayer ( const Layers layers) const
inline

Definition at line 33 of file HitPairGeneratorFromLayerPair.h.

References theOuterLayer.

Referenced by doublets().

33 { return layers[theOuterLayer]; }
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4

Member Data Documentation

const unsigned int HitPairGeneratorFromLayerPair::theInnerLayer
private

Definition at line 38 of file HitPairGeneratorFromLayerPair.h.

Referenced by innerLayer().

LayerCacheType& HitPairGeneratorFromLayerPair::theLayerCache
private

Definition at line 36 of file HitPairGeneratorFromLayerPair.h.

Referenced by doublets().

const unsigned int HitPairGeneratorFromLayerPair::theMaxElement
private

Definition at line 39 of file HitPairGeneratorFromLayerPair.h.

Referenced by doublets(), and hitPairs().

const unsigned int HitPairGeneratorFromLayerPair::theOuterLayer
private

Definition at line 37 of file HitPairGeneratorFromLayerPair.h.

Referenced by outerLayer().