test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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::auto_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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
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 46 of file L1TDigiToRaw.cc.

Constructor & Destructor Documentation

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

Definition at line 78 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_.

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

Definition at line 97 of file L1TDigiToRaw.cc.

98  {
99  }

Member Function Documentation

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

Reimplemented from edm::stream::EDProducerBase.

Definition at line 60 of file L1TDigiToRaw.cc.

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

Reimplemented from edm::stream::EDProducerBase.

Definition at line 58 of file L1TDigiToRaw.cc.

58 {};
virtual void l1t::L1TDigiToRaw::endLuminosityBlock ( 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::endRun ( edm::Run const &  ,
edm::EventSetup const &   
)
inlineoverrideprivatevirtual

Reimplemented from edm::stream::EDProducerBase.

Definition at line 59 of file L1TDigiToRaw.cc.

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

Definition at line 227 of file L1TDigiToRaw.cc.

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

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

Implements edm::stream::EDProducerBase.

Definition at line 103 of file L1TDigiToRaw.cc.

References createPayload::block, gather_cfg::blocks, evf::compute_crc(), evtType_, fedId_, fwId_, i, svgfig::load(), LogDebug, l1t::MP7, alignCSCRings::s, FEDTrailer::set(), FEDHeader::set(), setup_, findQualityFiles::size, slinkHeaderSize_, slinkTrailerSize_, and tokens_.

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

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

Member Data Documentation

int l1t::L1TDigiToRaw::evtType_
private

Definition at line 61 of file L1TDigiToRaw.cc.

Referenced by L1TDigiToRaw(), and produce().

int l1t::L1TDigiToRaw::fedId_
private

Definition at line 65 of file L1TDigiToRaw.cc.

Referenced by produce().

unsigned l1t::L1TDigiToRaw::fwId_
private

Definition at line 66 of file L1TDigiToRaw.cc.

Referenced by L1TDigiToRaw(), and produce().

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

Definition at line 72 of file L1TDigiToRaw.cc.

Referenced by L1TDigiToRaw(), and produce().

int l1t::L1TDigiToRaw::slinkHeaderSize_
private

Definition at line 69 of file L1TDigiToRaw.cc.

Referenced by L1TDigiToRaw(), and produce().

int l1t::L1TDigiToRaw::slinkTrailerSize_
private

Definition at line 70 of file L1TDigiToRaw.cc.

Referenced by L1TDigiToRaw(), and produce().

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

Definition at line 73 of file L1TDigiToRaw.cc.

Referenced by L1TDigiToRaw(), and produce().