ATLAS Offline Software
CMAcablingdata.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 
8 
9 using namespace RPC_CondCabling;
10 
12  (++data)("{");
13  do {
15  parser.sectorType = type;
16  if (get_data(data, parser)) {
17  if (m_view == ViewType::Eta) { m_etaCMA.emplace_back(parser); }
18  }
19  ++data;
20  } while (!data("}"));
21 }
22 
24 
26  unsigned int div = 247;
27  std::string view = (side == ViewType::Phi) ? "phi" : "eta";
28 
29  std::ostringstream disp;
30 
31  bool have_low_Pt_input = (parser.lowPtNumCo != -1);
32  bool have_high_Pt_input = (parser.highPtNumCo != -1);
33 
34  if (side == Eta) {
35  if (parser.lowPtStartCo >= parser.lowPtStopCo && have_low_Pt_input) {
36  REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "CMAcablingdata")
37  << "CMA cabling error in CONF data for Sector Type " << parser.sectorType << ", " << view
38  << " CMA at eta = " << parser.etaIndex << ", phi = " << parser.phiIndex << std::endl
39  << " start position for low Pt cabling (" << parser.lowPtStartCo << ") is greater than stop position ("
40  << parser.lowPtStopCo;
41  return false;
42  }
43  if (parser.lowPtStopCo - parser.lowPtStartCo + 1 != parser.lowPtNumCo && have_low_Pt_input) {
44  REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "CMAcablingdata")
45  << "CMA cabling error in CONF data for Sector Type " << parser.sectorType << ", " << view
46  << " CMA at eta = " << parser.etaIndex << ", phi = " << parser.phiIndex << std::endl
47  << " cabling inconsistence for low Pt <" << parser.lowPtNumCo << ", " << parser.lowPtStartCo << " " << (char)div << " "
48  << parser.lowPtStopCo << ">";
49  return false;
50  }
51 
52  if (parser.highPtStartCo >= parser.highPtStopCo && have_high_Pt_input) {
53  REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "CMAcablingdata")
54  << "CMA cabling error in CONF data for Sector Type " << parser.sectorType << ", " << view
55  << " CMA at eta = " << parser.etaIndex << ", phi = " << parser.phiIndex << std::endl
56  << " start position for high Pt cabling (" << parser.highPtStartCo << ") is greater than stop position ("
57  << parser.highPtStopCo;
58  return false;
59  }
60  if (parser.highPtStopCo - parser.highPtStartCo + 1 != parser.highPtNumCo && have_high_Pt_input) {
61  REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "CMAcablingdata")
62  << "CMA cabling error in CONF data for Sector Type " << parser.sectorType << ", " << view
63  << " CMA at eta = " << parser.etaIndex << ", phi = " << parser.phiIndex << std::endl
64  << " cabling inconsistence for high Pt <" << parser.highPtNumCo << ", " << parser.highPtStartCo << " " << (char)div << " "
65  << parser.highPtStopCo << ">";
66  return false;
67  }
68  }
69 
70  return true;
71 }
72 
74  reset_data();
75 
76  if (data("eta matrix") >> "eta" >> parser.etaIndex >> "phi" >> parser.phiIndex >> ":" >> "low Pt" >> parser.lowPtNumCo >> "," >>
77  parser.lowPtStartCo >> "-" >> parser.lowPtStopCo >> "high Pt" >> parser.highPtNumCo >> "," >> parser.highPtStartCo >> "-" >>
78  parser.highPtStopCo) {
79  if (parser.lowPtNumCo == 0) {
80  parser.lowPtNumCo = -1;
81  parser.lowPtStartCo = -1;
82  parser.lowPtStopCo = -1;
83  }
84  if (parser.highPtNumCo == 0) {
85  parser.highPtNumCo = -1;
86  parser.highPtStartCo = -1;
87  parser.highPtStopCo = -1;
88  }
89  m_view = parser.view = ViewType::Eta;
90  m_fail = false;
91  if (!confirm_data(Eta, parser)) m_fail = true;
92  }
93 
94  return !m_fail;
95 }
96 
97 std::unique_ptr<EtaCMA> CMAcablingdata::give_eta_cma() {
98  if (!m_etaCMA.empty()) {
99  std::unique_ptr<EtaCMA> CMA = std::make_unique<EtaCMA>(m_etaCMA.front());
100  m_etaCMA.pop_front();
101  return CMA;
102  }
103  return nullptr;
104 }
105 
106 void CMAcablingdata::Print(std::ostream& stream, bool detail) const {
107  stream << "CMA cabling data ";
108 
109  stream << "It contains " << m_etaCMA.size();
110  stream << " eta CMAs:" << std::endl;
111  ETAlist::const_iterator ei;
112  for (ei = m_etaCMA.begin(); ei != m_etaCMA.end(); ++ei) stream << ShowRequest<EtaCMA>(*ei, detail);
113 }
python.CaloScaleNoiseConfig.parser
parser
Definition: CaloScaleNoiseConfig.py:75
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
RPC_CondCabling::CMAcablingdata::m_fail
bool m_fail
Definition: CMAcablingdata.h:24
RPC_CondCabling::CMAcablingdata::m_etaCMA
ETAlist m_etaCMA
Definition: CMAcablingdata.h:29
xAOD::char
char
Definition: TrigDecision_v1.cxx:38
RPC_CondCabling::CMAcablingdata::CMAcablingdata
CMAcablingdata(DBline &, int)
Definition: CMAcablingdata.cxx:11
RPC_CondCabling::CMAcablingdata::get_data
bool get_data(DBline &, CMAparameters::parseParams &params)
Definition: CMAcablingdata.cxx:73
detail
Definition: extract_histogram_tag.cxx:14
Phi
@ Phi
Definition: RPCdef.h:8
RPC_CondCabling
Definition: CMAcablingdata.h:18
Logic
@ Logic
Definition: BaseObject.h:11
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
RPC_CondCabling::CMAcablingdata::m_view
ViewType m_view
Definition: CMAcablingdata.h:26
TRT::Hit::side
@ side
Definition: HitInfo.h:83
RPC_CondCabling::CMAcablingdata::confirm_data
bool confirm_data(ViewType, const CMAparameters::parseParams &parser)
Definition: CMAcablingdata.cxx:25
RPC_CondCabling::CMAcablingdata::give_eta_cma
std::unique_ptr< EtaCMA > give_eta_cma()
Definition: CMAcablingdata.cxx:97
ViewType
ViewType
Definition: RPCdef.h:8
RPC_CondCabling::CMAcablingdata::reset_data
void reset_data(void)
Definition: CMAcablingdata.cxx:23
REPORT_MESSAGE_WITH_CONTEXT
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:345
BaseObject
Definition: BaseObject.h:13
errorcheck.h
Helpers for checking error return status codes and reporting errors.
CMAparameters::parseParams
Definition: CMAparameters.h:51
DBline
Definition: dbline.h:255
CMAcablingdata.h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
RPC_CondCabling::CMAcablingdata::Print
virtual void Print(std::ostream &, bool) const override
Definition: CMAcablingdata.cxx:106
Eta
@ Eta
Definition: RPCdef.h:8
drawFromPickle.view
view
Definition: drawFromPickle.py:294