ATLAS Offline Software
Loading...
Searching...
No Matches
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
25
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"
95CLASS_DEF(TopoClusterMap,179090094,1)
96
97#endif
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
File providing the different SG_BASE macros.
TopoClusterMap & DuplicateMap()
static double GetLArThirdLayerRatio(const xAOD::CaloCluster *)
TopoClusterMap(float minEta=-6., float minPhi=-3.2, float maxEta=6., float maxPhi=3.2, float dEta=0.3, float dPhi=0.1)
std::pair< int, int > GetEtaPhiKeys(double eta, double phi) const
TopoCluster2DMap & RetrieveMap()
std::vector< const xAOD::CaloCluster * > RetrieveTopoClusters(int eta_key, int phi_key) const
StatusCode SetTopoClusters(const xAOD::CaloClusterContainer *)
void InsertTopoCluster(xAOD::CaloCluster *)
interface methods
TopoCluster2DMap m_map
void SortGridVector(int eta_key, int phi_key)
std::map< int, std::map< int, std::vector< const xAOD::CaloCluster * > > > TopoCluster2DMap
std::vector< const xAOD::CaloCluster * > RetrieveTopoClusters(double eta, double phi, double Pt) const
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.