ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
ISF
ISF_FastCaloSim
ISF_FastCaloSimParametrization
src
FastCaloSimCaloExtrapolation.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#ifndef FastCaloSimCaloExtrapolation_H
6
#define FastCaloSimCaloExtrapolation_H
7
8
#include "
CxxUtils/CachedPointer.h
"
9
10
#include "
ISF_FastCaloSimParametrization/IFastCaloSimGeometryHelper.h
"
11
#include "
ISF_FastCaloSimParametrization/IFastCaloSimCaloExtrapolation.h
"
12
#include "
ISF_FastCaloSimEvent/TFCSExtrapolationState.h
"
13
#include "
GeoPrimitives/GeoPrimitives.h
"
14
15
16
#include "
ISF_FastCaloSimParametrization/IFastCaloSimCaloTransportation.h
"
17
18
class
TFCSTruthState
;
19
class
G4FieldTrack;
20
21
22
struct
CylinderIntersections
23
{
24
Amg::Vector3D
first
;
25
Amg::Vector3D
second
;
26
unsigned
int
number
= 0;
27
28
};
29
30
31
class
FastCaloSimCaloExtrapolation
:
public
extends<AthAlgTool, IFastCaloSimCaloExtrapolation>
32
{
33
34
public
:
35
36
FastCaloSimCaloExtrapolation
(
const
std::string& t,
const
std::string& n,
const
IInterface* p);
37
~FastCaloSimCaloExtrapolation
() =
default
;
38
39
virtual
StatusCode
initialize
() override final;
40
virtual StatusCode
finalize
() override final;
41
42
enum
SUBPOS
{
43
SUBPOS_MID
=
TFCSExtrapolationState::SUBPOS_MID
,
//MID=middle of calo layer
44
SUBPOS_ENT
=
TFCSExtrapolationState::SUBPOS_ENT
,
//ENT=entrance of calo layer
45
SUBPOS_EXT
=
TFCSExtrapolationState::SUBPOS_EXT
//EXT=exit of calo layer
46
};
47
48
enum
HITPOSITION
{
49
INSIDE
,
//hit position is inside cylinder bounds
50
OUTSIDE
,
//hit position is outside cylinder bounds
51
ON
//hit position is on cylinder bounds
52
};
53
54
virtual
void
extrapolate
(
TFCSExtrapolationState
& result,
const
TFCSTruthState
* truth,
const
std::vector<G4FieldTrack>& caloSteps)
const
override
final
;
55
virtual
void
extrapolate
(
TFCSExtrapolationState
& result,
const
TFCSTruthState
* truth)
const
override
final
;
56
57
protected
:
58
59
const
IFastCaloSimGeometryHelper
*
GetCaloGeometry
()
const
{
return
&(*m_CaloGeometryHelper);};
60
61
/*Main extrapolation methods*/
62
64
bool
extrapolateToCylinder
(
const
std::vector<G4FieldTrack>& caloSteps,
float
cylR,
float
cylZ,
Amg::Vector3D
& extPos,
Amg::Vector3D
& momDir)
const
;
66
void
extrapolateToID
(
TFCSExtrapolationState
& result,
const
std::vector<G4FieldTrack>& caloSteps,
const
TFCSTruthState
* truth)
const
;
68
void
extrapolateToLayers
(
TFCSExtrapolationState
& result,
const
std::vector<G4FieldTrack>& caloSteps,
const
TFCSTruthState
* truth)
const
;
69
70
/*Extrapolator helper methods*/
71
73
void
findPCA
(
float
cylR,
float
cylZ,
Amg::Vector3D
& hitPos1,
Amg::Vector3D
& hitPos2,
Amg::Vector3D
& PCA)
const
;
75
static
double
getPointLineSegmentDistance
(
Amg::Vector3D
& point,
Amg::Vector3D
& hitPos1,
Amg::Vector3D
& hitPos2) ;
77
void
getIterativePCA
(
float
cylR,
float
cylZ,
Amg::Vector3D
& BoundA,
Amg::Vector3D
& BoundB,
Amg::Vector3D
& PCA)
const
;
79
static
bool
isOnSegment
(
Amg::Vector3D
& point,
Amg::Vector3D
& hitPos1,
Amg::Vector3D
& hitPos2) ;
81
static
bool
cylinderEndcapIntersection
(
float
cylR,
float
cylZ,
bool
positiveEndcap,
Amg::Vector3D
& pointA,
Amg::Vector3D
& pointB,
Amg::Vector3D
&
intersection
) ;
84
bool
extrapolateWithIntersection
(
const
std::vector<G4FieldTrack>& caloSteps,
float
cylR,
float
cylZ,
Amg::Vector3D
& extPos,
Amg::Vector3D
& momDir)
const
;
86
bool
extrapolateWithPCA
(
const
std::vector<G4FieldTrack>& caloSteps,
float
cylR,
float
cylZ,
Amg::Vector3D
& extPos,
Amg::Vector3D
& momDir)
const
;
88
static
bool
doesTravelThroughSurface
(
float
cylR,
float
cylZ,
Amg::Vector3D
& hitPos1,
Amg::Vector3D
& hitPos2) ;
90
int
whichIntersection
(
float
cylR,
float
cylZ,
Amg::Vector3D
& hitPos1,
Amg::Vector3D
& hitPos2,
Amg::Vector3D
& intersectionA,
Amg::Vector3D
intersectionB)
const
;
92
int
circleLineIntersection2D
(
float
circR,
Amg::Vector3D
& pointA,
Amg::Vector3D
& pointB,
Amg::Vector3D
& intersectA,
Amg::Vector3D
& intersectB)
const
;
94
int
cylinderLineIntersection
(
float
cylR,
float
cylZ,
Amg::Vector3D
& pointA,
Amg::Vector3D
& pointB,
Amg::Vector3D
& intersectA,
Amg::Vector3D
& intersectB)
const
;
96
static
enum
HITPOSITION
whereOnCylinder
(
float
cylR,
float
cylZ,
Amg::Vector3D
& hitPos) ;
98
static
Amg::Vector3D
projectOnCylinder
(
float
cylR,
float
cylZ,
Amg::Vector3D
& hitPos) ;
100
CylinderIntersections
getCylinderIntersections
(
float
cylR,
float
cylZ,
Amg::Vector3D
& hitPos1,
Amg::Vector3D
& hitPos2)
const
;
101
102
//helper methods for calo geometry
103
void
minmaxeta
(
int
sample,
double
eta
,
double
& mineta,
double
& maxeta)
const
;
104
bool
isCaloBarrel
(
int
sample)
const
;
105
double
deta
(
int
sample,
double
eta
)
const
;
106
double
rzmid
(
int
sample,
double
eta
)
const
;
107
double
rzent
(
int
sample,
double
eta
)
const
;
108
double
rzext
(
int
sample,
double
eta
)
const
;
109
double
rmid
(
int
sample,
double
eta
)
const
;
110
double
rent
(
int
sample,
double
eta
)
const
;
111
double
rext
(
int
sample,
double
eta
)
const
;
112
double
zmid
(
int
sample,
double
eta
)
const
;
113
double
zent
(
int
sample,
double
eta
)
const
;
114
double
zext
(
int
sample,
double
eta
)
const
;
115
double
rpos
(
int
sample,
double
eta
,
int
subpos =
CaloSubPos::SUBPOS_MID
)
const
;
116
double
zpos
(
int
sample,
double
eta
,
int
subpos =
CaloSubPos::SUBPOS_MID
)
const
;
117
double
rzpos
(
int
sample,
double
eta
,
int
subpos =
CaloSubPos::SUBPOS_MID
)
const
;
118
119
120
//uniquely defined ID-Calo surfaces
121
FloatArrayProperty
m_CaloBoundaryR
{
this
,
"CaloBoundaryR"
, {1148.0,120.0,41.0}};
122
FloatArrayProperty
m_CaloBoundaryZ
{
this
,
"CaloBoundaryZ"
, {3550.0,4587.0,4587.0}};
123
124
// FastCaloSim particle transport with ATLAS tracking tools
125
PublicToolHandle<IFastCaloSimCaloTransportation>
m_CaloTransportation
{
this
,
"CaloTransportation"
,
"FastCaloSimCaloTransportation"
};
126
// FastCaloSim geometry helper
127
PublicToolHandle<IFastCaloSimGeometryHelper>
m_CaloGeometryHelper
{
this
,
"CaloGeometryHelper"
,
"FastCaloSimGeometryHelper"
};
128
129
};
130
131
#endif
// FastCaloSimCaloExtrapolation_H
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
CachedPointer.h
Cached pointer with atomic update.
SUBPOS_MID
@ SUBPOS_MID
Definition
FastCaloSim_CaloCell_ID.h:11
GeoPrimitives.h
IFastCaloSimCaloExtrapolation.h
IFastCaloSimCaloTransportation.h
IFastCaloSimGeometryHelper.h
TFCSExtrapolationState.h
FastCaloSimCaloExtrapolation::extrapolate
virtual void extrapolate(TFCSExtrapolationState &result, const TFCSTruthState *truth, const std::vector< G4FieldTrack > &caloSteps) const override final
Definition
FastCaloSimCaloExtrapolation.cxx:68
FastCaloSimCaloExtrapolation::zpos
double zpos(int sample, double eta, int subpos=CaloSubPos::SUBPOS_MID) const
Definition
FastCaloSimCaloExtrapolation.cxx:936
FastCaloSimCaloExtrapolation::~FastCaloSimCaloExtrapolation
~FastCaloSimCaloExtrapolation()=default
FastCaloSimCaloExtrapolation::whereOnCylinder
static enum HITPOSITION whereOnCylinder(float cylR, float cylZ, Amg::Vector3D &hitPos)
Checks if position of hitPos is inside, outside or on the cylinder bounds.
Definition
FastCaloSimCaloExtrapolation.cxx:845
FastCaloSimCaloExtrapolation::m_CaloBoundaryZ
FloatArrayProperty m_CaloBoundaryZ
Definition
FastCaloSimCaloExtrapolation.h:122
FastCaloSimCaloExtrapolation::extrapolateWithPCA
bool extrapolateWithPCA(const std::vector< G4FieldTrack > &caloSteps, float cylR, float cylZ, Amg::Vector3D &extPos, Amg::Vector3D &momDir) const
Extrapolates to the cylinder using the PCA to the polygon spanned by the individual line segments fro...
Definition
FastCaloSimCaloExtrapolation.cxx:338
FastCaloSimCaloExtrapolation::extrapolateToID
void extrapolateToID(TFCSExtrapolationState &result, const std::vector< G4FieldTrack > &caloSteps, const TFCSTruthState *truth) const
Extrapolates to ID using three uniquely defined cylinder surfaces.
Definition
FastCaloSimCaloExtrapolation.cxx:90
FastCaloSimCaloExtrapolation::deta
double deta(int sample, double eta) const
Definition
FastCaloSimCaloExtrapolation.cxx:876
FastCaloSimCaloExtrapolation::rext
double rext(int sample, double eta) const
Definition
FastCaloSimCaloExtrapolation.cxx:916
FastCaloSimCaloExtrapolation::getIterativePCA
void getIterativePCA(float cylR, float cylZ, Amg::Vector3D &BoundA, Amg::Vector3D &BoundB, Amg::Vector3D &PCA) const
Finds PCA iteratively given two bounds A and B on a line segment, used for (rare) cases with no easy ...
Definition
FastCaloSimCaloExtrapolation.cxx:484
FastCaloSimCaloExtrapolation::extrapolateToLayers
void extrapolateToLayers(TFCSExtrapolationState &result, const std::vector< G4FieldTrack > &caloSteps, const TFCSTruthState *truth) const
Extrapolates to all other layers of the calorimeter.
Definition
FastCaloSimCaloExtrapolation.cxx:162
FastCaloSimCaloExtrapolation::projectOnCylinder
static Amg::Vector3D projectOnCylinder(float cylR, float cylZ, Amg::Vector3D &hitPos)
Projects position hitPos onto the cylinder surface and returns projected position.
Definition
FastCaloSimCaloExtrapolation.cxx:610
FastCaloSimCaloExtrapolation::finalize
virtual StatusCode finalize() override final
Definition
FastCaloSimCaloExtrapolation.cxx:62
FastCaloSimCaloExtrapolation::getCylinderIntersections
CylinderIntersections getCylinderIntersections(float cylR, float cylZ, Amg::Vector3D &hitPos1, Amg::Vector3D &hitPos2) const
Analytically computes the intersection between the (infinite) line spanned by hitPos1 and hitPos2 wit...
Definition
FastCaloSimCaloExtrapolation.cxx:645
FastCaloSimCaloExtrapolation::rpos
double rpos(int sample, double eta, int subpos=CaloSubPos::SUBPOS_MID) const
Definition
FastCaloSimCaloExtrapolation.cxx:931
FastCaloSimCaloExtrapolation::minmaxeta
void minmaxeta(int sample, double eta, double &mineta, double &maxeta) const
Definition
FastCaloSimCaloExtrapolation.cxx:881
FastCaloSimCaloExtrapolation::m_CaloBoundaryR
FloatArrayProperty m_CaloBoundaryR
Definition
FastCaloSimCaloExtrapolation.h:121
FastCaloSimCaloExtrapolation::GetCaloGeometry
const IFastCaloSimGeometryHelper * GetCaloGeometry() const
Definition
FastCaloSimCaloExtrapolation.h:59
FastCaloSimCaloExtrapolation::FastCaloSimCaloExtrapolation
FastCaloSimCaloExtrapolation(const std::string &t, const std::string &n, const IInterface *p)
Definition
FastCaloSimCaloExtrapolation.cxx:43
FastCaloSimCaloExtrapolation::m_CaloGeometryHelper
PublicToolHandle< IFastCaloSimGeometryHelper > m_CaloGeometryHelper
Definition
FastCaloSimCaloExtrapolation.h:127
FastCaloSimCaloExtrapolation::SUBPOS
SUBPOS
Definition
FastCaloSimCaloExtrapolation.h:42
FastCaloSimCaloExtrapolation::SUBPOS_ENT
@ SUBPOS_ENT
Definition
FastCaloSimCaloExtrapolation.h:44
FastCaloSimCaloExtrapolation::SUBPOS_MID
@ SUBPOS_MID
Definition
FastCaloSimCaloExtrapolation.h:43
FastCaloSimCaloExtrapolation::SUBPOS_EXT
@ SUBPOS_EXT
Definition
FastCaloSimCaloExtrapolation.h:45
FastCaloSimCaloExtrapolation::zent
double zent(int sample, double eta) const
Definition
FastCaloSimCaloExtrapolation.cxx:906
FastCaloSimCaloExtrapolation::circleLineIntersection2D
int circleLineIntersection2D(float circR, Amg::Vector3D &pointA, Amg::Vector3D &pointB, Amg::Vector3D &intersectA, Amg::Vector3D &intersectB) const
Analytically computes 2D intersections between circle of radius circR and (infinite) line spanned by ...
Definition
FastCaloSimCaloExtrapolation.cxx:561
FastCaloSimCaloExtrapolation::isCaloBarrel
bool isCaloBarrel(int sample) const
Definition
FastCaloSimCaloExtrapolation.cxx:871
FastCaloSimCaloExtrapolation::extrapolateWithIntersection
bool extrapolateWithIntersection(const std::vector< G4FieldTrack > &caloSteps, float cylR, float cylZ, Amg::Vector3D &extPos, Amg::Vector3D &momDir) const
Extrapolates position on cylinder by finding intersections of subsequent hit positions,...
Definition
FastCaloSimCaloExtrapolation.cxx:260
FastCaloSimCaloExtrapolation::rzmid
double rzmid(int sample, double eta) const
Definition
FastCaloSimCaloExtrapolation.cxx:896
FastCaloSimCaloExtrapolation::rzpos
double rzpos(int sample, double eta, int subpos=CaloSubPos::SUBPOS_MID) const
Definition
FastCaloSimCaloExtrapolation.cxx:941
FastCaloSimCaloExtrapolation::whichIntersection
int whichIntersection(float cylR, float cylZ, Amg::Vector3D &hitPos1, Amg::Vector3D &hitPos2, Amg::Vector3D &intersectionA, Amg::Vector3D intersectionB) const
Returns ID of more sensible intersection between line segment spanned by hitPos1 and hitPos2 and cyli...
Definition
FastCaloSimCaloExtrapolation.cxx:792
FastCaloSimCaloExtrapolation::findPCA
void findPCA(float cylR, float cylZ, Amg::Vector3D &hitPos1, Amg::Vector3D &hitPos2, Amg::Vector3D &PCA) const
Finds Point of Closest Approach (PCA) on the cylinder defined by radius cylR and half-length cylZ of ...
Definition
FastCaloSimCaloExtrapolation.cxx:378
FastCaloSimCaloExtrapolation::rent
double rent(int sample, double eta) const
Definition
FastCaloSimCaloExtrapolation.cxx:901
FastCaloSimCaloExtrapolation::initialize
virtual StatusCode initialize() override final
Definition
FastCaloSimCaloExtrapolation.cxx:48
FastCaloSimCaloExtrapolation::extrapolateToCylinder
bool extrapolateToCylinder(const std::vector< G4FieldTrack > &caloSteps, float cylR, float cylZ, Amg::Vector3D &extPos, Amg::Vector3D &momDir) const
Finds best extrapolation extPos from the caloSteps for a cylinder defined by radius cylR and half-len...
Definition
FastCaloSimCaloExtrapolation.cxx:233
FastCaloSimCaloExtrapolation::getPointLineSegmentDistance
static double getPointLineSegmentDistance(Amg::Vector3D &point, Amg::Vector3D &hitPos1, Amg::Vector3D &hitPos2)
Computes the distance between a point and the line segment spanned by hitPos1 and hitPos2.
Definition
FastCaloSimCaloExtrapolation.cxx:830
FastCaloSimCaloExtrapolation::HITPOSITION
HITPOSITION
Definition
FastCaloSimCaloExtrapolation.h:48
FastCaloSimCaloExtrapolation::INSIDE
@ INSIDE
Definition
FastCaloSimCaloExtrapolation.h:49
FastCaloSimCaloExtrapolation::ON
@ ON
Definition
FastCaloSimCaloExtrapolation.h:51
FastCaloSimCaloExtrapolation::OUTSIDE
@ OUTSIDE
Definition
FastCaloSimCaloExtrapolation.h:50
FastCaloSimCaloExtrapolation::cylinderLineIntersection
int cylinderLineIntersection(float cylR, float cylZ, Amg::Vector3D &pointA, Amg::Vector3D &pointB, Amg::Vector3D &intersectA, Amg::Vector3D &intersectB) const
Analytically computes the intersection between the (infinite) line defined by pointA and pointB and t...
Definition
FastCaloSimCaloExtrapolation.cxx:726
FastCaloSimCaloExtrapolation::doesTravelThroughSurface
static bool doesTravelThroughSurface(float cylR, float cylZ, Amg::Vector3D &hitPos1, Amg::Vector3D &hitPos2)
Returns true if the line segment spanned by hitPos1 and hitPos2 crosses the cylinder surface,...
Definition
FastCaloSimCaloExtrapolation.cxx:862
FastCaloSimCaloExtrapolation::rzent
double rzent(int sample, double eta) const
Definition
FastCaloSimCaloExtrapolation.cxx:911
FastCaloSimCaloExtrapolation::zext
double zext(int sample, double eta) const
Definition
FastCaloSimCaloExtrapolation.cxx:921
FastCaloSimCaloExtrapolation::rzext
double rzext(int sample, double eta) const
Definition
FastCaloSimCaloExtrapolation.cxx:926
FastCaloSimCaloExtrapolation::rmid
double rmid(int sample, double eta) const
Definition
FastCaloSimCaloExtrapolation.cxx:886
FastCaloSimCaloExtrapolation::m_CaloTransportation
PublicToolHandle< IFastCaloSimCaloTransportation > m_CaloTransportation
Definition
FastCaloSimCaloExtrapolation.h:125
FastCaloSimCaloExtrapolation::zmid
double zmid(int sample, double eta) const
Definition
FastCaloSimCaloExtrapolation.cxx:891
FastCaloSimCaloExtrapolation::cylinderEndcapIntersection
static bool cylinderEndcapIntersection(float cylR, float cylZ, bool positiveEndcap, Amg::Vector3D &pointA, Amg::Vector3D &pointB, Amg::Vector3D &intersection)
Computes intersection between the (infinite) line spanned by pointA and pointB with the positive (neg...
Definition
FastCaloSimCaloExtrapolation.cxx:768
FastCaloSimCaloExtrapolation::isOnSegment
static bool isOnSegment(Amg::Vector3D &point, Amg::Vector3D &hitPos1, Amg::Vector3D &hitPos2)
Returns true if point lies on the line segment spanned by hitPos1 and hitPos2, otherwise returns fals...
Definition
FastCaloSimCaloExtrapolation.cxx:867
IFastCaloSimGeometryHelper
Definition
IFastCaloSimGeometryHelper.h:18
TFCSExtrapolationState
Definition
TFCSExtrapolationState.h:13
TFCSExtrapolationState::SUBPOS_ENT
@ SUBPOS_ENT
Definition
TFCSExtrapolationState.h:21
TFCSExtrapolationState::SUBPOS_EXT
@ SUBPOS_EXT
Definition
TFCSExtrapolationState.h:22
TFCSExtrapolationState::SUBPOS_MID
@ SUBPOS_MID
Definition
TFCSExtrapolationState.h:20
TFCSTruthState
Definition
TFCSTruthState.h:13
intersection
std::vector< std::string > intersection(std::vector< std::string > &v1, std::vector< std::string > &v2)
Definition
compareFlatTrees.cxx:25
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition
GeoPrimitives.h:47
CylinderIntersections
Definition
FastCaloSimCaloExtrapolation.h:23
CylinderIntersections::first
Amg::Vector3D first
Definition
FastCaloSimCaloExtrapolation.h:24
CylinderIntersections::second
Amg::Vector3D second
Definition
FastCaloSimCaloExtrapolation.h:25
CylinderIntersections::number
unsigned int number
Definition
FastCaloSimCaloExtrapolation.h:26
Generated on
for ATLAS Offline Software by
1.17.0