2 Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
5 // tdaq-common includes for CTP format definition
6 //#include "CTPfragment/CTPdataformat.h"
7 #include "CTPfragment/CTPdataformatVersion.h"
13 // inline implementations for CTPResult class
15 inline const ROIB::Header& ROIB::CTPResult::header() const {
16 return m_CTPResultHeader;
19 inline const ROIB::Trailer& ROIB::CTPResult::trailer() const {
20 return m_CTPResultTrailer;
23 inline const std::vector<ROIB::CTPRoI>& ROIB::CTPResult::roIVec() const {
24 return m_CTPResultRoIVec;
27 inline bool ROIB::CTPResult::isValid() const {
28 return (m_CTPResultHeader.size() != 0 && m_CTPResultTrailer.size() != 0);
31 inline bool ROIB::CTPResult::isComplete() const {
32 return isValid() && m_CTPResultRoIVec.size() >= (m_ctpDataformat.getNumberTimeWords() +
33 ((m_useRoIB) ? m_ctpDataformat.getRoIBwordsPerBunch():m_ctpDataformat.getDAQwordsPerBunch()));
36 inline const std::vector<ROIB::CTPRoI> ROIB::CTPResult::TBP() const {
37 // adding some safety protection by restriction index range
38 return std::vector<ROIB::CTPRoI>(m_CTPResultRoIVec.begin() +
39 std::min(m_CTPResultRoIVec.size(),
40 static_cast<size_t>(((m_useRoIB) ? m_ctpDataformat.getRoIBTBPpos():m_l1aBunch*m_ctpDataformat.getDAQwordsPerBunch()+m_ctpDataformat.getTBPpos()))),
41 m_CTPResultRoIVec.begin() +
42 std::min(m_CTPResultRoIVec.size(),
43 static_cast<size_t>(((m_useRoIB) ? m_ctpDataformat.getRoIBTBPpos():m_l1aBunch*m_ctpDataformat.getDAQwordsPerBunch()+m_ctpDataformat.getTBPpos())+m_ctpDataformat.getTBPwords())));
46 inline const std::vector<ROIB::CTPRoI> ROIB::CTPResult::TAP() const {
47 // adding some safety protection by restriction index range
48 return std::vector<ROIB::CTPRoI>(m_CTPResultRoIVec.begin() +
49 std::min(m_CTPResultRoIVec.size(), static_cast<size_t>(m_l1aBunch*m_ctpDataformat.getDAQwordsPerBunch() + m_ctpDataformat.getTAPpos())),
50 m_CTPResultRoIVec.begin() +
51 std::min(m_CTPResultRoIVec.size(), static_cast<size_t>(m_ctpDataformat.getTAPpos()+((m_useRoIB) ? m_ctpDataformat.getRoIBTAPwords():m_l1aBunch*m_ctpDataformat.getDAQwordsPerBunch()+m_ctpDataformat.getTAPwords()))));
54 inline const std::vector<ROIB::CTPRoI> ROIB::CTPResult::TAV() const {
55 // adding some safety protection by restriction index range
56 return std::vector<ROIB::CTPRoI>(m_CTPResultRoIVec.begin() +
57 std::min(m_CTPResultRoIVec.size(), static_cast<size_t>(((m_useRoIB) ? m_ctpDataformat.getRoIBTAVpos():m_l1aBunch*m_ctpDataformat.getDAQwordsPerBunch()+m_ctpDataformat.getTAVpos()))),
58 m_CTPResultRoIVec.begin() +
59 std::min(m_CTPResultRoIVec.size(), static_cast<size_t>(((m_useRoIB) ? m_ctpDataformat.getRoIBTAVpos():m_l1aBunch*m_ctpDataformat.getDAQwordsPerBunch()+m_ctpDataformat.getTAVpos())+ m_ctpDataformat.getTAVwords())));
62 inline bool ROIB::CTPResult::acceptBP() const {
63 // adding some safety protection by restriction index range
65 for (size_t i(std::min(m_CTPResultRoIVec.size(),static_cast<size_t>(((m_useRoIB) ? m_ctpDataformat.getRoIBTBPpos():m_l1aBunch*m_ctpDataformat.getDAQwordsPerBunch()+m_ctpDataformat.getTBPpos()))));
66 i < std::min(m_CTPResultRoIVec.size(),
67 static_cast<size_t>(((m_useRoIB) ? m_ctpDataformat.getRoIBTBPpos():m_l1aBunch*m_ctpDataformat.getDAQwordsPerBunch()+m_ctpDataformat.getTBPpos())+m_ctpDataformat.getTBPwords()));
69 if (m_CTPResultRoIVec[i].roIWord() != 0) return true;
75 inline bool ROIB::CTPResult::acceptAP() const {
76 // adding some safety protection by restriction index range
78 for (size_t i(std::min(m_CTPResultRoIVec.size(), static_cast<size_t>(m_l1aBunch*m_ctpDataformat.getDAQwordsPerBunch()+m_ctpDataformat.getTAPpos())));
79 i < std::min(m_CTPResultRoIVec.size(),
80 static_cast<size_t>(m_l1aBunch*m_ctpDataformat.getDAQwordsPerBunch()+m_ctpDataformat.getTAPpos()+((m_useRoIB) ? m_ctpDataformat.getRoIBTAPwords():m_ctpDataformat.getTAPwords())));
82 if (m_CTPResultRoIVec[i].roIWord() != 0) return true;
88 inline bool ROIB::CTPResult::acceptAV() const {
89 // adding some safety protection by restriction index range
91 for (size_t i(std::min(m_CTPResultRoIVec.size(),
92 static_cast<size_t>(((m_useRoIB) ? m_ctpDataformat.getRoIBTAVpos():m_l1aBunch*m_ctpDataformat.getDAQwordsPerBunch()+m_ctpDataformat.getTAVpos()))));
93 i < std::min(m_CTPResultRoIVec.size(),
94 static_cast<size_t>(((m_useRoIB) ? m_ctpDataformat.getRoIBTAVpos():m_l1aBunch*m_ctpDataformat.getDAQwordsPerBunch()+m_ctpDataformat.getTAVpos())+m_ctpDataformat.getTAVwords()));
96 if (m_CTPResultRoIVec[i].roIWord() != 0) return true;