CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
PixelTripletHLTGenerator Class Reference

#include <PixelTripletHLTGenerator.h>

Inheritance diagram for PixelTripletHLTGenerator:
HitTripletGeneratorFromPairAndLayers HitTripletGenerator OrderedHitsGenerator

Public Member Functions

virtual void hitTriplets (const TrackingRegion &region, OrderedHitTriplets &trs, const edm::Event &ev, const edm::EventSetup &es)
 
virtual void init (const HitPairGenerator &pairs, const std::vector< ctfseeding::SeedingLayer > &layers, LayerCacheType *layerCache)
 
const HitPairGeneratorpairGenerator () const
 
 PixelTripletHLTGenerator (const edm::ParameterSet &cfg)
 
const std::vector
< ctfseeding::SeedingLayer > & 
thirdLayers () const
 
virtual ~PixelTripletHLTGenerator ()
 
- Public Member Functions inherited from HitTripletGeneratorFromPairAndLayers
virtual ~HitTripletGeneratorFromPairAndLayers ()
 
- Public Member Functions inherited from HitTripletGenerator
virtual void clear ()
 
 HitTripletGenerator (unsigned int size=500)
 
virtual void hitTriplets (const TrackingRegion &reg, OrderedHitTriplets &prs, const edm::EventSetup &es)
 
virtual const OrderedHitTripletsrun (const TrackingRegion &region, const edm::Event &ev, const edm::EventSetup &es)
 
virtual ~HitTripletGenerator ()
 
- Public Member Functions inherited from OrderedHitsGenerator
 OrderedHitsGenerator ()
 
virtual ~OrderedHitsGenerator ()
 

Private Types

typedef
CombinedHitTripletGenerator::LayerCacheType 
LayerCacheType
 

Private Member Functions

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
 

Private Attributes

float dphi
 
float extraHitRPhitolerance
 
float extraHitRZtolerance
 
LayerCacheTypetheLayerCache
 
std::vector
< ctfseeding::SeedingLayer
theLayers
 
HitPairGeneratorthePairGenerator
 
bool useBend
 
bool useFixedPreFiltering
 
bool useMScat
 

Additional Inherited Members

- Public Types inherited from HitTripletGeneratorFromPairAndLayers
typedef
CombinedHitTripletGenerator::LayerCacheType 
LayerCacheType
 
- Public Attributes inherited from OrderedHitsGenerator
unsigned int theMaxElement
 

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

Definition at line 24 of file PixelTripletHLTGenerator.h.

Constructor & Destructor Documentation

PixelTripletHLTGenerator::PixelTripletHLTGenerator ( const edm::ParameterSet cfg)

Definition at line 23 of file PixelTripletHLTGenerator.cc.

References dphi, edm::ParameterSet::getParameter(), OrderedHitsGenerator::theMaxElement, and useFixedPreFiltering.

24  : thePairGenerator(0),
25  theLayerCache(0),
26  useFixedPreFiltering(cfg.getParameter<bool>("useFixedPreFiltering")),
27  extraHitRZtolerance(cfg.getParameter<double>("extraHitRZtolerance")),
28  extraHitRPhitolerance(cfg.getParameter<double>("extraHitRPhitolerance")),
29  useMScat(cfg.getParameter<bool>("useMultScattering")),
30  useBend(cfg.getParameter<bool>("useBending"))
31 {
32  theMaxElement=cfg.getParameter<unsigned int>("maxElement");
33  dphi = (useFixedPreFiltering) ? cfg.getParameter<double>("phiPreFiltering") : 0;
34 }
T getParameter(std::string const &) const
virtual PixelTripletHLTGenerator::~PixelTripletHLTGenerator ( )
inlinevirtual

Definition at line 29 of file PixelTripletHLTGenerator.h.

References thePairGenerator.

29 { delete thePairGenerator; }

Member Function Documentation

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

Definition at line 196 of file PixelTripletHLTGenerator.cc.

References Geom::ftwoPi().

Referenced by hitTriplets().

197 {
198  while (phi > phi2) phi -= Geom::ftwoPi();
199  while (phi < phi1) phi += Geom::ftwoPi();
200  return ( (phi1 <= phi) && (phi <= phi2) );
201 }
float ftwoPi()
Definition: Pi.h:36
Definition: DDAxes.h:10
void PixelTripletHLTGenerator::hitTriplets ( const TrackingRegion region,
OrderedHitTriplets trs,
const edm::Event ev,
const edm::EventSetup es 
)
virtual

