CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
RectangularEtaPhiTrackingRegion Class Referencefinal

#include <RectangularEtaPhiTrackingRegion.h>

Inheritance diagram for RectangularEtaPhiTrackingRegion:
TrackingRegion

Public Types

typedef TkTrackingRegionsMargin< float > Margin
 
enum  UseMeasurementTracker { UseMeasurementTracker::kNever = -1, UseMeasurementTracker::kForSiStrips = 0, UseMeasurementTracker::kAlways = 1 }
 
- Public Types inherited from TrackingRegion
typedef SeedingLayerSetsHits::ConstRecHitPointer Hit
 
typedef SeedingLayerSetsHits::Hits Hits
 
typedef PixelRecoRange< float > Range
 

Public Member Functions

HitRZCompatibilitycheckRZ (const DetLayer *layer, const Hit &outerHit, const edm::EventSetup &iSetup, const DetLayer *outerlayer=0, float lr=0, float gz=0, float dr=0, float dz=0) const override
 
RectangularEtaPhiTrackingRegionclone () const override
 
const RangeetaRange () const
 allowed eta range [eta_min, eta_max] interval More...
 
TrackingRegion::Hits hits (const edm::EventSetup &es, const SeedingLayerSetsHits::SeedingLayer &layer) const override
 get hits from layer compatible with region constraints More...
 
bool isPrecise () const
 is precise error calculation switched on More...
 
std::string name () const override
 
RectangularEtaPhiTrackingRegionoperator= (RectangularEtaPhiTrackingRegion const &)=delete
 
RectangularEtaPhiTrackingRegionoperator= (RectangularEtaPhiTrackingRegion &&)=default
 
const MarginphiMargin () const
 
std::string print () const override
 
 RectangularEtaPhiTrackingRegion (RectangularEtaPhiTrackingRegion const &rh)
 
 RectangularEtaPhiTrackingRegion (RectangularEtaPhiTrackingRegion &&)=default
 
 RectangularEtaPhiTrackingRegion (const GlobalVector &dir, const GlobalPoint &vertexPos, float ptMin, float rVertex, float zVertex, float deltaEta, float deltaPhi, UseMeasurementTracker whereToUseMeasurementTracker=UseMeasurementTracker::kNever, bool precise=true, const MeasurementTrackerEvent *measurementTracker=0, bool etaPhiRegion=false)
 
 RectangularEtaPhiTrackingRegion (const GlobalVector &dir, const GlobalPoint &vertexPos, float ptMin, float rVertex, float zVertex, Margin etaMargin, Margin phiMargin, UseMeasurementTracker whereToUseMeasurementTracker=UseMeasurementTracker::kNever, bool precise=true, const MeasurementTrackerEvent *measurementTracker=0, bool etaPhiRegion=false)
 
 RectangularEtaPhiTrackingRegion (const GlobalVector &dir, const GlobalPoint &vertexPos, Range invPtRange, float rVertex, float zVertex, Margin etaMargin, Margin phiMargin, UseMeasurementTracker whereToUseMeasurementTracker=UseMeasurementTracker::kNever, bool precise=true, const MeasurementTrackerEvent *measurementTracker=0, bool etaPhiRegion=false, bool useMS=true)
 
const RangetanLambdaRange () const
 
- Public Member Functions inherited from TrackingRegion
GlobalVector const & direction () const
 the direction around which region is constructed More...
 
Range invPtRange () const
 inverse pt range More...
 
GlobalPoint const & origin () const
 
float originRBound () const
 bounds the particle vertex in the transverse plane More...
 
float originZBound () const
 bounds the particle vertex in the longitudinal plane More...
 
float phiDirection () const
 
float ptMin () const
 minimal pt of interest More...
 
TrackingRegionrestrictedRegion (const GlobalPoint &originPos, const float &originRBound, const float &originZBound) const
 clone region with new vertex position More...
 
 TrackingRegion (const GlobalVector &direction, const GlobalPoint &originPos, const Range &invPtRange, const float &originRBound, const float &originZBound)
 
GlobalVector const & unitDirection () const
 
virtual ~TrackingRegion ()
 

Static Public Member Functions

static UseMeasurementTracker doubleToUseMeasurementTracker (double value)
 
static UseMeasurementTracker intToUseMeasurementTracker (int value)
 
static UseMeasurementTracker stringToUseMeasurementTracker (const std::string &name)
 

Private Types

using cacheHitPointer = mayown_ptr< BaseTrackerRecHit >
 
using cacheHits = std::vector< cacheHitPointer >
 

Private Member Functions

HitRZCompatibilitycheckRZOld (const DetLayer *layer, const Hit &outerHit, const edm::EventSetup &iSetup, const DetLayer *outerlayer) const
 
std::unique_ptr< MeasurementEstimatorestimator (const BarrelDetLayer *layer, const edm::EventSetup &iSetup) const
 
std::unique_ptr< MeasurementEstimatorestimator (const ForwardDetLayer *layer, const edm::EventSetup &iSetup) const
 
void initEtaRange (const GlobalVector &dir, const Margin &margin)
 
OuterHitPhiPrediction phiWindow (const edm::EventSetup &iSetup) const
 
HitRZConstraint rzConstraint () const
 

Private Attributes

cacheHits cache
 
Range theEtaRange
 
Range theLambdaRange
 
float theMeanLambda
 
const MeasurementTrackerEventtheMeasurementTracker = 0
 
const UseMeasurementTracker theMeasurementTrackerUsage = UseMeasurementTracker::kNever
 
Margin thePhiMargin
 
bool thePrecise =false
 
