CMS 3D CMS Logo

PixelTripletHLTGenerator Class Reference

A HitTripletGenerator from HitPairGenerator and vector of Layers. More...

#include <RecoPixelVertexing/PixelTriplets/src/PixelTripletHLTGenerator.h>

Inheritance diagram for PixelTripletHLTGenerator:

HitTripletGeneratorFromPairAndLayers HitTripletGeneratorFromPairAndLayers HitTripletGenerator HitTripletGenerator OrderedHitsGenerator OrderedHitsGenerator

List of all members.

Public Member Functions

virtual void hitTriplets (const TrackingRegion &region, OrderedHitTriplets &trs, const edm::EventSetup &iSetup)
virtual void hitTriplets (const TrackingRegion &region, OrderedHitTriplets &trs, const edm::Event &ev, const edm::EventSetup &es)
virtual void init (const HitPairGenerator &pairs, std::vector< const LayerWithHits * > layers, LayerCacheType *layerCache)
virtual void init (const HitPairGenerator &pairs, const std::vector< ctfseeding::SeedingLayer > &layers, LayerCacheType *layerCache)
const HitPairGeneratorpairGenerator () const
const HitPairGeneratorpairGenerator () const
 PixelTripletHLTGenerator (const edm::ParameterSet &cfg)
 PixelTripletHLTGenerator (const edm::ParameterSet &cfg)
const std::vector< const
LayerWithHits * > 
thirdLayers () const
const std::vector
< ctfseeding::SeedingLayer > & 
thirdLayers () const
virtual ~PixelTripletHLTGenerator ()
virtual ~PixelTripletHLTGenerator ()

Private Types

typedef
PixelHitTripletGenerator::LayerCacheType 
LayerCacheType
typedef
CombinedHitTripletGenerator::LayerCacheType 
LayerCacheType

Private Member Functions

bool checkPhiInRange (float phi, float phi1, float phi2) const
bool checkPhiInRange (float phi, float phi1, float phi2) const
std::pair< float, float > mergePhiRanges (const std::pair< float, float > &r1, const std::pair< float, float > &r2) const
std::pair< float, float > mergePhiRanges (const std::pair< float, float > &r1, const std::pair< float, float > &r2) const

Private Attributes

edm::ParameterSet theConfig
LayerCacheTypetheLayerCache
LayerCacheTypetheLayerCache
std::vector< const
LayerWithHits * > 
theLayers
std::vector
< ctfseeding::SeedingLayer
theLayers
HitPairGeneratorthePairGenerator
HitPairGeneratorthePairGenerator


Detailed Description

A HitTripletGenerator from HitPairGenerator and vector of Layers.

The HitPairGenerator provides a set of hit pairs. For each pair the search for compatible hit(s) is done among provided Layers

Definition at line 22 of file PixelTripletHLTGenerator.h.


Member Typedef Documentation

typedef PixelHitTripletGenerator::LayerCacheType PixelTripletHLTGenerator::LayerCacheType [private]

Reimplemented from HitTripletGeneratorFromPairAndLayers.

Definition at line 24 of file TripletHLTGenerator.h.

typedef CombinedHitTripletGenerator::LayerCacheType PixelTripletHLTGenerator::LayerCacheType [private]

Reimplemented from HitTripletGeneratorFromPairAndLayers.

Definition at line 24 of file PixelTripletHLTGenerator.h.


Constructor & Destructor Documentation

PixelTripletHLTGenerator::PixelTripletHLTGenerator ( const edm::ParameterSet cfg  )  [inline]

Definition at line 27 of file PixelTripletHLTGenerator.h.

00028     : theConfig(cfg), thePairGenerator(0), theLayerCache(0) { }

virtual PixelTripletHLTGenerator::~PixelTripletHLTGenerator (  )  [inline, virtual]

Definition at line 30 of file PixelTripletHLTGenerator.h.

References thePairGenerator.

00030 { delete thePairGenerator; }

PixelTripletHLTGenerator::PixelTripletHLTGenerator ( const edm::ParameterSet cfg  )  [inline]

Definition at line 27 of file TripletHLTGenerator.h.

00028     : theConfig(cfg), thePairGenerator(0), theLayerCache(0) { }

virtual PixelTripletHLTGenerator::~PixelTripletHLTGenerator (  )  [inline, virtual]

Definition at line 30 of file TripletHLTGenerator.h.

References thePairGenerator.

00030 { delete thePairGenerator; }


Member Function Documentation

bool PixelTripletHLTGenerator::checkPhiInRange ( float  phi,
float  phi1,
float  phi2 
) const [private]

