CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 (edm::ConsumesCollector iC, 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 MagneticField &field, const MultipleScatteringParametrisationMaker &msmaker, const unsigned int theMaxElement, HitDoublets &result)
 

Private Attributes

const edm::ESGetToken
< MagneticField,
IdealMagneticFieldRecord
theFieldToken
 
const unsigned int theInnerLayer
 
LayerCacheTypetheLayerCache
 
const unsigned int theMaxElement
 
const edm::ESGetToken
< MultipleScatteringParametrisationMaker,
TrackerMultipleScatteringRecord
theMSMakerToken
 
const unsigned int theOuterLayer
 

Detailed Description

Definition at line 16 of file HitPairGeneratorFromLayerPair.h.

Member Typedef Documentation

Definition at line 20 of file HitPairGeneratorFromLayerPair.h.

Definition at line 18 of file HitPairGeneratorFromLayerPair.h.

Definition at line 19 of file HitPairGeneratorFromLayerPair.h.

Constructor & Destructor Documentation

HitPairGeneratorFromLayerPair::HitPairGeneratorFromLayerPair ( edm::ConsumesCollector  iC,
unsigned int  inner,
unsigned int  outer,
LayerCacheType layerCache,
unsigned int  max = 0 
)

Definition at line 35 of file HitPairGeneratorFromLayerPair.cc.

37  : theLayerCache(layerCache),
42  theMaxElement(max) {}
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > theFieldToken
const edm::ESGetToken< MultipleScatteringParametrisationMaker, TrackerMultipleScatteringRecord > theMSMakerToken
HitPairGeneratorFromLayerPair::~HitPairGeneratorFromLayerPair ( )

Definition at line 44 of file HitPairGeneratorFromLayerPair.cc.

44 {}

Member Function Documentation

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

Definition at line 30 of file HitPairGeneratorFromLayerPair.h.

References cms::cuda::assert(), and theLayerCache.

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

30  {
32  return doublets(reg, ev, es, layers, *theLayerCache);
33  }
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
assert(be >=bs)
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 34 of file HitPairGeneratorFromLayerPair.h.

References cms::cuda::assert(), doublets(), and theLayerCache.

38  {
40  return doublets(reg, ev, es, innerLayer, outerLayer, *theLayerCache);
41  }
assert(be >=bs)
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 42 of file HitPairGeneratorFromLayerPair.h.

References doublets(), innerLayer(), and outerLayer().

46  {
47  Layer innerLayerObj = innerLayer(layers);
48  Layer outerLayerObj = outerLayer(layers);
49  return doublets(reg, ev, es, innerLayerObj, outerLayerObj, layerCache);
50  }
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 91 of file HitPairGeneratorFromLayerPair.cc.

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

96  {
97  const RecHitsSortedInPhi& innerHitsMap = layerCache(innerLayer, region);
98  if (innerHitsMap.empty())
99  return HitDoublets(innerHitsMap, innerHitsMap);
100 
101  const RecHitsSortedInPhi& outerHitsMap = layerCache(outerLayer, region);
102  if (outerHitsMap.empty())
103  return HitDoublets(innerHitsMap, outerHitsMap);
104  const auto& field = iSetup.getData(theFieldToken);
105  const auto& msmaker = iSetup.getData(theMSMakerToken);
106  HitDoublets result(innerHitsMap, outerHitsMap);
107  result.reserve(std::max(innerHitsMap.size(), outerHitsMap.size()));
109  *innerLayer.detLayer(),
110  *outerLayer.detLayer(),
111  innerHitsMap,
112  outerHitsMap,
113  field,
114  msmaker,
116  result);
117 
118  return result;
119 }
Layer innerLayer(const Layers &layers) const
tuple result
Definition: mps_fire.py:311
HitDoublets doublets(const TrackingRegion &reg, const edm::Event &ev, const edm::EventSetup &es, Layers layers)
std::size_t size() const
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > theFieldToken
const edm::ESGetToken< MultipleScatteringParametrisationMaker, TrackerMultipleScatteringRecord > theMSMakerToken
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 MagneticField field,
const MultipleScatteringParametrisationMaker msmaker,
const unsigned int  theMaxElement,
HitDoublets result 
)
static

