|
|
Go to the documentation of this file.
23 #define EDM_ML_DEBUG 1
73 std::unique_ptr<PackingSetup>
setup_;
82 : fedId_(
config.getParameter<
int>(
"FedId")), ctp7_mode_(
config.getUntrackedParameter<
bool>(
"CTP7")) {
84 produces<FEDRawDataCollection>();
108 auto bxId =
event.bunchCrossing();
113 auto evtId =
event.id().event();
114 auto orbit =
event.eventAuxiliary().orbitNumber();
115 LogDebug(
"L1T") <<
"Forming FED with metadata bxId=" << bxId <<
", l1ID=" << evtId <<
", orbit=" << orbit;
119 auto amc_no =
item.first.first;
120 auto board =
item.first.second;
121 auto packers =
item.second;
124 for (
const auto& packer : packers) {
125 LogDebug(
"L1T") <<
"Adding packed blocks";
126 packer->setBoard(board);
128 block_load.insert(block_load.end(),
blocks.begin(),
blocks.end());
131 std::sort(block_load.begin(), block_load.end());
133 LogDebug(
"L1T") <<
"Concatenating blocks";
135 std::vector<uint32_t> load32;
141 load32.push_back(
fwId_);
143 for (
const auto&
block : block_load) {
144 LogDebug(
"L1T") <<
"Adding block " <<
block.header().getID() <<
" with size " <<
block.payload().size();
148 std::stringstream
s(
"");
149 s <<
"Block content:" << std::endl << std::hex << std::setfill(
'0');
151 s << std::setw(8) <<
word << std::endl;
157 load32.push_back(0xA110CA7E);
159 load32.push_back(
block.header().raw());
160 load32.insert(load32.end(),
load.begin(),
load.end());
163 LogDebug(
"L1T") <<
"Converting payload";
165 std::vector<uint64_t> load64;
166 for (
unsigned int i = 0;
i < load32.size();
i += 2) {
168 if (
i + 1 < load32.size()) {
169 word |= static_cast<uint64_t>(load32[
i + 1]) << 32;
171 word |= static_cast<uint64_t>(0xffffffff) << 32;
173 load64.push_back(
word);
176 LogDebug(
"L1T") <<
"Creating AMC packet";
178 unsigned amc_user_header = 0;
180 amc_user_header =
fwId_;
181 amc13.add(amc_no, board, evtId, orbit, bxId, load64, amc_user_header);
190 unsigned char* payload_start =
payload;
241 desc.
add<
unsigned int>(
"FWId", -1);
242 desc.
add<
int>(
"FedId");
253 descriptions.
add(
"l1tDigiToRaw", desc);
std::vector< Block > Blocks
L1TDigiToRaw(const edm::ParameterSet &)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
#define DEFINE_FWK_MODULE(type)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::unique_ptr< PackingSetup > setup_
void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
unsigned short compute_crc(unsigned char *buffer, unsigned int bufSize)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
std::unique_ptr< PackerTokens > tokens_
void beginRun(edm::Run const &, edm::EventSetup const &) override
void produce(edm::Event &, const edm::EventSetup &) override
void fillDescription(edm::ParameterSetDescription &) const
static void set(unsigned char *trailer, uint32_t lenght, uint16_t crc, uint8_t evt_stat, uint8_t tts, bool moreTrailers=false)
Set all fields in the trailer.
void endRun(edm::Run const &, edm::EventSetup const &) override
void resize(size_t newsize)
std::unique_ptr< PackingSetup > make(const std::string &) const
void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
unsigned long long uint64_t
static const PackingSetupFactory * get()