bool theUseEtaPhi =false
 
bool theUseMS =false
 

Detailed Description

A concrete implementation of TrackingRegion. Apart of vertex constraint from TrackingRegion in this implementation the region of interest is further constrainted in phi and eta around the direction of the region

Definition at line 28 of file RectangularEtaPhiTrackingRegion.h.

Member Typedef Documentation

Definition at line 207 of file RectangularEtaPhiTrackingRegion.h.

Definition at line 208 of file RectangularEtaPhiTrackingRegion.h.

Definition at line 65 of file RectangularEtaPhiTrackingRegion.h.

Member Enumeration Documentation

Enumerator
kNever 
kForSiStrips 
kAlways 

Definition at line 30 of file RectangularEtaPhiTrackingRegion.h.

30  {
31  kNever = -1,
32  kForSiStrips = 0,
33  kAlways = 1
34  };

Constructor & Destructor Documentation

RectangularEtaPhiTrackingRegion::RectangularEtaPhiTrackingRegion ( RectangularEtaPhiTrackingRegion const &  rh)
inline

Definition at line 50 of file RectangularEtaPhiTrackingRegion.h.

References operator=().

Referenced by clone().

50  :
51  TrackingRegion(rh),
52  theEtaRange(rh.theEtaRange),
53  theLambdaRange(rh.theLambdaRange),
54  thePhiMargin(rh.thePhiMargin),
55  theMeanLambda(rh.theMeanLambda),
56  theMeasurementTrackerUsage(rh.theMeasurementTrackerUsage),
57  thePrecise(rh.thePrecise),
58  theUseEtaPhi(rh.theUseEtaPhi),
59  theMeasurementTracker(rh.theMeasurementTracker) {}
const UseMeasurementTracker theMeasurementTrackerUsage
TrackingRegion(const GlobalVector &direction, const GlobalPoint &originPos, const Range &invPtRange, const float &originRBound, const float &originZBound)
const MeasurementTrackerEvent * theMeasurementTracker
RectangularEtaPhiTrackingRegion::RectangularEtaPhiTrackingRegion ( RectangularEtaPhiTrackingRegion &&  )
default
RectangularEtaPhiTrackingRegion::RectangularEtaPhiTrackingRegion ( const GlobalVector dir,
const GlobalPoint vertexPos,
float  ptMin,
float  rVertex,
float  zVertex,
float  deltaEta,
float  deltaPhi,
UseMeasurementTracker  whereToUseMeasurementTracker = UseMeasurementTracker::kNever,
bool  precise = true,
const MeasurementTrackerEvent measurementTracker = 0,
bool  etaPhiRegion = false 
)
inline

constructor (symmetric eta and phi margins).
dir - the direction around which region is constructed
the initial direction of the momentum of the particle should be in the range
phi of dir +- deltaPhi
eta of dir +- deltaEta

vertexPos - the position of the vertex (origin) of the of the region.
It is a centre of cylinder constraind with rVertex, zVertex. The track of the particle should cross the cylinder
WARNING: in the current implementaion the vertexPos is supposed to be placed on the beam line, i.e. to be of the form (0,0,float)

ptMin - minimal pt of interest
rVertex - radius of the cylinder around beam line where the tracks of interest should point to.
zVertex - half height of the cylinder around the beam line where the tracks of interest should point to.
deltaEta - allowed deviation of the initial direction of particle in eta in respect to direction of the region
deltaPhi - allowed deviation of the initial direction of particle in phi in respect to direction of the region whereToUseMeasurementTracker: 1=everywhere, 0=outside pixles, -1=nowhere

Definition at line 92 of file RectangularEtaPhiTrackingRegion.h.

100  : RectangularEtaPhiTrackingRegion(dir, vertexPos, Range( -1/ptMin, 1/ptMin), rVertex, zVertex,
104  measurementTracker, etaPhiRegion)
105  {}
static const double deltaEta
Definition: CaloConstants.h:8
PixelRecoRange< float > Range
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float ptMin() const
minimal pt of interest
RectangularEtaPhiTrackingRegion(RectangularEtaPhiTrackingRegion const &rh)
TkTrackingRegionsMargin< float > Margin
RectangularEtaPhiTrackingRegion::RectangularEtaPhiTrackingRegion ( const GlobalVector dir,
const GlobalPoint vertexPos,
float  ptMin,
float  rVertex,
float  zVertex,
Margin  etaMargin,
Margin  phiMargin,
UseMeasurementTracker  whereToUseMeasurementTracker = UseMeasurementTracker::kNever,
bool  precise = true,
const MeasurementTrackerEvent measurementTracker = 0,
bool  etaPhiRegion = false 
)
inline

constructor (asymmetrinc eta and phi margins).
non equal left-right eta and phi bounds around direction are possible. The ranges are defined using Margin. the meaning of other arguments is the same as in the case of symmetring bounds to direction of the region.

Definition at line 113 of file RectangularEtaPhiTrackingRegion.h.

RectangularEtaPhiTrackingRegion::RectangularEtaPhiTrackingRegion ( const GlobalVector dir,
const GlobalPoint vertexPos,
Range  invPtRange,
float  rVertex,
float  zVertex,
Margin  etaMargin,
Margin  phiMargin,
UseMeasurementTracker  whereToUseMeasurementTracker = UseMeasurementTracker::kNever,
bool  precise = true,
const MeasurementTrackerEvent measurementTracker = 0,
bool  etaPhiRegion = false,
bool  useMS = true 
)
inline

