15 template <
class T>
inline T sqr(
T t) {
return t*
t;}
18 return abs(x) <= 1 ? asin(x) : (x > 0 ?
M_PI/2 : -
M_PI/2);
22 double checked_asin(
double x,
const char *expr,
const char *
file,
int line) {
23 if (fabs(x) >= 1.0)
throw cms::Exception(
"CorruptData") <<
"asin(x) called with x = " << expr <<
" = " << x <<
"\n\tat " << file <<
":" << line <<
"\n";
33 bool precise,
float extraTolerance)
34 : thePrecise(precise),
35 theROrigin(region.originRBound()),
38 theExtraTolerance(extraTolerance),
41 theVtxZ(region.origin().
z()),
42 thePtMin(region.
ptMin()),
43 theVtx(region.origin().x(),region.origin().
y()),
71 float zMinOrigin,
float zMaxOrigin)
78 theB = layerZ > 0 ? zMaxOrigin : zMinOrigin;
88 bool checkCrossing =
true;
92 double dHitmag = dHit.
mag();
100 crossing = theVtx + t*dHit;
101 rLayer = crossing.
mag();
102 dLayer = t*dHitmag; dL = dt * dHitmag;
103 checkCrossing =
false;
105 checkCrossing =
true;
123 double vtxmag2 = theVtx.mag2();
124 if (vtxmag2 < 1.e-10) {
128 double var_c = theVtx.mag2()-
sqr(rLayer);
129 double var_b = 2*theVtx.dot(dHit.
unit());
130 double var_delta =
sqr(var_b)-4*var_c;
131 if (var_delta <=0.) var_delta = 0;
132 dLayer = 0.5*(-var_b +
std::sqrt(var_delta));
134 crossing = theVtx+ dHit.
unit() * dLayer;
146 deltaPhi *= dLayer/(rLayer*cosCross);
150 Point2D crossing2 = theVtx + dHit.
unit()* (dLayer+dL);
151 double phicross2 = crossing2.
phi();
152 double phicross1 = crossing.
phi();
153 double dphicross = phicross2-phicross1;
154 if (dphicross < -
M_PI) dphicross += 2*
M_PI;
155 if (dphicross >
M_PI) dphicross -= 2*
M_PI;
156 if (dphicross >
M_PI/2) dphicross = 0.;
157 phicross2 = phicross1 + dphicross;
162 deltaPhiOrig *= dLayer/(rLayer*cosCross);
169 double deltaPhiHitOuter = errRPhi/hitXY.
mag();
171 double margin = deltaPhi+deltaPhiOrig+deltaPhiHit+deltaPhiHitOuter ;
183 std::max(phicross1,phicross2)+margin);
200 float deltaPhiOrig = asin(
theROrigin * (rHit-rMin) / (rHit*rMin));
206 return deltaPhi+deltaPhiOrig+deltaPhiHit;
212 float deltaPhiHitOuter = errRPhi/rMin;
214 return deltaPhi+deltaPhiOrig+deltaPhiHit + scatt + deltaPhiHitOuter;
220 float rHit,
float phiHit,
float zHit,
float errRPhi)
const
226 return phiRange(hitXY,zHit,errRPhi);
233 float rmin = (
theA*hitR)/(hitZ-
theB);
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
virtual Location location() const =0
Which part of the detector (barrel, endcap)
double deltaPhi(float phi1, float phi2)
Sin< T >::type sin(const T &t)
T dot(const Basic2DVector &lh) const
Scalar product, or "dot" product, with a vector of same type.
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
PixelRecoRange< float > phiRange(const Point2D &hitXY, float zHit, float errRPhi) const
float operator()(float rHit, float zHit, float errRPhi) const
double cropped_asin(double x)
Basic2DVector unit() const
virtual float thickness() const =0
float minRadius(float hitR, float hitZ) const
Scalar radius() const
Radius of the cylinder.
const T & max(const T &a, const T &b)
virtual const BoundDisk & specificSurface() const
Cos< T >::type cos(const T &t)
const Bounds & bounds() const
virtual const Surface::PositionType & position() const
Returns position of the surface.
void initBarrelLayer(const DetLayer &layer)
void initForwardLayer(const DetLayer &layer, float zMinOrigin, float zMaxOrigin)
virtual const BoundCylinder & specificSurface() const
Extension of the interface.
T bendingRadius(T pt, const edm::EventSetup &iSetup)
virtual float originZBound() const =0
bounds the particle vertex in the longitudinal plane
Square< F >::type sqr(const F &f)
float innerRadius() const
The inner radius of the disk.
Geom::Phi< T > phi() const
*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
MultipleScatteringParametrisation sigma
InnerDeltaPhi(const DetLayer &layer, const TrackingRegion ®ion, const edm::EventSetup &iSetup, bool precise=true, float extraTolerance=0.f)