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>

Inheritance diagram for HitPairGeneratorFromLayerPair:
HitPairGenerator OrderedHitsGenerator

Public Types

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

Public Member Functions

virtual
HitPairGeneratorFromLayerPair
clone () const
 
virtual HitDoublets doublets (const TrackingRegion &reg, const edm::Event &ev, const edm::EventSetup &es)
 
 HitPairGeneratorFromLayerPair (unsigned int inner, unsigned int outer, LayerCacheType *layerCache, unsigned int nSize=30000, unsigned int max=0)
 
virtual void hitPairs (const TrackingRegion &reg, OrderedHitPairs &prs, const edm::Event &ev, const edm::EventSetup &es)
 
Layer innerLayer () const
 
Layer outerLayer () const
 
void setSeedingLayers (Layers layers) override
 
virtual ~HitPairGeneratorFromLayerPair ()
 
- Public Member Functions inherited from HitPairGenerator
virtual void clear () final
 
 HitPairGenerator (unsigned int size=4000)
 
 HitPairGenerator (HitPairGenerator const &other)
 
virtual void hitPairs (const TrackingRegion &reg, OrderedHitPairs &prs, const edm::EventSetup &es)
 
virtual const OrderedHitPairsrun (const TrackingRegion &region, const edm::Event &ev, const edm::EventSetup &es)
 
virtual ~HitPairGenerator ()
 
- Public Member Functions inherited from OrderedHitsGenerator
 OrderedHitsGenerator ()
 
virtual ~OrderedHitsGenerator ()
 

Private Attributes

const unsigned int theInnerLayer
 
LayerCacheTypetheLayerCache
 
const unsigned int theOuterLayer
 
Layers theSeedingLayers
 

Additional Inherited Members

- Public Attributes inherited from OrderedHitsGenerator
unsigned int theMaxElement
 

Detailed Description

Definition at line 10 of file HitPairGeneratorFromLayerPair.h.

Member Typedef Documentation

Definition at line 16 of file HitPairGeneratorFromLayerPair.h.

Definition at line 14 of file HitPairGeneratorFromLayerPair.h.

Definition at line 15 of file HitPairGeneratorFromLayerPair.h.

Constructor & Destructor Documentation

HitPairGeneratorFromLayerPair::HitPairGeneratorFromLayerPair ( unsigned int  inner,
unsigned int  outer,
LayerCacheType layerCache,
unsigned int  nSize = 30000,
unsigned int  max = 0 
)
virtual HitPairGeneratorFromLayerPair::~HitPairGeneratorFromLayerPair ( )
inlinevirtual

Definition at line 24 of file HitPairGeneratorFromLayerPair.h.

24 { }

Member Function Documentation

virtual HitPairGeneratorFromLayerPair* HitPairGeneratorFromLayerPair::clone ( void  ) const
inlinevirtual

Implements HitPairGenerator.

Definition at line 34 of file HitPairGeneratorFromLayerPair.h.

References HitPairGeneratorFromLayerPair().

34  {
35  return new HitPairGeneratorFromLayerPair(*this);
36  }
HitPairGeneratorFromLayerPair(unsigned int inner, unsigned int outer, LayerCacheType *layerCache, unsigned int nSize=30000, unsigned int max=0)
HitDoublets HitPairGeneratorFromLayerPair::doublets ( const TrackingRegion reg,
const edm::Event ev,
const edm::EventSetup es 
)
virtual

Reimplemented from HitPairGenerator.

Definition at line 92 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, OrderedHitsGenerator::theMaxElement, RecHitsSortedInPhi::x, RecHitsSortedInPhi::y, RecHitsSortedInPhi::z, and HitRZCompatibility::zAlgo.

Referenced by hitPairs().

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

Implements HitPairGenerator.

Definition at line 77 of file HitPairGeneratorFromLayerPair.cc.

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

79  {
80 
81  auto const & ds = doublets(region, iEvent, iSetup);
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 }
int i
Definition: DBlmapReader.cc:9
int iEvent
Definition: GenABIO.cc:230
tuple result
Definition: query.py:137
virtual HitDoublets doublets(const TrackingRegion &reg, const edm::Event &ev, const edm::EventSetup &es)
Layer HitPairGeneratorFromLayerPair::innerLayer ( ) const
inline
Layer HitPairGeneratorFromLayerPair::outerLayer ( ) const
inline
void HitPairGeneratorFromLayerPair::setSeedingLayers ( Layers  layers)
inlineoverridevirtual

Implements HitPairGenerator.

Definition at line 26 of file HitPairGeneratorFromLayerPair.h.

References LayerTriplets::layers(), and theSeedingLayers.

std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4

Member Data Documentation

const unsigned int HitPairGeneratorFromLayerPair::theInnerLayer
private

Definition at line 45 of file HitPairGeneratorFromLayerPair.h.

Referenced by innerLayer().

LayerCacheType& HitPairGeneratorFromLayerPair::theLayerCache
private

Definition at line 42 of file HitPairGeneratorFromLayerPair.h.

Referenced by doublets().

const unsigned int HitPairGeneratorFromLayerPair::theOuterLayer
private

Definition at line 44 of file HitPairGeneratorFromLayerPair.h.

Referenced by outerLayer().

Layers HitPairGeneratorFromLayerPair::theSeedingLayers
private

Definition at line 43 of file HitPairGeneratorFromLayerPair.h.

Referenced by innerLayer(), outerLayer(), and setSeedingLayers().