CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

HitPairGeneratorFromLayerPair Class Reference

#include <HitPairGeneratorFromLayerPair.h>

Inheritance diagram for HitPairGeneratorFromLayerPair:
HitPairGenerator OrderedHitsGenerator

List of all members.

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

Private Attributes

Layer theInnerLayer
LayerCacheTypetheLayerCache
Layer theOuterLayer

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 ( ) [inline, virtual]

Definition at line 25 of file HitPairGeneratorFromLayerPair.h.

{ }

Member Function Documentation

virtual HitPairGeneratorFromLayerPair* HitPairGeneratorFromLayerPair::clone ( void  ) const [inline, virtual]

Implements HitPairGenerator.

Definition at line 30 of file HitPairGeneratorFromLayerPair.h.

References HitPairGeneratorFromLayerPair().

                                                       {
    return new HitPairGeneratorFromLayerPair(*this);
  }
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(), Geom::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().

{

  typedef OrderedHitPair::InnerRecHit InnerHit;
  typedef OrderedHitPair::OuterRecHit OuterHit;
  typedef RecHitsSortedInPhi::Hit Hit;

  const RecHitsSortedInPhi & innerHitsMap = theLayerCache(&theInnerLayer, region, iEvent, iSetup);
  if (innerHitsMap.empty()) return;
 
  const RecHitsSortedInPhi& outerHitsMap = theLayerCache(&theOuterLayer, region, iEvent, iSetup);
  if (outerHitsMap.empty()) return;

  InnerDeltaPhi deltaPhi(*theInnerLayer.detLayer(), region, iSetup);

  RecHitsSortedInPhi::Range outerHits = outerHitsMap.all();

  static const float nSigmaRZ = std::sqrt(12.f);
  static const float nSigmaPhi = 3.f;
  vector<Hit> innerHits;
  for (RecHitsSortedInPhi::HitIter oh = outerHits.first; oh!= outerHits.second; ++oh) { 
    Hit ohit = (*oh).hit();
    GlobalPoint oPos = ohit->globalPosition();  
    PixelRecoRange<float> phiRange = deltaPhi( oPos.perp(), oPos.phi(), oPos.z(), nSigmaPhi*(ohit->errorGlobalRPhi()));    

    if (phiRange.empty()) continue;

    const HitRZCompatibility *checkRZ = region.checkRZ(theInnerLayer.detLayer(), ohit, iSetup);
    if(!checkRZ) continue;

    innerHits.clear();
    innerHitsMap.hits(phiRange.min(), phiRange.max(), innerHits);
    LogDebug("HitPairGeneratorFromLayerPair")<<
      "preparing for combination of: "<<innerHits.size()<<" inner and: "<<outerHits.second-outerHits.first<<" outter";
    for ( vector<Hit>::const_iterator ih=innerHits.begin(), ieh = innerHits.end(); ih < ieh; ++ih) {  
      GlobalPoint innPos = (*ih)->globalPosition();
      float r_reduced = std::sqrt( sqr(innPos.x()-region.origin().x())+sqr(innPos.y()-region.origin().y()));
      Range allowed;
      Range hitRZ;
      if (theInnerLayer.detLayer()->location() == barrel) {
        allowed = checkRZ->range(r_reduced);
        float zErr = nSigmaRZ * (*ih)->errorGlobalZ();
        hitRZ = Range(innPos.z()-zErr, innPos.z()+zErr);
      } else {
        allowed = checkRZ->range(innPos.z());
        float rErr = nSigmaRZ * (*ih)->errorGlobalR();
        hitRZ = Range(r_reduced-rErr, r_reduced+rErr);
      }
      Range crossRange = allowed.intersection(hitRZ);
      if (! crossRange.empty() ) {
        if (theMaxElement!=0 && result.size() >= theMaxElement){
          result.clear();
          edm::LogError("TooManyPairs")<<"number of pairs exceed maximum, no pairs produced";
          delete checkRZ;
          return;
        }
        result.push_back( OrderedHitPair( *ih, ohit) );
      }
    }
    delete checkRZ;
  }
  LogDebug("HitPairGeneratorFromLayerPair")<<" total number of pairs provided back: "<<result.size();
}
const Layer& HitPairGeneratorFromLayerPair::innerLayer ( ) const [inline]

Definition at line 34 of file HitPairGeneratorFromLayerPair.h.

References theInnerLayer.

Referenced by PixelTripletNoTipGenerator::hitTriplets().

{ return theInnerLayer; }
const Layer& HitPairGeneratorFromLayerPair::outerLayer ( ) const [inline]

Definition at line 35 of file HitPairGeneratorFromLayerPair.h.

References theOuterLayer.

Referenced by PixelTripletNoTipGenerator::hitTriplets().

{ return theOuterLayer; }

Member Data Documentation

Definition at line 40 of file HitPairGeneratorFromLayerPair.h.

Referenced by hitPairs(), and innerLayer().

Definition at line 38 of file HitPairGeneratorFromLayerPair.h.

Referenced by hitPairs().

Definition at line 39 of file HitPairGeneratorFromLayerPair.h.

Referenced by hitPairs(), and outerLayer().