ATLAS Offline Software
CaloCellSelectorNearestdR.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 // CaloCellSelectorNearestdR.cxx, (c) ATLAS Detector software
8 
10 
11 #include "CaloEvent/CaloCell.h"
14 
15 namespace Trk {
16 
17  CaloCellSelectorNearestdR::CaloCellSelectorNearestdR(double coneSize) : m_caloExtension(nullptr), m_coneSize2(coneSize * coneSize) {}
18 
20 
22  m_caloExtension = &caloExtension;
23  return true;
24  }
25 
27  if (!m_caloExtension) return false;
28 
29  const CaloDetDescrElement* dde = cell.caloDDE();
30  if (!dde) return false;
31 
32  Amg::Vector3D cellPos(dde->x(), dde->y(), dde->z());
33 
34  int nearestIdx;
35  Amg::Vector3D nearestPos, nearestMom;
36  Utils::findNearestPoint(cellPos, m_caloExtension, nearestIdx, nearestPos, nearestMom);
37 
38  return Utils::deltaR2(nearestPos.eta(), dde->eta(), nearestPos.phi(), dde->phi()) < m_coneSize2;
39  }
40 
41 } // namespace Trk
Trk::CaloCellSelectorNearestdR::~CaloCellSelectorNearestdR
~CaloCellSelectorNearestdR()
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
CaloExtension.h
CaloCell.h
Trk::CaloCellSelectorNearestdR::select
bool select(const CaloCell &cell) const
Method to determine if a cell is to be selected or not.
Definition: CaloCellSelectorNearestdR.cxx:26
CaloCellSelectorUtils.h
Trk::CaloCellSelectorNearestdR::CaloCellSelectorNearestdR
CaloCellSelectorNearestdR(double coneSize)
Definition: CaloCellSelectorNearestdR.cxx:17
Trk::CaloCellSelectorNearestdR::m_coneSize2
double m_coneSize2
Definition: CaloCellSelectorNearestdR.h:33
CaloCellSelectorNearestdR.h
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
WriteCellNoiseToCool.cellPos
cellPos
Definition: WriteCellNoiseToCool.py:400
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
CaloDetDescrElement::x
float x() const
cell x
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:363
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::CaloCellSelectorNearestdR::m_caloExtension
const Trk::CaloExtension * m_caloExtension
Definition: CaloCellSelectorNearestdR.h:32
Trk::CaloCellSelectorNearestdR::preSelectAction
bool preSelectAction(const Trk::CaloExtension &caloExtension)
Initialize selector wtih CaloExtension, returns false if the selection cannot be performed for the gi...
Definition: CaloCellSelectorNearestdR.cxx:21
CaloDetDescrElement::eta
float eta() const
cell eta
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:344
CaloDetDescrElement::phi
float phi() const
cell phi
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:346
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
Utils::deltaR2
double deltaR2(double eta1, double eta2, double phi1, double phi2)
Definition: CaloCellSelectorUtils.cxx:17