ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
TrkEvent
TrkEventUtils
TrkEventUtils
PrepRawDataComparisonFunction.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
// PrepRawDataComparisonFunction.h
7
// Header file for struct PrepRawDataComparisonFunction
9
// (c) ATLAS Detector software
11
// Wolfgang.Liebig@cern.ch / Andreas.Salzburger@cern.ch
13
14
#ifndef TRKNIRVANA_PREPRAWDATACOMPARISONFUNCTION_H
15
#define TRKNIRVANA_PREPRAWDATACOMPARISONFUNCTION_H
16
17
// Trk
18
#include "
GeoPrimitives/GeoPrimitives.h
"
19
#include "
TrkPrepRawData/PrepRawData.h
"
20
#include "
TrkSurfaces/DiscSurface.h
"
21
#include "
TrkSurfaces/PlaneSurface.h
"
22
#include "
TrkSurfaces/StraightLineSurface.h
"
23
// STL
24
#include <cmath>
25
#include <stdexcept>
26
27
namespace
Trk
{
32
class
PrepRawDataComparisonFunction
33
{
34
public
:
36
PrepRawDataComparisonFunction
(
const
Amg::Vector3D
&
sp
,
37
const
Amg::Vector3D
& dir)
38
:
m_point
(
sp
)
39
,
m_direction
(dir.
unit
())
40
{}
41
42
PrepRawDataComparisonFunction
() =
delete
;
43
PrepRawDataComparisonFunction
(
const
PrepRawDataComparisonFunction
& PCF) =
44
default
;
45
PrepRawDataComparisonFunction
(
PrepRawDataComparisonFunction
&& PCF) =
default
;
46
47
PrepRawDataComparisonFunction
&
operator=
(
48
const
PrepRawDataComparisonFunction
& PCF) =
default
;
49
50
PrepRawDataComparisonFunction
&
operator=
(
51
PrepRawDataComparisonFunction
&& PCF) =
default
;
52
53
~PrepRawDataComparisonFunction
() =
default
;
54
57
bool
operator()
(
const
Trk::PrepRawData
*
one
,
58
const
Trk::PrepRawData
*
two
)
const
59
{
60
61
// --- identify the surface type and get intersection path for surface 1
62
//
63
double
path1 = 0;
64
const
Trk::Surface
& sf1 =
one
->detectorElement()->surface(
one
->identify());
65
const
Trk::SurfaceType
surfType1 = sf1.
type
();
66
switch
(surfType1) {
67
case
Trk::SurfaceType::Plane
: {
68
const
Trk::PlaneSurface
& opsf =
69
static_cast<
const
Trk::PlaneSurface
&
>
(sf1);
70
path1 = this->
pathIntersectWithPlane
(opsf);
71
}
break
;
72
case
Trk::SurfaceType::Line
: {
73
const
Trk::StraightLineSurface
& ossf =
74
static_cast<
const
Trk::StraightLineSurface
&
>
(sf1);
75
path1 = this->
pathIntersectWithLine
(ossf);
76
}
break
;
77
case
Trk::SurfaceType::Disc
: {
78
const
Trk::DiscSurface
& odsf =
79
static_cast<
const
Trk::DiscSurface
&
>
(sf1);
80
path1 = this->
pathIntersectWithDisc
(odsf);
81
}
break
;
82
default
: {
83
throw
std::runtime_error(
84
"PrepRawDataComparisonFunction: surface type error!"
);
85
}
86
}
// --- no raw data on Cylinder. Ever.
87
88
// --- identify the surface type and get intersection path for surface 1
89
//
90
double
path2 = 0;
91
const
Trk::Surface
& sf2 =
two
->detectorElement()->surface(
two
->identify());
92
const
Trk::SurfaceType
surfType2 = sf2.
type
();
93
switch
(surfType2) {
94
case
Trk::SurfaceType::Plane
: {
95
const
Trk::PlaneSurface
& opsf =
96
static_cast<
const
Trk::PlaneSurface
&
>
(sf2);
97
path2 = this->
pathIntersectWithPlane
(opsf);
98
}
break
;
99
case
Trk::SurfaceType::Line
: {
100
const
Trk::StraightLineSurface
& ossf =
101
static_cast<
const
Trk::StraightLineSurface
&
>
(sf2);
102
path2 = this->
pathIntersectWithLine
(ossf);
103
}
break
;
104
case
Trk::SurfaceType::Disc
: {
105
const
Trk::DiscSurface
& odsf =
106
static_cast<
const
Trk::DiscSurface
&
>
(sf2);
107
path2 = this->
pathIntersectWithDisc
(odsf);
108
}
break
;
109
default
: {
110
throw
std::runtime_error(
111
"PrepRawDataComparisonFunction: surface type error!"
);
112
}
113
}
// --- no raw data on Cylinder. Ever.
114
115
return
path1 < path2;
116
}
117
118
private
:
119
Amg::Vector3D
m_point
;
120
Amg::Vector3D
m_direction
;
121
122
double
pathIntersectWithPlane
(
const
Trk::PlaneSurface
& psf)
const
123
{
124
double
denom =
m_direction
.dot(psf.
normal
());
125
return
(denom) ? psf.
normal
().dot(psf.
center
() -
m_point
) / (denom)
126
: denom;
127
}
128
129
double
pathIntersectWithLine
(
const
Trk::StraightLineSurface
& lsf)
const
130
{
131
Amg::Vector3D
dirWire(lsf.
transform
().rotation().col(2).unit());
132
Amg::Vector3D
trackToWire(lsf.
center
() -
m_point
);
133
double
parallelity =
m_direction
.dot(dirWire);
134
double
denom = 1 - parallelity * parallelity;
135
return
(std::abs(denom) > 10e-7)
136
? (trackToWire.dot(
m_direction
) -
137
trackToWire.dot(dirWire) * parallelity) /
138
denom
139
: 0.;
140
}
141
142
double
pathIntersectWithDisc
(
const
Trk::DiscSurface
& dsf)
const
143
{
144
double
denom =
m_direction
.dot(dsf.
normal
());
145
return
(denom) ? dsf.
normal
().dot(dsf.
center
() -
m_point
) / (denom)
146
: denom;
147
}
148
};
149
150
}
// end of namespace
151
152
#endif
// TRKNIRVANA_PREPRAWDATACOMPARISONFUNCTION_H
153
unit
const PlainObject unit() const
This is a plugin that makes Eigen look like CLHEP & defines some convenience methods.
Definition
AmgMatrixBasePlugin.h:21
DiscSurface.h
GeoPrimitives.h
sp
static Double_t sp
Definition
LArPhysWaveHECTool.cxx:37
PlaneSurface.h
PrepRawData.h
StraightLineSurface.h
Trk::DiscSurface
Class for a DiscSurface in the ATLAS detector.
Definition
DiscSurface.h:54
Trk::PlaneSurface
Class for a planaer rectangular or trapezoidal surface in the ATLAS detector.
Definition
PlaneSurface.h:64
Trk::PrepRawDataComparisonFunction::~PrepRawDataComparisonFunction
~PrepRawDataComparisonFunction()=default
Trk::PrepRawDataComparisonFunction::pathIntersectWithPlane
double pathIntersectWithPlane(const Trk::PlaneSurface &psf) const
Definition
PrepRawDataComparisonFunction.h:122
Trk::PrepRawDataComparisonFunction::operator=
PrepRawDataComparisonFunction & operator=(PrepRawDataComparisonFunction &&PCF)=default
Trk::PrepRawDataComparisonFunction::m_point
Amg::Vector3D m_point
Definition
PrepRawDataComparisonFunction.h:119
Trk::PrepRawDataComparisonFunction::PrepRawDataComparisonFunction
PrepRawDataComparisonFunction()=delete
Trk::PrepRawDataComparisonFunction::PrepRawDataComparisonFunction
PrepRawDataComparisonFunction(const Amg::Vector3D &sp, const Amg::Vector3D &dir)
Full relation definition using a straight line propagation.
Definition
PrepRawDataComparisonFunction.h:36
Trk::PrepRawDataComparisonFunction::m_direction
Amg::Vector3D m_direction
Definition
PrepRawDataComparisonFunction.h:120
Trk::PrepRawDataComparisonFunction::operator()
bool operator()(const Trk::PrepRawData *one, const Trk::PrepRawData *two) const
The comparison function defining in what case a PRD is 'smaller' than a second one.
Definition
PrepRawDataComparisonFunction.h:57
Trk::PrepRawDataComparisonFunction::pathIntersectWithLine
double pathIntersectWithLine(const Trk::StraightLineSurface &lsf) const
Definition
PrepRawDataComparisonFunction.h:129
Trk::PrepRawDataComparisonFunction::PrepRawDataComparisonFunction
PrepRawDataComparisonFunction(const PrepRawDataComparisonFunction &PCF)=default
Trk::PrepRawDataComparisonFunction::pathIntersectWithDisc
double pathIntersectWithDisc(const Trk::DiscSurface &dsf) const
Definition
PrepRawDataComparisonFunction.h:142
Trk::PrepRawDataComparisonFunction::PrepRawDataComparisonFunction
PrepRawDataComparisonFunction(PrepRawDataComparisonFunction &&PCF)=default
Trk::PrepRawDataComparisonFunction::operator=
PrepRawDataComparisonFunction & operator=(const PrepRawDataComparisonFunction &PCF)=default
Trk::PrepRawData
Definition
PrepRawData.h:62
Trk::StraightLineSurface
Class for a StraightLineSurface in the ATLAS detector to describe dirft tube and straw like detectors...
Definition
StraightLineSurface.h:51
Trk::Surface
Abstract Base Class for tracking surfaces.
Definition
Surface.h:79
Trk::Surface::normal
virtual const Amg::Vector3D & normal() const
Returns the normal vector of the Surface (i.e.
Trk::Surface::transform
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
Trk::Surface::type
virtual constexpr SurfaceType type() const =0
Returns the Surface type to avoid dynamic casts.
Trk::Surface::center
const Amg::Vector3D & center() const
Returns the center position of the Surface.
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition
GeoPrimitives.h:47
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition
FakeTrackBuilder.h:9
Trk::SurfaceType
SurfaceType
This enumerator simplifies the persistency & calculations,.
Definition
SurfaceTypes.h:17
Trk::SurfaceType::Plane
@ Plane
Definition
SurfaceTypes.h:22
Trk::SurfaceType::Line
@ Line
Definition
SurfaceTypes.h:23
Trk::SurfaceType::Disc
@ Disc
Definition
SurfaceTypes.h:20
Trk::one
@ one
Definition
TrkDetDescr/TrkSurfaces/TrkSurfaces/RealQuadraticEquation.h:22
Trk::two
@ two
Definition
TrkDetDescr/TrkSurfaces/TrkSurfaces/RealQuadraticEquation.h:23
Generated on
for ATLAS Offline Software by
1.17.0