40 void endJob()
override;
51 std::map<l1t::demo::LinkId, std::vector<ap_uint<64>>>
linkData_;
55 template <
typename T, std::
size_t N>
56 static std::array<T, N>
convert(std::vector<T> vec,
const char*
name) {
57 if (vec.size() !=
N) {
59 <<
"The parameter '" <<
name <<
"' should have " <<
N <<
" elements, but has " << vec.size()
60 <<
" elements in the configuration.\n";
63 std::copy_n(std::make_move_iterator(vec.begin()),
N,
a.begin());
69 maxEvents_(
config.getUntrackedParameter<unsigned
int>(
"maxEvents")),
76 channelFinOr_(
config.getUntrackedParameter<unsigned
int>(
"channelFinOr")),
83 config.getUntrackedParameter<unsigned
int>(
"maxFrames"),
118 auto algoBlockIt = algoBlocks.begin();
134 for (std::size_t
idx = 0;
idx < 64 && algoBlockIt != algoBlocks.end();
idx++, algoBlockIt++) {
135 auto& [alogName, algoBlock] = *algoBlockIt;
137 idx, algoBlock.decisionBeforeBxMaskAndPrescale());
139 idx, algoBlock.decisionBeforePrescale());
141 algoBlock.decisionFinal());
146 for (std::size_t
idx = 0;
idx < 64 && algoBlockIt != algoBlocks.end();
idx++, algoBlockIt++) {
147 auto& [alogName, algoBlock] = *algoBlockIt;
149 idx, algoBlock.decisionBeforeBxMaskAndPrescale());
151 idx, algoBlock.decisionBeforePrescale());
153 algoBlock.decisionFinal());
158 for (std::size_t
idx = 0;
idx < 64 && algoBlockIt != algoBlocks.end();
idx++, algoBlockIt++) {
159 auto& [
algoName, algoBlock] = *algoBlockIt;
161 idx, algoBlock.decisionBeforeBxMaskAndPrescale());
163 idx, algoBlock.decisionBeforePrescale());
165 idx, algoBlock.decisionFinal());
169 bool vetoed =
false, vetoedPreview =
false;
170 int finOrByTypes = 0, finOrPreviewByTypes = 0;
171 for (
auto algoBlockIt = algoBlocks.begin(); algoBlockIt != algoBlocks.end(); algoBlockIt++) {
172 auto& [alogName, algoBlock] = *algoBlockIt;
173 vetoed |= (algoBlock.isVeto() && algoBlock.decisionFinal());
174 vetoedPreview |= (algoBlock.isVeto() && algoBlock.decisionFinalPreview());
175 finOrByTypes |= algoBlock.decisionFinal() ? algoBlock.triggerTypes() : 0;
176 finOrPreviewByTypes |= algoBlock.decisionFinalPreview() ? algoBlock.triggerTypes() : 0;
180 ap_uint<64> finOrBits(0);
181 finOrBits(7, 0) = finOrByTypes;
182 finOrBits(15, 8) = finOrPreviewByTypes;
183 finOrBits(23, 16) = vetoed ? 0 : finOrByTypes;
184 finOrBits(31, 24) = vetoedPreview ? 0 : finOrPreviewByTypes;
215 desc.addUntracked<std::vector<unsigned int>>(
"channelsLow");
216 desc.addUntracked<std::vector<unsigned int>>(
"channelsMid");
217 desc.addUntracked<std::vector<unsigned int>>(
"channelsHigh");
218 desc.addUntracked<
unsigned int>(
"channelFinOr");
219 desc.addUntracked<
unsigned int>(
"maxFrames", 1024);
220 desc.addUntracked<
unsigned int>(
"maxEvents", 0);
static std::array< T, N > convert(std::vector< T > vec, const char *name)
std::map< l1t::demo::LinkId, std::vector< ap_uint< 64 > > > linkData_
Logical ID for link within any given time slice (e.g. ["tracks", 0] -> ["tracks", 17] for links from ...
L1GTFinOrBoardWriter(const edm::ParameterSet &)
void addEvent(const EventData &data)
std::map< std::string, P2GTAlgoBlock > P2GTAlgoBlockMap
FileFormat parseFileFormat(const std::string &)
const std::array< unsigned int, 3 > channelsMid_
const unsigned int maxEvents_
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
void analyze(const edm::Event &, const edm::EventSetup &) override
const edm::EDGetTokenT< P2GTAlgoBlockMap > algoBlocksToken_
void addDefault(ParameterSetDescription const &psetDescription)
#define DEFINE_FWK_MODULE(type)
std::map< LinkId, std::pair< ChannelSpec, std::vector< size_t > > > ChannelMap_t
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
unsigned int eventCounter_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const unsigned int channelFinOr_
Class representing information phase-2 ATCA I/O data corresponding to a single event, with logical channel IDs (essentially string-uint pairs, e.g. tracks-0 to tracks-17).
const std::array< unsigned int, 3 > channelsHigh_
const std::array< unsigned int, 3 > channelsLow_
l1t::demo::BoardDataWriter boardDataWriter_