CMS 3D CMS Logo

HGCalTowerMap.h
Go to the documentation of this file.
1 #ifndef DataFormats_L1TCalorimeter_HGCalTowerMap_h
2 #define DataFormats_L1TCalorimeter_HGCalTowerMap_h
3 
6 
7 #include <unordered_map>
8 
9 namespace l1t {
10 
13 
14  class HGCalTowerMap {
15 
16  public:
17 
19 
20  HGCalTowerMap( int nEtaBins, int nPhiBins );
21 
22  HGCalTowerMap( const std::vector<double>& etaBins, const std::vector<double>& phiBins );
23 
25 
26  void setLayer( const unsigned layer ) { layer_ = layer; }
27 
28 
29  int nEtaBins() const { return nEtaBins_; }
30  int nPhiBins() const { return nPhiBins_; }
31  const vector<double>& etaBins() const { return etaBins_; }
32  const vector<double>& phiBins() const { return phiBins_; }
33  const l1t::HGCalTower& tower(int iEta, int iPhi) const { return towerMap_.at(bin_id(iEta,iPhi)); }
34 
35  int iEta(const double eta) const;
36  int iPhi(const double phi) const;
37  int layer() const { return layer_;}
38 
40  void addTower(int iEta, int iPhi, const l1t::HGCalTower& tower) { towerMap_[bin_id(iEta,iPhi)] += tower; }
41 
42  private:
43 
44  static constexpr double kEtaMin_ = 1.479;
45  static constexpr double kEtaMax_ = 3.;
46  static constexpr double kEtaMinLoose_ = 1.401; //BH has some TC below 1.479
47  static constexpr double kEtaMaxLoose_ = 3.085; //FH has some TC above 3.0
48  static constexpr double kPhiMin_ = -M_PI;
49  static constexpr double kPhiMax_ = +M_PI;
50 
51  int nEtaBins_;
52  int nPhiBins_;
53  vector<double> etaBins_;
54  vector<double> phiBins_;
55  std::unordered_map<int,l1t::HGCalTower> towerMap_;
56  unsigned layer_;
57 
58  int bin_id(int iEta,int iPhi) const;
59 
60  };
61 
62 }
63 
64 #endif
65 
66 
void setLayer(const unsigned layer)
Definition: HGCalTowerMap.h:26
int iPhi(const double phi) const
vector< double > phiBins_
Definition: HGCalTowerMap.h:54
static double kEtaMin_
Definition: HGCalTowerMap.h:44
int nEtaBins() const
Definition: HGCalTowerMap.h:29
const vector< double > & etaBins() const
Definition: HGCalTowerMap.h:31
std::unordered_map< int, l1t::HGCalTower > towerMap_
Definition: HGCalTowerMap.h:55
static double kEtaMax_
Definition: HGCalTowerMap.h:45
delete x;
Definition: CaloConfig.h:22
BXVector< HGCalTowerMap > HGCalTowerMapBxCollection
Definition: HGCalTowerMap.h:11
int bin_id(int iEta, int iPhi) const
void addTower(int iEta, int iPhi, const l1t::HGCalTower &tower)
Definition: HGCalTowerMap.h:40
#define constexpr
int iEta(const double eta) const
static double kPhiMax_
Definition: HGCalTowerMap.h:49
static double kPhiMin_
Definition: HGCalTowerMap.h:48
const l1t::HGCalTower & tower(int iEta, int iPhi) const
Definition: HGCalTowerMap.h:33
int nPhiBins() const
Definition: HGCalTowerMap.h:30
int layer() const
Definition: HGCalTowerMap.h:37
#define M_PI
static double kEtaMinLoose_
Definition: HGCalTowerMap.h:46
vector< double > etaBins_
Definition: HGCalTowerMap.h:53
static double kEtaMaxLoose_
Definition: HGCalTowerMap.h:47
HGCalTowerMap & operator+=(const HGCalTowerMap &map)
const vector< double > & phiBins() const
Definition: HGCalTowerMap.h:32