CMS 3D CMS Logo

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

Public Member Functions

 L1TDigiToRaw (const edm::ParameterSet &)
 
 ~L1TDigiToRaw ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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 ()
 
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, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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::vector< ModuleDescription const * > &modules, 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 updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

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

Private Member Functions

virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &) override
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
virtual void endRun (edm::Run const &, edm::EventSetup const &) override
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

int evtType_
 
int fedId_
 
unsigned fwId_
 
std::unique_ptr< PackingSetupsetup_
 
int slinkHeaderSize_
 
int slinkTrailerSize_
 
std::unique_ptr< PackerTokenstokens_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 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)
 

Detailed Description

Definition at line 47 of file L1TDigiToRaw.cc.

Constructor & Destructor Documentation

L1TDigiToRaw::L1TDigiToRaw ( const edm::ParameterSet config)
explicit

Definition at line 79 of file L1TDigiToRaw.cc.

References edm::EDConsumerBase::consumesCollector(), evtType_, fwId_, l1t::PackingSetupFactory::get(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), l1t::PackingSetupFactory::make(), setup_, slinkHeaderSize_, slinkTrailerSize_, AlCaHLTBitMon_QueryRunRegistry::string, and tokens_.

79  :
80  fedId_(config.getParameter<int>("FedId"))
81  {
82  // Register products
83  produces<FEDRawDataCollection>();
84 
85  fwId_ = config.getParameter<unsigned int>("FWId");
86  evtType_ = config.getUntrackedParameter<int>("eventType", 1);
87 
89 
91  tokens_ = setup_->registerConsumes(config, cc);
92 
93  slinkHeaderSize_ = config.getUntrackedParameter<int>("lenSlinkHeader", 8);
94  slinkTrailerSize_ = config.getUntrackedParameter<int>("lenSlinkTrailer", 8);
95  }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::unique_ptr< PackerTokens > tokens_
Definition: L1TDigiToRaw.cc:74
std::unique_ptr< PackingSetup > setup_
Definition: L1TDigiToRaw.cc:73
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
std::unique_ptr< PackingSetup > make(const std::string &) const
static const PackingSetupFactory * get()
L1TDigiToRaw::~L1TDigiToRaw ( )

Definition at line 98 of file L1TDigiToRaw.cc.

99  {
100  }

Member Function Documentation

virtual void l1t::L1TDigiToRaw::beginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
inlineoverrideprivatevirtual

Reimplemented from edm::stream::EDProducerBase.

Definition at line 61 of file L1TDigiToRaw.cc.

61 {};
virtual void l1t::L1TDigiToRaw::beginRun ( edm::Run const &  ,
edm::EventSetup const &   
)
inlineoverrideprivatevirtual

Reimplemented from edm::stream::EDProducerBase.

Definition at line 59 of file L1TDigiToRaw.cc.

59 {};
virtual void l1t::L1TDigiToRaw::endLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
inlineoverrideprivatevirtual

Reimplemented from edm::stream::EDProducerBase.

Definition at line 62 of file L1TDigiToRaw.cc.

62 {};
virtual void l1t::L1TDigiToRaw::endRun ( edm::Run const &  ,
edm::EventSetup const &   
)
inlineoverrideprivatevirtual

Reimplemented from edm::stream::EDProducerBase.

Definition at line 60 of file L1TDigiToRaw.cc.

60 {};
void L1TDigiToRaw::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 228 of file L1TDigiToRaw.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addOptional(), edm::ParameterSetDescription::addUntracked(), DEFINE_FWK_MODULE, l1t::PackingSetupFactory::fillDescription(), l1t::PackingSetupFactory::get(), and AlCaHLTBitMon_QueryRunRegistry::string.

228  {
230  desc.add<unsigned int>("FWId", -1);
231  desc.add<int>("FedId");
232  desc.addUntracked<int>("eventType", 1);
233  desc.add<std::string>("Setup");
234  desc.addOptional<edm::InputTag>("InputLabel",edm::InputTag(""));
235  desc.addUntracked<int>("lenSlinkHeader", 8);
236  desc.addUntracked<int>("lenSlinkTrailer", 8);
237 
239 
240  descriptions.add("l1tDigiToRaw", desc);
241  }
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void fillDescription(edm::ParameterSetDescription &) const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static const PackingSetupFactory * get()
void L1TDigiToRaw::produce ( edm::Event event,
const edm::EventSetup setup 
)
overrideprivatevirtual

Definition at line 104 of file L1TDigiToRaw.cc.

References amc13::Packet::add(), groupFilesInBlocks::block, gather_cfg::blocks, evf::compute_crc(), FEDRawData::data(), evtType_, fedId_, fwId_, RecoTauValidation_cfi::header, mps_fire::i, svgfig::load(), LogDebug, eostools::move(), l1t::MP7, jetCorrFactors_cfi::payload, FEDRawData::resize(), alignCSCRings::s, FEDTrailer::set(), FEDHeader::set(), setup_, amc13::Packet::size(), findQualityFiles::size, slinkHeaderSize_, slinkTrailerSize_, tokens_, and amc13::Packet::write().

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

