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

std::optional< HitDoubletsdoublets (const TrackingRegion &reg, const edm::Event &ev, const edm::EventSetup &es, Layers layers)
 
std::optional< HitDoubletsdoublets (const TrackingRegion &reg, const edm::Event &ev, const edm::EventSetup &es, const Layer &innerLayer, const Layer &outerLayer)
 
std::optional< HitDoubletsdoublets (const TrackingRegion &reg, const edm::Event &ev, const edm::EventSetup &es, Layers layers, LayerCacheType &layerCache)
 
std::optional< HitDoubletsdoublets (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)
 
bool 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 bool 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, IdealMagneticFieldRecordtheFieldToken
 
const unsigned int theInnerLayer
 
LayerCacheTypetheLayerCache
 
const unsigned int theMaxElement
 
const edm::ESGetToken< MultipleScatteringParametrisationMaker, TrackerMultipleScatteringRecordtheMSMakerToken
 
const unsigned int theOuterLayer
 

Detailed Description

Definition at line 18 of file HitPairGeneratorFromLayerPair.h.

Member Typedef Documentation

◆ Layer

Definition at line 22 of file HitPairGeneratorFromLayerPair.h.

◆ LayerCacheType

Definition at line 20 of file HitPairGeneratorFromLayerPair.h.

◆ Layers

Definition at line 21 of file HitPairGeneratorFromLayerPair.h.

Constructor & Destructor Documentation

◆ HitPairGeneratorFromLayerPair()

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::~HitPairGeneratorFromLayerPair ( )

Definition at line 44 of file HitPairGeneratorFromLayerPair.cc.

44 {}

Member Function Documentation

◆ doublets() [1/5]

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

Definition at line 32 of file HitPairGeneratorFromLayerPair.h.

References cms::cuda::assert(), makeMEIFBenchmarkPlots::ev, hgcalTBTopologyTester_cfi::layers, and theLayerCache.

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

35  {
37  return doublets(reg, ev, es, layers, *theLayerCache);
38  }
assert(be >=bs)
std::optional< HitDoublets > doublets(const TrackingRegion &reg, const edm::Event &ev, const edm::EventSetup &es, Layers layers)

◆ doublets() [2/5]

std::optional<HitDoublets> HitPairGeneratorFromLayerPair::doublets ( const TrackingRegion reg,
const edm::Event ev,
const edm::EventSetup es,
const Layer innerLayer,
const Layer outerLayer 
)
inline

Definition at line 39 of file HitPairGeneratorFromLayerPair.h.

References cms::cuda::assert(), doublets(), makeMEIFBenchmarkPlots::ev, innerLayer(), outerLayer(), and theLayerCache.

43  {
45  return doublets(reg, ev, es, innerLayer, outerLayer, *theLayerCache);
46  }
Layer outerLayer(const Layers &layers) const
assert(be >=bs)
Layer innerLayer(const Layers &layers) const
std::optional< HitDoublets > doublets(const TrackingRegion &reg, const edm::Event &ev, const edm::EventSetup &es, Layers layers)

◆ doublets() [3/5]

std::optional<HitDoublets> HitPairGeneratorFromLayerPair::doublets ( const TrackingRegion reg,
const edm::Event ev,
const edm::EventSetup es,
Layers  layers,
LayerCacheType layerCache 
)
inline

Definition at line 47 of file HitPairGeneratorFromLayerPair.h.

References doublets(), makeMEIFBenchmarkPlots::ev, innerLayer(), hgcalTBTopologyTester_cfi::layers, and outerLayer().

51  {
52  Layer innerLayerObj = innerLayer(layers);
53  Layer outerLayerObj = outerLayer(layers);
54  return doublets(reg, ev, es, innerLayerObj, outerLayerObj, layerCache);
55  }
Layer outerLayer(const Layers &layers) const
SeedingLayerSetsHits::SeedingLayer Layer
Layer innerLayer(const Layers &layers) const
std::optional< HitDoublets > doublets(const TrackingRegion &reg, const edm::Event &ev, const edm::EventSetup &es, Layers layers)

◆ doublets() [4/5]

std::optional< 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 96 of file HitPairGeneratorFromLayerPair.cc.

References SeedingLayerSetsHits::SeedingLayer::detLayer(), doublets(), RecHitsSortedInPhi::empty(), edm::EventSetup::getData(), innerLayer(), SiStripPI::max, outerLayer(), nano_mu_digi_cff::region, mps_fire::result, RecHitsSortedInPhi::size(), summarizeEdmComparisonLogfiles::succeeded, theFieldToken, theMaxElement, and theMSMakerToken.