Implements HitTripletGenerator.

Definition at line 46 of file PixelTripletHLTGenerator.cc.

References GeomDetEnumerators::barrel, checkPhiInRange(), PixelRecoUtilities::curvature(), dphi, extraHitRPhitolerance, extraHitRZtolerance, f, HitPairGenerator::hitPairs(), ThirdHitRZPredictionBase::initLayer(), ThirdHitRZPrediction< Propagator >::initPropagator(), PixelRecoRange< T >::intersection(), geometryCSVtoXML::line, DetLayer::location(), max(), PixelRecoRange< T >::max(), mergePhiRanges(), min, nSigmaPhi, nSigmaRZ, TrackingRegion::origin(), TrackingRegion::originRBound(), PV3DBase< T, PVType, FrameType >::perp(), point, TrackingRegion::ptMin(), CosmicsPD_Skims::radius, OrderedHitTriplets::size(), findQualityFiles::size, mathSSE::sqrt(), PixelRecoRange< T >::sum(), theLayers, OrderedHitsGenerator::theMaxElement, thePairGenerator, useBend, useFixedPreFiltering, useMScat, PV3DBase< T, PVType, FrameType >::x(), Hit::x, PV3DBase< T, PVType, FrameType >::y(), Hit::y, and PV3DBase< T, PVType, FrameType >::z().