105  {
106  using namespace edm;
107 
108  LogDebug("L1T") << "Packing data with FED ID " << fedId_;
109 
111 
112  auto bxId = event.bunchCrossing();
113  auto evtId = event.id().event();
114  auto orbit = event.eventAuxiliary().orbitNumber();
115 
116  // Create all the AMC payloads to pack into the AMC13
117  for (const auto& item: setup_->getPackers(fedId_, fwId_)) {
118  auto amc_no = item.first.first;
119  auto board = item.first.second;
120  auto packers = item.second;
121 
122  Blocks block_load;
123  for (const auto& packer: packers) {
124  LogDebug("L1T") << "Adding packed blocks";
125  auto blocks = packer->pack(event, tokens_.get());
126  block_load.insert(block_load.end(), blocks.begin(), blocks.end());
127  }
128 
129  std::sort(block_load.begin(), block_load.end());
130 
131  LogDebug("L1T") << "Concatenating blocks";
132 
133  std::vector<uint32_t> load32;
134  // TODO Infrastructure firmware version. Currently not used.
135  // Would change the way the payload has to be unpacked.
136  load32.push_back(0);
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();
140  auto load = block.payload();
141 
142 #ifdef EDM_ML_DEBUG
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;
147  LogDebug("L1T") << s.str();
148 #endif
149 
150  load32.push_back(block.header().raw(MP7));
151  load32.insert(load32.end(), load.begin(), load.end());
152  }
153 
154  LogDebug("L1T") << "Converting payload";
155 
156  std::vector<uint64_t> load64;
157  for (unsigned int i = 0; i < load32.size(); i += 2) {
158  uint64_t word = load32[i];
159  if (i + 1 < load32.size()) {
160  word |= static_cast<uint64_t>(load32[i + 1]) << 32;
161  } else {
162  word |= static_cast<uint64_t>(0xffffffff) << 32;
163  }
164  load64.push_back(word);
165  }
166 
167  LogDebug("L1T") << "Creating AMC packet";
168 
169  amc13.add(amc_no, board, evtId, orbit, bxId, load64);
170  }
171 
172  std::unique_ptr<FEDRawDataCollection> raw_coll(new FEDRawDataCollection());
173  FEDRawData& fed_data = raw_coll->FEDData(fedId_);
174 
175  unsigned int size = slinkHeaderSize_ + slinkTrailerSize_ + amc13.size() * 8;
176  fed_data.resize(size);
177  unsigned char * payload = fed_data.data();
178  unsigned char * payload_start = payload;
179 
180  FEDHeader header(payload);
181  header.set(payload, evtType_, evtId, bxId, fedId_);
182 
183  amc13.write(event, payload, slinkHeaderSize_, size - slinkHeaderSize_ - slinkTrailerSize_);
184 
185  payload += slinkHeaderSize_;
186  payload += amc13.size() * 8;
187 
188  FEDTrailer trailer(payload);
189  trailer.set(payload, size / 8, evf::compute_crc(payload_start, size), 0, 0);
190 
191  event.put(std::move(raw_coll));
192  }
#define LogDebug(id)
size
Write out results.
std::unique_ptr< PackerTokens > tokens_
Definition: L1TDigiToRaw.cc:74
std::unique_ptr< PackingSetup > setup_
Definition: L1TDigiToRaw.cc:73
Definition: Block.h:10
unsigned int size() const
Definition: AMC13Spec.cc:200
bool write(const edm::Event &ev, unsigned char *ptr, unsigned int skip, unsigned int size) const
Definition: AMC13Spec.cc:218
payload
payload postfix for testing
void resize(size_t newsize)
Definition: FEDRawData.cc:32
unsigned short compute_crc(unsigned char *buffer, unsigned int bufSize)
Definition: CRC16.h:67
std::vector< Block > Blocks
Definition: Block.h:72
unsigned long long uint64_t
Definition: Time.h:15
void add(unsigned int amc_no, unsigned int board, unsigned int lv1id, unsigned int orbit, unsigned int bx, const std::vector< uint64_t > &load)
Definition: AMC13Spec.cc:61
def load(fileName)
Definition: svgfig.py:546
HLT enums.
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

int l1t::L1TDigiToRaw::evtType_
private

Definition at line 62 of file L1TDigiToRaw.cc.

Referenced by L1TDigiToRaw(), and produce().

int l1t::L1TDigiToRaw::fedId_
private

Definition at line 66 of file L1TDigiToRaw.cc.

Referenced by produce().

unsigned l1t::L1TDigiToRaw::fwId_
private

Definition at line 67 of file L1TDigiToRaw.cc.

Referenced by L1TDigiToRaw(), and produce().

std::unique_ptr<PackingSetup> l1t::L1TDigiToRaw::setup_
private

Definition at line 73 of file L1TDigiToRaw.cc.

Referenced by L1TDigiToRaw(), and produce().

int l1t::L1TDigiToRaw::slinkHeaderSize_
private

Definition at line 70 of file L1TDigiToRaw.cc.

Referenced by L1TDigiToRaw(), and produce().

int l1t::L1TDigiToRaw::slinkTrailerSize_
private

Definition at line 71 of file L1TDigiToRaw.cc.

Referenced by L1TDigiToRaw(), and produce().

std::unique_ptr<PackerTokens> l1t::L1TDigiToRaw::tokens_
private

Definition at line 74 of file L1TDigiToRaw.cc.

Referenced by L1TDigiToRaw(), and produce().