CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static 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)
 
HitDoublets doublets (const TrackingRegion &reg, const edm::Event &ev, const edm::EventSetup &es, const Layer &innerLayer, const Layer &outerLayer)
 
HitDoublets doublets (const TrackingRegion &reg, const edm::Event &ev, const edm::EventSetup &es, Layers layers, LayerCacheType &layerCache)
 
HitDoublets doublets (const TrackingRegion &reg, const edm::Event &ev, const edm::EventSetup &es, const Layer &innerLayer, const Layer &outerLayer, LayerCacheType &layerCache)
 
 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 ()
 

Static Public Member Functions

static void doublets (const TrackingRegion &region, const DetLayer &innerHitDetLayer, const DetLayer &outerHitDetLayer, const RecHitsSortedInPhi &innerHitsMap, const RecHitsSortedInPhi &outerHitsMap, const edm::EventSetup &iSetup, const unsigned int theMaxElement, HitDoublets &result)
 

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 ( )

Member Function Documentation

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

Definition at line 26 of file HitPairGeneratorFromLayerPair.h.

References theLayerCache.

Referenced by doublets(), hitPairs(), and SeedFinderSelector::pass().

27  {
28  assert(theLayerCache);
29  return doublets(reg, ev, es, layers, *theLayerCache);
30  }
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
HitDoublets doublets(const TrackingRegion &reg, const edm::Event &ev, const edm::EventSetup &es, Layers layers)
HitDoublets HitPairGeneratorFromLayerPair::doublets ( const TrackingRegion reg,
const edm::Event ev,
const edm::EventSetup es,
const Layer innerLayer,
const Layer outerLayer 
)
inline

Definition at line 31 of file HitPairGeneratorFromLayerPair.h.

References doublets(), and theLayerCache.

32  {
33  assert(theLayerCache);
34  return doublets(reg, ev, es, innerLayer, outerLayer, *theLayerCache);
35  }
Layer innerLayer(const Layers &layers) const
HitDoublets doublets(const TrackingRegion &reg, const edm::Event &ev, const edm::EventSetup &es, Layers layers)
Layer outerLayer(const Layers &layers) const
HitDoublets HitPairGeneratorFromLayerPair::doublets ( const TrackingRegion reg,
const edm::Event ev,
const edm::EventSetup es,
Layers  layers,
LayerCacheType layerCache 
)
inline

Definition at line 36 of file HitPairGeneratorFromLayerPair.h.

References doublets(), ev, hitPairs(), innerLayer(), LayerTriplets::layers(), outerLayer(), mps_fire::result, and theMaxElement.

37  {
38  Layer innerLayerObj = innerLayer(layers);
39  Layer outerLayerObj = outerLayer(layers);
40  return doublets(reg, ev, es, innerLayerObj, outerLayerObj, layerCache);
41  }
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
Layer innerLayer(const Layers &layers) const
HitDoublets doublets(const TrackingRegion &reg, const edm::Event &ev, const edm::EventSetup &es, Layers layers)
SeedingLayerSetsHits::SeedingLayer Layer
Layer outerLayer(const Layers &layers) const
HitDoublets HitPairGeneratorFromLayerPair::doublets ( const TrackingRegion reg,
const edm::Event ev,
const edm::EventSetup es,
const Layer innerLayer,
const Layer outerLayer,
LayerCacheType layerCache 
)

Definition at line 89 of file HitPairGeneratorFromLayerPair.cc.

References SeedingLayerSetsHits::SeedingLayer::detLayer(), doublets(), RecHitsSortedInPhi::empty(), SiStripPI::max, HitDoublets::reserve(), mps_fire::result, RecHitsSortedInPhi::size(), and theMaxElement.

