ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
RecoTools
TrackToCalo
src
CaloCellSelectorMinPerp.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
// CaloCellSelectorMinPerp.cxx, (c) ATLAS Detector software
8
9
#include "
TrackToCalo/CaloCellSelectorMinPerp.h
"
10
11
#include "
CaloEvent/CaloCell.h
"
12
#include "
TrackToCalo/CaloCellSelectorUtils.h
"
13
#include "
TrkCaloExtension/CaloExtension.h
"
14
15
namespace
Trk
{
16
17
CaloCellSelectorMinPerp::CaloCellSelectorMinPerp
(
double
coneSize) :
m_caloExtension
(nullptr),
m_coneSize
(coneSize),
m_perp2cut
(0) {}
18
19
bool
CaloCellSelectorMinPerp::preSelectAction
(
const
Trk::CaloExtension
& caloExtension) {
20
m_caloExtension
= &caloExtension;
21
22
// find a circular cone (defined by cut in perpendicular distance form track i.e. perp2)
23
// with approx area as the dR cone
24
// the dR cone is roughly thought as an elipse
25
if
(
m_caloExtension
->caloLayerIntersections().empty())
return
false
;
26
27
Amg::Vector3D
pos =
m_caloExtension
->caloLayerIntersections()[0].position();
28
29
double
a
= fabs(pos.eta());
30
double
b = exp(-
a
);
// = tan(theta/2)
31
double
c = 2. * b / (1. - b * b);
// = tan(theta)
32
double
r
= c / sqrt(1. + c * c);
// distance from beam axis
33
double
t1 = 2. * atan(exp(-(
a
-
m_coneSize
)));
34
double
t2 = 2. * atan(exp(-(
a
+
m_coneSize
)));
35
double
dRad1 = fabs(t1 - t2) / 2.;
36
// double dRad1 = 2.*b/(1.+b*b) * m_coneSize; //semi-major axis of the dR cone elipse
37
double
dRad2 =
r
*
m_coneSize
;
// semi minor axis of the dR cone elipse
38
m_perp2cut
= dRad1 * dRad2;
// force area of circle = area of elipse, i.e. pi*r*r = pi*dRad1*dRad2
39
return
true
;
40
}
41
42
bool
CaloCellSelectorMinPerp::select
(
const
CaloCell
& cell)
const
{
43
if
(!
m_caloExtension
||
m_caloExtension
->caloLayerIntersections().empty())
return
false
;
44
45
const
CaloDetDescrElement
* dde = cell.caloDDE();
46
if
(!dde)
return
false
;
47
48
Amg::Vector3D
cellPos(dde->
x
(), dde->
y
(), dde->
z
());
49
50
int
nearestIdx;
51
Amg::Vector3D
nearestPos, nearestMom;
52
Utils::findNearestPoint
(cellPos,
m_caloExtension
, nearestIdx, nearestPos, nearestMom);
53
54
// get the perp2 from track
55
Amg::Vector3D
dPos = cellPos - nearestPos;
56
float
perp2
= dPos.perp2(nearestMom);
57
58
// get the total track length from IP to point of cloest approach to the cell
59
// scale the perp2 cut with this length
60
float
totTrkLen = sqrt(dPos.mag2() -
perp2
);
61
if
(dPos.dot(nearestMom) < 0) { totTrkLen = -totTrkLen; }
62
63
Amg::Vector3D
pos;
64
Amg::Vector3D
oldPos(0., 0., 0.);
65
const
std::vector<Trk::CurvilinearParameters>& intersections =
m_caloExtension
->caloLayerIntersections();
66
for
(
int
i = 0; i <= nearestIdx; ++i) {
67
pos = intersections[i].position();
68
totTrkLen += (pos - oldPos).
mag
();
69
std::swap
(oldPos, pos);
70
}
71
72
// prevent cell at exact opposite of the track from being selected..
73
if
(totTrkLen < 0)
return
false
;
74
75
if
(
perp2
< (
m_perp2cut
* totTrkLen * totTrkLen)) {
return
true
; }
// IF
76
77
return
false
;
78
}
79
80
}
// namespace Trk
perp2
Scalar perp2() const
perp2 method - perpendicular length squared
Definition
AmgMatrixBasePlugin.h:36
mag
Scalar mag() const
mag method
Definition
AmgMatrixBasePlugin.h:26
CaloCellSelectorMinPerp.h
CaloCellSelectorUtils.h
CaloCell.h
a
static Double_t a
Definition
LArPhysWaveHECTool.cxx:38
CaloExtension.h
CaloCell
Data object for each calorimeter readout cell.
Definition
CaloCell.h:57
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell.
Definition
Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
CaloDetDescrElement::y
float y() const
cell y
Definition
Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:365
CaloDetDescrElement::x
float x() const
cell x
Definition
Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:363
CaloDetDescrElement::z
float z() const
cell z
Definition
Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:367
Trk::CaloCellSelectorMinPerp::CaloCellSelectorMinPerp
CaloCellSelectorMinPerp(double coneSize)
Definition
CaloCellSelectorMinPerp.cxx:17
Trk::CaloCellSelectorMinPerp::m_perp2cut
double m_perp2cut
Definition
CaloCellSelectorMinPerp.h:35
Trk::CaloCellSelectorMinPerp::m_coneSize
double m_coneSize
Definition
CaloCellSelectorMinPerp.h:33
Trk::CaloCellSelectorMinPerp::m_caloExtension
const Trk::CaloExtension * m_caloExtension
Definition
CaloCellSelectorMinPerp.h:32
Trk::CaloCellSelectorMinPerp::select
bool select(const CaloCell &cell) const
Method to determine if a cell is to be selected or not.
Definition
CaloCellSelectorMinPerp.cxx:42
Trk::CaloCellSelectorMinPerp::preSelectAction
bool preSelectAction(const Trk::CaloExtension &caloExtension)
Initialize selector wtih CaloExtension, returns false if the selection cannot be performed for the gi...
Definition
CaloCellSelectorMinPerp.cxx:19
Trk::CaloExtension
Tracking class to hold the extrapolation through calorimeter Layers Both the caloEntryLayerIntersecti...
Definition
TrkEvent/TrkCaloExtension/TrkCaloExtension/CaloExtension.h:19
r
int r
Definition
globals.cxx:22
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
Utils::findNearestPoint
void findNearestPoint(const Amg::Vector3D &inputPos, const Trk::CaloExtension *caloExtension, int &nearestIdx, Amg::Vector3D &nearestPos, Amg::Vector3D &nearestMom)
Definition
CaloCellSelectorUtils.cxx:25
std::swap
void swap(ElementLinkVector< DOBJ > &lhs, ElementLinkVector< DOBJ > &rhs)
Definition
AthLinks/ElementLinkVector.h:484
Generated on
for ATLAS Offline Software by
1.17.0