ATLAS Offline Software
CMAidentity.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include <iomanip>
8 #include <string>
9 
10 const char CMAidentity::CoverageTAG[3][5] = {{"even"}, {"odd"}, {""}};
11 
12 bool CMAidentity::coverage(const std::string& side, CMAcoverage& cov) {
13  for (int i = EvenSectors; i <= AllSectors; ++i) {
14  std::string tag(CoverageTAG[i]);
15  if (side == tag) {
16  cov = (CMAcoverage)i;
17  return true;
18  }
19  }
20  return false;
21 }
22 
23 const std::string CMAidentity::name(const ViewType view, const CMAcoverage coverage) {
24  std::string cover(CMAidentity::covtag(coverage));
25  std::string side = view == ViewType::Eta ? "Eta" : (view == ViewType::Phi ? "Phi" : "NoView");
26  std::string v_name = cover + side + "CMA";
27  return v_name;
28 }
30 
31 CMAidentity::CMAidentity(ViewType view, CMAcoverage side, int number, int eta_index, int phi_index, int PAD_index, int Ixx_index) {
32  m_params.view = view;
39 }
40 
42  m_params.view = view;
45 }
46 
48  m_params.view = view;
50  m_params.etaIndex = indexes.first;
51  m_params.phiIndex = indexes.second;
52 }
53 
55  m_params.view = view;
57  m_params.padIndex = PAD;
58  m_params.IxxIndex = Ixx;
59 }
60 
61 bool CMAidentity::operator==(const CMAidentity& id) const {
62  if (m_params.view == id.type() && m_params.coverage == id.coverage()) {
63  if (number() >= 0)
64  if (number() == id.number()) return true;
65 
66  if (m_params.etaIndex >= 0)
67  if (m_params.etaIndex == id.eta_index() && m_params.phiIndex == id.phi_index()) return true;
68 
69  if (m_params.padIndex >= 0)
70  if (m_params.padIndex == id.PAD_index() && m_params.IxxIndex == id.Ixx_index()) return true;
71  }
72  return false;
73 }
74 
75 bool CMAidentity::operator!=(const CMAidentity& id) const { return !(*this == id); }
76 
77 bool CMAidentity::operator<(const CMAidentity& id) const {
78  if (*this == id) return false;
79  if (m_params.view < id.type()) return true;
80  if (m_params.coverage < id.coverage()) return true;
81  int id1 = m_params.etaIndex * 10 + m_params.phiIndex;
82  int id2 = id.eta_index() * 10 + id.phi_index();
83  return id1 < id2;
84 }
85 
87  if (*this != id) return *this;
88  if (m_params.seqNumber == -1) m_params.seqNumber = id.number();
89  if (m_params.etaIndex == -1) m_params.etaIndex = id.eta_index();
90  if (m_params.phiIndex == -1) m_params.phiIndex = id.phi_index();
91  if (m_params.padIndex == -1) m_params.padIndex = id.PAD_index();
92  if (m_params.IxxIndex == -1) m_params.IxxIndex = id.Ixx_index();
93  return *this;
94 }
95 
97 
98 std::ostream& operator<<(std::ostream& stream, const CMAidentity& id) {
99  char exttag[5] = {' ', ' ', ' ', ' ', '\0'};
100  const char* tag = CMAidentity::covtag(id.m_params.coverage);
101  for (int i = 0; i < 5; ++i) {
102  if (tag[i] == '\0') break;
103  exttag[i] = tag[i];
104  }
105 
106  std::string covtag(exttag);
107 
108  std::string type = (id.type() == Phi) ? " phi cma " + covtag : " eta cma " + covtag;
109  if (!covtag.empty()) type = type + " ";
110  stream << type << std::setw(2) << id.number() << ": Eta ";
111  stream << std::setw(2) << id.eta_index();
112  stream << " Phi " << std::setw(2) << id.phi_index();
113  stream << " PAD " << std::setw(2) << id.PAD_index();
114  stream << " Ixx " << std::setw(2) << id.Ixx_index();
115  return stream;
116 }
119 int CMAidentity::number() const { return m_params.seqNumber; }
120 int CMAidentity::eta_index() const { return m_params.etaIndex; }
121 int CMAidentity::phi_index() const { return m_params.phiIndex; }
122 int CMAidentity::PAD_index() const { return m_params.padIndex; }
123 int CMAidentity::Ixx_index() const { return m_params.IxxIndex; }
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
CMAidentity.h
CMAidentity::operator!=
bool operator!=(const CMAidentity &) const
Definition: CMAidentity.cxx:75
operator<<
std::ostream & operator<<(std::ostream &stream, const CMAidentity &id)
Definition: CMAidentity.cxx:98
CMAidentity::CoverageTAG
static const char CoverageTAG[3][5]
Definition: CMAidentity.h:21
CMAidentity::type
ViewType type() const
Definition: CMAidentity.cxx:117
CMAcoverage
CMAcoverage
Definition: CMAidentity.h:14
CMAidentity::operator<
bool operator<(const CMAidentity &) const
Definition: CMAidentity.cxx:77
plotBeamSpotVxVal.cov
cov
Definition: plotBeamSpotVxVal.py:201
CMAidentity::inversion
void inversion()
Definition: CMAidentity.cxx:96
Phi
@ Phi
Definition: RPCdef.h:8
CMAidentity::CMAidentity
CMAidentity(const defineParams &pars)
Definition: CMAidentity.cxx:29
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
CMAidentity::operator+=
CMAidentity & operator+=(const CMAidentity &)
Definition: CMAidentity.cxx:86
TRT::Hit::side
@ side
Definition: HitInfo.h:83
CMAidentity::defineParams::IxxIndex
int IxxIndex
PAD index into the sector logic (start from 0)
Definition: CMAidentity.h:38
CMAidentity::name
static const std::string name(const ViewType, const CMAcoverage)
Definition: CMAidentity.cxx:23
CMAidentity::defineParams
Definition: CMAidentity.h:27
id2
HWIdentifier id2
Definition: LArRodBlockPhysicsV0.cxx:562
lumiFormat.i
int i
Definition: lumiFormat.py:85
ViewType
ViewType
Definition: RPCdef.h:8
EvenSectors
@ EvenSectors
Definition: CMAidentity.h:14
AllSectors
@ AllSectors
Definition: CMAidentity.h:14
CMAidentity::m_params
defineParams m_params
Definition: CMAidentity.h:43
createCablingJSON.eta_index
int eta_index
Definition: createCablingJSON.py:14
CMAidentity::covtag
static const char * covtag(const CMAcoverage co)
Definition: CMAidentity.h:24
CMAidentity::Ixx_index
int Ixx_index() const
Definition: CMAidentity.cxx:123
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:227
python.selection.number
number
Definition: selection.py:20
CMAidentity::eta_index
int eta_index() const
Definition: CMAidentity.cxx:120
CMAidentity::PAD_index
int PAD_index() const
Definition: CMAidentity.cxx:122
CMAidentity::defineParams::view
ViewType view
Definition: CMAidentity.h:34
CMAidentity::defineParams::coverage
CMAcoverage coverage
CMA identity params.
Definition: CMAidentity.h:33
CMAidentity
Definition: CMAidentity.h:16
CMAidentity::defineParams::etaIndex
int etaIndex
Matrix type (0 = eta matrix, 1 = phi matrix)
Definition: CMAidentity.h:35
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
CMAidentity::defineParams::phiIndex
int phiIndex
Matrix eta address (start from 0)
Definition: CMAidentity.h:36
CMAidentity::operator==
bool operator==(const CMAidentity &) const
Definition: CMAidentity.cxx:61
CMAidentity::phi_index
int phi_index() const
Definition: CMAidentity.cxx:121
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
CMAidentity::coverage
CMAcoverage coverage() const
Definition: CMAidentity.cxx:118
CMAidentity::defineParams::seqNumber
int seqNumber
Matrix index into the PAD (start from 0)
Definition: CMAidentity.h:39
CMAidentity::number
int number() const
Definition: CMAidentity.cxx:119
CMAidentity::Offline_indexes
std::pair< int, int > Offline_indexes
Definition: CMAidentity.h:18
CMAidentity::defineParams::padIndex
int padIndex
Matrix chi address (start from 0)
Definition: CMAidentity.h:37
Eta
@ Eta
Definition: RPCdef.h:8
drawFromPickle.view
view
Definition: drawFromPickle.py:294