91  {
92 
93  const RecHitsSortedInPhi & innerHitsMap = layerCache(innerLayer, region, iSetup);
94  if (innerHitsMap.empty()) return HitDoublets(innerHitsMap,innerHitsMap);
95 
96  const RecHitsSortedInPhi& outerHitsMap = layerCache(outerLayer, region, iSetup);
97  if (outerHitsMap.empty()) return HitDoublets(innerHitsMap,outerHitsMap);
98  HitDoublets result(innerHitsMap,outerHitsMap); result.reserve(std::max(innerHitsMap.size(),outerHitsMap.size()));
99  doublets(region,
101  innerHitsMap,outerHitsMap,iSetup,theMaxElement,result);
102 
103  return result;
104 
105 }
Layer innerLayer(const Layers &layers) const
HitDoublets doublets(const TrackingRegion &reg, const edm::Event &ev, const edm::EventSetup &es, Layers layers)
std::size_t size() const
Layer outerLayer(const Layers &layers) const
const DetLayer * detLayer() const
void HitPairGeneratorFromLayerPair::doublets ( const TrackingRegion region,
const DetLayer innerHitDetLayer,
const DetLayer outerHitDetLayer,
const RecHitsSortedInPhi innerHitsMap,
const RecHitsSortedInPhi outerHitsMap,
const edm::EventSetup iSetup,
const unsigned int  theMaxElement,
HitDoublets result 
)
static

Definition at line 107 of file HitPairGeneratorFromLayerPair.cc.

References HitDoublets::add(), HitRZCompatibility::algo(), b, TrackingRegion::checkRZ(), HitDoublets::clear(), constexpr, hiPixelPairStep_cff::deltaPhi, RecHitsSortedInPhi::doubleRange(), RecHitsSortedInPhi::drphi, RecHitsSortedInPhi::du, RecHitsSortedInPhi::dv, MillePedeFileConverter_cfg::e, PixelRecoRange< T >::empty(), HitRZCompatibility::etaAlgo, mps_fire::i, createfilelist::int, RecHitsSortedInPhi::isBarrel, LogDebug, PixelRecoRange< T >::max(), PixelRecoRange< T >::min(), nSigmaPhi, convertSQLiteXML::ok, InnerDeltaPhi::prefilter(), HitRZCompatibility::rAlgo, RecHitsSortedInPhi::rv(), HitDoublets::shrink_to_fit(), HitDoublets::size(), RecHitsSortedInPhi::theHits, theMaxElement, RecHitsSortedInPhi::x, RecHitsSortedInPhi::y, RecHitsSortedInPhi::z, and HitRZCompatibility::zAlgo.

