CMS 3D CMS Logo

SimpleConeBounds.h
Go to the documentation of this file.
1 #ifndef Geom_SimpleConeBounds_H
2 #define Geom_SimpleConeBounds_H
3 
18 
19 #include <cmath>
20 #include <limits>
21 #include <algorithm>
22 
23 class SimpleConeBounds final : public Bounds {
24 public:
26  SimpleConeBounds(float zmin, float rmin_zmin, float rmax_zmin, float zmax, float rmin_zmax, float rmax_zmax)
27  : theZmin(zmin),
28  theRminZmin(rmin_zmin),
29  theRmaxZmin(rmax_zmin),
30  theZmax(zmax),
31  theRminZmax(rmin_zmax),
32  theRmaxZmax(rmax_zmax) {
33  if (theZmin > theZmax) {
36  }
41  }
42 
44  float length() const override { return theZmax - theZmin; }
46  float width() const override { return 2 * std::max(theRmaxZmin, theRmaxZmax); }
49  float thickness() const override { return ((theRmaxZmin - theRminZmin) + (theRmaxZmax - theRminZmax)) / 2.; }
50 
51  using Bounds::inside;
52 
53  bool inside(const Local3DPoint& p) const override {
54  float lrmin = (p.z() - theZmin) * (theRminZmax - theRminZmin) / (theZmax - theZmin);
55  float lrmax = (p.z() - theZmin) * (theRmaxZmax - theRmaxZmin) / (theZmax - theZmin);
56  return p.z() > theZmin && p.z() < theZmax && p.perp() > lrmin && p.perp() < lrmax;
57  }
58 
59  bool inside(const Local3DPoint& p, const LocalError& err, float scale) const override {
60  // std::cout << "WARNING: SimpleConeBounds::inside(const Local3DPoint&, const LocalError not fully implemented"
61  // << std::endl; // FIXME! does not check R.
65  theZmax + sqrt(err.yy()) * scale,
67  theRmaxZmax);
68  return tmp.inside(p);
69  }
70 
71  virtual bool inside(const Local2DPoint& p, const LocalError& err) const { return Bounds::inside(p, err); }
72 
73  Bounds* clone() const override { return new SimpleConeBounds(*this); }
74 
75  // Extension of the Bounds interface
77  float theta = atan(((theRmaxZmax + theRminZmax) / 2. - (theRmaxZmin + theRminZmin) / 2.) / length());
78  return Geom::Theta<float>(theta < 0 ? theta + Geom::pi() : theta);
79  }
80 
81  GlobalPoint vertex() const {
82  float rAtZmax = (theRmaxZmax + theRminZmax) / 2.;
83  float rAtZmin = (theRmaxZmin + theRminZmin) / 2.;
84  float dr = (rAtZmax - rAtZmin);
85 
86  if (std::abs(dr) < 0.0001) { // handle degenerate case (cone->cylinder)
88  } else {
89  return GlobalPoint(0, 0, (theZmin * rAtZmax - theZmax * rAtZmin) / dr);
90  }
91  }
92 
93 private:
94  float theZmin;
95  float theRminZmin;
96  float theRmaxZmin;
97  float theZmax;
98  float theRminZmax;
99  float theRmaxZmax;
100 };
101 
102 #endif // Geom_SimpleConeBounds_H
SimpleConeBounds
Definition: SimpleConeBounds.h:23
Point2DBase< float, LocalTag >
SimpleConeBounds::openingAngle
Geom::Theta< float > openingAngle() const
Definition: SimpleConeBounds.h:76
L1EGammaCrystalsEmulatorProducer_cfi.scale
scale
Definition: L1EGammaCrystalsEmulatorProducer_cfi.py:10
SimpleConeBounds::inside
virtual bool inside(const Local2DPoint &p, const LocalError &err) const
Definition: SimpleConeBounds.h:71
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
Geom::Theta
Definition: Theta.h:12
Bounds
Definition: Bounds.h:18
SimpleConeBounds::vertex
GlobalPoint vertex() const
Definition: SimpleConeBounds.h:81
SimpleConeBounds::clone
Bounds * clone() const override
Definition: SimpleConeBounds.h:73
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
SiStripMonitorCluster_cfi.zmin
zmin
Definition: SiStripMonitorCluster_cfi.py:200
SimpleConeBounds::theRminZmax
float theRminZmax
Definition: SimpleConeBounds.h:98
std::swap
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition: DataFrameContainer.h:209
SiStripMonitorCluster_cfi.zmax
zmax
Definition: SiStripMonitorCluster_cfi.py:201
Bounds::inside
virtual bool inside(const Local3DPoint &) const =0
Determine if the point is inside the bounds.
LocalError.h
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
Geom::pi
constexpr double pi()
Definition: Pi.h:31
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Bounds.h
SimpleConeBounds::theRminZmin
float theRminZmin
Definition: SimpleConeBounds.h:95
Point3DBase< float, LocalTag >
SimpleConeBounds::theRmaxZmin
float theRmaxZmin
Definition: SimpleConeBounds.h:96
SimpleConeBounds::inside
bool inside(const Local3DPoint &p) const override
Determine if the point is inside the bounds.
Definition: SimpleConeBounds.h:53
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
Pi.h
LocalError
Definition: LocalError.h:12
SimpleConeBounds::inside
bool inside(const Local3DPoint &p, const LocalError &err, float scale) const override
Determine if a point is inside the bounds, taking error into account.
Definition: SimpleConeBounds.h:59
SimpleConeBounds::width
float width() const override
Maximum diameter.
Definition: SimpleConeBounds.h:46
SimpleConeBounds::theZmin
float theZmin
Definition: SimpleConeBounds.h:94
submitPVResolutionJobs.err
err
Definition: submitPVResolutionJobs.py:85
LocalPoint.h
SimpleConeBounds::SimpleConeBounds
SimpleConeBounds(float zmin, float rmin_zmin, float rmax_zmin, float zmax, float rmin_zmax, float rmax_zmax)
Construct from inner/outer radius on the two Z faces.
Definition: SimpleConeBounds.h:26
flavorHistoryFilter_cfi.dr
dr
Definition: flavorHistoryFilter_cfi.py:37
SimpleConeBounds::theZmax
float theZmax
Definition: SimpleConeBounds.h:97
SimpleConeBounds::theRmaxZmax
float theRmaxZmax
Definition: SimpleConeBounds.h:99
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
SimpleConeBounds::thickness
float thickness() const override
Definition: SimpleConeBounds.h:49
GlobalPoint.h
SimpleConeBounds::length
float length() const override
Length along Z.
Definition: SimpleConeBounds.h:44