23 #define EDM_ML_DEBUG 1 73 std::unique_ptr<PackingSetup>
setup_;
83 produces<FEDRawDataCollection>();
112 auto bxId =
event.bunchCrossing();
113 auto evtId =
event.id().event();
114 auto orbit =
event.eventAuxiliary().orbitNumber();
118 auto amc_no = item.first.first;
119 auto board = item.first.second;
120 auto packers = item.second;
123 for (
const auto& packer: packers) {
124 LogDebug(
"L1T") <<
"Adding packed blocks";
126 block_load.insert(block_load.end(),
blocks.begin(),
blocks.end());
129 std::sort(block_load.begin(), block_load.end());
131 LogDebug(
"L1T") <<
"Concatenating blocks";
133 std::vector<uint32_t> load32;
137 load32.push_back(
fwId_);
138 for (
const auto&
block: block_load) {
139 LogDebug(
"L1T") <<
"Adding block " <<
block.header().getID() <<
" with size " <<
block.payload().size();
143 std::stringstream
s(
"");
144 s <<
"Block content:" << std::endl << std::hex << std::setfill(
'0');
145 for (
const auto& word:
load)
146 s << std::setw(8) << word << std::endl;
150 load32.push_back(
block.header().raw(
MP7));
151 load32.insert(load32.end(), load.begin(), load.end());
154 LogDebug(
"L1T") <<
"Converting payload";
156 std::vector<uint64_t> load64;
157 for (
unsigned int i = 0;
i < load32.size();
i += 2) {
159 if (
i + 1 < load32.size()) {
160 word |=
static_cast<uint64_t>(load32[
i + 1]) << 32;
162 word |=
static_cast<uint64_t>(0xffffffff) << 32;
164 load64.push_back(word);
167 LogDebug(
"L1T") <<
"Creating AMC packet";
169 amc13.
add(amc_no, board, evtId, orbit, bxId, load64);
178 unsigned char * payload_start =
payload;
186 payload += amc13.
size() * 8;
230 desc.
add<
unsigned int>(
"FWId", -1);
231 desc.
add<
int>(
"FedId");
240 descriptions.
add(
"l1tDigiToRaw", desc);
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::unique_ptr< PackerTokens > tokens_
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
std::unique_ptr< PackingSetup > setup_
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
#define DEFINE_FWK_MODULE(type)
unsigned int size() const
virtual void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
def setup(process, global_tag, zero_tesla=False)
bool write(const edm::Event &ev, unsigned char *ptr, unsigned int skip, unsigned int size) const
static void set(unsigned char *trailer, int evt_lgth, int crc, int evt_stat, int tts, bool T=false)
Set all fields in the trailer.
virtual void beginRun(edm::Run const &, edm::EventSetup const &) override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
payload
payload postfix for testing
void fillDescription(edm::ParameterSetDescription &) const
virtual void produce(edm::Event &, const edm::EventSetup &) override
void resize(size_t newsize)
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
unsigned short compute_crc(unsigned char *buffer, unsigned int bufSize)
std::vector< Block > Blocks
L1TDigiToRaw(const edm::ParameterSet &)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::unique_ptr< PackingSetup > make(const std::string &) const
unsigned long long uint64_t
void add(unsigned int amc_no, unsigned int board, unsigned int lv1id, unsigned int orbit, unsigned int bx, const std::vector< uint64_t > &load)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static const PackingSetupFactory * get()
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
virtual void endRun(edm::Run const &, edm::EventSetup const &) override
virtual void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override