TrackingTools
GeomPropagators
interface
OptimalHelixPlaneCrossing.h
Go to the documentation of this file.
1
#ifndef OptimalHelixPlaneCrossing_H
2
#define OptimalHelixPlaneCrossing_H
3
4
#include "
TrackingTools/GeomPropagators/interface/HelixBarrelPlaneCrossingByCircle.h
"
5
#include "
TrackingTools/GeomPropagators/interface/HelixForwardPlaneCrossing.h
"
6
#include "
TrackingTools/GeomPropagators/interface/HelixArbitraryPlaneCrossing.h
"
7
8
#include <memory>
9
10
class
OptimalHelixPlaneCrossing
{
11
public
:
12
using
Base
=
HelixPlaneCrossing
;
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
34
~OptimalHelixPlaneCrossing
() {
get
()->~Base(); }
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
{
44
HelixBarrelPlaneCrossingByCircle
a
;
45
HelixForwardPlaneCrossing
b
;
46
HelixArbitraryPlaneCrossing
c
;
47
};
48
using
aligned_union_t
=
typename
std::aligned_storage<
sizeof
(
Tmp
),
alignof
(
Tmp
)>
::type
;
49
aligned_union_t
mem
;
50
};
51
52
#endif
Vector3DBase
Definition:
Vector3DBase.h:8
writedatasetfile.args
args
Definition:
writedatasetfile.py:18
OptimalHelixPlaneCrossing::aligned_union_t
typename std::aligned_storage< sizeof(Tmp), alignof(Tmp)>::type aligned_union_t
Definition:
OptimalHelixPlaneCrossing.h:48
PV3DBase::x
T x() const
Definition:
PV3DBase.h:59
OptimalHelixPlaneCrossing::get
Base * get()
Definition:
OptimalHelixPlaneCrossing.h:40
OptimalHelixPlaneCrossing::Tmp
Definition:
OptimalHelixPlaneCrossing.h:43
PV3DBase::z
T z() const
Definition:
PV3DBase.h:61
HelixArbitraryPlaneCrossing
Definition:
HelixArbitraryPlaneCrossing.h:10
HelixArbitraryPlaneCrossing.h
OptimalHelixPlaneCrossing::mem
aligned_union_t mem
Definition:
OptimalHelixPlaneCrossing.h:49
HelixBarrelPlaneCrossingByCircle
Definition:
HelixBarrelPlaneCrossingByCircle.h:13
OptimalHelixPlaneCrossing
Definition:
OptimalHelixPlaneCrossing.h:10
PV3DBase::y
T y() const
Definition:
PV3DBase.h:60
OptimalHelixPlaneCrossing::Tmp::b
HelixForwardPlaneCrossing b
Definition:
OptimalHelixPlaneCrossing.h:45
OptimalHelixPlaneCrossing::Tmp::a
HelixBarrelPlaneCrossingByCircle a
Definition:
OptimalHelixPlaneCrossing.h:44
HelixPlaneCrossing
Definition:
HelixPlaneCrossing.h:13
type
type
Definition:
HCALResponse.h:21
OptimalHelixPlaneCrossing::operator*
const Base & operator*() const
Definition:
OptimalHelixPlaneCrossing.h:37
OptimalHelixPlaneCrossing::operator*
Base & operator*()
Definition:
OptimalHelixPlaneCrossing.h:36
Plane
Definition:
Plane.h:16
OptimalHelixPlaneCrossing::~OptimalHelixPlaneCrossing
~OptimalHelixPlaneCrossing()
Definition:
OptimalHelixPlaneCrossing.h:34
OptimalHelixPlaneCrossing::get
const Base * get() const
Definition:
OptimalHelixPlaneCrossing.h:41
HelixForwardPlaneCrossing
Definition:
HelixForwardPlaneCrossing.h:13
funct::abs
Abs< T >::type abs(const T &t)
Definition:
Abs.h:22
OptimalHelixPlaneCrossing::Tmp::c
HelixArbitraryPlaneCrossing c
Definition:
OptimalHelixPlaneCrossing.h:46
HelixForwardPlaneCrossing.h
OptimalHelixPlaneCrossing::OptimalHelixPlaneCrossing
OptimalHelixPlaneCrossing(Plane const &plane, Args &&... args)
Definition:
OptimalHelixPlaneCrossing.h:15
HelixBarrelPlaneCrossingByCircle.h
Plane::normalVector
GlobalVector normalVector() const
Definition:
Plane.h:41
Generated for CMSSW Reference Manual by
1.8.16