ATLAS Offline Software
Loading...
Searching...
No Matches
CMApivotdata.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
9using namespace RPC_CondCabling;
10
11CMApivotdata::CMApivotdata(DBline& data, int type, const std::string& layout)
12 : BaseObject(Logic, "CMA Data"),
13 m_layout (layout)
14{
15 (++data)("{");
16 do {
18 parser.sectorType = type;
19 parser.station = 0;
20 if (get_data(data, parser)) {
21 if (m_view == ViewType::Eta) {
22 m_etaCMA.emplace_back(parser);
23 } else if (m_view == ViewType::Phi) {
24 if (parser.coverage == EvenSectors) {
25 m_evenphiCMA.emplace_back(parser);
26 } else if (parser.coverage == OddSectors) {
27 m_oddphiCMA.emplace_back(parser);
28 }
29 }
30 }
31 ++data;
32 } while (!data("}"));
33}
36 m_covtag.clear();
37 m_fail = true;
38}
39
41 int start = parser.pivotStartChan * 100 + parser.pivotStartStation;
42 int stop = parser.pivotStopChan * 100 + parser.pivotStopStation;
43 std::string view = (side == Phi) ? "phi" : "eta";
44
45 std::ostringstream disp;
46
47 if (!CMAidentity::coverage(m_covtag, parser.coverage)) {
48 REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "CMApivotdata")
49 << "CMA cabling error into configuration for Sector Type " << parser.sectorType << ", " << m_covtag << " " << view
50 << " CMA number " << parser.number << std::endl
51 << " coverage tag ==> " << m_covtag << " <== is not recognized!";
52 return false;
53 }
54
55 if ((side == ViewType::Eta) & start) {
56 if (start >= stop) {
57 REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "CMApivotdata")
58 << "CMA cabling error into configuration for Sector Type " << parser.sectorType << ", " << view << " CMA number "
59 << parser.number << std::endl
60 << " start position (" << parser.pivotStartChan << ":" << parser.pivotStartStation << ") is greater than stop position ("
61 << parser.pivotStopChan << ":" << parser.pivotStopStation << ")";
62 return false;
63 }
64 }
65 if (side == ViewType::Phi && start) {
66 if (start >= stop && parser.coverage == EvenSectors) {
67 REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "CMApivotdata")
68 << "CMA cabling error into configuration for Sector Type " << parser.sectorType << ", " << m_covtag << " " << view
69 << " CMA number " << parser.number << std::endl
70 << " start position (" << parser.pivotStartChan << ":" << parser.pivotStartStation << ") is greater than stop position ("
71 << parser.pivotStopChan << ":" << parser.pivotStopStation << ")";
72 return false;
73 }
74 if (start <= stop && parser.coverage == OddSectors) {
75 REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "CMApivotdata")
76 << "CMA cabling error into configuration for Sector Type " << parser.sectorType << ", " << m_covtag << " " << view
77 << " CMA number " << parser.number << std::endl
78 << " start position (" << parser.pivotStartChan << ":" << parser.pivotStartStation << ") is lower than stop position ("
79 << parser.pivotStopChan << ":" << parser.pivotStopStation << ")";
80 return false;
81 }
82 if (parser.pivotStartChan != parser.pivotStopChan) {
83 REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "CMApivotdata")
84 << "CMA cabling error into configuration for Sector Type " << parser.sectorType << ", " << m_covtag << " " << view
85 << " CMA number " << parser.number << std::endl
86 << " phi CMA Pivot connected to more than 1 wired or";
87 return false;
88 }
89 }
90 return true;
91}
92
94 reset_data();
95
96 if (data("eta matrix") >> parser.number >> ":" >> "eta" >> parser.etaIndex >> "phi" >> parser.phiIndex >> "PAD" >> parser.padIndex >>
97 "Idx" >> parser.IxxIndex >> parser.pivotStation >> parser.lowPtStation >> parser.highPtStation >> parser.pivotStartChan >> ":" >>
98 parser.pivotStartStation >> "-" >> parser.pivotStopChan >> ":" >> parser.pivotStopStation) {
99 m_view = parser.view = ViewType::Eta;
100 m_fail = false;
101 if (!confirm_data(ViewType::Eta, parser)) m_fail = true;
102 }
103
104 if (data("phi matrix") >> m_covtag >> parser.number >> ":" >> "eta" >> parser.etaIndex >> "phi" >> parser.phiIndex >> "PAD" >>
105 parser.padIndex >> "Idx" >> parser.IxxIndex >> parser.pivotStation >> parser.lowPtStation >> parser.highPtStation >>
106 parser.pivotStartChan >> ":" >> parser.pivotStartStation >> "-" >> parser.pivotStopChan >> ":" >> parser.pivotStopStation) {
107 m_view = parser.view = ViewType::Phi;
108 m_fail = false;
109 if (!confirm_data(ViewType::Phi, parser)) m_fail = true;
110 }
111
112 return !m_fail;
113}
114
115std::unique_ptr<EtaCMA> CMApivotdata::give_eta_cma() {
116 if (!m_etaCMA.empty()) {
117 std::unique_ptr<EtaCMA> CMA = std::make_unique<EtaCMA>(m_etaCMA.front());
118 m_etaCMA.pop_front();
119 return CMA;
120 }
121 return nullptr;
122}
123
124std::unique_ptr<EvenPhiCMA> CMApivotdata::give_evenphi_cma() {
125 if (!m_evenphiCMA.empty()) {
126 std::unique_ptr<EvenPhiCMA> CMA = std::make_unique<EvenPhiCMA>(m_evenphiCMA.front());
127 m_evenphiCMA.pop_front();
128 return CMA;
129 }
130 return nullptr;
131}
132
133std::unique_ptr<OddPhiCMA> CMApivotdata::give_oddphi_cma() {
134 if (!m_oddphiCMA.empty()) {
135 std::unique_ptr<OddPhiCMA> CMA = std::make_unique<OddPhiCMA>(m_oddphiCMA.front());
136 m_oddphiCMA.pop_front();
137 return CMA;
138 }
139 return nullptr;
140}
141
142void CMApivotdata::Print(std::ostream& stream, bool detail) const {
143 stream << "CMA pivot segmentation";
144
145 stream << "It contains " << m_etaCMA.size();
146 stream << " eta CMAs:" << std::endl;
147 ETAlist::const_iterator ei;
148 for (ei = m_etaCMA.begin(); ei != m_etaCMA.end(); ++ei) stream << ShowRequest<EtaCMA>(*ei, detail);
149
150 stream << "It contains " << m_evenphiCMA.size();
151 stream << "even phi CMAs:" << std::endl;
152 EvenPHIlist::const_iterator ev;
153 for (ev = m_evenphiCMA.begin(); ev != m_evenphiCMA.end(); ++ev) stream << ShowRequest<EvenPhiCMA>(*ev, detail);
154
155 stream << "It contains " << m_oddphiCMA.size();
156 stream << "odd phi CMAs:" << std::endl;
157 OddPHIlist::const_iterator od;
158 for (od = m_oddphiCMA.begin(); od != m_oddphiCMA.end(); ++od) stream << ShowRequest<OddPhiCMA>(*od, detail);
159}
@ Logic
Definition BaseObject.h:11
@ OddSectors
Definition CMAidentity.h:14
@ EvenSectors
Definition CMAidentity.h:14
Helpers for checking error return status codes and reporting errors.
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
ViewType
Definition RPCdef.h:8
@ Phi
Definition RPCdef.h:8
@ Eta
Definition RPCdef.h:8
@ NoView
Definition RPCdef.h:8
BaseObject(ObjectType, const std::string &)
Definition BaseObject.cxx:7
static bool coverage(const std::string &, CMAcoverage &)
std::unique_ptr< EtaCMA > give_eta_cma()
CMApivotdata(DBline &, int, const std::string &)
std::unique_ptr< EvenPhiCMA > give_evenphi_cma()
bool confirm_data(ViewType, CMAparameters::parseParams &parser)
virtual void Print(std::ostream &, bool) const override
bool get_data(DBline &, CMAparameters::parseParams &parser)
std::unique_ptr< OddPhiCMA > give_oddphi_cma()
int ev
Definition globals.cxx:25