CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
l1t::MP7BufferDumpToRaw Class Reference
Inheritance diagram for l1t::MP7BufferDumpToRaw:
edm::one::EDProducer<> edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 MP7BufferDumpToRaw (const edm::ParameterSet &)
 
 ~MP7BufferDumpToRaw () override
 
- Public Member Functions inherited from edm::one::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void formatAMC (amc13::Packet &amc13, const std::vector< Block > &blocks, int iAmc)
 
void formatRaw (edm::Event &iEvent, amc13::Packet &amc13, FEDRawData &fed_data)
 
std::vector< BlockgetBlocks (int iAmc)
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

std::vector< int > boardId_
 
int evType_
 
int fedId_
 
int fwVer_
 
unsigned iBoard_
 
bool mux_
 
int muxOffset_
 
unsigned nBoard_
 
unsigned nFramesPerEvent_
 
bool packetisedData_
 
std::vector< std::vector< int > > rxBlockLength_
 
MP7FileReader rxFileReader_
 
std::vector< unsigned > rxIndex_
 
MP7PacketReader rxPacketReader_
 
int slinkHeaderSize_
 
int slinkTrailerSize_
 
std::vector< std::vector< int > > txBlockLength_
 
MP7FileReader txFileReader_
 
std::vector< unsigned > txIndex_
 
MP7PacketReader txPacketReader_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 56 of file MP7BufferDumpToRaw.cc.

Constructor & Destructor Documentation

◆ MP7BufferDumpToRaw()

l1t::MP7BufferDumpToRaw::MP7BufferDumpToRaw ( const edm::ParameterSet iConfig)
explicit

Definition at line 124 of file MP7BufferDumpToRaw.cc.

References boardId_, edm::ParameterSet::getUntrackedParameter(), mps_fire::i, dqmiolumiharvest::j, LogDebug, SiStripPI::max, nBoard_, nFramesPerEvent_, corrVsCorr::rx, rxBlockLength_, rxFileReader_, rxIndex_, MP7FileReader::size(), txBlockLength_, txFileReader_, and txIndex_.