constructor (explicit pt range, asymmetrinc eta and phi margins).
the meaning of other arguments is the same as in the case of symmetring bounds to direction of the region.

Definition at line 132 of file RectangularEtaPhiTrackingRegion.h.

References initEtaRange().

142  : TrackingRegionBase( dir, vertexPos, invPtRange, rVertex, zVertex),
144  thePrecise(precise),theUseMS(useMS),theUseEtaPhi(etaPhiRegion),
145  theMeasurementTracker(measurementTracker)
146  { initEtaRange(dir, etaMargin); }
const UseMeasurementTracker theMeasurementTrackerUsage
const MeasurementTrackerEvent * theMeasurementTracker
void initEtaRange(const GlobalVector &dir, const Margin &margin)
Range invPtRange() const
inverse pt range
TrackingRegion TrackingRegionBase

Member Function Documentation

HitRZCompatibility* RectangularEtaPhiTrackingRegion::checkRZ ( const DetLayer layer,
const Hit outerHit,
const edm::EventSetup iSetup,
const DetLayer outerlayer = 0,
float  lr = 0,
float  gz = 0,
float  dr = 0,
float  dz = 0 
) const
inlineoverridevirtual

utility to check eta/theta hit compatibility with region constraints and outer hit constraint

Implements TrackingRegion.

Definition at line 164 of file RectangularEtaPhiTrackingRegion.h.

References checkRZOld().

169  { return checkRZOld(layer,outerHit,iSetup, outerlayer); }
HitRZCompatibility * checkRZOld(const DetLayer *layer, const Hit &outerHit, const edm::EventSetup &iSetup, const DetLayer *outerlayer) const
HitRZCompatibility * RectangularEtaPhiTrackingRegion::checkRZOld ( const DetLayer layer,
const Hit outerHit,
const edm::EventSetup iSetup,
const DetLayer outerlayer 
) const
private

Definition at line 69 of file RectangularEtaPhiTrackingRegion.cc.

References funct::abs(), GeomDetEnumerators::barrel, corr, SimpleLineRZ::cotLine(), f, gedGsfElectrons_cfi::isBarrel, DetLayer::location(), SiStripPI::max, min(), SurfaceOrientation::outer, ALCARECOTkAlBeamHalo_cff::ptMin, DetLayer::seqNum(), funct::sqr(), mathSSE::sqrt(), vtxMean(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), PixelRecoPointRZ::z(), PV3DBase< T, PVType, FrameType >::z(), and PixelRecoLineRZ::zAtR().

Referenced by checkRZ(), initEtaRange(), and name().

70 {
71 
72  bool isBarrel = (layer->location() == GeomDetEnumerators::barrel);
73  GlobalPoint ohit = outerHit->globalPosition();
74  float outerred_r = std::sqrt( sqr(ohit.x()-origin().x())+sqr(ohit.y()-origin().y()) );
75  PixelRecoPointRZ outer(outerred_r, ohit.z());
76 
77  float zMinOrigin = origin().z() - originZBound();
78  float zMaxOrigin = origin().z() + originZBound();
79 
80  if (!thePrecise) {
81  float vcotMin = (outer.z() > zMaxOrigin) ?
82  (outer.z()-zMaxOrigin)/(outer.r()+originRBound())
83  : (outer.z()-zMaxOrigin)/(outer.r()-originRBound());
84  float vcotMax = (outer.z() > zMinOrigin) ?
85  (outer.z()-zMinOrigin)/(outer.r()-originRBound())
86  : (outer.z()-zMinOrigin)/(outer.r()+originRBound());
87  float cotRight = std::max(vcotMin,theLambdaRange.min());
88  float cotLeft = std::min(vcotMax, theLambdaRange.max());
89  return new HitEtaCheck( isBarrel, outer, cotLeft, cotRight);
90  }
91 
92 
93 
94  float outerZscatt=0;
95  float innerScatt =0;
96  //CHECK
97  if (theUseMS) {
98  MultipleScatteringParametrisation oSigma(layer,iSetup);
99  float cotThetaOuter = theMeanLambda;
100  float sinThetaOuterInv = std::sqrt(1.f+sqr(cotThetaOuter));
101  outerZscatt = 3.f*oSigma(ptMin(),cotThetaOuter)*sinThetaOuterInv;
102  }
103 
106  float zMinLine = boundL.zAtR(0.)-outerZscatt;
107  float zMaxLine = boundR.zAtR(0.)+outerZscatt;
108  PixelRecoPointRZ vtxL(0.,max(zMinLine, zMinOrigin));
109  PixelRecoPointRZ vtxR(0.,min(zMaxLine, zMaxOrigin));
110  PixelRecoPointRZ vtxMean(0.,(vtxL.z()+vtxR.z())*0.5f);
111  //CHECK
112 
113  if (theUseMS) {
114  MultipleScatteringParametrisation iSigma(layer,iSetup);
115 
116  innerScatt = 3.f * ( outerlayer ?
117  iSigma( ptMin(), vtxMean, outer, outerlayer->seqNum())
118  : iSigma( ptMin(), vtxMean, outer) ) ;
119 
120  // innerScatt = 3.f *iSigma( ptMin(), vtxMean, outer);
121  }
122 
123  SimpleLineRZ leftLine( vtxL, outer);
124  SimpleLineRZ rightLine(vtxR, outer);
125 
126  HitRZConstraint rzConstraint(leftLine, rightLine);
127  auto cotTheta = std::abs(leftLine.cotLine()+rightLine.cotLine())*0.5f;
128 
129 
130  // std::cout << "RectangularEtaPhiTrackingRegion " << outer.r()<<','<< outer.z() << " " << innerScatt << " " << cotTheta << " " << hitZErr << std::endl;
131 
132  if (isBarrel) {
133  auto sinThetaInv = std::sqrt(1.f+sqr(cotTheta));
134  auto corr = innerScatt*sinThetaInv;
136  } else {
137  auto cosThetaInv = std::sqrt(1.f+sqr(1.f/cotTheta));
138  auto corr = innerScatt*cosThetaInv;
140  }
141 }
float originRBound() const
bounds the particle vertex in the transverse plane
GlobalPoint const & origin() const
T max() const
virtual Location location() const =0
Which part of the detector (barrel, endcap)
T y() const
Definition: PV3DBase.h:63
T min() const
float zAtR(float r) const
int seqNum() const
Definition: DetLayer.h:36
T sqrt(T t)
Definition: SSEVec.h:18
T z() const
Definition: PV3DBase.h:64
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static GlobalPoint vtxMean(const GlobalPoint &p1, const GlobalError &e1, const GlobalPoint &p2, const GlobalError &e2)
double f[11][100]
T min(T a, T b)
Definition: MathUtil.h:58
float originZBound() const
bounds the particle vertex in the longitudinal plane
JetCorrectorParameters corr
Definition: classes.h:5
float ptMin() const
minimal pt of interest
Square< F >::type sqr(const F &f)
Definition: Square.h:13
T x() const
Definition: PV3DBase.h:62
RectangularEtaPhiTrackingRegion* RectangularEtaPhiTrackingRegion::clone ( void  ) const
inlineoverridevirtual

