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
 
SeedComparitortheComparitor
 
LayerCacheTypetheLayerCache
 
std::vector
< ctfseeding::SeedingLayer
theLayers
 
HitPairGeneratorthePairGenerator
 
bool useBend
 
bool useFixedPreFiltering
 
bool useMScat
 

Additional Inherited Members

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

Detailed Description

Definition at line 23 of file PixelTripletHLTGenerator.h.

Member Typedef Documentation

Definition at line 25 of file PixelTripletHLTGenerator.h.

Constructor & Destructor Documentation

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

Definition at line 26 of file PixelTripletHLTGenerator.cc.

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

27  : thePairGenerator(0),
28  theLayerCache(0),
29  useFixedPreFiltering(cfg.getParameter<bool>("useFixedPreFiltering")),
30  extraHitRZtolerance(cfg.getParameter<double>("extraHitRZtolerance")),
31  extraHitRPhitolerance(cfg.getParameter<double>("extraHitRPhitolerance")),
32  useMScat(cfg.getParameter<bool>("useMultScattering")),
33  useBend(cfg.getParameter<bool>("useBending"))
34 {
35  theMaxElement=cfg.getParameter<unsigned int>("maxElement");
36  dphi = (useFixedPreFiltering) ? cfg.getParameter<double>("phiPreFiltering") : 0;
37 
38  edm::ParameterSet comparitorPSet =
39  cfg.getParameter<edm::ParameterSet>("SeedComparitorPSet");
40  std::string comparitorName = comparitorPSet.getParameter<std::string>("ComponentName");
41  theComparitor = (comparitorName == "none") ?
42  0 : SeedComparitorFactory::get()->create( comparitorName, comparitorPSet);
43 
44 }
T getParameter(std::string const &) const
T get(const Candidate &c)
Definition: component.h:56
PixelTripletHLTGenerator::~PixelTripletHLTGenerator ( )
virtual

Definition at line 46 of file PixelTripletHLTGenerator.cc.

References theComparitor, and thePairGenerator.

48 { delete thePairGenerator;
49  delete theComparitor;
50 }

Member Function Documentation

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

Definition at line 221 of file PixelTripletHLTGenerator.cc.

References Geom::ftwoPi().

Referenced by hitTriplets().

222 {
223  while (phi > phi2) phi -= Geom::ftwoPi();
224  while (phi < phi1) phi += Geom::ftwoPi();
225  return ( (phi1 <= phi) && (phi <= phi2) );
226 }
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 61 of file PixelTripletHLTGenerator.cc.

References GeomDetEnumerators::barrel, checkPhiInRange(), SeedComparitor::compatible(), PixelRecoUtilities::curvature(), dphi, extraHitRPhitolerance, extraHitRZtolerance, f, HitPairGenerator::hitPairs(), SeedComparitor::init(), ThirdHitRZPredictionBase::initLayer(), ThirdHitRZPrediction< Propagator >::initPropagator(), PixelRecoRange< T >::intersection(), geometryCSVtoXML::line, DetLayer::location(), LogDebug, 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(), theComparitor, theLayers, OrderedHitsGenerator::theMaxElement, thePairGenerator, useBend, useFixedPreFiltering, useMScat, Hit::x, PV3DBase< T, PVType, FrameType >::x(), Hit::y, PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