Definition at line 121 of file HitPairGeneratorFromLayerPair.cc.

References HitDoublets::add(), b, TrackingRegion::checkRZ(), HitDoublets::clear(), srCondWrite_cfg::deltaPhi, RecHitsSortedInPhi::doubleRange(), RecHitsSortedInPhi::drphi, RecHitsSortedInPhi::du, RecHitsSortedInPhi::dv, PixelRecoRange< T >::empty(), HitRZCompatibility::etaAlgo, mps_fire::i, RecHitsSortedInPhi::isBarrel, dqmiolumiharvest::j, LogDebug, PixelRecoRange< T >::max(), PixelRecoRange< T >::min(), nSigmaPhi, InnerDeltaPhi::prefilter(), HitRZCompatibility::rAlgo, RecHitsSortedInPhi::rv(), HitDoublets::shrink_to_fit(), HitDoublets::size(), RecHitsSortedInPhi::theHits, theMaxElement, RecHitsSortedInPhi::x, RecHitsSortedInPhi::y, RecHitsSortedInPhi::z, and HitRZCompatibility::zAlgo.

129  {
130  // HitDoublets result(innerHitsMap,outerHitsMap); result.reserve(std::max(innerHitsMap.size(),outerHitsMap.size()));
132  InnerDeltaPhi deltaPhi(outerHitDetLayer, innerHitDetLayer, region, field, msmaker);
133 
134  // std::cout << "layers " << theInnerLayer.detLayer()->seqNum() << " " << outerLayer.detLayer()->seqNum() << std::endl;
135 
136  // constexpr float nSigmaRZ = std::sqrt(12.f);
137  constexpr float nSigmaPhi = 3.f;
138  for (int io = 0; io != int(outerHitsMap.theHits.size()); ++io) {
139  if (!deltaPhi.prefilter(outerHitsMap.x[io], outerHitsMap.y[io]))
140  continue;
141  Hit const& ohit = outerHitsMap.theHits[io].hit();
142  PixelRecoRange<float> phiRange =
143  deltaPhi(outerHitsMap.x[io], outerHitsMap.y[io], outerHitsMap.z[io], nSigmaPhi * outerHitsMap.drphi[io]);
144 
145  if (phiRange.empty())
146  continue;
147 
148  std::unique_ptr<const HitRZCompatibility> checkRZ =
149  region.checkRZ(&innerHitDetLayer,
150  ohit,
151  &outerHitDetLayer,
152  outerHitsMap.rv(io),
153  outerHitsMap.z[io],
154  outerHitsMap.isBarrel ? outerHitsMap.du[io] : outerHitsMap.dv[io],
155  outerHitsMap.isBarrel ? outerHitsMap.dv[io] : outerHitsMap.du[io]);
156  if (!checkRZ)
157  continue;
158 
159  Kernels<HitZCheck, HitRCheck, HitEtaCheck> kernels;
160 
161  auto innerRange = innerHitsMap.doubleRange(phiRange.min(), phiRange.max());
162  LogDebug("HitPairGeneratorFromLayerPair")
163  << "preparing for combination of: " << innerRange[1] - innerRange[0] + innerRange[3] - innerRange[2]
164  << " inner and: " << outerHitsMap.theHits.size() << " outter";
165  for (int j = 0; j < 3; j += 2) {
166  auto b = innerRange[j];
167  auto e = innerRange[j + 1];
168  if (e == b)
169  continue;
170  bool ok[e - b];
171  switch (checkRZ->algo()) {
173  std::get<0>(kernels).set(checkRZ.get());
174  std::get<0>(kernels)(b, e, innerHitsMap, ok);
175  break;
177  std::get<1>(kernels).set(checkRZ.get());
178  std::get<1>(kernels)(b, e, innerHitsMap, ok);
179  break;
181  std::get<2>(kernels).set(checkRZ.get());
182  std::get<2>(kernels)(b, e, innerHitsMap, ok);
183  break;
184  }
185  for (int i = 0; i != e - b; ++i) {
186  if (!ok[i])
187  continue;
188  if (theMaxElement != 0 && result.size() >= theMaxElement) {
189  result.clear();
190  edm::LogError("TooManyPairs") << "number of pairs exceed maximum, no pairs produced";
191  return;
192  }
193  result.add(b + i, io);
194  }
195  }
196  }
197  LogDebug("HitPairGeneratorFromLayerPair") << " total number of pairs provided back: " << result.size();
198  result.shrink_to_fit();
199 }
std::vector< HitWithPhi > theHits
virtual std::unique_ptr< HitRZCompatibility > checkRZ(const DetLayer *layer, const Hit &outerHit, const DetLayer *outerlayer=nullptr, float lr=0, float gz=0, float dr=0, float dz=0) const =0
std::size_t size() const
std::vector< float > drphi
T max() const
std::vector< float > z
bool empty() const
T min() const
Log< level::Error, false > LogError
std::vector< float > x
DoubleRange doubleRange(float phiMin, float phiMax) const
std::vector< float > y
constexpr float nSigmaPhi
SeedingHitSet::ConstRecHitPointer Hit
BaseTrackerRecHit const * Hit
double b
Definition: hdecay.h:118
std::vector< float > dv
float rv(int i) const
std::vector< float > du
void add(int il, int ol)
#define LogDebug(id)
void HitPairGeneratorFromLayerPair::hitPairs ( const TrackingRegion reg,
OrderedHitPairs prs,
const edm::Event ev,
const edm::EventSetup es,
Layers  layers 
)

