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

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

References SeedingLayerSetsHits::SeedingLayer::detLayer(), RecHitsSortedInPhi::empty(), innerLayer(), bookConverter::max, outerLayer(), HitDoublets::reserve(), mps_fire::result, RecHitsSortedInPhi::size(), theLayerCache, and theMaxElement.

Referenced by hitPairs(), and TrajectorySeedProducer::produce().

90  {
91 
92  typedef OrderedHitPair::InnerRecHit InnerHit;
93  typedef OrderedHitPair::OuterRecHit OuterHit;
95 
96  Layer innerLayerObj = innerLayer(layers);
97  Layer outerLayerObj = outerLayer(layers);
98 
99  const RecHitsSortedInPhi & innerHitsMap = theLayerCache(innerLayerObj, region, iEvent, iSetup);
100  if (innerHitsMap.empty()) return HitDoublets(innerHitsMap,innerHitsMap);
101 
102  const RecHitsSortedInPhi& outerHitsMap = theLayerCache(outerLayerObj, region, iEvent, iSetup);
103  if (outerHitsMap.empty()) return HitDoublets(innerHitsMap,outerHitsMap);
104  HitDoublets result(innerHitsMap,outerHitsMap); result.reserve(std::max(innerHitsMap.size(),outerHitsMap.size()));
106  *innerLayerObj.detLayer(),*outerLayerObj.detLayer(),
107  innerHitsMap,outerHitsMap,iSetup,theMaxElement,result);
108  return result;
109 
110 }
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
SeedingHitSet::ConstRecHitPointer InnerRecHit
Layer innerLayer(const Layers &layers) const
tuple result
Definition: mps_fire.py:84
int iEvent
Definition: GenABIO.cc:230
HitDoublets doublets(const TrackingRegion &reg, const edm::Event &ev, const edm::EventSetup &es, Layers layers)
std::size_t size() const
SeedingHitSet::ConstRecHitPointer Hit
BaseTrackerRecHit const * Hit
SeedingLayerSetsHits::SeedingLayer Layer
Layer outerLayer(const Layers &layers) const
SeedingHitSet::ConstRecHitPointer OuterRecHit
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 112 of file HitPairGeneratorFromLayerPair.cc.

References HitDoublets::add(), HitRZCompatibility::algo(), b, TrackingRegion::checkRZ(), HitDoublets::clear(), constexpr, SiPixelRawToDigiRegional_cfi::deltaPhi, RecHitsSortedInPhi::doubleRange(), RecHitsSortedInPhi::drphi, RecHitsSortedInPhi::du, RecHitsSortedInPhi::dv, PixelRecoRange< T >::empty(), HitRZCompatibility::etaAlgo, i, RecHitsSortedInPhi::isBarrel, 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.

119  {
120 
121  // HitDoublets result(innerHitsMap,outerHitsMap); result.reserve(std::max(innerHitsMap.size(),outerHitsMap.size()));
123  InnerDeltaPhi deltaPhi(outerHitDetLayer, innerHitDetLayer, region, iSetup);
124 
125  // std::cout << "layers " << theInnerLayer.detLayer()->seqNum() << " " << outerLayer.detLayer()->seqNum() << std::endl;
126 
127  // constexpr float nSigmaRZ = std::sqrt(12.f);
128  constexpr float nSigmaPhi = 3.f;
129  for (int io = 0; io!=int(outerHitsMap.theHits.size()); ++io) {
130  if (!deltaPhi.prefilter(outerHitsMap.x[io],outerHitsMap.y[io])) continue;
131  Hit const & ohit = outerHitsMap.theHits[io].hit();
132  PixelRecoRange<float> phiRange = deltaPhi(outerHitsMap.x[io],
133  outerHitsMap.y[io],
134  outerHitsMap.z[io],
135  nSigmaPhi*outerHitsMap.drphi[io]
136  );
137 
138  if (phiRange.empty()) continue;
139 
140  const HitRZCompatibility *checkRZ = region.checkRZ(&innerHitDetLayer, ohit, iSetup, &outerHitDetLayer,
141  outerHitsMap.rv(io),outerHitsMap.z[io],
142  outerHitsMap.isBarrel ? outerHitsMap.du[io] : outerHitsMap.dv[io],
143  outerHitsMap.isBarrel ? outerHitsMap.dv[io] : outerHitsMap.du[io]
144  );
145  if(!checkRZ) continue;
146 
147  Kernels<HitZCheck,HitRCheck,HitEtaCheck> kernels;
148 
149  auto innerRange = innerHitsMap.doubleRange(phiRange.min(), phiRange.max());
150  LogDebug("HitPairGeneratorFromLayerPair")<<
151  "preparing for combination of: "<< innerRange[1]-innerRange[0]+innerRange[3]-innerRange[2]
152  <<" inner and: "<< outerHitsMap.theHits.size()<<" outter";
153  for(int j=0; j<3; j+=2) {
154  auto b = innerRange[j]; auto e=innerRange[j+1];
155  bool ok[e-b];
156  switch (checkRZ->algo()) {
158  std::get<0>(kernels).set(checkRZ);
159  std::get<0>(kernels)(b,e,innerHitsMap, ok);
160  break;
162  std::get<1>(kernels).set(checkRZ);
163  std::get<1>(kernels)(b,e,innerHitsMap, ok);
164  break;
166  std::get<2>(kernels).set(checkRZ);
167  std::get<2>(kernels)(b,e,innerHitsMap, ok);
168  break;
169  }
170  for (int i=0; i!=e-b; ++i) {
171  if (!ok[i]) continue;
172  if (theMaxElement!=0 && result.size() >= theMaxElement){
173  result.clear();
174  edm::LogError("TooManyPairs")<<"number of pairs exceed maximum, no pairs produced";
175  delete checkRZ;
176  return;
177  }
178  result.add(b+i,io);
179  }
180  }
181  delete checkRZ;
182  }
183  LogDebug("HitPairGeneratorFromLayerPair")<<" total number of pairs provided back: "<<result.size();
184  result.shrink_to_fit();
185 
186 }
#define LogDebug(id)
std::vector< HitWithPhi > theHits
int i
Definition: DBlmapReader.cc:9
std::size_t size() const
std::vector< float > drphi
T max() const
std::vector< float > z
bool empty() const
T min() const
#define constexpr
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
int j
Definition: DBlmapReader.cc:9
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)
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
tuple result
Definition: mps_fire.py:84
int iEvent
Definition: GenABIO.cc:230
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 41 of file HitPairGeneratorFromLayerPair.h.

References theInnerLayer.

Referenced by doublets().

41 { 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 42 of file HitPairGeneratorFromLayerPair.h.

References theOuterLayer.

Referenced by doublets().

42 { 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 47 of file HitPairGeneratorFromLayerPair.h.

Referenced by innerLayer().

LayerCacheType& HitPairGeneratorFromLayerPair::theLayerCache
private

Definition at line 45 of file HitPairGeneratorFromLayerPair.h.

Referenced by doublets().

const unsigned int HitPairGeneratorFromLayerPair::theMaxElement
private

Definition at line 48 of file HitPairGeneratorFromLayerPair.h.

Referenced by doublets(), and hitPairs().

const unsigned int HitPairGeneratorFromLayerPair::theOuterLayer
private

Definition at line 46 of file HitPairGeneratorFromLayerPair.h.

Referenced by outerLayer().