9 #include "GaudiKernel/IInterface.h"
10 #include "GaudiKernel/MsgStream.h"
11 #include "GaudiKernel/StatusCode.h"
23 bool hasEnding(std::string
const &fullString, std::string
const &ending) {
24 if (fullString.length() >= ending.length()) {
25 return (0 == fullString.compare (fullString.length() - ending.length(), ending.length(), ending));
37 static const InterfaceID IID_IRodHeaderByteStreamTool(
"RodHeaderByteStreamTool", 1, 1);
41 return IID_IRodHeaderByteStreamTool;
47 const std::string&
name,
50 m_robDataProvider(
"ROBDataProviderSvc",
name),
51 m_errorTool(
"LVL1BS::L1CaloErrorByteStreamTool/L1CaloErrorByteStreamTool")
53 declareInterface<RodHeaderByteStreamTool>(
this);
56 "Tool to collect errors for monitoring");
58 "ROB fragment source identifiers - All except RoIB");
60 "ROB fragment source identifiers - PP only");
62 "ROB fragment source identifiers - CP DAQ only");
64 "ROB fragment source identifiers - JEP DAQ only");
66 "ROB fragment source identifiers - CP RoI only");
68 "ROB fragment source identifiers - JEP RoI only");
70 "ROB fragment source identifiers - CP RoIB only");
72 "ROB fragment source identifiers - JEP RoIB only");
90 return StatusCode::SUCCESS;
97 return StatusCode::SUCCESS;
104 const std::string& sgKey,
107 const std::vector<uint32_t>& vID(
sourceIDs(sgKey));
111 ATH_MSG_DEBUG(
"Number of ROB fragments:" << robFrags.size());
112 return convert(robFrags, rhCollection);
125 std::set<uint32_t> dupCheck;
128 for (; rob != robEnd; ++rob) {
132 msg() <<
"Treating ROB fragment " << robCount <<
endmsg;
137 uint32_t robid = (*rob)->source_id();
138 if ((*rob)->nstatus() > 0) {
140 (*rob)->status(robData);
143 if (
debug)
msg() <<
"ROB status error - skipping fragment" <<
endmsg;
150 if (!dupCheck.insert(robid).second) {
159 const uint32_t sourceId = (*rob)->rod_source_id();
161 const uint32_t lvl1Id = (*rob)->rod_lvl1_id();
163 const uint32_t trigType = (*rob)->rod_lvl1_trigger_type();
164 const uint32_t detType = (*rob)->rod_detev_type();
165 const uint32_t nData = (*rob)->rod_ndata();
169 std::vector<uint32_t> statusWords;
170 unsigned int nstatus = (*rob)->rod_nstatus();
174 (*rob)->rod_status(
status);
175 statusEnd =
status + nstatus;
185 bcId, trigType, detType, statusWords, nData));
188 <<
"ROD Header version/sourceId/run/lvl1Id/bcId/trigType/detType/nData: "
189 <<
version <<
"/" << sourceId <<
"/" <<
run <<
"/" << lvl1Id <<
"/"
190 <<
bcId <<
"/" << trigType <<
"/" << detType <<
"/" << nData
191 <<
endmsg <<
"ROD Status Words:";
192 std::vector<uint32_t>::const_iterator
pos = statusWords.begin();
193 std::vector<uint32_t>::const_iterator pose = statusWords.end();
199 return StatusCode::SUCCESS;
205 const std::string& sgKey)
const
208 static const std::vector<int> slinksPP { 0, 1, 2, 3 };
209 static const std::vector<uint32_t> sourceIDsPP =
210 makeRobIds(8, 0, slinksPP, 0, eformat::TDAQ_CALO_PREPROC,
216 static const std::vector<int> slinksCP { 0, 2 };
217 static const std::vector<uint32_t> sourceIDsCP =
218 makeRobIds(4, 8, slinksCP, 0, eformat::TDAQ_CALO_CLUSTER_PROC_DAQ,
224 static const std::vector<int> slinksCPRoI { 0 };
225 static const std::vector<uint32_t> sourceIDsCPRoI =
226 makeRobIds(4, 8, slinksCPRoI, 1, eformat::TDAQ_CALO_CLUSTER_PROC_ROI,
228 return sourceIDsCPRoI;
232 static const std::vector<int> slinksJEP { 0, 1, 2, 3 };
233 static const std::vector<uint32_t> sourceIDsJEP =
234 makeRobIds(2, 12, slinksJEP, 0, eformat::TDAQ_CALO_JET_PROC_DAQ,
240 static const std::vector<int> slinksJEPRoI { 0 };
241 static const std::vector<uint32_t> sourceIDsJEPRoI =
242 makeRobIds(2, 12, slinksJEPRoI, 1, eformat::TDAQ_CALO_JET_PROC_ROI,
244 return sourceIDsJEPRoI;
248 static const std::vector<int> slinksCPRoIB { 2 };
249 static const std::vector<uint32_t> sourceIDsCPRoIB =
250 makeRobIds(4, 8, slinksCPRoIB, 1, eformat::TDAQ_CALO_CLUSTER_PROC_ROI,
252 return sourceIDsCPRoIB;
256 static const std::vector<int> slinksJEPRoIB { 2 };
257 static const std::vector<uint32_t> sourceIDsJEPRoIB =
258 makeRobIds(2, 12, slinksJEPRoIB, 1, eformat::TDAQ_CALO_JET_PROC_ROI,
260 return sourceIDsJEPRoIB;
272 std::vector<uint32_t> robIds;
274 auto append = [&robIds] (
const std::vector<uint32_t>&
v)
275 { robIds.insert (robIds.end(),
v.begin(),
v.end()); };
289 const int crateOffset,
290 const std::vector<int>& slinks,
292 const eformat::SubDetector subdet,
293 const std::vector<uint32_t>& prop)
const
295 std::vector<uint32_t>
robs;
301 for (
int crate = 0; crate < numCrates; ++crate) {
302 const int numSlinks = slinks.size();
303 for (
int i = 0;
i < numSlinks; ++
i) {
305 slinks[
i], daqOrRoi, subdet);
307 robs.push_back (robId);
317 const std::string&
flag)
const
320 return ::hasEnding(sgKey,
flag) || ::hasEnding(sgKey,
flag +
"Aux.");