Definition at line 76 of file HitPairGeneratorFromLayerPair.cc.

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

80  {
81  auto const& ds = doublets(region, iEvent, iSetup, layers);
82  for (std::size_t i = 0; i != ds.size(); ++i) {
83  result.push_back(OrderedHitPair(ds.hit(i, HitDoublets::inner), ds.hit(i, HitDoublets::outer)));
84  }
85  if (theMaxElement != 0 && result.size() >= theMaxElement) {
86  result.clear();
87  edm::LogError("TooManyPairs") << "number of pairs exceed maximum, no pairs produced";
88  }
89 }
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
Log< level::Error, false > LogError
tuple result
Definition: mps_fire.py:311
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 70 of file HitPairGeneratorFromLayerPair.h.

References theInnerLayer.

Referenced by doublets().

70 { 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 71 of file HitPairGeneratorFromLayerPair.h.

References theOuterLayer.

Referenced by doublets().

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

Member Data Documentation

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> HitPairGeneratorFromLayerPair::theFieldToken
private

Definition at line 75 of file HitPairGeneratorFromLayerPair.h.

Referenced by doublets().

const unsigned int HitPairGeneratorFromLayerPair::theInnerLayer
private

Definition at line 78 of file HitPairGeneratorFromLayerPair.h.

Referenced by innerLayer().

LayerCacheType* HitPairGeneratorFromLayerPair::theLayerCache
private

Definition at line 74 of file HitPairGeneratorFromLayerPair.h.

Referenced by doublets().

const unsigned int HitPairGeneratorFromLayerPair::theMaxElement
private

Definition at line 79 of file HitPairGeneratorFromLayerPair.h.

Referenced by doublets(), and hitPairs().

const edm::ESGetToken<MultipleScatteringParametrisationMaker, TrackerMultipleScatteringRecord> HitPairGeneratorFromLayerPair::theMSMakerToken
private

Definition at line 76 of file HitPairGeneratorFromLayerPair.h.

Referenced by doublets().

const unsigned int HitPairGeneratorFromLayerPair::theOuterLayer
private

Definition at line 77 of file HitPairGeneratorFromLayerPair.h.

Referenced by outerLayer().