ATLAS Offline Software
TopoClusterMap.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef CALOCLUSTERMATCHING_TOPOCLUSTERMAP_H
6 #define CALOCLUSTERMATCHING_TOPOCLUSTERMAP_H
7 
8 //xAOD includes:
10 
12 
13  typedef std::map<int, std::map< int, std::vector<const xAOD::CaloCluster* > > > TopoCluster2DMap;
14 
15  public:
16 
17  //Constructor/destructor.
18  // TopoClusterMap();
19 
20  TopoClusterMap(float minEta=-6., float minPhi=-3.2, float maxEta=6., float maxPhi=3.2,
21  float dEta=0.3, float dPhi=0.1);
23 
26  //Function to insert a topocluster, then re-sort the vector it belongs to.
28 
30  return (*this);
31  }
32 
33  //Clear the map.
34  void ClearMap();
35 
36  //Function to set TopoClusters.
38 
40 
41  //Routine to retrieve vector of TopoClusters for a given Pt region.
42  std::vector<const xAOD::CaloCluster*> RetrieveTopoClusters(double eta, double phi,
43  double Pt) const;
44 
45  //Routine to retrieve vector of TopoClusters for a given (eta, phi) region.
46  std::vector<const xAOD::CaloCluster*> RetrieveTopoClusters(double eta, double phi,
47  double dEta,
48  double dPhi) const;
49 
50  //Routine to retrieve vector of TopoClusters for a given (eta, phi) region.
51  inline std::vector<const xAOD::CaloCluster*> RetrieveTopoClusters(int eta_key, int phi_key) const
52  {
53  return m_map.at(eta_key).at(phi_key);
54  }
55 
56  //Private routine to translate an input eta, phi into integer keys for map.
57  inline std::pair<int,int> GetEtaPhiKeys(double eta, double phi) const {
58 
59  //Some checks on eta, phi values.
60  if (eta > m_maxEta) eta = m_maxEta;
61  if (eta < m_minEta) eta = m_minEta;
62  if (phi > m_maxPhi) phi = m_maxPhi;
63  if (phi < m_minPhi) phi = m_minPhi;
64 
65  //Need some warnings against max/min eta, phi here, I think.
66  int eta_key = (int)((eta-m_minEta)/m_dEta);
67 
68  //NOTE: May have to account for phi wraparound here.
69  int phi_key = (int)((phi-m_minPhi)/m_dPhi);
70 
71  return std::pair<int,int>(eta_key,phi_key);
72 
73  }
74 
75  /* void DumpMapContents(); */
76 
77  private:
78 
80 
81  //Map granularity and range.
83  double m_dEta, m_dPhi;
84 
85  //Routine to sort topocluster grid elements by Pt.
86  void SortGridVectors();
87  void SortGridVector(int eta_key, int phi_key);
88 
89  //Used for removing clusters from map - reducing size, access time.
90  static double GetLArThirdLayerRatio (const xAOD::CaloCluster*);
91 
92 };
93 
94 #include "xAODCore/CLASS_DEF.h"
95 CLASS_DEF(TopoClusterMap,179090094,1)
96 
97 #endif
TopoClusterMap::GetLArThirdLayerRatio
static double GetLArThirdLayerRatio(const xAOD::CaloCluster *)
Definition: TopoClusterMap.cxx:167
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
TopoClusterMap::m_map
TopoCluster2DMap m_map
Definition: TopoClusterMap.h:79
TopoClusterMap::SortGridVectors
void SortGridVectors()
Definition: TopoClusterMap.cxx:76
TopoClusterMap::RetrieveMap
TopoCluster2DMap & RetrieveMap()
Definition: TopoClusterMap.h:39
TopoClusterMap::m_dEta
double m_dEta
Definition: TopoClusterMap.h:83
TopoClusterMap::SetTopoClusters
StatusCode SetTopoClusters(const xAOD::CaloClusterContainer *)
Definition: TopoClusterMap.cxx:41
TopoClusterMap::m_minPhi
double m_minPhi
Definition: TopoClusterMap.h:82
TopoClusterMap::InsertTopoCluster
void InsertTopoCluster(xAOD::CaloCluster *)
interface methods
Definition: TopoClusterMap.cxx:62
PUfitVar::maxEta
constexpr float maxEta
Definition: GepMETPufitAlg.cxx:13
TopoClusterMap::m_minEta
double m_minEta
Definition: TopoClusterMap.h:82
TopoClusterMap::TopoClusterMap
TopoClusterMap(float minEta=-6., float minPhi=-3.2, float maxEta=6., float maxPhi=3.2, float dEta=0.3, float dPhi=0.1)
Definition: TopoClusterMap.cxx:23
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TauGNNUtils::Variables::Track::dPhi
bool dPhi(const xAOD::TauJet &tau, const xAOD::TauTrack &track, double &out)
Definition: TauGNNUtils.cxx:538
TopoClusterMap::m_dPhi
double m_dPhi
Definition: TopoClusterMap.h:83
TopoClusterMap::SortGridVector
void SortGridVector(int eta_key, int phi_key)
Definition: TopoClusterMap.cxx:84
TopoClusterMap::GetEtaPhiKeys
std::pair< int, int > GetEtaPhiKeys(double eta, double phi) const
Definition: TopoClusterMap.h:57
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
TopoClusterMap::ClearMap
void ClearMap()
Definition: TopoClusterMap.cxx:90
TopoClusterMap::RetrieveTopoClusters
std::vector< const xAOD::CaloCluster * > RetrieveTopoClusters(int eta_key, int phi_key) const
Definition: TopoClusterMap.h:51
TopoClusterMap::~TopoClusterMap
~TopoClusterMap()
TopoClusterMap
Definition: TopoClusterMap.h:11
TopoClusterMap::DuplicateMap
TopoClusterMap & DuplicateMap()
Definition: TopoClusterMap.h:29
CLASS_DEF.h
File providing the different SG_BASE macros.
Prompt::Def::Pt
@ Pt
Definition: VarHolder.h:76
TopoClusterMap::m_maxEta
double m_maxEta
Definition: TopoClusterMap.h:82
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:64
TopoClusterMap::TopoCluster2DMap
std::map< int, std::map< int, std::vector< const xAOD::CaloCluster * > > > TopoCluster2DMap
Definition: TopoClusterMap.h:13
CaloClusterContainer.h
TopoClusterMap::RetrieveTopoClusters
std::vector< const xAOD::CaloCluster * > RetrieveTopoClusters(double eta, double phi, double Pt) const
Definition: TopoClusterMap.cxx:118
TauGNNUtils::Variables::Track::dEta
bool dEta(const xAOD::TauJet &tau, const xAOD::TauTrack &track, double &out)
Definition: TauGNNUtils.cxx:527
TopoClusterMap::m_maxPhi
double m_maxPhi
Definition: TopoClusterMap.h:82