125  : rxFileReader_(iConfig.getUntrackedParameter<std::string>("rxFile", "rx_summary.txt")),
126  txFileReader_(iConfig.getUntrackedParameter<std::string>("txFile", "tx_summary.txt")),
127  rxPacketReader_(iConfig.getUntrackedParameter<std::string>("rxFile", "rx_summary.txt"),
128  iConfig.getUntrackedParameter<int>("rxHeaderFrames", 1),
129  0,
130  iConfig.getUntrackedParameter<int>("rxKeyLink", 0)),
131  txPacketReader_(iConfig.getUntrackedParameter<std::string>("txFile", "tx_summary.txt"),
132  iConfig.getUntrackedParameter<int>("txHeaderFrames", 1),
133  0,
134  iConfig.getUntrackedParameter<int>("txKeyLink", 0)),
135  packetisedData_(iConfig.getUntrackedParameter<bool>("packetisedData", true)),
136  nFramesPerEvent_(iConfig.getUntrackedParameter<int>("nFramesPerEvent", 6)),
137  iBoard_(iConfig.getUntrackedParameter<int>("boardOffset", 0)),
138  boardId_(iConfig.getUntrackedParameter<std::vector<int> >("boardId")),
139  mux_(iConfig.getUntrackedParameter<bool>("mux", false)),
140  fedId_(iConfig.getUntrackedParameter<int>("fedId", 1)),
141  evType_(iConfig.getUntrackedParameter<int>("eventType", 1)),
142  fwVer_(iConfig.getUntrackedParameter<int>("fwVersion", 1)),
143  slinkHeaderSize_(iConfig.getUntrackedParameter<int>("lenSlinkHeader", 8)),
144  slinkTrailerSize_(iConfig.getUntrackedParameter<int>("lenSlinkTrailer", 8)) {
145  produces<FEDRawDataCollection>();
146 
147  // check tx/rx file size consistency and number of boards
148  if (rxFileReader_.size() != txFileReader_.size()) {
149  edm::LogError("L1T") << "Different number of boards in Rx and Tx files";
150  }
152  LogDebug("L1T") << "# boards : " << nBoard_;
153 
154  // advance pointers for non packetised data
155  rxIndex_ = iConfig.getUntrackedParameter<std::vector<unsigned> >("nFramesOffset");
156  if (rxIndex_.size() != nBoard_) {
157  edm::LogError("L1T") << "Wrong number of boards in nFramesOffset " << rxIndex_.size();
158  }
159 
160  txIndex_ = iConfig.getUntrackedParameter<std::vector<unsigned> >("nFramesLatency");
161  if (txIndex_.size() != nBoard_) {
162  edm::LogError("L1T") << "Wrong number of boards in nFramesLatency " << txIndex_.size();
163  }
164 
165  // add latency to offset for Tx
166  for (unsigned i = 0; i < rxIndex_.size(); ++i)
167  txIndex_.at(i) += rxIndex_.at(i);
168 
169  // check board IDs
170  if (nBoard_ != boardId_.size()) {
171  edm::LogError("L1T") << "Found " << nBoard_ << " boards, but given " << boardId_.size() << " IDs";
172  }
173 
174  // block length PSet
175  std::vector<edm::ParameterSet> vpset = iConfig.getUntrackedParameter<std::vector<edm::ParameterSet> >("blocks");
176 
177  if (vpset.size() != nBoard_) {
178  edm::LogError("L1T") << "Wrong number of block specs " << vpset.size();
179  }
180 
181  rxBlockLength_.resize(nBoard_);
182  txBlockLength_.resize(nBoard_);
183 
184  for (unsigned i = 0; i < nBoard_; ++i) {
185  std::vector<int> rx = vpset.at(i).getUntrackedParameter<std::vector<int> >("rxBlockLength");
186 
187  rxBlockLength_.at(i).resize(rx.size());
188 
189  for (unsigned j = 0; j < rx.size(); ++j) {
190  rxBlockLength_.at(i).at(j) = rx.at(j);
191 
192  if (rx.at(j) != 0) {
193  // LogDebug("L1T") << "Block readout : board " << i << " Rx link " << j << " size " << rx.at(j);
194  }
195  }
196 
197  std::vector<int> tx = vpset.at(i).getUntrackedParameter<std::vector<int> >("txBlockLength");
198  txBlockLength_.at(i).resize(tx.size());
199 
200  for (unsigned j = 0; j < tx.size(); ++j) {
201  txBlockLength_.at(i).at(j) = tx.at(j);
202 
203  if (tx.at(j) != 0) {
204  // LogDebug("L1T") << "Block readout : board " << i << " Tx link " << j << " size " << tx.at(j);
205  }
206  }
207  }
208 
209  LogDebug("L1T") << "Board ID size " << boardId_.size();
210 
211  LogDebug("L1T") << "Frames per event " << nFramesPerEvent_;
212  }
MP7PacketReader txPacketReader_
Log< level::Error, false > LogError
T getUntrackedParameter(std::string const &, T const &) const
std::vector< unsigned > rxIndex_
std::vector< std::vector< int > > rxBlockLength_
std::vector< std::vector< int > > txBlockLength_
std::vector< unsigned > txIndex_
size_t size() const
number of rawdata objects stored
Definition: MP7FileReader.h:71
std::vector< int > boardId_
MP7PacketReader rxPacketReader_
#define LogDebug(id)

◆ ~MP7BufferDumpToRaw()

l1t::MP7BufferDumpToRaw::~MP7BufferDumpToRaw ( )
override

Definition at line 214 of file MP7BufferDumpToRaw.cc.

214  {
215  // do anything here that needs to be done at desctruction time
216  // (e.g. close files, deallocate resources etc.)
217  }

Member Function Documentation

◆ fillDescriptions()

void l1t::MP7BufferDumpToRaw::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 423 of file MP7BufferDumpToRaw.cc.

References edm::ConfigurationDescriptions::addDefault(), and submitPVResolutionJobs::desc.