66 {
68  OrderedHitPairs pairs; pairs.reserve(30000);
69  OrderedHitPairs::const_iterator ip;
70 
71  thePairGenerator->hitPairs(region,pairs,ev,es);
72 
73  if (pairs.empty()) return;
74 
75  int size = theLayers.size();
76 
77  typedef std::vector<ThirdHitRZPrediction<PixelRecoLineRZ> > Preds;
78  Preds preds(size);
79 
80  std::vector<const RecHitsSortedInPhi *> thirdHitMap(size);
82  vector<Hit> thirdHits;
83 
84  // fill the prediciton vetor
85  for (int il=0; il!=size; ++il) {
86  thirdHitMap[il] = &(*theLayerCache)(&theLayers[il], region, ev, es);
87  ThirdHitRZPrediction<PixelRecoLineRZ> & pred = preds[il];
88  pred.initLayer(theLayers[il].detLayer());
89  pred.initTolerance(extraHitRZtolerance);
90  }
91 
92 
93  double imppar = region.originRBound();
94  double curv = PixelRecoUtilities::curvature(1/region.ptMin(), es);
95 
96  for (ip = pairs.begin(); ip != pairs.end(); ip++) {
97 
98  GlobalPoint gp1tmp = (*ip).inner()->globalPosition();
99  GlobalPoint gp2tmp = (*ip).outer()->globalPosition();
100  GlobalPoint gp1(gp1tmp.x()-region.origin().x(), gp1tmp.y()-region.origin().y(), gp1tmp.z());
101  GlobalPoint gp2(gp2tmp.x()-region.origin().x(), gp2tmp.y()-region.origin().y(), gp2tmp.z());
102 
103  PixelRecoPointRZ point1(gp1.perp(), gp1.z());
104  PixelRecoPointRZ point2(gp2.perp(), gp2.z());
105  PixelRecoLineRZ line(point1, point2);
106  ThirdHitPredictionFromInvParabola predictionRPhi(gp1,gp2,imppar,curv,extraHitRPhitolerance);
107  ThirdHitPredictionFromInvParabola predictionRPhitmp(gp1tmp,gp2tmp,imppar+region.origin().perp(),curv,extraHitRPhitolerance);
108 
109 
110  for (int il=0; il!=size; ++il) {
111  const DetLayer * layer = theLayers[il].detLayer();
112 // bool pixelLayer = ( layer->subDetector() == GeomDetEnumerators::PixelBarrel
113 // || layer->subDetector() == GeomDetEnumerators::PixelEndcap);
114  bool barrelLayer = (layer->location() == GeomDetEnumerators::barrel);
115 
116  ThirdHitCorrection correction(es, region.ptMin(), layer, line, point2, useMScat, useBend);
117 
118  ThirdHitRZPrediction<PixelRecoLineRZ> & predictionRZ = preds[il];
119 
120  predictionRZ.initPropagator(&line);
121  Range rzRange = predictionRZ();
122 
123  correction.correctRZRange(rzRange);
124  Range phiRange;
125  if (useFixedPreFiltering) {
126  float phi0 = (*ip).outer()->globalPosition().phi();
127  phiRange = Range(phi0-dphi,phi0+dphi);
128  }
129  else {
130  Range radius;
131  if (barrelLayer) {
132  radius = predictionRZ.detRange();
133  } else {
134  radius = Range(
135  max(rzRange.min(), predictionRZ.detSize().min()),
136  min(rzRange.max(), predictionRZ.detSize().max()) );
137  }
138  if (radius.empty()) continue;
139  Range rPhi1m = predictionRPhitmp(radius.max(), -1);
140  Range rPhi1p = predictionRPhitmp(radius.max(), 1);
141  Range rPhi2m = predictionRPhitmp(radius.min(), -1);
142  Range rPhi2p = predictionRPhitmp(radius.min(), 1);
143  Range rPhi1 = rPhi1m.sum(rPhi1p);
144  Range rPhi2 = rPhi2m.sum(rPhi2p);
145  correction.correctRPhiRange(rPhi1);
146  correction.correctRPhiRange(rPhi2);
147  rPhi1.first /= radius.max();
148  rPhi1.second /= radius.max();
149  rPhi2.first /= radius.min();
150  rPhi2.second /= radius.min();
151  phiRange = mergePhiRanges(rPhi1,rPhi2);
152  }
153 
154 // LayerHitMapLoop thirdHits =
155 // pixelLayer ? thirdHitMap[il]->loop(phiRange, rzRange) :
156 // thirdHitMap[il]->loop();
157 
158  thirdHits.clear();
159  thirdHitMap[il]->hits(phiRange.min(),phiRange.max(), thirdHits);
160 
161  static float nSigmaRZ = std::sqrt(12.f);
162  static float nSigmaPhi = 3.f;
163 
164  typedef vector<Hit>::const_iterator IH;
165  for (IH th=thirdHits.begin(), eh=thirdHits.end(); th !=eh; ++th) {
166 
167  if (theMaxElement!=0 && result.size() >= theMaxElement){
168  result.clear();
169  edm::LogError("TooManyTriplets")<<" number of triples exceed maximum. no triplets produced.";
170  return;
171  }
172  const Hit& hit = (*th);
173  GlobalPoint point(hit->globalPosition().x()-region.origin().x(),
174  hit->globalPosition().y()-region.origin().y(),
175  hit->globalPosition().z() );
176  float p3_r = point.perp();
177  float p3_z = point.z();
178  float p3_phi = point.phi();
179 
180  if (barrelLayer) {
181  Range allowedZ = predictionRZ(p3_r);
182  correction.correctRZRange(allowedZ);
183 
184  float zErr = nSigmaRZ * hit->errorGlobalZ();
185  Range hitRange(p3_z-zErr, p3_z+zErr);
186  Range crossingRange = allowedZ.intersection(hitRange);
187  if (crossingRange.empty()) continue;
188  } else {
189  Range allowedR = predictionRZ(p3_z);
190  correction.correctRZRange(allowedR);
191  float rErr = nSigmaRZ * hit->errorGlobalR();
192  Range hitRange(p3_r-rErr, p3_r+rErr);
193  Range crossingRange = allowedR.intersection(hitRange);
194  if (crossingRange.empty()) continue;
195  }
196 
197  float phiErr = nSigmaPhi*hit->errorGlobalRPhi()/p3_r;
198  for (int icharge=-1; icharge <=1; icharge+=2) {
199  Range rangeRPhi = predictionRPhi(p3_r, icharge);
200  correction.correctRPhiRange(rangeRPhi);
201  if (checkPhiInRange(p3_phi, rangeRPhi.first/p3_r-phiErr, rangeRPhi.second/p3_r+phiErr)) {
202  // insert here check with comparitor
203  OrderedHitTriplet hittriplet( (*ip).inner(), (*ip).outer(), hit);
204  if(!theComparitor || theComparitor->compatible(hittriplet,region) ) {
205  result.push_back( hittriplet );
206  } else {
207  LogDebug("RejectedTriplet") << "rejected triplet from comparitor "
208  << hittriplet.outer()->globalPosition().x() << " "
209  << hittriplet.outer()->globalPosition().y() << " "
210  << hittriplet.outer()->globalPosition().z();
211  }
212  break;
213  }
214  }
215  }
216  }
217  }
218 
219 }
#define LogDebug(id)
std::vector< ctfseeding::SeedingLayer > theLayers
void initPropagator(const Propagator *propagator)
T perp() const
Definition: PV3DBase.h:71
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:62
#define min(a, b)
Definition: mlp_lapack.h:161
virtual bool compatible(const SeedingHitSet &hits, const TrackingRegion &region) const =0
virtual void init(const edm::EventSetup &es)=0
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: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
bool checkPhiInRange(float phi, float phi1, float phi2) const
TransientTrackingRecHit::ConstRecHitPointer Hit
T x() const
Definition: PV3DBase.h:61
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 52 of file PixelTripletHLTGenerator.cc.

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

