ATLAS Offline Software
Loading...
Searching...
No Matches
eflowCellList.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5/********************************************************************
6
7NAME: eflowCellList.cxx
8PACKAGE: offline/Reconstruction/eflowRec
9
10AUTHORS: M.Hodgkinson, R Duxfield (based on R.Duxfields Root package)
11CREATED: 18th Aug, 2005
12
13********************************************************************/
14
15// Athena Headers
20
21#include "CaloEvent/CaloCell.h"
22
24
25// C++ Headers
26
27#include <cmath>
28
30 : m_etaFF(eflowCalo::nRegions)
31 , m_phiFF(eflowCalo::nRegions)
32{}
33
34void
39
40void
42{
43 for (int i = 0; i < eflowCalo::nRegions; i++) {
45 m_etaFF[layer] = trackCalo.getEta(layer);
46 m_phiFF[layer] = trackCalo.getPhi(layer);
47 }
48
50}
51
52void
53eflowCellList::addCell(std::pair<const CaloCell*, int> cell)
54{
55 eflowCellPosition myPos(this, cell.first);
56
57 CellIt inmap = m_cellPositionToCellMap.find(myPos);
58
59 if (inmap != m_cellPositionToCellMap.end())
60 inmap->second.push_back(cell);
61 else {
62 std::vector<std::pair<const CaloCell*, int>> myVec;
63 myVec.push_back(cell);
65 std::map<eflowCellPosition,
66 std::vector<std::pair<const CaloCell*, int>>>::value_type(myPos,
67 myVec));
68 }
69}
70
71void
73{
74 /* Collect all cells in layer EMB2 and higher, i.e. start with dR = 0 to the
75 * track in EMB2 */
76 CellIt it = m_cellPositionToCellMap.lower_bound(
79 while (it != end) {
80 /* Create a CellPosition in EMB1 that has the same dR to the track as in its
81 * original layer */
82 eflowCellPosition tempPos(this, eflowCalo::EMB1, it->first.dR());
83
84 /* (Try to) insert the new CellPosition into the map. The resulting iterator
85 * either points to the inserted or to the already existing element (but we
86 * don't care). */
87 std::map<eflowCellPosition,
88 std::vector<std::pair<const CaloCell*, int>>>::iterator itInserted =
90 .insert(
91 std::make_pair(tempPos, std::vector<std::pair<const CaloCell*, int>>(0)))
92 .first;
93
94 /* Append the cell/index pairs of the original CellPosition to the (either
95 * newly inserted or already existing) element */
96 std::vector<std::pair<const CaloCell*, int>>& pairVector(it->second);
97 itInserted->second.insert(
98 itInserted->second.end(), pairVector.begin(), pairVector.end());
99
100 /* Remove the original CellPosition from the map */
101 m_cellPositionToCellMap.erase(it++);
102 }
103}
104
105double
106eflowCellList::dR2(double eta, double phi, eflowCaloENUM layer) const
107{
108 if (eflowCalo::Unknown != layer) {
109 double dEta = eta - m_etaFF[layer];
110 double dPhi = xAOD::P4Helpers::deltaPhi(phi, m_phiFF[layer]);
111 return dEta * dEta + dPhi * dPhi;
112 } else {
113 return -999.0;
114 }
115}
116
117double
118eflowCellList::dR(double eta, double phi, eflowCaloENUM layer) const
119{
120 return (eflowCalo::Unknown != layer) ? sqrt(dR2(eta, phi, layer)) : -999.0;
121}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
This defines the eflowCalo enum, which is used to label calorimeter layers in a simplified scheme whi...
static const int nRegions
double dR(double eta, double phi, eflowCaloENUM layer) const
std::vector< double > m_etaFF
std::map< eflowCellPosition, std::vector< std::pair< const CaloCell *, int > > > m_cellPositionToCellMap
void addCell(std::pair< const CaloCell *, int > cell)
double dR2(double eta, double phi, eflowCaloENUM layer) const
void reorderWithoutLayers()
void setNewExtrapolatedTrack(const eflowTrackCaloPoints *trackCalo)
std::vector< double > m_phiFF
This class stores the eta,phi and layer of the calorimeter cell and defines a "<" operator which can ...
This class stores a map of calorimeter layers and track parameters (the result of the track extrapola...
double getPhi(eflowCalo::LAYER layer) const
double getEta(eflowCalo::LAYER layer) const
eflowCalo::LAYER eflowCaloENUM
std::map< eflowCellPosition, std::vector< std::pair< constCaloCell *, int > > >::iterator CellIt
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[