51 {
52  OrderedHitPairs pairs; pairs.reserve(30000);
53  OrderedHitPairs::const_iterator ip;
54 
55  thePairGenerator->hitPairs(region,pairs,ev,es);
56 
57  if (pairs.empty()) return;
58 
59  int size = theLayers.size();
60 
61  typedef std::vector<ThirdHitRZPrediction<PixelRecoLineRZ> > Preds;
62  Preds preds(size);
63 
64  std::vector<const RecHitsSortedInPhi *> thirdHitMap(size);
66  vector<Hit> thirdHits;
67 
68  // fill the prediciton vetor
69  for (int il=0; il!=size; ++il) {
70  thirdHitMap[il] = &(*theLayerCache)(&theLayers[il], region, ev, es);
71  ThirdHitRZPrediction<PixelRecoLineRZ> & pred = preds[il];
72  pred.initLayer(theLayers[il].detLayer());
73  pred.initTolerance(extraHitRZtolerance);
74  }
75 
76 
77  double imppar = region.originRBound();
78  double curv = PixelRecoUtilities::curvature(1/region.ptMin(), es);
79 
80  for (ip = pairs.begin(); ip != pairs.end(); ip++) {
81 
82  GlobalPoint gp1tmp = (*ip).inner()->globalPosition();
83  GlobalPoint gp2tmp = (*ip).outer()->globalPosition();
84  GlobalPoint gp1(gp1tmp.x()-region.origin().x(), gp1tmp.y()-region.origin().y(), gp1tmp.z());
85  GlobalPoint gp2(gp2tmp.x()-region.origin().x(), gp2tmp.y()-region.origin().y(), gp2tmp.z());
86 
87  PixelRecoPointRZ point1(gp1.perp(), gp1.z());
88  PixelRecoPointRZ point2(gp2.perp(), gp2.z());
89  PixelRecoLineRZ line(point1, point2);
90  ThirdHitPredictionFromInvParabola predictionRPhi(gp1,gp2,imppar,curv,extraHitRPhitolerance);
91  ThirdHitPredictionFromInvParabola predictionRPhitmp(gp1tmp,gp2tmp,imppar+region.origin().perp(),curv,extraHitRPhitolerance);
92 
93 
94  for (int il=0; il!=size; ++il) {
95  const DetLayer * layer = theLayers[il].detLayer();
96 // bool pixelLayer = ( layer->subDetector() == GeomDetEnumerators::PixelBarrel
97 // || layer->subDetector() == GeomDetEnumerators::PixelEndcap);
98  bool barrelLayer = (layer->location() == GeomDetEnumerators::barrel);
99 
100  ThirdHitCorrection correction(es, region.ptMin(), layer, line, point2, useMScat, useBend);
101 
102  ThirdHitRZPrediction<PixelRecoLineRZ> & predictionRZ = preds[il];
103 
104  predictionRZ.initPropagator(&line);
105  Range rzRange = predictionRZ();
106 
107  correction.correctRZRange(rzRange);
108  Range phiRange;
109  if (useFixedPreFiltering) {
110  float phi0 = (*ip).outer()->globalPosition().phi();
111  phiRange = Range(phi0-dphi,phi0+dphi);
112  }
113  else {
114  Range radius;
115  if (barrelLayer) {
116  radius = predictionRZ.detRange();
117  } else {
118  radius = Range(
119  max(rzRange.min(), predictionRZ.detSize().min()),
120  min(rzRange.max(), predictionRZ.detSize().max()) );
121  }
122  if (radius.empty()) continue;
123  Range rPhi1m = predictionRPhitmp(radius.max(), -1);
124  Range rPhi1p = predictionRPhitmp(radius.max(), 1);
125  Range rPhi2m = predictionRPhitmp(radius.min(), -1);
126  Range rPhi2p = predictionRPhitmp(radius.min(), 1);
127  Range rPhi1 = rPhi1m.sum(rPhi1p);
128  Range rPhi2 = rPhi2m.sum(rPhi2p);
129  correction.correctRPhiRange(rPhi1);
130  correction.correctRPhiRange(rPhi2);
131  rPhi1.first /= radius.max();
132  rPhi1.second /= radius.max();
133  rPhi2.first /= radius.min();
134  rPhi2.second /= radius.min();
135  phiRange = mergePhiRanges(rPhi1,rPhi2);
136  }
137 
138 // LayerHitMapLoop thirdHits =
139 // pixelLayer ? thirdHitMap[il]->loop(phiRange, rzRange) :
140 // thirdHitMap[il]->loop();
141 
142  thirdHits.clear();
143  thirdHitMap[il]->hits(phiRange.min(),phiRange.max(), thirdHits);
144 
145  static float nSigmaRZ = std::sqrt(12.f);
146  static float nSigmaPhi = 3.f;
147 
148  typedef vector<Hit>::const_iterator IH;
149  for (IH th=thirdHits.begin(), eh=thirdHits.end(); th !=eh; ++th) {
150 
151  if (theMaxElement!=0 && result.size() >= theMaxElement){
152  result.clear();
153  edm::LogError("TooManyTriplets")<<" number of triples exceed maximum. no triplets produced.";
154  return;
155  }
156  const Hit& hit = (*th);
157  GlobalPoint point(hit->globalPosition().x()-region.origin().x(),
158  hit->globalPosition().y()-region.origin().y(),
159  hit->globalPosition().z() );
160  float p3_r = point.perp();
161  float p3_z = point.z();
162  float p3_phi = point.phi();
163 
164  if (barrelLayer) {
165  Range allowedZ = predictionRZ(p3_r);
166  correction.correctRZRange(allowedZ);
167 
168  float zErr = nSigmaRZ * std::sqrt(float(hit->globalPositionError().czz()));
169  Range hitRange(p3_z-zErr, p3_z+zErr);
170  Range crossingRange = allowedZ.intersection(hitRange);
171  if (crossingRange.empty()) continue;
172  } else {
173  Range allowedR = predictionRZ(p3_z);
174  correction.correctRZRange(allowedR);
175  float rErr = nSigmaRZ * std::sqrt(float(hit->globalPositionError().rerr( hit->globalPosition())));
176  Range hitRange(p3_r-rErr, p3_r+rErr);
177  Range crossingRange = allowedR.intersection(hitRange);
178  if (crossingRange.empty()) continue;
179  }
180 
181  float phiErr = nSigmaPhi*std::sqrt(float(hit->globalPositionError().phierr(hit->globalPosition())));
182  for (int icharge=-1; icharge <=1; icharge+=2) {
183  Range rangeRPhi = predictionRPhi(p3_r, icharge);
184  correction.correctRPhiRange(rangeRPhi);
185  if (checkPhiInRange(p3_phi, rangeRPhi.first/p3_r-phiErr, rangeRPhi.second/p3_r+phiErr)) {
186  result.push_back( OrderedHitTriplet( (*ip).inner(), (*ip).outer(), hit));
187  break;
188  }
189  }
190  }
191  }
192  }
193 
194 }
std::vector< ctfseeding::SeedingLayer > theLayers
void initPropagator(const Propagator *propagator)
T perp() const
Definition: PV3DBase.h:66
T max() const
void initLayer(const DetLayer *layer)
virtual Location location() const =0
Which part of the detector (barrel, endcap)
static const double nSigmaPhi
PixelRecoRange< T > sum(const PixelRecoRange< T > &r) const
T y() const
Definition: PV3DBase.h:57
#define min(a, b)
Definition: mlp_lapack.h:161
std::pair< float, float > mergePhiRanges(const std::pair< float, float > &r1, const std::pair< float, float > &r2) const
T curvature(T InversePt, const edm::EventSetup &iSetup)
const T & max(const T &a, const T &b)
virtual void hitPairs(const TrackingRegion &reg, OrderedHitPairs &prs, const edm::EventSetup &es)
T sqrt(T t)
Definition: SSEVec.h:28
T z() const
Definition: PV3DBase.h:58
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
bool checkPhiInRange(float phi, float phi1, float phi2) const
TransientTrackingRecHit::ConstRecHitPointer Hit
T x() const
Definition: PV3DBase.h:56
tuple size
Write out results.
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
void PixelTripletHLTGenerator::init ( const HitPairGenerator pairs,
const std::vector< ctfseeding::SeedingLayer > &  layers,
LayerCacheType layerCache 
)
virtual

