CMS 3D CMS Logo

OptimalHelixPlaneCrossing.h
Go to the documentation of this file.
1 #ifndef OptimalHelixPlaneCrossing_H
2 #define OptimalHelixPlaneCrossing_H
3 
7 
8 #include <memory>
9 
11 public:
13 
14  template <typename... Args>
15  OptimalHelixPlaneCrossing(Plane const &plane, Args &&... args) {
16  GlobalVector u = plane.normalVector();
17  constexpr float small = 1.e-6; // for orientation of planes
18 
19  if (std::abs(u.z()) < small) {
20  // barrel plane:
21  // instantiate HelixBarrelPlaneCrossing,
22  new (get()) HelixBarrelPlaneCrossingByCircle(args...);
23  } else if ((std::abs(u.x()) < small) & (std::abs(u.y()) < small)) {
24  // forward plane:
25  // instantiate HelixForwardPlaneCrossing
26  new (get()) HelixForwardPlaneCrossing(args...);
27  } else {
28  // arbitrary plane:
29  // instantiate HelixArbitraryPlaneCrossing
30  new (get()) HelixArbitraryPlaneCrossing(args...);
31  }
32  }
33 
35 
36  Base &operator*() { return *get(); }
37  Base const &operator*() const { return *get(); }
38 
39 private:
40  Base *get() { return (Base *)&mem; }
41  Base const *get() const { return (Base const *)&mem; }
42 
43  union Tmp {
47  };
50 };
51 
52 #endif
type
Definition: HCALResponse.h:21
typename std::aligned_storage< sizeof(Tmp), alignof(Tmp)>::type aligned_union_t
GlobalVector normalVector() const
Definition: Plane.h:41
T y() const
Definition: PV3DBase.h:60
Definition: Plane.h:16
T z() const
Definition: PV3DBase.h:61
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
OptimalHelixPlaneCrossing(Plane const &plane, Args &&...args)
HelixBarrelPlaneCrossingByCircle a
T x() const
Definition: PV3DBase.h:59
#define constexpr