Implements TrackingRegion.

Definition at line 171 of file RectangularEtaPhiTrackingRegion.h.

References RectangularEtaPhiTrackingRegion().

171  {
172  return new RectangularEtaPhiTrackingRegion(*this);
173  }
RectangularEtaPhiTrackingRegion(RectangularEtaPhiTrackingRegion const &rh)
static UseMeasurementTracker RectangularEtaPhiTrackingRegion::doubleToUseMeasurementTracker ( double  value)
inlinestatic
std::unique_ptr< MeasurementEstimator > RectangularEtaPhiTrackingRegion::estimator ( const BarrelDetLayer layer,
const edm::EventSetup iSetup 
) const
private

Definition at line 144 of file RectangularEtaPhiTrackingRegion.cc.

References funct::abs(), Surface::bounds(), PixelRecoRange< T >::empty(), f, reco::helper::VirtualJetProducerHelper::intersection(), PixelRecoRange< T >::intersection(), Bounds::length(), PixelRecoUtilities::longitudinalBendingCorrection(), SiStripPI::max, PixelRecoRange< T >::max(), PixelRecoRange< T >::mean(), PixelRecoRange< T >::min(), min(), trackingPOGFilters_cfi::phiWindow, GeometricSearchDet::position(), ALCARECOTkAlBeamHalo_cff::ptMin, TCMET_cfi::radius, HitZCheck::range(), OuterHitPhiPrediction::setTolerance(), HitZCheck::setTolerance(), BarrelDetLayer::specificSurface(), funct::sqr(), mathSSE::sqrt(), BarrelDetLayer::surface(), Bounds::thickness(), w2, and PV3DBase< T, PVType, FrameType >::z().

Referenced by name().

145 {
146 
147  using Algo = HitZCheck;
148 
149  // det dimensions
150  float halfLength = 0.5f*layer->surface().bounds().length();
151  float halfThickness = 0.5f*layer->surface().bounds().thickness();
152  float z0 = layer->position().z();
153  float radius = layer->specificSurface().radius();
154 
155  // det ranges
156  Range detRWindow (radius-halfThickness, radius+halfThickness);
157  Range detZWindow(z0-halfLength,z0+halfLength);
158 
159  // z prediction, skip if not intersection
160  HitZCheck zPrediction(rzConstraint());
161  Range hitZWindow = zPrediction.range(detRWindow.min()).
162  intersection(detZWindow);
163  if (hitZWindow.empty()) return nullptr;
164 
165  // phi prediction
166  OuterHitPhiPrediction phiPrediction = phiWindow(iSetup);
167 
168  //
169  // optional corrections for tolerance (mult.scatt, error, bending)
170  //
172  if (thePrecise) {
173  auto invR = 1.f/ radius;
174  auto cotTheta = (hitZWindow.mean()-origin().z()) * invR;
175  auto sinThetaInv = std::sqrt(1.f+sqr(cotTheta));
176  MultipleScatteringParametrisation msSigma(layer,iSetup);
177  auto scatt = 3.f * msSigma(ptMin(), cotTheta);
178  auto bendR = longitudinalBendingCorrection(radius,ptMin(),iSetup);
179 
180  float hitErrRPhi = 0.;
181  float hitErrZ = 0.;
182  float corrPhi = (scatt+ hitErrRPhi)*invR;
183  float corrZ = scatt*sinThetaInv + bendR*std::abs(cotTheta) + hitErrZ;
184 
185  phiPrediction.setTolerance(corrPhi);
186  zPrediction.setTolerance(HitZCheck::Margin(corrZ,corrZ));
187 
188  //
189  // hit ranges in det
190  //
191  OuterHitPhiPrediction::Range phi1 = phiPrediction(detRWindow.min());
192  OuterHitPhiPrediction::Range phi2 = phiPrediction(detRWindow.max());
193  phiRange = Range( std::min(phi1.min(),phi2.min()), std::max(phi1.max(),phi2.max()));
194  Range w1 = zPrediction.range(detRWindow.min());
195  Range w2 = zPrediction.range(detRWindow.max());
196  hitZWindow = Range(std::min(w1.min(),w2.min()), std::max(w1.max(),w2.max())).intersection(detZWindow);
197  }
198  else {
199  phiRange = phiPrediction(detRWindow.mean());
200  }
201 
202  return std::make_unique<OuterEstimator<Algo>>(
203  OuterDetCompatibility( layer, phiRange, detRWindow, hitZWindow),
204  OuterHitCompatibility<Algo>( phiPrediction, zPrediction ),
205  iSetup);
206 }
void setTolerance(float tolerance)
virtual float length() const =0
common ppss p3p6s2 common epss epspn46 common const1 w2
Definition: inclppp.h:1
GlobalPoint const & origin() const
T max() const
const Bounds & bounds() const
Definition: Surface.h:120
virtual const BoundCylinder & specificSurface() const final
Extension of the interface.
T min() const
PixelRecoRange< float > Range
T sqrt(T t)
Definition: SSEVec.h:18
T z() const
Definition: PV3DBase.h:64
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
T min(T a, T b)
Definition: MathUtil.h:58
OuterHitPhiPrediction phiWindow(const edm::EventSetup &iSetup) const
double longitudinalBendingCorrection(double radius, double pt, const edm::EventSetup &iSetup)
virtual float thickness() const =0
virtual const Surface::PositionType & position() const
Returns position of the surface.
float ptMin() const
minimal pt of interest
PixelRecoRange< T > intersection(const PixelRecoRange< T > &r) const
Square< F >::type sqr(const F &f)
Definition: Square.h:13
const BoundSurface & surface() const final
GeometricSearchDet interface.
Definition: fakeMenu.h:6
std::unique_ptr< MeasurementEstimator > RectangularEtaPhiTrackingRegion::estimator ( const ForwardDetLayer layer,
const edm::EventSetup iSetup 
) const
private