Implements HitTripletGeneratorFromPairAndLayers.

Definition at line 37 of file PixelTripletHLTGenerator.cc.

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

40 {
41  thePairGenerator = pairs.clone();
42  theLayers = layers;
43  theLayerCache = layerCache;
44 }
std::vector< ctfseeding::SeedingLayer > theLayers
virtual HitPairGenerator * clone() const =0
std::pair< float, float > PixelTripletHLTGenerator::mergePhiRanges ( const std::pair< float, float > &  r1,
const std::pair< float, float > &  r2 
) const
private

Definition at line 203 of file PixelTripletHLTGenerator.cc.

References Geom::fpi(), Geom::ftwoPi(), max(), and min.

Referenced by hitTriplets().

205 {
206  float r2_min=r2.first;
207  float r2_max=r2.second;
208  while (r1.first-r2_min > Geom::fpi()) { r2_min += Geom::ftwoPi(); r2_max += Geom::ftwoPi();}
209  while (r1.first-r2_min < -Geom::fpi()) { r2_min -= Geom::ftwoPi(); r2_max -= Geom::ftwoPi(); }
210 
211  return std::make_pair(min(r1.first,r2_min),max(r1.second,r2_max));
212 }
#define min(a, b)
Definition: mlp_lapack.h:161
float fpi()
Definition: Pi.h:35
const T & max(const T &a, const T &b)
float ftwoPi()
Definition: Pi.h:36
const HitPairGenerator& PixelTripletHLTGenerator::pairGenerator ( ) const
inline

Definition at line 37 of file PixelTripletHLTGenerator.h.

References thePairGenerator.

37 { return *thePairGenerator; }
const std::vector<ctfseeding::SeedingLayer>& PixelTripletHLTGenerator::thirdLayers ( ) const
inline

Definition at line 38 of file PixelTripletHLTGenerator.h.

References theLayers.

38 { return theLayers; }
std::vector< ctfseeding::SeedingLayer > theLayers

Member Data Documentation

float PixelTripletHLTGenerator::dphi
private

Definition at line 55 of file PixelTripletHLTGenerator.h.

Referenced by hitTriplets(), and PixelTripletHLTGenerator().

float PixelTripletHLTGenerator::extraHitRPhitolerance
private

Definition at line 52 of file PixelTripletHLTGenerator.h.

Referenced by hitTriplets().

float PixelTripletHLTGenerator::extraHitRZtolerance
private

Definition at line 51 of file PixelTripletHLTGenerator.h.

Referenced by hitTriplets().

LayerCacheType* PixelTripletHLTGenerator::theLayerCache
private

Definition at line 48 of file PixelTripletHLTGenerator.h.

Referenced by init().

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

Definition at line 47 of file PixelTripletHLTGenerator.h.

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

HitPairGenerator* PixelTripletHLTGenerator::thePairGenerator
private
bool PixelTripletHLTGenerator::useBend
private

Definition at line 54 of file PixelTripletHLTGenerator.h.

Referenced by hitTriplets().

bool PixelTripletHLTGenerator::useFixedPreFiltering
private

Definition at line 50 of file PixelTripletHLTGenerator.h.

Referenced by hitTriplets(), and PixelTripletHLTGenerator().

bool PixelTripletHLTGenerator::useMScat
private

Definition at line 53 of file PixelTripletHLTGenerator.h.

Referenced by hitTriplets().