55 {
56  thePairGenerator = pairs.clone();
57  theLayers = layers;
58  theLayerCache = layerCache;
59 }
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 228 of file PixelTripletHLTGenerator.cc.

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

Referenced by hitTriplets().

230 {
231  float r2_min=r2.first;
232  float r2_max=r2.second;
233  while (r1.first-r2_min > Geom::fpi()) { r2_min += Geom::ftwoPi(); r2_max += Geom::ftwoPi();}
234  while (r1.first-r2_min < -Geom::fpi()) { r2_min -= Geom::ftwoPi(); r2_max -= Geom::ftwoPi(); }
235 
236  return std::make_pair(min(r1.first,r2_min),max(r1.second,r2_max));
237 }
#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 38 of file PixelTripletHLTGenerator.h.

References thePairGenerator.

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

Definition at line 39 of file PixelTripletHLTGenerator.h.

References theLayers.

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

Member Data Documentation

float PixelTripletHLTGenerator::dphi
private

Definition at line 56 of file PixelTripletHLTGenerator.h.

Referenced by hitTriplets(), and PixelTripletHLTGenerator().

float PixelTripletHLTGenerator::extraHitRPhitolerance
private

Definition at line 53 of file PixelTripletHLTGenerator.h.

Referenced by hitTriplets().

float PixelTripletHLTGenerator::extraHitRZtolerance
private

Definition at line 52 of file PixelTripletHLTGenerator.h.

Referenced by hitTriplets().

SeedComparitor* PixelTripletHLTGenerator::theComparitor
private
LayerCacheType* PixelTripletHLTGenerator::theLayerCache
private

Definition at line 49 of file PixelTripletHLTGenerator.h.

Referenced by init().

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
bool PixelTripletHLTGenerator::useBend
private

Definition at line 55 of file PixelTripletHLTGenerator.h.

Referenced by hitTriplets().

bool PixelTripletHLTGenerator::useFixedPreFiltering
private

Definition at line 51 of file PixelTripletHLTGenerator.h.

Referenced by hitTriplets(), and PixelTripletHLTGenerator().

bool PixelTripletHLTGenerator::useMScat
private

Definition at line 54 of file PixelTripletHLTGenerator.h.

Referenced by hitTriplets().