Definition at line 209 of file RectangularEtaPhiTrackingRegion.cc.

References funct::abs(), Surface::bounds(), PixelRecoRange< T >::empty(), reco::helper::VirtualJetProducerHelper::intersection(), PixelRecoRange< T >::intersection(), PixelRecoUtilities::longitudinalBendingCorrection(), PixelRecoRange< T >::max(), PixelRecoRange< T >::mean(), PixelRecoRange< T >::min(), trackingPOGFilters_cfi::phiWindow, GeometricSearchDet::position(), ALCARECOTkAlBeamHalo_cff::ptMin, OuterHitPhiPrediction::setTolerance(), ForwardDetLayer::specificSurface(), funct::sqr(), mathSSE::sqrt(), ForwardDetLayer::surface(), Bounds::thickness(), w2, and PV3DBase< T, PVType, FrameType >::z().

210 {
211  using Algo=HitRCheck;
212  // det dimensions, ranges
213  float halfThickness = 0.5f*layer->surface().bounds().thickness();
214  float zLayer = layer->position().z() ;
215  Range detZWindow( zLayer-halfThickness, zLayer+halfThickness);
216  Range detRWindow( layer->specificSurface().innerRadius(),
217  layer->specificSurface().outerRadius());
218 
219  // r prediction, skip if not intersection
220  HitRCheck rPrediction(rzConstraint());
221  Range hitRWindow = rPrediction.range(zLayer).intersection(detRWindow);
222  if (hitRWindow.empty()) return nullptr;
223 
224  // phi prediction
225  OuterHitPhiPrediction phiPrediction = phiWindow(iSetup);
226  OuterHitPhiPrediction::Range phiRange = phiPrediction(detRWindow.max());
227 
228  //
229  // optional corrections for tolerance (mult.scatt, error, bending)
230  //
231  if (thePrecise) {
232  float cotTheta = (detZWindow.mean()-origin().z())/hitRWindow.mean();
233  float cosThetaInv = std::sqrt(1+sqr(cotTheta))/cotTheta;
234  MultipleScatteringParametrisation msSigma(layer,iSetup);
235  float scatt = 3.f * msSigma(ptMin(),cotTheta);
236  float bendR = longitudinalBendingCorrection(hitRWindow.max(),ptMin(),iSetup);
237  float hitErrRPhi = 0.;
238  float hitErrR = 0.;
239  float corrPhi = (scatt+hitErrRPhi)/detRWindow.min();
240  float corrR = scatt*std::abs(cosThetaInv) + bendR + hitErrR;
241 
242  phiPrediction.setTolerance(corrPhi);
243  rPrediction.setTolerance(HitRCheck::Margin(corrR,corrR));
244 
245  //
246  // hit ranges in det
247  //
248  Range w1,w2;
249  if (zLayer > 0) {
250  w1 = rPrediction.range(detZWindow.min());
251  w2 = rPrediction.range(detZWindow.max());
252  } else {
253  w1 = rPrediction.range(detZWindow.max());
254  w2 = rPrediction.range(detZWindow.min());
255  }
256  hitRWindow = Range(w1.min(),w2.max()).intersection(detRWindow);
257  }
258 
259  return std::make_unique<OuterEstimator<Algo>>(
260  OuterDetCompatibility( layer, phiRange, hitRWindow, detZWindow),
261  OuterHitCompatibility<Algo>( phiPrediction, rPrediction),iSetup );
262 }
void setTolerance(float tolerance)
common ppss p3p6s2 common epss epspn46 common const1 w2
Definition: inclppp.h:1
GlobalPoint const & origin() const
const Bounds & bounds() const
Definition: Surface.h:120
PixelRecoRange< float > Range
T sqrt(T t)
Definition: SSEVec.h:18
T z() const
Definition: PV3DBase.h:64
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
OuterHitPhiPrediction phiWindow(const edm::EventSetup &iSetup) const
virtual const BoundDisk & specificSurface() const final
double longitudinalBendingCorrection(double radius, double pt, const edm::EventSetup &iSetup)
virtual float thickness() const =0
virtual const Surface::PositionType & position() const
Returns position of the surface.
float ptMin() const
minimal pt of interest
const BoundSurface & surface() const final
The surface of the GeometricSearchDet.
PixelRecoRange< T > intersection(const PixelRecoRange< T > &r) const
Square< F >::type sqr(const F &f)
Definition: Square.h:13
Definition: fakeMenu.h:6
const Range& RectangularEtaPhiTrackingRegion::etaRange ( ) const
inline