bool PixelTripletHLTGenerator::checkPhiInRange ( float  phi,
float  phi1,
float  phi2 
) const [private]

Definition at line 175 of file PixelTripletHLTGenerator.cc.

Referenced by hitTriplets().

00176 {
00177   while (phi > phi2) phi -=  2*M_PI;
00178   while (phi < phi1) phi +=  2*M_PI;
00179   return (  (phi1 <= phi) && (phi <= phi2) );
00180 }  

virtual void PixelTripletHLTGenerator::hitTriplets ( const TrackingRegion region,
OrderedHitTriplets trs,
const edm::EventSetup iSetup 
) [virtual]

Reimplemented from HitTripletGenerator.

void PixelTripletHLTGenerator::hitTriplets ( const TrackingRegion region,
OrderedHitTriplets trs,
const edm::Event ev,
const edm::EventSetup es 
) [virtual]

Implements HitTripletGenerator.

Definition at line 32 of file PixelTripletHLTGenerator.cc.

References GeomDetEnumerators::barrel, checkPhiInRange(), PixelRecoUtilities::curvature(), ThirdHitRZPrediction::detRange(), TrackingRecHit::geographicalId(), edm::EventSetup::get(), LayerHitMapLoop::getHit(), edm::ParameterSet::getParameter(), gp1, h1, h2, HitPairGenerator::hitPairs(), ThirdHitRZPrediction::initLayer(), PixelRecoRange< T >::intersection(), parsecf::pyparsing::line(), TrackingRecHit::localPosition(), DetLayer::location(), LayerHitMap::loop(), PixelRecoRange< T >::max(), mergePhiRanges(), PixelRecoRange< T >::min(), TrackingRegion::origin(), TrackingRegion::originRBound(), mergeAndRegister_online::pairs, GeomDetEnumerators::PixelBarrel, GeomDetEnumerators::PixelEndcap, TrackingRegion::ptMin(), OrderedHitPairs::size(), size, funct::sqrt(), DetLayer::subDetector(), theConfig, theLayers, thePairGenerator, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