423  {
424  //The following says we do not know what parameters are allowed so do no validation
425  // Please change this to state exactly what you do use, even if it is no parameters
427  desc.setUnknown();
428  descriptions.addDefault(desc);
429  }
void addDefault(ParameterSetDescription const &psetDescription)

◆ formatAMC()

void l1t::MP7BufferDumpToRaw::formatAMC ( amc13::Packet amc13,
const std::vector< Block > &  blocks,
int  iAmc 
)
private

Definition at line 358 of file MP7BufferDumpToRaw.cc.

References groupFilesInBlocks::block, gather_cfg::blocks, boardId_, fwVer_, mps_fire::i, svgfig::load(), LogDebug, and alignCSCRings::s.

Referenced by produce().

358  {
359  LogDebug("L1T") << "Formatting Board " << iBoard;
360 
361  std::vector<uint32_t> load32;
362  // TODO this is an empty word to be replaced with a proper MP7
363  // header containing at least the firmware version
364  load32.push_back(0);
365  load32.push_back(fwVer_);
366 
367  for (const auto& block : blocks) {
368  LogDebug("L1T") << "Adding block " << block.header().getID() << " with size " << block.payload().size();
369  auto load = block.payload();
370 
371 #ifdef EDM_ML_DEBUG
372  std::stringstream s("");
373  s << "Block content:" << std::endl << std::hex << std::setfill('0');
374  for (const auto& word : load)
375  s << std::setw(8) << word << std::endl;
376  LogDebug("L1T") << s.str();
377 #endif
378 
379  load32.push_back(block.header().raw());
380  load32.insert(load32.end(), load.begin(), load.end());
381  }
382 
383  LogDebug("L1T") << "Converting payload " << iBoard;
384 
385  std::vector<uint64_t> load64;
386  for (unsigned int i = 0; i < load32.size(); i += 2) {
387  uint64_t word = load32[i];
388  if (i + 1 < load32.size())
389  word |= static_cast<uint64_t>(load32[i + 1]) << 32;
390  load64.push_back(word);
391  }
392 
393  LogDebug("L1T") << "Creating AMC packet " << iBoard;
394  // LogDebug("L1T") << iBoard << ", " << boardId_.at(iBoard) << ", " << load64.size();
395 
396  amc13.add(iBoard, boardId_.at(iBoard), 0, 0, 0, load64);
397  }
uint64_t word
unsigned long long uint64_t
Definition: Time.h:13
def load(fileName)
Definition: svgfig.py:547
std::vector< int > boardId_
#define LogDebug(id)

◆ formatRaw()

void l1t::MP7BufferDumpToRaw::formatRaw ( edm::Event iEvent,
amc13::Packet amc13,
FEDRawData fed_data 
)
private

Definition at line 399 of file MP7BufferDumpToRaw.cc.

References evf::compute_crc(), FEDRawData::data(), evType_, fedId_, RecoTauValidation_cfi::header, iEvent, LogDebug, jetsAK4_Puppi_cff::payload, FEDRawData::resize(), FEDTrailer::set(), findQualityFiles::size, slinkHeaderSize_, and slinkTrailerSize_.

Referenced by produce().

399  {
400  unsigned int size = slinkHeaderSize_ + slinkTrailerSize_ + amc13.size() * 8;
401  fed_data.resize(size);
402  unsigned char* payload = fed_data.data();
403  unsigned char* payload_start = payload;
404 
405  auto bxId = iEvent.bunchCrossing();
406  auto evtId = iEvent.id().event();
407 
408  LogDebug("L1T") << "Creating FEDRawData ID " << fedId_ << ", size " << size;
409 
411  header.set(payload, evType_, evtId, bxId, fedId_);
412 
414 
416  payload += amc13.size() * 8;
417 
418  FEDTrailer trailer(payload);
419  trailer.set(payload, size / 8, evf::compute_crc(payload_start, size), 0, 0);
420  }
size
Write out results.
int iEvent
Definition: GenABIO.cc:224
void resize(size_t newsize)
Definition: FEDRawData.cc:28
unsigned short compute_crc(unsigned char *buffer, unsigned int bufSize)
Definition: CRC16.h:46
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
#define LogDebug(id)

