ATLAS Offline Software
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 
9 using namespace RPC_CondCabling;
10 
11 CMApivotdata::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 
115 std::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 
124 std::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 
133 std::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 
142 void 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 }
python.CaloScaleNoiseConfig.parser
parser
Definition: CaloScaleNoiseConfig.py:75
OddSectors
@ OddSectors
Definition: CMAidentity.h:14
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
RPC_CondCabling::CMApivotdata::give_oddphi_cma
std::unique_ptr< OddPhiCMA > give_oddphi_cma()
Definition: CMApivotdata.cxx:133
RPC_CondCabling::CMApivotdata::m_covtag
std::string m_covtag
Definition: CMApivotdata.h:31
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
CMApivotdata.h
detail
Definition: extract_histogram_tag.cxx:14
Phi
@ Phi
Definition: RPCdef.h:8
PixelModuleFeMask_create_db.stop
int stop
Definition: PixelModuleFeMask_create_db.py:76
RPC_CondCabling
Definition: CMAcablingdata.h:18
RPC_CondCabling::CMApivotdata::CMApivotdata
CMApivotdata(DBline &, int, const std::string &)
Definition: CMApivotdata.cxx:11
Logic
@ Logic
Definition: BaseObject.h:11
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
RPC_CondCabling::CMApivotdata::Print
virtual void Print(std::ostream &, bool) const override
Definition: CMApivotdata.cxx:142
TRT::Hit::side
@ side
Definition: HitInfo.h:83
ev
int ev
Definition: globals.cxx:25
RPC_CondCabling::CMApivotdata::m_etaCMA
ETAlist m_etaCMA
Definition: CMApivotdata.h:33
ViewType
ViewType
Definition: RPCdef.h:8
EvenSectors
@ EvenSectors
Definition: CMAidentity.h:14
RPC_CondCabling::CMApivotdata::m_evenphiCMA
EvenPHIlist m_evenphiCMA
Definition: CMApivotdata.h:34
RPC_CondCabling::CMApivotdata::m_oddphiCMA
OddPHIlist m_oddphiCMA
Definition: CMApivotdata.h:35
RPC_CondCabling::CMApivotdata::give_eta_cma
std::unique_ptr< EtaCMA > give_eta_cma()
Definition: CMApivotdata.cxx:115
RPC_CondCabling::CMApivotdata::confirm_data
bool confirm_data(ViewType, CMAparameters::parseParams &parser)
Definition: CMApivotdata.cxx:40
RPC_CondCabling::CMApivotdata::reset_data
void reset_data(void)
Definition: CMApivotdata.cxx:34
NoView
@ NoView
Definition: RPCdef.h:8
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
RPC_CondCabling::CMApivotdata::m_fail
bool m_fail
Definition: CMApivotdata.h:26
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
RPC_CondCabling::CMApivotdata::give_evenphi_cma
std::unique_ptr< EvenPhiCMA > give_evenphi_cma()
Definition: CMApivotdata.cxx:124
CMAidentity::coverage
CMAcoverage coverage() const
Definition: CMAidentity.cxx:118
RPC_CondCabling::CMApivotdata::get_data
bool get_data(DBline &, CMAparameters::parseParams &parser)
Definition: CMApivotdata.cxx:93
Eta
@ Eta
Definition: RPCdef.h:8
RPC_CondCabling::CMApivotdata::m_view
ViewType m_view
Definition: CMApivotdata.h:30
drawFromPickle.view
view
Definition: drawFromPickle.py:294