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 ctfseeding::SeedingLayer Layer
 
typedef
CombinedHitPairGenerator::LayerCacheType 
LayerCacheType
 

Public Member Functions

virtual
HitPairGeneratorFromLayerPair
clone () const
 
 HitPairGeneratorFromLayerPair (const Layer &inner, const Layer &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)
 
const LayerinnerLayer () const
 
const LayerouterLayer () const
 
virtual ~HitPairGeneratorFromLayerPair ()
 
- Public Member Functions inherited from HitPairGenerator
virtual void clear ()
 
 HitPairGenerator (unsigned int size=7500)
 
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

Layer theInnerLayer
 
LayerCacheTypetheLayerCache
 
Layer theOuterLayer
 

Additional Inherited Members

- Public Attributes inherited from OrderedHitsGenerator
unsigned int theMaxElement
 

Detailed Description

Definition at line 12 of file HitPairGeneratorFromLayerPair.h.

Member Typedef Documentation

Definition at line 17 of file HitPairGeneratorFromLayerPair.h.

Definition at line 16 of file HitPairGeneratorFromLayerPair.h.

Constructor & Destructor Documentation

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

Definition at line 25 of file HitPairGeneratorFromLayerPair.h.

25 { }

Member Function Documentation

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

Implements HitPairGenerator.

Definition at line 30 of file HitPairGeneratorFromLayerPair.h.

References HitPairGeneratorFromLayerPair().

30  {
31  return new HitPairGeneratorFromLayerPair(*this);
32  }
HitPairGeneratorFromLayerPair(const Layer &inner, const Layer &outer, LayerCacheType *layerCache, unsigned int nSize=30000, unsigned int max=0)
void HitPairGeneratorFromLayerPair::hitPairs ( const TrackingRegion reg,
OrderedHitPairs prs,
const edm::Event ev,
const edm::EventSetup es 
)
virtual

Implements HitPairGenerator.

Definition at line 45 of file HitPairGeneratorFromLayerPair.cc.

References RecHitsSortedInPhi::all(), Reference_intrackfit_cff::barrel, TrackingRegion::checkRZ(), SiPixelRawToDigiRegional_cfi::deltaPhi, ctfseeding::SeedingLayer::detLayer(), PixelRecoRange< T >::empty(), RecHitsSortedInPhi::empty(), f, RecHitsSortedInPhi::hits(), PixelRecoRange< T >::intersection(), DetLayer::location(), LogDebug, PixelRecoRange< T >::max(), PixelRecoRange< T >::min(), nSigmaPhi, nSigmaRZ, TrackingRegion::origin(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), HitRZCompatibility::range(), OrderedHitPairs::size(), funct::sqr(), mathSSE::sqrt(), theInnerLayer, theLayerCache, OrderedHitsGenerator::theMaxElement, theOuterLayer, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