◆ getBlocks()

std::vector< Block > l1t::MP7BufferDumpToRaw::getBlocks ( int  iAmc)
private

Definition at line 261 of file MP7BufferDumpToRaw.cc.

References groupFilesInBlocks::block, gather_cfg::blocks, ztail::d, data, MP7PacketReader::get(), MP7FileReader::get(), mps_fire::i, FileData::link(), LogDebug, nFramesPerEvent_, AlCaHLTBitMon_ParallelJobs::p, packetisedData_, rxBlockLength_, rxFileReader_, rxIndex_, rxPacketReader_, findQualityFiles::size, txBlockLength_, txFileReader_, txIndex_, and txPacketReader_.

Referenced by produce().

261  {
262  LogDebug("L1T") << "Getting blocks from board " << iBoard << ", " << rxBlockLength_.at(iBoard).size()
263  << " Rx links, " << txBlockLength_.at(iBoard).size() << " Tx links";
264 
265  std::vector<Block> blocks;
266 
267  // Rx blocks first
268  for (unsigned link = 0; link < rxBlockLength_.at(iBoard).size(); ++link) {
269  unsigned id = link * 2;
270  unsigned size = rxBlockLength_.at(iBoard).at(link);
271 
272  if (size == 0)
273  continue;
274 
275  std::vector<uint32_t> data;
276  if (packetisedData_) {
277  const PacketData& p = rxPacketReader_.get(iBoard);
278  PacketData::const_iterator itr = p.begin();
279  for (unsigned i = 0; i < rxIndex_.at(iBoard); i++)
280  itr++;
281 
282  LogDebug("L1T") << "Found packet [" << itr->first_ << ", " << itr->last_ << "]";
283  LogDebug("L1T") << "Link " << link << " has " << itr->links_.find(link)->second.size() << " frames";
284 
285  for (unsigned iFrame = 0; iFrame < itr->links_.find(link)->second.size(); ++iFrame) {
286  uint64_t d = itr->links_.find(link)->second.at(iFrame);
287  data.push_back(d);
288  }
289  } else {
290  for (unsigned iFrame = rxIndex_.at(iBoard); iFrame < rxIndex_.at(iBoard) + size; ++iFrame) {
291  uint64_t d = rxFileReader_.get(iBoard).link(link).at(iFrame);
292  LogDebug("L1T") << "Frame " << iFrame << " : " << std::hex << d;
293  if ((d & 0x100000000) > 0)
294  data.push_back(d & 0xffffffff);
295  }
296  }
297 
298  LogDebug("L1T") << "Board " << iBoard << " block " << id << ", size " << data.size();
299 
300  Block block(id, data);
301  blocks.push_back(block);
302  }
303 
304  // then Tx blocks
305  for (unsigned link = 0; link < txBlockLength_.at(iBoard).size(); ++link) {
306  unsigned id = (link * 2) + 1;
307  unsigned size = txBlockLength_.at(iBoard).at(link);
308 
309  if (size == 0)
310  continue;
311 
312  LogDebug("L1T") << "Block " << id << " expecting size " << size;
313 
314  std::vector<uint32_t> data;
315  if (packetisedData_) {
316  const PacketData& p = txPacketReader_.get(iBoard);
317  PacketData::const_iterator itr = p.begin();
318  for (unsigned i = 0; i < txIndex_.at(iBoard); i++)
319  itr++;
320 
321  LogDebug("L1T") << "Found packet [" << itr->first_ << ", " << itr->last_ << "]";
322  LogDebug("L1T") << "Link " << link << " has " << itr->links_.find(link)->second.size() << " frames";
323 
324  for (unsigned iFrame = 0; iFrame < itr->links_.find(link)->second.size(); ++iFrame) {
325  uint64_t d = itr->links_.find(link)->second.at(iFrame);
326  data.push_back(d);
327  }
328 
329  } else {
330  for (unsigned iFrame = txIndex_.at(iBoard); iFrame < txIndex_.at(iBoard) + size; ++iFrame) {
331  uint64_t d = txFileReader_.get(iBoard).link(link).at(iFrame);
332  LogDebug("L1T") << "Frame " << iFrame << " : " << std::hex << d;
333  if ((d & 0x100000000) > 0)
334  data.push_back(d & 0xffffffff);
335  }
336  }
337 
338  LogDebug("L1T") << "Board " << iBoard << " block " << id << ", size " << data.size();
339 
340  Block block(id, data);
341 
342  blocks.push_back(block);
343  }
344 
345  if (packetisedData_) {
346  rxIndex_.at(iBoard)++;
347  txIndex_.at(iBoard)++;
348  } else {
349  rxIndex_.at(iBoard) += nFramesPerEvent_;
350  txIndex_.at(iBoard) += nFramesPerEvent_;
351  }
352 
353  LogDebug("L1T") << "Board " << iBoard << ", read " << blocks.size() << " blocks";
354 
355  return blocks;
356  }
size
Write out results.
const std::vector< uint64_t > & link(uint32_t i) const
MP7PacketReader txPacketReader_
const PacketData & get(size_t i)
std::vector< unsigned > rxIndex_
std::vector< std::vector< int > > rxBlockLength_
std::vector< std::vector< int > > txBlockLength_
d
Definition: ztail.py:151
std::vector< unsigned > txIndex_
unsigned long long uint64_t
Definition: Time.h:13
std::vector< Packet >::const_iterator const_iterator
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
const FileData & get(size_t k) const
data getter via index
MP7PacketReader rxPacketReader_
#define LogDebug(id)