allowed eta range [eta_min, eta_max] interval

Definition at line 150 of file RectangularEtaPhiTrackingRegion.h.

References theEtaRange.

Referenced by FastTSGFromL2Muon::clean(), FastTSGFromIOHit::clean(), and TrackerSeedCleaner::clean().

TrackingRegion::Hits RectangularEtaPhiTrackingRegion::hits ( const edm::EventSetup es,
const SeedingLayerSetsHits::SeedingLayer layer 
) const
overridevirtual

get hits from layer compatible with region constraints

Implements TrackingRegion.

Definition at line 301 of file RectangularEtaPhiTrackingRegion.cc.

References alongMomentum, GeomDetEnumerators::barrel, Plane::build(), helperFunctions::cache(), funct::cos(), SeedingLayerSetsHits::SeedingLayer::detLayer(), dir, GeomDetEnumerators::endcap, f, edm::EventSetup::get(), hfClusterShapes_cfi::hits, SeedingLayerSetsHits::SeedingLayer::hits(), GeomDetEnumerators::isBarrel(), GeomDetEnumerators::isEndcap(), GeomDetEnumerators::isTrackerPixel(), GeomDetEnumerators::isTrackerStrip(), DetLayer::location(), LogDebug, eostools::move(), edm::ESHandle< T >::product(), mps_fire::result, makeMuonMisalignmentScenario::rot, funct::sin(), DetLayer::subDetector(), and badGlobalMuonTaggersAOD_cff::vtx.

Referenced by isPrecise().

