24 #include <unordered_map> 45 return std::max<int>(0,
47 std::normal_distribution<double>(0, 500)(randomGenerator_));
58 void writeInputPatterns(
61 void endJob()
override;
67 template <
typename T, std::
size_t low, std::
size_t high, std::
size_t incr = 1>
78 template <
typename T, std::
size_t low, std::
size_t high, std::
size_t incr = 1>
85 {{
"GTT", 0}, {{6, 0}, vrange<std::size_t, 0, 6>()}},
86 {{
"GTT", 1}, {{6, 0}, vrange<std::size_t, 6, 12>()}},
87 {{
"CL2", 0}, {{6, 0}, vrange<std::size_t, 28, 34>()}},
88 {{
"CL2", 1}, {{6, 0}, vrange<std::size_t, 34, 40>()}},
89 {{
"GCT", 0}, {{6, 0}, vrange<std::size_t, 54, 60>()}},
90 {{
"GMT", 0}, {{18, 0}, vrange<std::size_t, 60, 78>()}},
91 {{
"CL2", 2}, {{6, 0}, vrange<std::size_t, 80, 86>()}},
92 {{
"GTT", 2}, {{6, 0}, vrange<std::size_t, 104, 110>()}},
93 {{
"GTT", 3}, {{6, 0}, vrange<std::size_t, 110, 116>()}}};
96 {{
"GTT", 0}, {{6, 0}, vrange<std::size_t, 0, 6>()}},
97 {{
"GTT", 1}, {{6, 0}, vrange<std::size_t, 6, 12>()}},
98 {{
"GCT", 0}, {{6, 0}, vrange<std::size_t, 24, 30>()}},
99 {{
"CL2", 0}, {{6, 0}, vrange<std::size_t, 32, 38>()}},
100 {{
"CL2", 1}, {{6, 0}, vrange<std::size_t, 38, 44>()}},
101 {{
"GMT", 0}, {{18, 0}, {48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 68, 69, 70, 71, 72, 73}}},
102 {{
"CL2", 2}, {{6, 0}, vrange<std::size_t, 80, 86>()}},
103 {{
"GTT", 2}, {{6, 0}, vrange<std::size_t, 112, 118>()}},
104 {{
"GTT", 3}, {{6, 0}, vrange<std::size_t, 118, 124>()}}};
107 : randomGenerator_(
config.exists(
"random_seed") ?
config.getParameter<unsigned
int>(
"random_seed")
108 :
std::random_device()()),
114 config.getParameter<unsigned
int>(
"maxLines"),
116 produces<P2GTCandidateCollection>(
"GCTNonIsoEg");
117 produces<P2GTCandidateCollection>(
"GCTIsoEg");
118 produces<P2GTCandidateCollection>(
"GCTJets");
119 produces<P2GTCandidateCollection>(
"GCTTaus");
120 produces<P2GTCandidateCollection>(
"GCTHtSum");
121 produces<P2GTCandidateCollection>(
"GCTEtSum");
122 produces<P2GTCandidateCollection>(
"GMTSaPromptMuons");
123 produces<P2GTCandidateCollection>(
"GMTSaDisplacedMuons");
124 produces<P2GTCandidateCollection>(
"GMTTkMuons");
125 produces<P2GTCandidateCollection>(
"GMTTopo");
126 produces<P2GTCandidateCollection>(
"GTTPromptJets");
127 produces<P2GTCandidateCollection>(
"GTTDisplacedJets");
128 produces<P2GTCandidateCollection>(
"GTTPhiCandidates");
129 produces<P2GTCandidateCollection>(
"GTTRhoCandidates");
130 produces<P2GTCandidateCollection>(
"GTTBsCandidates");
131 produces<P2GTCandidateCollection>(
"GTTHadronicTaus");
132 produces<P2GTCandidateCollection>(
"GTTPrimaryVert");
133 produces<P2GTCandidateCollection>(
"GTTPromptHtSum");
134 produces<P2GTCandidateCollection>(
"GTTDisplacedHtSum");
135 produces<P2GTCandidateCollection>(
"GTTEtSum");
136 produces<P2GTCandidateCollection>(
"CL2Jets");
137 produces<P2GTCandidateCollection>(
"CL2Taus");
138 produces<P2GTCandidateCollection>(
"CL2Electrons");
139 produces<P2GTCandidateCollection>(
"CL2Photons");
140 produces<P2GTCandidateCollection>(
"CL2HtSum");
141 produces<P2GTCandidateCollection>(
"CL2EtSum");
146 desc.addOptional<
unsigned int>(
"random_seed");
147 desc.add<
unsigned int>(
"maxLines", 1024);
152 edm::allowedValues<std::string>(
"VU9P",
"VU13P"));
167 template <
typename...
Args>
168 static std::vector<ap_uint<64>>
vpack(
const Args &...vobjects) {
169 std::vector<ap_uint<64>> vpacked;
172 [&vpacked](
const std::vector<std::unique_ptr<l1t::L1TGT_BaseInterface>> &
objects) {
173 std::optional<ap_uint<64>> next_packed;
174 for (
const auto &
object :
objects) {
175 if (
object->packed_width() == 64) {
177 vpacked.emplace_back(interface_obj.
pack());
178 }
else if (
object->packed_width() == 96) {
180 ap_uint<96> packed = interface_obj.
pack();
181 if (next_packed.has_value()) {
182 vpacked.emplace_back(packed(95, 64) << 32 | next_packed.value());
185 next_packed = packed(95, 64);
188 vpacked.emplace_back(packed(63, 0));
190 }
else if (
object->packed_width() == 128) {
192 ap_uint<128> packed = interface_obj.
pack();
193 vpacked.emplace_back(packed(63, 0));
194 vpacked.emplace_back(packed(127, 64));
237 std::unordered_map<std::string, std::vector<std::unique_ptr<l1t::L1TGT_BaseInterface>>>
inputObjects;
238 for (std::size_t
i = 0;
i < 12; ++
i) {
240 inputObjects[
"GMTSaPromptMuons"].emplace_back(std::make_unique<l1t::L1TGT_GMT_PromptDisplacedMuon>(
243 inputObjects[
"GMTSaDisplacedMuons"].emplace_back(std::make_unique<l1t::L1TGT_GMT_PromptDisplacedMuon>(
245 inputObjects[
"GMTTkMuons"].emplace_back(std::make_unique<l1t::L1TGT_GMT_TrackMatchedmuon>(
true,
272 inputObjects[
"GTTDisplacedJets"].emplace_back(std::make_unique<l1t::L1TGT_GTT_DisplacedJet>(
274 inputObjects[
"GTTHadronicTaus"].emplace_back(std::make_unique<l1t::L1TGT_GTT_HadronicTau>(
286 inputObjects[
"CL2Electrons"].emplace_back(std::make_unique<l1t::L1TGT_CL2_Electron>(
290 inputObjects[
"CL2Taus"].emplace_back(std::make_unique<l1t::L1TGT_CL2_Tau>(
314 std::unique_ptr<P2GTCandidateCollection> gtCollection = std::make_unique<P2GTCandidateCollection>();
316 gtCollection->emplace_back(
object->to_GTObject());
std::mt19937 randomGenerator_
l1t::demo::BoardDataWriter boardDataWriter_
L1GTEvaluationProducer(const edm::ParameterSet &)
void addEvent(const EventData &data)
FileFormat parseFileFormat(const std::string &)
static std::vector< T > vrange()
#define DEFINE_FWK_MODULE(type)
static const l1t::demo::BoardDataWriter::ChannelMap_t CHANNEL_MAP_VU13P
void produce(edm::Event &, const edm::EventSetup &) override
std::map< LinkId, std::pair< ChannelSpec, std::vector< size_t > > > ChannelMap_t
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void writeInputPatterns(const std::unordered_map< std::string, std::vector< std::unique_ptr< l1t::L1TGT_BaseInterface >>> &inputObjects)
static constexpr std::array< T, high - low > arange()
virtual ap_uint< N > pack() const =0
int nextValue(int mean=1000, bool sign=false, int max=std::numeric_limits< int >::max())
static const l1t::demo::BoardDataWriter::ChannelMap_t CHANNEL_MAP_VU9P
static void fillDescriptions(edm::ConfigurationDescriptions &)
static std::vector< ap_uint< 64 > > vpack(const Args &...vobjects)
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).