◆ produce()

void l1t::MP7BufferDumpToRaw::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDProducerBase.

Definition at line 224 of file MP7BufferDumpToRaw.cc.

References gather_cfg::blocks, fedId_, EcalFEDMonitor_cfi::FEDRawDataCollection, formatAMC(), formatRaw(), getBlocks(), iBoard_, iEvent, LogDebug, eostools::move(), mux_, nBoard_, and FEDRawData::size().

224  {
225  using namespace edm;
226 
227  // AMC 13 packet
229 
230  // create AMC formatted data
231  if (mux_) {
232  std::vector<Block> blocks = getBlocks(iBoard_);
234  } else {
235  for (unsigned iBoard = 0; iBoard < nBoard_; ++iBoard) {
236  std::vector<Block> blocks = getBlocks(iBoard);
237  formatAMC(amc13, blocks, iBoard);
238  }
239  }
240 
241  LogDebug("L1T") << "AMC13 size " << amc13.size();
242 
243  // prepare the raw data collection
244  std::unique_ptr<FEDRawDataCollection> raw_coll(new FEDRawDataCollection());
245  FEDRawData& fed_data = raw_coll->FEDData(fedId_);
246 
247  formatRaw(iEvent, amc13, fed_data);
248 
249  LogDebug("L1T") << "Packing FED ID " << fedId_ << " size " << fed_data.size();
250 
251  // put the collection in the event
252  iEvent.put(std::move(raw_coll));
253 
254  //advance to next AMC for next event, if required...
255  if (mux_) {
256  iBoard_++;
257  iBoard_ = iBoard_ % nBoard_;
258  }
259  }
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
std::vector< Block > getBlocks(int iAmc)
int iEvent
Definition: GenABIO.cc:224
void formatAMC(amc13::Packet &amc13, const std::vector< Block > &blocks, int iAmc)
HLT enums.
void formatRaw(edm::Event &iEvent, amc13::Packet &amc13, FEDRawData &fed_data)
def move(src, dest)
Definition: eostools.py:511
#define LogDebug(id)

Member Data Documentation

◆ boardId_

std::vector<int> l1t::MP7BufferDumpToRaw::boardId_
private

Definition at line 97 of file MP7BufferDumpToRaw.cc.

Referenced by formatAMC(), and MP7BufferDumpToRaw().

◆ evType_

int l1t::MP7BufferDumpToRaw::evType_
private

Definition at line 107 of file MP7BufferDumpToRaw.cc.

Referenced by formatRaw().