303  {
305 
306  //ESTIMATOR
307 
308  const DetLayer * detLayer = layer.detLayer();
309 
310  bool measurementMethod = false;
311  if(theMeasurementTrackerUsage == UseMeasurementTracker::kAlways) measurementMethod = true;
313  GeomDetEnumerators::isTrackerStrip(detLayer->subDetector())) measurementMethod = true;
314 
315  if(measurementMethod) {
317  es.get<IdealMagneticFieldRecord>().get(field);
318  const MagneticField * magField = field.product();
319 
320  const GlobalPoint vtx = origin();
322 
323  std::unique_ptr<MeasurementEstimator> est;
325  (!theUseEtaPhi && detLayer->location() == GeomDetEnumerators::barrel)) {
326  const BarrelDetLayer& bl = dynamic_cast<const BarrelDetLayer&>(*detLayer);
327  est = estimator(&bl,es);
329  (!theUseEtaPhi && detLayer->location() == GeomDetEnumerators::endcap)) {
330  const ForwardDetLayer& fl = dynamic_cast<const ForwardDetLayer&>(*detLayer);
331  est = estimator(&fl,es);
332  }
333 
334  EtaPhiMeasurementEstimator etaPhiEstimator ((theEtaRange.second-theEtaRange.first)*0.5f,
336  MeasurementEstimator * findDetAndHits = &etaPhiEstimator;
337  if (est){
338  LogDebug("RectangularEtaPhiTrackingRegion")<<"use pixel specific estimator.";
339  findDetAndHits = est.get();
340  }
341  else{
342  LogDebug("RectangularEtaPhiTrackingRegion")<<"use generic etat phi estimator.";
343  }
344 
345  // TSOS
346  float phi = phiDirection();
347  // std::cout << "dir " << direction().x()/direction().perp() <<','<< direction().y()/direction().perp() << " " << sin(phi) <<','<<cos(phi)<< std::endl;
348  Surface::RotationType rot( sin(phi), -cos(phi), 0,
349  0, 0, -1,
350  cos(phi), sin(phi), 0);
351 
352  Plane::PlanePointer surface = Plane::build(GlobalPoint(0.,0.,0.), rot);
353  //TrajectoryStateOnSurface tsos(lpar, *surface, magField);
354 
355  FreeTrajectoryState fts( GlobalTrajectoryParameters(vtx, dir, 1, magField) );
356  TrajectoryStateOnSurface tsos(fts, *surface);
357 
358  // propagator
359  StraightLinePropagator prop( magField, alongMomentum);
360 
362 
364  lm.recHits(hits,*detLayer, tsos, prop, *findDetAndHits);
365  /*
366  { // old code
367  vector<TrajectoryMeasurement> meas = lm.measurements(*detLayer, tsos, prop, *findDetAndHits);
368  auto n=0UL;
369  for (auto const & im : meas)
370  if(im.recHit()->isValid()) ++n;
371  assert(n==hits.size());
372  // std::cout << "old/new " << n <<'/'<<hits.size() << std::endl;
373  }
374  */
375 
376  result.reserve(hits.size());
377  for (auto h : hits) {
378  cache.emplace_back(h);
379  result.emplace_back(h);
380  }
381 
382  LogDebug("RectangularEtaPhiTrackingRegion")<<" found "<< hits.size()<<" minus one measurements on layer: "<<detLayer->subDetector();
383  // std::cout << "RectangularEtaPhiTrackingRegion" <<" found "<< meas.size()<<" minus one measurements on layer: "<<detLayer->subDetector() << std::endl;
384 
385  } else {
386  //
387  // temporary solution (actually heavily used for Pixels....)
388  //
389  if (detLayer->location() == GeomDetEnumerators::barrel) {
390  const BarrelDetLayer& bl = dynamic_cast<const BarrelDetLayer&>(*detLayer);
391  auto est = estimator(&bl,es);
392  if (!est) return result;
393  using Algo = HitZCheck;
394  auto const & hitComp = (reinterpret_cast<OuterEstimator<Algo> const&>(*est)).hitCompatibility();
395  auto layerHits = layer.hits();
396  result.reserve(layerHits.size());
397  for (auto && ih : layerHits) {
398  if ( hitComp(*ih) )
399  result.emplace_back( std::move(ih) );
400  }
401 
402  } else {
403  const ForwardDetLayer& fl = dynamic_cast<const ForwardDetLayer&>(*detLayer);
404  auto est = estimator(&fl,es);
405  if (!est) return result;
406  using Algo = HitRCheck;
407  auto const & hitComp = (reinterpret_cast<OuterEstimator<Algo> const&>(*est)).hitCompatibility();
408  auto layerHits = layer.hits();
409  result.reserve(layerHits.size());
410  for (auto && ih : layerHits) {
411  if ( hitComp(*ih) )
412  result.emplace_back( std::move(ih) );
413  }
414 
415  }
416 
417  }
418 
419  // std::cout << "RectangularEtaPhiTrackingRegion hits " << result.size() << std::endl;
420 
421  return result;
422 }
#define LogDebug(id)
GlobalPoint const & origin() const
std::vector< BaseTrackerRecHit * > SimpleHitContainer
virtual SubDetector subDetector() const =0
The type of detector (PixelBarrel, PixelEndcap, TIB, TOB, TID, TEC, CSC, DT, RPCBarrel, RPCEndcap)
bool isBarrel(GeomDetEnumerators::SubDetector m)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
virtual Location location() const =0
Which part of the detector (barrel, endcap)
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
const UseMeasurementTracker theMeasurementTrackerUsage
TrackingRegion::Hits hits(const edm::EventSetup &es, const SeedingLayerSetsHits::SeedingLayer &layer) const override
get hits from layer compatible with region constraints
std::unique_ptr< MeasurementEstimator > estimator(const BarrelDetLayer *layer, const edm::EventSetup &iSetup) const
GlobalVector const & direction() const
the direction around which region is constructed
const MeasurementTrackerEvent * theMeasurementTracker
static PlanePointer build(Args &&...args)
Definition: Plane.h:33
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double f[11][100]
float phiDirection() const
bool isEndcap(GeomDetEnumerators::SubDetector m)
bool isTrackerStrip(GeomDetEnumerators::SubDetector m)
SeedingLayerSetsHits::Hits Hits
const T & get() const
Definition: EventSetup.h:59
const DetLayer * detLayer() const
dbl *** dir
Definition: mlp_gen.cc:35
T const * product() const
Definition: ESHandle.h:86
Definition: fakeMenu.h:6
def move(src, dest)
Definition: eostools.py:510
bool isTrackerPixel(GeomDetEnumerators::SubDetector m)
void RectangularEtaPhiTrackingRegion::initEtaRange ( const GlobalVector dir,
const Margin margin 
)
private
static UseMeasurementTracker RectangularEtaPhiTrackingRegion::intToUseMeasurementTracker ( int  value)
inlinestatic
bool RectangularEtaPhiTrackingRegion::isPrecise ( ) const
inline

is precise error calculation switched on

Definition at line 158 of file RectangularEtaPhiTrackingRegion.h.

References hits(), and thePrecise.

std::string RectangularEtaPhiTrackingRegion::name ( void  ) const
inlineoverridevirtual
RectangularEtaPhiTrackingRegion& RectangularEtaPhiTrackingRegion::operator= ( RectangularEtaPhiTrackingRegion const &  )
delete
RectangularEtaPhiTrackingRegion& RectangularEtaPhiTrackingRegion::operator= ( RectangularEtaPhiTrackingRegion &&  )
default
const Margin& RectangularEtaPhiTrackingRegion::phiMargin ( ) const
inline

defined phi range around phi0, margin is [phi_left,phi_right]. region is defined in a range: [phi0-phi_left, phi0+phi_right]

Definition at line 155 of file RectangularEtaPhiTrackingRegion.h.

References thePhiMargin.

Referenced by FastTSGFromL2Muon::clean(), FastTSGFromIOHit::clean(), TrackerSeedCleaner::clean(), and SeedFromConsecutiveHitsCreator::makeSeed().

OuterHitPhiPrediction RectangularEtaPhiTrackingRegion::phiWindow ( const edm::EventSetup iSetup) const
private

Definition at line 267 of file RectangularEtaPhiTrackingRegion.cc.

References PixelRecoUtilities::curvature(), SiStripPI::max, and min().

Referenced by name().

268 {
269  auto phi0 = phiDirection();
270  return OuterHitPhiPrediction(
272  phi0+thePhiMargin.right()),
274  curvature(invPtRange().max(),iSetup)),
275  originRBound());
276 }
float originRBound() const
bounds the particle vertex in the transverse plane
T curvature(T InversePt, const edm::EventSetup &iSetup)
T min(T a, T b)
Definition: MathUtil.h:58
float phiDirection() const
Range invPtRange() const
inverse pt range
std::string RectangularEtaPhiTrackingRegion::print ( void  ) const
overridevirtual