48 {
49 
50  typedef OrderedHitPair::InnerRecHit InnerHit;
51  typedef OrderedHitPair::OuterRecHit OuterHit;
53 
54  const RecHitsSortedInPhi & innerHitsMap = theLayerCache(&theInnerLayer, region, iEvent, iSetup);
55  if (innerHitsMap.empty()) return;
56 
57  const RecHitsSortedInPhi& outerHitsMap = theLayerCache(&theOuterLayer, region, iEvent, iSetup);
58  if (outerHitsMap.empty()) return;
59 
60  InnerDeltaPhi deltaPhi(*theInnerLayer.detLayer(), region, iSetup);
61 
62  RecHitsSortedInPhi::Range outerHits = outerHitsMap.all();
63 
64  static const float nSigmaRZ = std::sqrt(12.f);
65  static const float nSigmaPhi = 3.f;
66  vector<Hit> innerHits;
67  for (RecHitsSortedInPhi::HitIter oh = outerHits.first; oh!= outerHits.second; ++oh) {
68  Hit ohit = (*oh).hit();
69  GlobalPoint oPos = ohit->globalPosition();
70  PixelRecoRange<float> phiRange = deltaPhi( oPos.perp(), oPos.phi(), oPos.z(), nSigmaPhi*(ohit->errorGlobalRPhi()));
71 
72  if (phiRange.empty()) continue;
73 
74  const HitRZCompatibility *checkRZ = region.checkRZ(theInnerLayer.detLayer(), ohit, iSetup);
75  if(!checkRZ) continue;
76 
77  innerHits.clear();
78  innerHitsMap.hits(phiRange.min(), phiRange.max(), innerHits);
79  LogDebug("HitPairGeneratorFromLayerPair")<<
80  "preparing for combination of: "<<innerHits.size()<<" inner and: "<<outerHits.second-outerHits.first<<" outter";
81  for ( vector<Hit>::const_iterator ih=innerHits.begin(), ieh = innerHits.end(); ih < ieh; ++ih) {
82  GlobalPoint innPos = (*ih)->globalPosition();
83  float r_reduced = std::sqrt( sqr(innPos.x()-region.origin().x())+sqr(innPos.y()-region.origin().y()));
84  Range allowed;
85  Range hitRZ;
86  if (theInnerLayer.detLayer()->location() == barrel) {
87  allowed = checkRZ->range(r_reduced);
88  float zErr = nSigmaRZ * (*ih)->errorGlobalZ();
89  hitRZ = Range(innPos.z()-zErr, innPos.z()+zErr);
90  } else {
91  allowed = checkRZ->range(innPos.z());
92  float rErr = nSigmaRZ * (*ih)->errorGlobalR();
93  hitRZ = Range(r_reduced-rErr, r_reduced+rErr);
94  }
95  Range crossRange = allowed.intersection(hitRZ);
96  if (! crossRange.empty() ) {
97  if (theMaxElement!=0 && result.size() >= theMaxElement){
98  result.clear();
99  edm::LogError("TooManyPairs")<<"number of pairs exceed maximum, no pairs produced";
100  delete checkRZ;
101  return;
102  }
103  result.push_back( OrderedHitPair( *ih, ohit) );
104  }
105  }
106  delete checkRZ;
107  }
108  LogDebug("HitPairGeneratorFromLayerPair")<<" total number of pairs provided back: "<<result.size();
109 }
#define LogDebug(id)
T perp() const
Definition: PV3DBase.h:71
T max() const
virtual Location location() const =0
Which part of the detector (barrel, endcap)
const DetLayer * detLayer() const
Definition: SeedingLayer.cc:80
virtual Range range(const float &rORz) const =0
static const double nSigmaPhi
std::vector< Hit > hits(float phiMin, float phiMax) const
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
T y() const
Definition: PV3DBase.h:62
bool empty() const
T min() const
std::pair< HitIter, HitIter > Range
int iEvent
Definition: GenABIO.cc:243
std::vector< HitWithPhi >::const_iterator HitIter
T sqrt(T t)
Definition: SSEVec.h:46
T z() const
Definition: PV3DBase.h:63
tuple result
Definition: query.py:137
double f[11][100]
static const double nSigmaRZ
PixelRecoRange< float > Range
PixelRecoRange< T > intersection(const PixelRecoRange< T > &r) const
Square< F >::type sqr(const F &f)
Definition: Square.h:13
TransientTrackingRecHit::ConstRecHitPointer Hit
T x() const
Definition: PV3DBase.h:61
const Layer& HitPairGeneratorFromLayerPair::innerLayer ( ) const
inline
const Layer& HitPairGeneratorFromLayerPair::outerLayer ( ) const
inline

Member Data Documentation

Layer HitPairGeneratorFromLayerPair::theInnerLayer
private

Definition at line 40 of file HitPairGeneratorFromLayerPair.h.

Referenced by hitPairs(), and innerLayer().

LayerCacheType& HitPairGeneratorFromLayerPair::theLayerCache
private

Definition at line 38 of file HitPairGeneratorFromLayerPair.h.

Referenced by hitPairs().

Layer HitPairGeneratorFromLayerPair::theOuterLayer
private

Definition at line 39 of file HitPairGeneratorFromLayerPair.h.

Referenced by hitPairs(), and outerLayer().