ATLAS Offline Software
Loading...
Searching...
No Matches
Trk::CaloCellSelectorMinPerp Class Reference

#include <CaloCellSelectorMinPerp.h>

Inheritance diagram for Trk::CaloCellSelectorMinPerp:
Collaboration diagram for Trk::CaloCellSelectorMinPerp:

Public Member Functions

 CaloCellSelectorMinPerp (double coneSize)
 ~CaloCellSelectorMinPerp ()=default
bool preSelectAction (const Trk::CaloExtension &caloExtension)
 Initialize selector wtih CaloExtension, returns false if the selection cannot be performed for the given input.
bool select (const CaloCell &cell) const
 Method to determine if a cell is to be selected or not.
virtual bool preSelectActionCells (const Rec::ParticleCellAssociation &cellAssociation)
 Initialize selector wtih ParticleCellAssociation, returns false if the selection cannot be performed for the given input.

Private Attributes

const Trk::CaloExtensionm_caloExtension
double m_coneSize
Amg::Vector3D m_meanPos
double m_perp2cut

Detailed Description

Definition at line 22 of file CaloCellSelectorMinPerp.h.

Constructor & Destructor Documentation

◆ CaloCellSelectorMinPerp()

Trk::CaloCellSelectorMinPerp::CaloCellSelectorMinPerp ( double coneSize)

◆ ~CaloCellSelectorMinPerp()

Trk::CaloCellSelectorMinPerp::~CaloCellSelectorMinPerp ( )
default

Member Function Documentation

◆ preSelectAction()

bool Trk::CaloCellSelectorMinPerp::preSelectAction ( const Trk::CaloExtension & caloExtension)
virtual

Initialize selector wtih CaloExtension, returns false if the selection cannot be performed for the given input.

Reimplemented from Trk::ICaloCellSelector.

Definition at line 19 of file CaloCellSelectorMinPerp.cxx.

19 {
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 }
static Double_t a
int r
Definition globals.cxx:22
std::vector< ALFA_RawDataContainer_p1 > t2
std::vector< ALFA_RawDataCollection_p1 > t1
Eigen::Matrix< double, 3, 1 > Vector3D

◆ preSelectActionCells()

bool ICaloCellSelector::preSelectActionCells ( const Rec::ParticleCellAssociation & cellAssociation)
inlinevirtualinherited

Initialize selector wtih ParticleCellAssociation, returns false if the selection cannot be performed for the given input.

Definition at line 44 of file Reconstruction/RecoTools/RecoToolInterfaces/RecoToolInterfaces/ICaloCellSelector.h.

44 {
45 return preSelectAction(cellAssociation.caloExtension());
46 }
const Trk::CaloExtension & caloExtension() const
return calo extension
virtual bool preSelectAction(const Trk::CaloExtension &caloExtension)
Initialize selector wtih CaloExtension, returns false if the selection cannot be performed for the gi...

◆ select()

bool Trk::CaloCellSelectorMinPerp::select ( const CaloCell & cell) const
virtual

Method to determine if a cell is to be selected or not.

Parameters
CaloCell
Returns
bool

Implements Trk::ICaloCellSelector.

Definition at line 42 of file CaloCellSelectorMinPerp.cxx.

42 {
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 }
Scalar perp2() const
perp2 method - perpendicular length squared
Scalar mag() const
mag method
void findNearestPoint(const Amg::Vector3D &inputPos, const Trk::CaloExtension *caloExtension, int &nearestIdx, Amg::Vector3D &nearestPos, Amg::Vector3D &nearestMom)
void swap(ElementLinkVector< DOBJ > &lhs, ElementLinkVector< DOBJ > &rhs)

Member Data Documentation

◆ m_caloExtension

const Trk::CaloExtension* Trk::CaloCellSelectorMinPerp::m_caloExtension
private

Definition at line 32 of file CaloCellSelectorMinPerp.h.

◆ m_coneSize

double Trk::CaloCellSelectorMinPerp::m_coneSize
private

Definition at line 33 of file CaloCellSelectorMinPerp.h.

◆ m_meanPos

Amg::Vector3D Trk::CaloCellSelectorMinPerp::m_meanPos
private

Definition at line 34 of file CaloCellSelectorMinPerp.h.

◆ m_perp2cut

double Trk::CaloCellSelectorMinPerp::m_perp2cut
private

Definition at line 35 of file CaloCellSelectorMinPerp.h.


The documentation for this class was generated from the following files: