ATLAS Offline Software
eflowTrackCaloPoints.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
6 /********************************************************************
7 
8 NAME: eflowTrackCaloPoints.cxx
9 PACKAGE: offline/Reconstruction/eflowRec
10 
11 AUTHORS: R. Duxfield
12 CREATED: 4th January, 2006
13 
14 ********************************************************************/
15 
16 #include <utility>
17 #include <iostream>
18 #include <cmath>
19 
21 
22 using std::pair;
23 
24 const pair<float, float> eflowTrackCaloPoints::m_defaultEtaPhiPair = pair<float, float>(-999.0, -999.0);
27 
28 double eflowTrackCaloPoints::defaultEta() {return (double)m_defaultEtaPhiPair.first;}
29 double eflowTrackCaloPoints::defaultPhi() {return (double)m_defaultEtaPhiPair.second;}
30 
31 eflowTrackCaloPoints::eflowTrackCaloPoints(const std::map<eflowCalo::LAYER, const Trk::TrackParameters*> & trackParameters):
32  m_isEM1Barrel(trackParameters.begin()->first == eflowCalo::EMB1) {
33 
34  /* Fill etaPhiPositions map */
35  std::map<eflowCalo::LAYER, const Trk::TrackParameters*>::const_iterator itPars = trackParameters.begin();
36  std::map<eflowCalo::LAYER, const Trk::TrackParameters*>::const_iterator endPars = trackParameters.end();
37  m_isEM2Barrel = false;
38  for (; itPars != endPars; ++itPars) {
39  setEtaPhi(itPars->first, parToPosition(itPars->second));
40  if (itPars->first == eflowCalo::EMB2) m_isEM2Barrel = true;
41  m_positions[itPars->first] = parToPosition(itPars->second);
42  m_directions[itPars->first] = parToDirection(itPars->second);
43  }
44 
45 }
46 
47 eflowTrackCaloPoints::eflowTrackCaloPoints(const std::map<eflowCalo::LAYER, const Trk::TrackParameters*> & trackParameters,
48  std::map<CaloCell_ID::CaloSample,const Trk::TrackParameters*>& tileTrackParamaters) :
49  m_isEM1Barrel(trackParameters.begin()->first == eflowCalo::EMB1){
50  /* Fill etaPhiPositions map */
51  std::map<eflowCalo::LAYER, const Trk::TrackParameters*>::const_iterator itPars = trackParameters.begin();
52  std::map<eflowCalo::LAYER, const Trk::TrackParameters*>::const_iterator endPars = trackParameters.end();
53  m_isEM2Barrel = false;
54  for (; itPars != endPars; ++itPars) {
55  setEtaPhi(itPars->first, parToPosition(itPars->second));
56  if (itPars->first == eflowCalo::EMB2) m_isEM2Barrel = true;
57  m_positions[itPars->first] = parToPosition(itPars->second);
58  m_directions[itPars->first] = parToDirection(itPars->second);
59  }
60 
61  for (auto firstTileParam : tileTrackParamaters) setEtaPhiTile(firstTileParam.first,parToPosition(firstTileParam.second));
62 
63  }
64 
66 
68  m_etaPhiPositions[lay] = (vec != m_nullVector) ? eflowEtaPhiPosition(vec.eta(), vec.phi())
70 }
71 
75 }
76 
77 //only used in eflowTrackExtrapolatorTool
80 }
81 
82 const pair<float, float> eflowTrackCaloPoints::operator[] (eflowCaloENUM layer) const {
83  eflowEtaPhiPosition thisPosition = getEtaPhiPos(layer);
84  return pair<float, float>(thisPosition.getEta(), thisPosition.getPhiD());
85 }
87  std::map< eflowCalo::LAYER, eflowEtaPhiPosition>::const_iterator it = m_etaPhiPositions.find(layer);
88  return (it == m_etaPhiPositions.end()) ? m_defaultEtaPhiPosition : it->second;
89 }
90 
92  std::map< CaloCell_ID::CaloSample , eflowEtaPhiPosition>::const_iterator it = m_tileEtaPhiPositions.find(layer);
93  return (it == m_tileEtaPhiPositions.end()) ? m_defaultEtaPhiPosition : it->second;
94 }
95 
96 
98  std::map<eflowCalo::LAYER, Amg::Vector3D>::const_iterator it = m_positions.find(layer);
99  return (it == m_positions.end()) ? m_nullVector : it->second;
100 }
101 
103  std::map<eflowCalo::LAYER, Amg::Vector3D>::const_iterator it = m_directions.find(layer);
104  return (it == m_directions.end()) ? m_nullVector : it->second;
105 }
106 
108  return (trackPars != nullptr) ? trackPars->position() : m_nullVector;
109 }
110 
112  return (trackPars != nullptr) ? trackPars->momentum() : m_nullVector;
113 }
eflowTrackCaloPoints::defaultPhi
static double defaultPhi()
Definition: eflowTrackCaloPoints.cxx:29
eflowTrackCaloPoints::m_directions
std::map< eflowCalo::LAYER, Amg::Vector3D > m_directions
Definition: eflowTrackCaloPoints.h:86
constants.EMB1
int EMB1
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:53
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
eflowTrackCaloPoints::m_nullVector
static const Amg::Vector3D m_nullVector
Definition: eflowTrackCaloPoints.h:76
eflowCalo
This defines the eflowCalo enum, which is used to label calorimeter layers in a simplified scheme whi...
Definition: eflowCaloRegions.h:25
eflowTrackCaloPoints::getPosition
Amg::Vector3D getPosition(eflowCalo::LAYER layer)
Definition: eflowTrackCaloPoints.cxx:97
eflowCalo::EMB2
@ EMB2
Definition: eflowCaloRegions.h:45
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
Trk::ParametersBase::position
const Amg::Vector3D & position() const
Access method for the position.
eflowEtaPhiPosition::getEta
double getEta() const
Definition: eflowUtil.h:90
eflowTrackCaloPoints::m_isEM2Barrel
bool m_isEM2Barrel
Definition: eflowTrackCaloPoints.h:72
eflowTrackCaloPoints::setEtaPhiTile
void setEtaPhiTile(CaloCell_ID::CaloSample secondLayer, const Amg::Vector3D &vec)
Definition: eflowTrackCaloPoints.cxx:72
eflowTrackCaloPoints::m_tileEtaPhiPositions
std::map< CaloCell_ID::CaloSample, eflowEtaPhiPosition > m_tileEtaPhiPositions
Definition: eflowTrackCaloPoints.h:88
eflowEtaPhiPosition::getPhiD
double getPhiD() const
Definition: eflowUtil.h:92
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
skel.it
it
Definition: skel.GENtoEVGEN.py:396
eflowTrackCaloPoints::getTileEtaPhiPos
const eflowEtaPhiPosition & getTileEtaPhiPos(CaloCell_ID::CaloSample layer) const
Definition: eflowTrackCaloPoints.cxx:91
eflowTrackCaloPoints::m_etaPhiPositions
std::map< eflowCalo::LAYER, eflowEtaPhiPosition > m_etaPhiPositions
Definition: eflowTrackCaloPoints.h:87
eflowEtaPhiPosition
Definition: eflowUtil.h:85
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
eflowTrackCaloPoints::eflowTrackCaloPoints
eflowTrackCaloPoints()
Definition: eflowTrackCaloPoints.h:36
eflowTrackCaloPoints.h
eflowTrackCaloPoints::~eflowTrackCaloPoints
~eflowTrackCaloPoints()
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
eflowTrackCaloPoints::operator[]
const std::pair< float, float > operator[](eflowCalo::LAYER layer) const
Definition: eflowTrackCaloPoints.cxx:82
eflowTrackCaloPoints::m_defaultEtaPhiPair
static const std::pair< float, float > m_defaultEtaPhiPair
Definition: eflowTrackCaloPoints.h:82
Trk::ParametersBase
Definition: ParametersBase.h:55
eflowTrackCaloPoints::setEtaPhi
void setEtaPhi(eflowCaloENUM secondLayer, double eta, double phi)
Definition: eflowTrackCaloPoints.cxx:78
eflowTrackCaloPoints::m_positions
std::map< eflowCalo::LAYER, Amg::Vector3D > m_positions
Definition: eflowTrackCaloPoints.h:85
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
eflowTrackCaloPoints::getDirection
Amg::Vector3D getDirection(eflowCalo::LAYER layer)
Definition: eflowTrackCaloPoints.cxx:102
Trk::ParametersBase::momentum
const Amg::Vector3D & momentum() const
Access method for the momentum.
eflowTrackCaloPoints::parToPosition
static Amg::Vector3D parToPosition(const Trk::TrackParameters *extrapolatedParameters)
Definition: eflowTrackCaloPoints.cxx:107
eflowCalo::LAYER
LAYER
Definition: eflowCaloRegions.h:36
eflowTrackCaloPoints::getEtaPhiPos
const eflowEtaPhiPosition & getEtaPhiPos(eflowCalo::LAYER layer) const
Definition: eflowTrackCaloPoints.cxx:86
DeMoScan.first
bool first
Definition: DeMoScan.py:536
eflowTrackCaloPoints::m_defaultEtaPhiPosition
static const eflowEtaPhiPosition m_defaultEtaPhiPosition
Definition: eflowTrackCaloPoints.h:83
eflowTrackCaloPoints::defaultEta
static double defaultEta()
Definition: eflowTrackCaloPoints.cxx:28
eflowTrackCaloPoints::parToDirection
static Amg::Vector3D parToDirection(const Trk::TrackParameters *extrapolatedParameters)
Definition: eflowTrackCaloPoints.cxx:111