ATLAS Offline Software
ClusterId.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef DCMATH_CLUSTERID_H
6 #define DCMATH_CLUSTERID_H
7 
8 #include <ostream>
9 
10 namespace TrkDriftCircleMath {
11 
12  class ClusterId {
13  public:
14  static constexpr int stationOffSet = 1000000;
15  static constexpr int etaOffSet = 10000;
16  static constexpr int phiOffSet = 100;
17  ClusterId() = default;
18  ClusterId(int stName, int eta, int phi, int barrel, int measuresPhi) {
19  m_id = stationOffSet * stName + etaOffSet * eta + phiOffSet * phi + 10 * barrel + measuresPhi;
20  }
21 
22  int id() const { return m_id; }
23  int stName() const { return m_id / stationOffSet; }
24  int eta() const { return (m_id % stationOffSet) / etaOffSet; }
25  int phi() const { return (m_id % etaOffSet) / phiOffSet; }
26  int isTgc() const { return (m_id % phiOffSet) / 10; }
27  int measuresPhi() const { return m_id % 10; }
28 
29  private:
30  int m_id{0};
31  };
32 
33  std::ostream& operator<<(std::ostream& os, const TrkDriftCircleMath::ClusterId& id);
34 
35 } // namespace TrkDriftCircleMath
36 
37 #endif
TrkDriftCircleMath::ClusterId
Definition: ClusterId.h:12
TrkDriftCircleMath
Function object to check whether two Segments are sub/super sets or different.
Definition: IMdtSegmentFinder.h:13
TrkDriftCircleMath::ClusterId::ClusterId
ClusterId()=default
TrkDriftCircleMath::ClusterId::etaOffSet
static constexpr int etaOffSet
Definition: ClusterId.h:15
TrkDriftCircleMath::ClusterId::eta
int eta() const
Definition: ClusterId.h:24
TrkDriftCircleMath::operator<<
std::ostream & operator<<(std::ostream &os, const TrkDriftCircleMath::ClusterId &id)
Definition: ClusterId.cxx:9
TrkDriftCircleMath::ClusterId::measuresPhi
int measuresPhi() const
Definition: ClusterId.h:27
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
TrkDriftCircleMath::ClusterId::stationOffSet
static constexpr int stationOffSet
Definition: ClusterId.h:14
TrkDriftCircleMath::ClusterId::phi
int phi() const
Definition: ClusterId.h:25
TrkDriftCircleMath::ClusterId::isTgc
int isTgc() const
Definition: ClusterId.h:26
TrkDriftCircleMath::ClusterId::phiOffSet
static constexpr int phiOffSet
Definition: ClusterId.h:16
TrkDriftCircleMath::ClusterId::stName
int stName() const
Definition: ClusterId.h:23
TrkDriftCircleMath::ClusterId::m_id
int m_id
Definition: ClusterId.h:30
TrkDriftCircleMath::ClusterId::ClusterId
ClusterId(int stName, int eta, int phi, int barrel, int measuresPhi)
Definition: ClusterId.h:18
TrkDriftCircleMath::ClusterId::id
int id() const
Definition: ClusterId.h:22