114  {
115 
116  // HitDoublets result(innerHitsMap,outerHitsMap); result.reserve(std::max(innerHitsMap.size(),outerHitsMap.size()));
118  InnerDeltaPhi deltaPhi(outerHitDetLayer, innerHitDetLayer, region, iSetup);
119 
120  // std::cout << "layers " << theInnerLayer.detLayer()->seqNum() << " " << outerLayer.detLayer()->seqNum() << std::endl;
121 
122  // constexpr float nSigmaRZ = std::sqrt(12.f);
123  constexpr float nSigmaPhi = 3.f;
124  for (int io = 0; io!=int(outerHitsMap.theHits.size()); ++io) {
125  if (!deltaPhi.prefilter(outerHitsMap.x[io],outerHitsMap.y[io])) continue;
126  Hit const & ohit = outerHitsMap.theHits[io].hit();
127  PixelRecoRange<float> phiRange = deltaPhi(outerHitsMap.x[io],
128  outerHitsMap.y[io],
129  outerHitsMap.z[io],
130  nSigmaPhi*outerHitsMap.drphi[io]
131  );
132 
133  if (phiRange.empty()) continue;
134 
135  const HitRZCompatibility *checkRZ = region.checkRZ(&innerHitDetLayer, ohit, iSetup, &outerHitDetLayer,
136  outerHitsMap.rv(io),outerHitsMap.z[io],
137  outerHitsMap.isBarrel ? outerHitsMap.du[io] : outerHitsMap.dv[io],
138  outerHitsMap.isBarrel ? outerHitsMap.dv[io] : outerHitsMap.du[io]
139  );
140  if(!checkRZ) continue;
141 
142  Kernels<HitZCheck,HitRCheck,HitEtaCheck> kernels;
143 
144  auto innerRange = innerHitsMap.doubleRange(phiRange.min(), phiRange.max());
145  LogDebug("HitPairGeneratorFromLayerPair")<<
146  "preparing for combination of: "<< innerRange[1]-innerRange[0]+innerRange[3]-innerRange[2]
147  <<" inner and: "<< outerHitsMap.theHits.size()<<" outter";
148  for(int j=0; j<3; j+=2) {
149  auto b = innerRange[j]; auto e=innerRange[j+1];
150  bool ok[e-b];
151  switch (checkRZ->algo()) {
153  std::get<0>(kernels).set(checkRZ);
154  std::get<0>(kernels)(b,e,innerHitsMap, ok);
155  break;
157  std::get<1>(kernels).set(checkRZ);
158  std::get<1>(kernels)(b,e,innerHitsMap, ok);
159  break;
161  std::get<2>(kernels).set(checkRZ);
162  std::get<2>(kernels)(b,e,innerHitsMap, ok);
163  break;
164  }
165  for (int i=0; i!=e-b; ++i) {
166  if (!ok[i]) continue;
167  if (theMaxElement!=0 && result.size() >= theMaxElement){
168  result.clear();
169  edm::LogError("TooManyPairs")<<"number of pairs exceed maximum, no pairs produced";
170  delete checkRZ;
171  return;
172  }
173  result.add(b+i,io);
174  }
175  }
176  delete checkRZ;
177  }
178  LogDebug("HitPairGeneratorFromLayerPair")<<" total number of pairs provided back: "<<result.size();
179  result.shrink_to_fit();
180 
181 }
#define LogDebug(id)
std::vector< HitWithPhi > theHits
std::size_t size() const
std::vector< float > drphi
T max() const
std::vector< float > z
bool empty() const
T min() const
std::vector< float > x
DoubleRange doubleRange(float phiMin, float phiMax) const
virtual HitRZCompatibility * checkRZ(const DetLayer *layer, const Hit &outerHit, const edm::EventSetup &iSetup, const DetLayer *outerlayer=0, float lr=0, float gz=0, float dr=0, float dz=0) const =0
std::vector< float > y
SeedingHitSet::ConstRecHitPointer Hit
BaseTrackerRecHit const * Hit
double b
Definition: hdecay.h:120
std::vector< float > dv
float rv(int i) const
std::vector< float > du
void add(int il, int ol)
#define constexpr
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(), mps_fire::i, HitDoublets::inner, HitDoublets::outer, OrderedHitPairs::size(), and theMaxElement.

Referenced by doublets().

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 }
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
int iEvent
Definition: GenABIO.cc:224
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 59 of file HitPairGeneratorFromLayerPair.h.

References theInnerLayer.

Referenced by doublets().

59 { 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 60 of file HitPairGeneratorFromLayerPair.h.

References theOuterLayer.

Referenced by doublets().

60 { 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 65 of file HitPairGeneratorFromLayerPair.h.

Referenced by innerLayer().

LayerCacheType* HitPairGeneratorFromLayerPair::theLayerCache
private

Definition at line 63 of file HitPairGeneratorFromLayerPair.h.

Referenced by doublets().

const unsigned int HitPairGeneratorFromLayerPair::theMaxElement
private

Definition at line 66 of file HitPairGeneratorFromLayerPair.h.

Referenced by doublets(), and hitPairs().

const unsigned int HitPairGeneratorFromLayerPair::theOuterLayer
private

Definition at line 64 of file HitPairGeneratorFromLayerPair.h.

Referenced by outerLayer().