00037 {
00038 
00039 //  GlobalPoint origin = region.origin();
00040 //  GlobalVector direction = region.direction();
00041 
00042   OrderedHitPairs pairs; pairs.reserve(30000);
00043   OrderedHitPairs::const_iterator ip;
00044   thePairGenerator->hitPairs(region,pairs,ev,es);
00045 
00046   if (pairs.size() ==0) return;
00047 
00048   int size = theLayers.size();
00049 
00050   const LayerHitMap **thirdHitMap = new const LayerHitMap* [size];
00051   for (int il=0; il <=size-1; il++) {
00052      thirdHitMap[il] = &(*theLayerCache)(&theLayers[il], region, ev, es);
00053   }
00054 
00055   edm::ESHandle<TrackerGeometry> tracker;
00056   es.get<TrackerDigiGeometryRecord>().get(tracker);
00057 
00058   double imppar = region.originRBound();;
00059   double curv = PixelRecoUtilities::curvature(1/region.ptMin(), es);
00060 
00061   bool useFixedPreFiltering =  theConfig.getParameter<bool>("useFixedPreFiltering");
00062   float extraHitRZtolerance = theConfig.getParameter<double>("extraHitRZtolerance");
00063   float extraHitRPhitolerance = theConfig.getParameter<double>("extraHitRPhitolerance");
00064   bool  useMScat = theConfig.getParameter<bool>("useMultScattering");
00065   bool  useBend  = theConfig.getParameter<bool>("useBending");
00066 
00067 
00068   for (ip = pairs.begin(); ip != pairs.end(); ip++) {
00069 //
00070     const TrackingRecHit * h1 = (*ip).inner();
00071     const TrackingRecHit * h2 = (*ip).outer();
00072     GlobalPoint gp1tmp = tracker->idToDet( 
00073         h1->geographicalId())->surface().toGlobal(h1->localPosition());
00074     GlobalPoint gp2tmp = tracker->idToDet( 
00075         h2->geographicalId())->surface().toGlobal(h2->localPosition());
00076 
00077     GlobalPoint gp1(gp1tmp.x()-region.origin().x(), gp1tmp.y()-region.origin().y(), gp1tmp.z());
00078     GlobalPoint gp2(gp2tmp.x()-region.origin().x(), gp2tmp.y()-region.origin().y(), gp2tmp.z());
00079 
00080     PixelRecoPointRZ point1(gp1.perp(), gp1.z());
00081     PixelRecoPointRZ point2(gp2.perp(), gp2.z());
00082     PixelRecoLineRZ  line(point1, point2);
00083     ThirdHitRZPrediction predictionRZ(gp1,gp2,extraHitRZtolerance);
00084     ThirdHitPredictionFromInvParabola predictionRPhi(gp1,gp2,imppar,curv,extraHitRPhitolerance);
00085 
00086     for (int il=0; il <=size-1; il++) {
00087       const DetLayer * layer = theLayers[il].detLayer();
00088       bool pixelLayer = (    layer->subDetector() == GeomDetEnumerators::PixelBarrel 
00089                           || layer->subDetector() == GeomDetEnumerators::PixelEndcap); 
00090       bool barrelLayer = (layer->location() == GeomDetEnumerators::barrel);
00091 
00092       ThirdHitCorrection correction(es, region.ptMin(), layer, line, point2, useMScat, useBend);
00093       
00094       predictionRZ.initLayer(layer);
00095 
00096       ThirdHitRZPrediction::Range rzRange = predictionRZ(layer);
00097       correction.correctRZRange(rzRange);
00098 
00099       Range phiRange;
00100       if (useFixedPreFiltering) { 
00101         static float dphi = theConfig.getParameter<double>("phiPreFiltering");
00102         float phi0 = (*ip).outer().phi();
00103         phiRange = Range(phi0-dphi,phi0+dphi);
00104       }
00105       else {
00106         float radiusMax = barrelLayer ?  predictionRZ.detRange().max() : rzRange.max();
00107         float radiusMin = barrelLayer ?  predictionRZ.detRange().min() : rzRange.min();
00108 
00109         if (radiusMin < 0 || radiusMax < 0) continue;
00110         Range rPhi1m = predictionRPhi(radiusMax, -1);
00111         Range rPhi1p = predictionRPhi(radiusMax,  1);
00112         Range rPhi2m = predictionRPhi(radiusMin, -1);
00113         Range rPhi2p = predictionRPhi(radiusMin,  1);
00114         Range rPhi1 = rPhi1m.sum(rPhi1p);
00115         Range rPhi2 = rPhi2m.sum(rPhi2p);
00116         correction.correctRPhiRange(rPhi1);
00117         correction.correctRPhiRange(rPhi2);
00118         rPhi1.first  /= radiusMax;
00119         rPhi1.second /= radiusMax;
00120         rPhi2.first  /= radiusMin;
00121         rPhi2.second /= radiusMin;
00122         phiRange = mergePhiRanges(rPhi1,rPhi2);
00123       }
00124       
00125       LayerHitMapLoop thirdHits = 
00126           pixelLayer ? thirdHitMap[il]->loop(phiRange, rzRange) : 
00127           thirdHitMap[il]->loop();
00128   
00129       const SeedingHit * th;
00130       double nSigmaRZ = sqrt(12.);
00131       double nSigmaPhi = 3.;
00132    
00133       while ( (th = thirdHits.getHit()) ) {
00134 
00135         const TransientTrackingRecHit::ConstRecHitPointer& hit = (*th);
00136         GlobalPoint point(hit->globalPosition().x()-region.origin().x(),
00137                           hit->globalPosition().y()-region.origin().y(),
00138                           hit->globalPosition().z() ); 
00139         float p3_r = point.perp();
00140         float p3_z = point.z();
00141         float p3_phi = point.phi();
00142  
00143         if (barrelLayer) {
00144           ThirdHitRZPrediction::Range allowedZ = predictionRZ(p3_r);
00145           correction.correctRZRange(allowedZ);
00146 
00147           double zErr = nSigmaRZ * sqrt(hit->globalPositionError().czz());
00148           Range hitRange(p3_z-zErr, p3_z+zErr);
00149           Range crossingRange = allowedZ.intersection(hitRange);
00150           if (crossingRange.empty())  continue;
00151         } else {
00152           ThirdHitRZPrediction::Range allowedR = predictionRZ(p3_z);
00153           correction.correctRZRange(allowedR); 
00154           double rErr = nSigmaRZ * sqrt(hit->globalPositionError().rerr( hit->globalPosition()));
00155           Range hitRange(p3_r-rErr, p3_r+rErr);
00156           Range crossingRange = allowedR.intersection(hitRange);
00157           if (crossingRange.empty())  continue;
00158         }
00159 
00160         for (int icharge=-1; icharge <=1; icharge+=2) {
00161           Range rangeRPhi = predictionRPhi(p3_r, icharge);
00162           correction.correctRPhiRange(rangeRPhi);
00163           double phiErr = nSigmaPhi * sqrt(hit->globalPositionError().phierr(hit->globalPosition()));
00164           if (checkPhiInRange(p3_phi, rangeRPhi.first/p3_r-phiErr, rangeRPhi.second/p3_r+phiErr)) {
00165             result.push_back( OrderedHitTriplet( (*ip).inner(), (*ip).outer(), *th)); 
00166             break;
00167           } 
00168         }
00169       } 
00170     }
00171   }
00172   delete [] thirdHitMap;
00173 }