◆ fedId_

int l1t::MP7BufferDumpToRaw::fedId_
private

Definition at line 106 of file MP7BufferDumpToRaw.cc.

Referenced by formatRaw(), and produce().

◆ fwVer_

int l1t::MP7BufferDumpToRaw::fwVer_
private

Definition at line 108 of file MP7BufferDumpToRaw.cc.

Referenced by formatAMC().

◆ iBoard_

unsigned l1t::MP7BufferDumpToRaw::iBoard_
private

Definition at line 96 of file MP7BufferDumpToRaw.cc.

Referenced by produce().

◆ mux_

bool l1t::MP7BufferDumpToRaw::mux_
private

Definition at line 102 of file MP7BufferDumpToRaw.cc.

Referenced by produce().

◆ muxOffset_

int l1t::MP7BufferDumpToRaw::muxOffset_
private

Definition at line 103 of file MP7BufferDumpToRaw.cc.

◆ nBoard_

unsigned l1t::MP7BufferDumpToRaw::nBoard_
private

Definition at line 95 of file MP7BufferDumpToRaw.cc.

Referenced by MP7BufferDumpToRaw(), and produce().

◆ nFramesPerEvent_

unsigned l1t::MP7BufferDumpToRaw::nFramesPerEvent_
private

Definition at line 90 of file MP7BufferDumpToRaw.cc.

Referenced by getBlocks(), and MP7BufferDumpToRaw().

◆ packetisedData_

bool l1t::MP7BufferDumpToRaw::packetisedData_
private

Definition at line 87 of file MP7BufferDumpToRaw.cc.

Referenced by getBlocks().

◆ rxBlockLength_

std::vector<std::vector<int> > l1t::MP7BufferDumpToRaw::rxBlockLength_
private

Definition at line 100 of file MP7BufferDumpToRaw.cc.

Referenced by getBlocks(), and MP7BufferDumpToRaw().

◆ rxFileReader_

MP7FileReader l1t::MP7BufferDumpToRaw::rxFileReader_
private

Definition at line 75 of file MP7BufferDumpToRaw.cc.

Referenced by getBlocks(), and MP7BufferDumpToRaw().

◆ rxIndex_

std::vector<unsigned> l1t::MP7BufferDumpToRaw::rxIndex_
private

Definition at line 77 of file MP7BufferDumpToRaw.cc.

Referenced by getBlocks(), and MP7BufferDumpToRaw().

◆ rxPacketReader_

MP7PacketReader l1t::MP7BufferDumpToRaw::rxPacketReader_
private

Definition at line 81 of file MP7BufferDumpToRaw.cc.

Referenced by getBlocks().

◆ slinkHeaderSize_

int l1t::MP7BufferDumpToRaw::slinkHeaderSize_
private

Definition at line 109 of file MP7BufferDumpToRaw.cc.

Referenced by formatRaw().

◆ slinkTrailerSize_

int l1t::MP7BufferDumpToRaw::slinkTrailerSize_
private

Definition at line 110 of file MP7BufferDumpToRaw.cc.

Referenced by formatRaw().

◆ txBlockLength_

std::vector<std::vector<int> > l1t::MP7BufferDumpToRaw::txBlockLength_
private

Definition at line 101 of file MP7BufferDumpToRaw.cc.

Referenced by getBlocks(), and MP7BufferDumpToRaw().

◆ txFileReader_

MP7FileReader l1t::MP7BufferDumpToRaw::txFileReader_
private

Definition at line 76 of file MP7BufferDumpToRaw.cc.

Referenced by getBlocks(), and MP7BufferDumpToRaw().

◆ txIndex_

std::vector<unsigned> l1t::MP7BufferDumpToRaw::txIndex_
private

Definition at line 78 of file MP7BufferDumpToRaw.cc.

Referenced by getBlocks(), and MP7BufferDumpToRaw().

◆ txPacketReader_

MP7PacketReader l1t::MP7BufferDumpToRaw::txPacketReader_
private

Definition at line 82 of file MP7BufferDumpToRaw.cc.

Referenced by getBlocks().