101  {
102  const RecHitsSortedInPhi& innerHitsMap = layerCache(innerLayer, region);
103  if (innerHitsMap.empty())
104  return HitDoublets(innerHitsMap, innerHitsMap);
105 
106  const RecHitsSortedInPhi& outerHitsMap = layerCache(outerLayer, region);
107  if (outerHitsMap.empty())
108  return HitDoublets(innerHitsMap, outerHitsMap);
109  const auto& field = iSetup.getData(theFieldToken);
110  const auto& msmaker = iSetup.getData(theMSMakerToken);
111  HitDoublets result(innerHitsMap, outerHitsMap);
112  result.reserve(std::max(innerHitsMap.size(), outerHitsMap.size()));
113  bool succeeded = doublets(region,
114  *innerLayer.detLayer(),
115  *outerLayer.detLayer(),
116  innerHitsMap,
117  outerHitsMap,
118  field,
119  msmaker,
121  result);
122  if (succeeded) {
123  return result;
124  } else {
125  return std::nullopt;
126  }
127 }
Layer outerLayer(const Layers &layers) const
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > theFieldToken
const edm::ESGetToken< MultipleScatteringParametrisationMaker, TrackerMultipleScatteringRecord > theMSMakerToken
std::size_t size() const
Layer innerLayer(const Layers &layers) const
std::optional< HitDoublets > doublets(const TrackingRegion &reg, const edm::Event &ev, const edm::EventSetup &es, Layers layers)

◆ doublets() [5/5]

bool 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 129 of file HitPairGeneratorFromLayerPair.cc.

References b, SiPixelRawToDigiRegional_cfi::deltaPhi, RecHitsSortedInPhi::doubleRange(), RecHitsSortedInPhi::drphi, RecHitsSortedInPhi::du, RecHitsSortedInPhi::dv, MillePedeFileConverter_cfg::e, PixelRecoRange< T >::empty(), HitRZCompatibility::etaAlgo, mps_fire::i, createfilelist::int, RecHitsSortedInPhi::isBarrel, dqmiolumiharvest::j, LogDebug, PixelRecoRange< T >::max(), PixelRecoRange< T >::min(), nSigmaPhi, convertSQLiteXML::ok, HitRZCompatibility::rAlgo, nano_mu_digi_cff::region, mps_fire::result, RecHitsSortedInPhi::rv(), RecHitsSortedInPhi::theHits, theMaxElement, RecHitsSortedInPhi::x, RecHitsSortedInPhi::y, RecHitsSortedInPhi::z, and HitRZCompatibility::zAlgo.

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

◆ hitPairs()

bool 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, iEvent, HitDoublets::inner, hgcalTBTopologyTester_cfi::layers, HitDoublets::outer, nano_mu_digi_cff::region, mps_fire::result, and theMaxElement.

80  {
81  auto const& ds = doublets(region, iEvent, iSetup, layers);
82  if (not ds) {
83  return false;
84  }
85  for (std::size_t i = 0; i != ds->size(); ++i) {
86  result.push_back(OrderedHitPair(ds->hit(i, HitDoublets::inner), ds->hit(i, HitDoublets::outer)));
87  }
88  if (theMaxElement != 0 && result.size() >= theMaxElement) {
89  result.clear();
90  edm::LogError("TooManyPairs") << "number of pairs exceed maximum, no pairs produced";
91  return false;
92  }
93  return true;
94 }
Log< level::Error, false > LogError
int iEvent
Definition: GenABIO.cc:224
std::optional< HitDoublets > doublets(const TrackingRegion &reg, const edm::Event &ev, const edm::EventSetup &es, Layers layers)

◆ innerLayer()

Layer HitPairGeneratorFromLayerPair::innerLayer ( const Layers layers) const
inline

◆ outerLayer()

Layer HitPairGeneratorFromLayerPair::outerLayer ( const Layers layers) const
inline

Member Data Documentation

◆ theFieldToken

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

Definition at line 80 of file HitPairGeneratorFromLayerPair.h.

Referenced by doublets().

◆ theInnerLayer

const unsigned int HitPairGeneratorFromLayerPair::theInnerLayer
private

Definition at line 83 of file HitPairGeneratorFromLayerPair.h.

Referenced by innerLayer().

◆ theLayerCache

LayerCacheType* HitPairGeneratorFromLayerPair::theLayerCache
private

Definition at line 79 of file HitPairGeneratorFromLayerPair.h.

Referenced by doublets().

◆ theMaxElement

const unsigned int HitPairGeneratorFromLayerPair::theMaxElement
private

Definition at line 84 of file HitPairGeneratorFromLayerPair.h.

Referenced by doublets(), and hitPairs().

◆ theMSMakerToken

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

Definition at line 81 of file HitPairGeneratorFromLayerPair.h.

Referenced by doublets().

◆ theOuterLayer

const unsigned int HitPairGeneratorFromLayerPair::theOuterLayer
private

Definition at line 82 of file HitPairGeneratorFromLayerPair.h.

Referenced by outerLayer().