virtual void PixelTripletHLTGenerator::init ( const HitPairGenerator pairs,
std::vector< const LayerWithHits * >  layers,
LayerCacheType layerCache 
) [virtual]

void PixelTripletHLTGenerator::init ( const HitPairGenerator pairs,
const std::vector< ctfseeding::SeedingLayer > &  layers,
LayerCacheType layerCache 
) [virtual]

Implements HitTripletGeneratorFromPairAndLayers.

Definition at line 23 of file PixelTripletHLTGenerator.cc.

References HitPairGenerator::clone(), theLayerCache, theLayers, and thePairGenerator.

00026 {
00027   thePairGenerator = pairs.clone();
00028   theLayers = layers;
00029   theLayerCache = layerCache;
00030 }

std::pair<float,float> PixelTripletHLTGenerator::mergePhiRanges ( const std::pair< float, float > &  r1,
const std::pair< float, float > &  r2 
) const [private]

std::pair< float, float > PixelTripletHLTGenerator::mergePhiRanges ( const std::pair< float, float > &  r1,
const std::pair< float, float > &  r2 
) const [private]

Definition at line 182 of file PixelTripletHLTGenerator.cc.

References max, and min.

Referenced by hitTriplets().

00184 {
00185   float r2_min=r2.first;
00186   float r2_max=r2.second;
00187   while (r1.first-r2_min > M_PI) { r2_min += 2*M_PI; r2_max += 2*M_PI;}
00188   while (r1.first-r2_min < -M_PI) { r2_min -= 2*M_PI;  r2_max -= 2*M_PI; }
00189   
00190   return std::make_pair(min(r1.first,r2_min),max(r1.second,r2_max));
00191 }

const HitPairGenerator& PixelTripletHLTGenerator::pairGenerator (  )  const [inline]

Definition at line 38 of file TripletHLTGenerator.h.

References thePairGenerator.

00038 { return *thePairGenerator; }

const HitPairGenerator& PixelTripletHLTGenerator::pairGenerator (  )  const [inline]

Definition at line 38 of file PixelTripletHLTGenerator.h.

References thePairGenerator.

00038 { return *thePairGenerator; }

const std::vector<const LayerWithHits*> PixelTripletHLTGenerator::thirdLayers (  )  const [inline]

Definition at line 39 of file TripletHLTGenerator.h.

References theLayers.

00039 { return theLayers; }

const std::vector<ctfseeding::SeedingLayer>& PixelTripletHLTGenerator::thirdLayers (  )  const [inline]

Definition at line 39 of file PixelTripletHLTGenerator.h.

References theLayers.

00039 { return theLayers; }


Member Data Documentation

edm::ParameterSet PixelTripletHLTGenerator::theConfig [private]

Definition at line 46 of file PixelTripletHLTGenerator.h.

Referenced by hitTriplets().

LayerCacheType* PixelTripletHLTGenerator::theLayerCache [private]

Definition at line 49 of file TripletHLTGenerator.h.

LayerCacheType* PixelTripletHLTGenerator::theLayerCache [private]

Definition at line 49 of file PixelTripletHLTGenerator.h.

Referenced by init().

std::vector<const LayerWithHits*> PixelTripletHLTGenerator::theLayers [private]

Definition at line 48 of file TripletHLTGenerator.h.

std::vector<ctfseeding::SeedingLayer> PixelTripletHLTGenerator::theLayers [private]

Definition at line 48 of file PixelTripletHLTGenerator.h.

Referenced by hitTriplets(), init(), and thirdLayers().

HitPairGenerator* PixelTripletHLTGenerator::thePairGenerator [private]

Definition at line 47 of file TripletHLTGenerator.h.

HitPairGenerator* PixelTripletHLTGenerator::thePairGenerator [private]

Definition at line 47 of file PixelTripletHLTGenerator.h.

Referenced by hitTriplets(), init(), pairGenerator(), and ~PixelTripletHLTGenerator().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:30:08 2009 for CMSSW by  doxygen 1.5.4