46 std::vector<ap_uint<64>>
encodeSums(
const std::vector<l1t::EtSum> sums,
unsigned nSums);
57 nFramesPerBX_(iConfig.getParameter<unsigned>(
"nFramesPerBX")),
58 ctl2BoardTMUX_(iConfig.getParameter<unsigned>(
"TMUX")),
59 gapLengthOutput_(iConfig.getParameter<unsigned>(
"gapLengthOutput")),
60 maxLinesPerFile_(iConfig.getParameter<unsigned>(
"maxLinesPerFile")),
63 iConfig.getParameter<
std::string>(
"outputFilename"),
64 iConfig.getParameter<
std::string>(
"outputFileExtension"),
68 channelSpecsOutputToGT_) {
69 for (
const auto&
pset : collections_) {
72 unsigned nJets =
pset.getParameter<
unsigned>(
"nJets");
73 unsigned nSums =
pset.getParameter<
unsigned>(
"nSums");
74 nJets_.push_back(
nJets);
75 nSums_.push_back(
nSums);
76 bool writeJetToken(
false), writeMhtToken(
false);
82 mhtToken = consumes<edm::View<l1t::EtSum>>(
pset.getParameter<
edm::InputTag>(
"mht"));
86 tokensToWrite_.emplace_back(writeJetToken, writeMhtToken);
94 std::vector<ap_uint<64>> link_words;
95 for (
unsigned iCollection = 0; iCollection <
collections_.size(); iCollection++) {
100 std::vector<l1t::PFJet> sortedJets;
101 sortedJets.reserve(
jets.size());
107 link_words.insert(link_words.end(), outputJets.begin(), outputJets.end());
112 const auto& mhtToken =
tokens_.at(iCollection).second;
114 std::vector<l1t::EtSum> orderedSums;
117 link_words.insert(link_words.end(), outputSums.begin(), outputSums.end());
122 eventDataJets.
add({
"jets", 0}, link_words);
134 std::vector<ap_uint<64>> jet_words(2 *
nJets, 0);
137 jet_words[2 *
i] =
j.encodedJet()[0];
138 jet_words[2 *
i + 1] =
j.encodedJet()[1];
145 std::vector<ap_uint<64>> sum_words;
146 for (
unsigned i = 0;
i <
nSums;
i++) {
147 if (2 *
i < sums.size()) {
150 gtSum.
vector_pt.V = sums.at(2 *
i + 1).hwPt();
153 sum_words.push_back(gtSum.
pack_ap());
155 sum_words.push_back(0);
170 desc.addVPSet(
"collections", vpsd1);
174 desc.add<uint32_t>(
"nJets", 12);
175 desc.add<uint32_t>(
"nFramesPerBX", 9);
176 desc.add<uint32_t>(
"gapLengthOutput", 4);
177 desc.add<uint32_t>(
"TMUX", 6);
178 desc.add<uint32_t>(
"maxLinesPerFile", 1024);
std::map< l1t::demo::LinkId, std::pair< l1t::demo::ChannelSpec, std::vector< size_t > > > channelSpecsOutputToGT_
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
std::vector< std::pair< bool, bool > > tokensToWrite_
std::vector< std::pair< edm::EDGetTokenT< edm::View< l1t::PFJet > >, edm::EDGetTokenT< edm::View< l1t::EtSum > > > > tokens_
void addEvent(const EventData &data)
FileFormat parseFileFormat(const std::string &)
void add(const LinkId &, const std::vector< ap_uint< 64 >> &)
static constexpr int nJets
std::vector< ap_uint< 64 > > encodeSums(const std::vector< l1t::EtSum > sums, unsigned nSums)
L1CTJetFileWriter(const edm::ParameterSet &)
void addDefault(ParameterSetDescription const &psetDescription)
l1t::demo::BoardDataWriter fileWriterOutputToGT_
#define DEFINE_FWK_MODULE(type)
ap_uint< BITWIDTH > pack_ap() const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::vector< ap_uint< 64 > > encodeJets(const std::vector< l1t::PFJet > jets, unsigned nJets)
void analyze(const edm::Event &, const edm::EventSetup &) override
std::vector< unsigned > nSums_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< unsigned > nJets_
std::vector< edm::EDGetTokenT< int > > tokens_
std::vector< edm::ParameterSet > collections_
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).