ATLAS Offline Software
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 
7 NAME: eflowCellList.cxx
8 PACKAGE: offline/Reconstruction/eflowRec
9 
10 AUTHORS: M.Hodgkinson, R Duxfield (based on R.Duxfields Root package)
11 CREATED: 18th Aug, 2005
12 
13 ********************************************************************/
14 
15 // Athena Headers
16 #include "eflowRec/eflowCellList.h"
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 
34 void
36 {
37  setNewExtrapolatedTrack(*trackCalo);
38 }
39 
40 void
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 
52 void
53 eflowCellList::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 
71 void
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 
105 double
107 {
108  if (eflowCalo::Unknown != layer) {
109  double dEta = eta - m_etaFF[layer];
111  return dEta * dEta + dPhi * dPhi;
112  } else {
113  return -999.0;
114  }
115 }
116 
117 double
119 {
120  return (eflowCalo::Unknown != layer) ? sqrt(dR2(eta, phi, layer)) : -999.0;
121 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
eflowCaloRegions.h
eflowCellList::reorderWithoutLayers
void reorderWithoutLayers()
Definition: eflowCellList.cxx:72
eflowTrackCaloPoints
This class stores a map of calorimeter layers and track parameters (the result of the track extrapola...
Definition: eflowTrackCaloPoints.h:30
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
eflowCellList::m_etaFF
std::vector< double > m_etaFF
Definition: eflowCellList.h:85
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
eflowCellPosition.h
eflowCalo
This defines the eflowCalo enum, which is used to label calorimeter layers in a simplified scheme whi...
Definition: eflowCaloRegions.h:25
eflowCalo::EMB2
@ EMB2
Definition: eflowCaloRegions.h:45
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
xAODP4Helpers.h
eflowCalo::Unknown
@ Unknown
Definition: eflowCaloRegions.h:50
eflowCellList::setNewExtrapolatedTrack
void setNewExtrapolatedTrack(const eflowTrackCaloPoints *trackCalo)
Definition: eflowCellList.cxx:35
skel.it
it
Definition: skel.GENtoEVGEN.py:423
eflowCellList::addCell
void addCell(std::pair< const CaloCell *, int > cell)
Definition: eflowCellList.cxx:53
CaloCell.h
xAOD::P4Helpers::deltaPhi
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
Definition: xAODP4Helpers.h:69
eflowCellList::eflowCellList
eflowCellList()
Definition: eflowCellList.cxx:29
eflowCellList::end
CellIt end()
Definition: eflowCellList.h:57
eflowTrackCaloPoints.h
eflowCellPosition
This class stores the eta,phi and layer of the calorimeter cell and defines a "<" operator which can ...
Definition: eflowCellPosition.h:36
eflowTrackCaloPoints::getPhi
double getPhi(eflowCalo::LAYER layer) const
Definition: eflowTrackCaloPoints.h:44
lumiFormat.i
int i
Definition: lumiFormat.py:92
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
TauGNNUtils::Variables::Track::dPhi
bool dPhi(const xAOD::TauJet &tau, const xAOD::TauTrack &track, double &out)
Definition: TauGNNUtils.cxx:530
eflowCalo::EMB1
@ EMB1
Definition: eflowCaloRegions.h:45
eflowCellList::dR2
double dR2(double eta, double phi, eflowCaloENUM layer) const
Definition: eflowCellList.cxx:106
eflowCellList.h
eflowCellList::m_phiFF
std::vector< double > m_phiFF
Definition: eflowCellList.h:86
eflowCalo::nRegions
static const int nRegions
Definition: eflowCaloRegions.h:45
CellIt
std::map< eflowCellPosition, std::vector< std::pair< const CaloCell *, int > > >::iterator CellIt
Definition: eflowAbstractCellList.h:25
eflowCalo::LAYER
LAYER
Definition: eflowCaloRegions.h:36
eflowTrackCaloPoints::getEta
double getEta(eflowCalo::LAYER layer) const
Definition: eflowTrackCaloPoints.h:43
eflowCellList::m_cellPositionToCellMap
std::map< eflowCellPosition, std::vector< std::pair< const CaloCell *, int > > > m_cellPositionToCellMap
Definition: eflowCellList.h:88
TauGNNUtils::Variables::Track::dEta
bool dEta(const xAOD::TauJet &tau, const xAOD::TauTrack &track, double &out)
Definition: TauGNNUtils.cxx:525
value_type
Definition: EDM_MasterSearch.h:11
eflowCellList::dR
double dR(double eta, double phi, eflowCaloENUM layer) const
Definition: eflowCellList.cxx:118
eflowCaloENUM
eflowCalo::LAYER eflowCaloENUM
Definition: eflowCaloRegions.h:49