Reimplemented from TrackingRegion.

Definition at line 424 of file RectangularEtaPhiTrackingRegion.cc.

References TrackingRegion::print(), and harvestTrackValidationPlots::str.

Referenced by name().

424  {
425  std::ostringstream str;
426  str << TrackingRegionBase::print()
427  <<" eta: "<<theEtaRange<<" phi:"<<thePhiMargin
428  << "precise: "<<thePrecise;
429  return str.str();
430 }
virtual std::string print() const
HitRZConstraint RectangularEtaPhiTrackingRegion::rzConstraint ( ) const
private

Definition at line 280 of file RectangularEtaPhiTrackingRegion.cc.

References conversionPostprocessing_cfi::rMax, conversionPostprocessing_cfi::rMin, conversionPostprocessing_cfi::zMax, and conversionPostprocessing_cfi::zMin.

Referenced by name().

280  {
281  HitRZConstraint::Point pLeft,pRight;
282  float zMin = origin().z() - originZBound();
283  float zMax = origin().z() + originZBound();
284  float rMin = -originRBound();
285  float rMax = originRBound();
286  if(theEtaRange.max() > 0) {
287  pRight = HitRZConstraint::Point(rMin,zMax);
288  } else {
289  pRight = HitRZConstraint::Point(rMax,zMax);
290  }
291  if (theEtaRange.min() > 0.) {
292  pLeft = HitRZConstraint::Point(rMax, zMin);
293  } else {
294  pLeft = HitRZConstraint::Point(rMin, zMin);
295  }
296  return HitRZConstraint(pLeft, theLambdaRange.min(),
297  pRight,theLambdaRange.max()
298  );
299 }
float originRBound() const
bounds the particle vertex in the transverse plane
GlobalPoint const & origin() const
T max() const
T min() const
T z() const
Definition: PV3DBase.h:64
float originZBound() const
bounds the particle vertex in the longitudinal plane
SimpleLineRZ::Point Point
RectangularEtaPhiTrackingRegion::UseMeasurementTracker RectangularEtaPhiTrackingRegion::stringToUseMeasurementTracker ( const std::string &  name)
static

Definition at line 49 of file RectangularEtaPhiTrackingRegion.cc.

References Exception, dataset::name, AlCaHLTBitMon_QueryRunRegistry::string, tmp, and create_public_lumi_plots::transform.

Referenced by AreaSeededTrackingRegionsBuilder::AreaSeededTrackingRegionsBuilder(), CandidatePointSeededTrackingRegionsProducer::CandidatePointSeededTrackingRegionsProducer(), CandidateSeededTrackingRegionsProducer::CandidateSeededTrackingRegionsProducer(), doubleToUseMeasurementTracker(), L3MumuTrackingRegion::L3MumuTrackingRegion(), PointSeededTrackingRegionsProducer::PointSeededTrackingRegionsProducer(), TauRegionalPixelSeedGenerator::TauRegionalPixelSeedGenerator(), and TrackingRegionsFromBeamSpotAndL2Tau::TrackingRegionsFromBeamSpotAndL2Tau().

49  {
51  std::transform(tmp.begin(), tmp.end(), tmp.begin(), ::tolower);
52  if(tmp == "never")
54  if(tmp == "forsistrips")
56  if(tmp == "always")
58  throw cms::Exception("Configuration") << "Got invalid string '" << name << "', valid values are 'Never', 'ForSiStrips', 'Always' (case insensitive)";
59 }
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
const Range& RectangularEtaPhiTrackingRegion::tanLambdaRange ( ) const
inline

Member Data Documentation

cacheHits RectangularEtaPhiTrackingRegion::cache
mutableprivate

Definition at line 216 of file RectangularEtaPhiTrackingRegion.h.

Range RectangularEtaPhiTrackingRegion::theEtaRange
private

Definition at line 195 of file RectangularEtaPhiTrackingRegion.h.

Referenced by etaRange().

Range RectangularEtaPhiTrackingRegion::theLambdaRange
private

Definition at line 196 of file RectangularEtaPhiTrackingRegion.h.

Referenced by tanLambdaRange().

float RectangularEtaPhiTrackingRegion::theMeanLambda
private

Definition at line 198 of file RectangularEtaPhiTrackingRegion.h.

const MeasurementTrackerEvent* RectangularEtaPhiTrackingRegion::theMeasurementTracker = 0
private

Definition at line 203 of file RectangularEtaPhiTrackingRegion.h.

const UseMeasurementTracker RectangularEtaPhiTrackingRegion::theMeasurementTrackerUsage = UseMeasurementTracker::kNever
private

Definition at line 199 of file RectangularEtaPhiTrackingRegion.h.

Margin RectangularEtaPhiTrackingRegion::thePhiMargin
private

Definition at line 197 of file RectangularEtaPhiTrackingRegion.h.

Referenced by phiMargin().

bool RectangularEtaPhiTrackingRegion::thePrecise =false
private

Definition at line 200 of file RectangularEtaPhiTrackingRegion.h.

Referenced by isPrecise().

bool RectangularEtaPhiTrackingRegion::theUseEtaPhi =false
private

Definition at line 202 of file RectangularEtaPhiTrackingRegion.h.

bool RectangularEtaPhiTrackingRegion::theUseMS =false
private

Definition at line 201 of file RectangularEtaPhiTrackingRegion.h.