ATLAS Offline Software
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 
10 
11 #include "CaloEvent/CaloCell.h"
14 
15 namespace Trk {
16 
17  CaloCellSelectorMinPerp::CaloCellSelectorMinPerp(double coneSize) : m_caloExtension(nullptr), m_coneSize(coneSize), m_perp2cut(0) {}
18 
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 
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 
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 
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
Trk::CaloCellSelectorMinPerp::m_perp2cut
double m_perp2cut
Definition: CaloCellSelectorMinPerp.h:35
beamspotman.r
def r
Definition: beamspotman.py:676
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
CaloDetDescrElement::y
float y() const
cell y
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:365
Trk::CaloExtension
Tracking class to hold the extrapolation from a particle from the ID to the muon system (or the other...
Definition: CaloExtension.h:18
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
ALFA_EventTPCnv_Dict::t1
std::vector< ALFA_RawDataCollection_p1 > t1
Definition: ALFA_EventTPCnvDict.h:43
CaloExtension.h
CaloCell.h
Trk::CaloCellSelectorMinPerp::CaloCellSelectorMinPerp
CaloCellSelectorMinPerp(double coneSize)
Definition: CaloCellSelectorMinPerp.cxx:17
perp2
Scalar perp2() const
perp2 method - perpendicular length squared
Definition: AmgMatrixBasePlugin.h:42
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
CaloCellSelectorUtils.h
drawFromPickle.atan
atan
Definition: drawFromPickle.py:36
Trk::CaloCellSelectorMinPerp::m_coneSize
double m_coneSize
Definition: CaloCellSelectorMinPerp.h:33
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
CaloCellSelectorMinPerp.h
lumiFormat.i
int i
Definition: lumiFormat.py:92
WriteCalibToCool.swap
swap
Definition: WriteCalibToCool.py:94
Trk::CaloCellSelectorMinPerp::m_caloExtension
const Trk::CaloExtension * m_caloExtension
Definition: CaloCellSelectorMinPerp.h:32
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
WriteCellNoiseToCool.cellPos
cellPos
Definition: WriteCellNoiseToCool.py:400
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
CaloDetDescrElement::x
float x() const
cell x
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:363
ALFA_EventTPCnv_Dict::t2
std::vector< ALFA_RawDataContainer_p1 > t2
Definition: ALFA_EventTPCnvDict.h:44
a
TList * a
Definition: liststreamerinfos.cxx:10
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
CaloDetDescrElement::z
float z() const
cell z
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:367
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::caloLayerIntersections
const std::vector< CurvilinearParameters > & caloLayerIntersections() const
access to the intersections with the calorimeter layers.
Definition: CaloExtension.h:76
Utils::findNearestPoint
void findNearestPoint(const Amg::Vector3D &inputPos, const Trk::CaloExtension *caloExtension, int &nearestIdx, Amg::Vector3D &nearestPos, Amg::Vector3D &nearestMom)
Definition: CaloCellSelectorUtils.cxx:25
xAOD::Iso::coneSize
float coneSize(IsolationConeSize type)
convert Isolation Size into cone size
Definition: IsolationHelpers.h:27
python.compressB64.c
def c
Definition: compressB64.py:93
mag
Scalar mag() const
mag method
Definition: AmgMatrixBasePlugin.h:25