CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
HGCalRawToDigi Class Reference
Inheritance diagram for HGCalRawToDigi:
edm::stream::EDProducer<>

Public Member Functions

 HGCalRawToDigi (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
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
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &)
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

const unsigned int badECONDMax_
 
const edm::EDPutTokenT< HGCalDigiCollectiondigisToken_
 
const edm::EDPutTokenT< HGCalElecDigiCollectionelecDigisToken_
 
const std::vector< unsigned int > fedIds_
 
const edm::EDGetTokenT< FEDRawDataCollectionfedRawToken_
 
const unsigned int numERxsInECOND_
 
const std::unique_ptr< HGCalUnpacker< HGCalElectronicsId > > unpacker_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 16 of file HGCalRawToDigi.cc.

Constructor & Destructor Documentation

◆ HGCalRawToDigi()

HGCalRawToDigi::HGCalRawToDigi ( const edm::ParameterSet iConfig)
explicit

Definition at line 35 of file HGCalRawToDigi.cc.

References edm::ParameterSet::getParameter(), and HGCalUnpackerConfig::sLinkBOE.

36  : fedRawToken_(consumes<FEDRawDataCollection>(iConfig.getParameter<edm::InputTag>("src"))),
37  digisToken_(produces<HGCalDigiCollection>()),
38  elecDigisToken_(produces<HGCalElecDigiCollection>()),
39  fedIds_(iConfig.getParameter<std::vector<unsigned int> >("fedIds")),
40  badECONDMax_(iConfig.getParameter<unsigned int>("badECONDMax")),
41  numERxsInECOND_(iConfig.getParameter<unsigned int>("numERxsInECOND")),
43  HGCalUnpackerConfig{.sLinkBOE = iConfig.getParameter<unsigned int>("slinkBOE"),
44  .captureBlockReserved = iConfig.getParameter<unsigned int>("captureBlockReserved"),
45  .econdHeaderMarker = iConfig.getParameter<unsigned int>("econdHeaderMarker"),
46  .sLinkCaptureBlockMax = iConfig.getParameter<unsigned int>("maxCaptureBlock"),
47  .captureBlockECONDMax = iConfig.getParameter<unsigned int>("captureBlockECONDMax"),
48  .econdERXMax = iConfig.getParameter<unsigned int>("econdERXMax"),
49  .erxChannelMax = iConfig.getParameter<unsigned int>("erxChannelMax"),
50  .payloadLengthMax = iConfig.getParameter<unsigned int>("payloadLengthMax"),
51  .channelMax = iConfig.getParameter<unsigned int>("channelMax"),
52  .commonModeMax = iConfig.getParameter<unsigned int>("commonModeMax")})) {}
const edm::EDPutTokenT< HGCalDigiCollection > digisToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const std::vector< unsigned int > fedIds_
This class is designed to unpack raw data from HGCal, formatted as S-Links, capture blocks...
Definition: HGCalUnpacker.h:36
const unsigned int badECONDMax_
const edm::EDPutTokenT< HGCalElecDigiCollection > elecDigisToken_
uint32_t sLinkBOE
S-Link BOE pattern.
Definition: HGCalUnpacker.h:22
const std::unique_ptr< HGCalUnpacker< HGCalElectronicsId > > unpacker_
const unsigned int numERxsInECOND_
const edm::EDGetTokenT< FEDRawDataCollection > fedRawToken_

Member Function Documentation

◆ fillDescriptions()

void HGCalRawToDigi::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 110 of file HGCalRawToDigi.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and ProducerED_cfi::InputTag.

110  {
112  desc.add<edm::InputTag>("src", edm::InputTag("rawDataCollector"));
113  desc.add<unsigned int>("maxCaptureBlock", 1)->setComment("maximum number of capture blocks in one S-Link");
114  desc.add<unsigned int>("captureBlockReserved", 0)->setComment("capture block reserved pattern");
115  desc.add<unsigned int>("econdHeaderMarker", 0x154)->setComment("ECON-D header Marker pattern");
116  desc.add<unsigned int>("slinkBOE", 0x2a)->setComment("SLink BOE pattern");
117  desc.add<unsigned int>("captureBlockECONDMax", 12)->setComment("maximum number of ECON-D's in one capture block");
118  desc.add<unsigned int>("econdERXMax", 12)->setComment("maximum number of eRx's in one ECON-D");
119  desc.add<unsigned int>("erxChannelMax", 37)->setComment("maximum number of channels in one eRx");
120  desc.add<unsigned int>("payloadLengthMax", 469)->setComment("maximum length of payload length");
121  desc.add<unsigned int>("channelMax", 7000000)->setComment("maximum number of channels unpacked");
122  desc.add<unsigned int>("commonModeMax", 4000000)->setComment("maximum number of common modes unpacked");
123  desc.add<unsigned int>("badECONDMax", 200)->setComment("maximum number of bad ECON-D's");
124  desc.add<std::vector<unsigned int> >("fedIds", {});
125  desc.add<unsigned int>("numERxsInECOND", 12)->setComment("number of eRxs in each ECON-D payload");
126  descriptions.add("hgcalDigis", desc);
127 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

void HGCalRawToDigi::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 54 of file HGCalRawToDigi.cc.

References badECONDMax_, data, TauDecayModes::dec, digisToken_, elecDigisToken_, TopDecayID::elecID, fedIds_, fedRawToken_, mps_fire::i, l1ctLayer2EG_cff::id, iEvent, dqm-mbProfile::log, LogDebug, eostools::move(), numERxsInECOND_, hcallasereventfilter2012_cfi::prefix, edm::SortedCollection< T, SORT >::push_back(), edm::SortedCollection< T, SORT >::size(), AlCaHLTBitMon_QueryRunRegistry::string, and unpacker_.

54  {
55  // retrieve the FED raw data
56  const auto& raw_data = iEvent.get(fedRawToken_);
57  // prepare the output
58  HGCalDigiCollection digis;
59  HGCalElecDigiCollection elec_digis;
60  for (const auto& fed_id : fedIds_) {
61  const auto& fed_data = raw_data.FEDData(fed_id);
62  if (fed_data.size() == 0)
63  continue;
64 
65  std::vector<uint32_t> data_32bit;
66  auto* ptr = fed_data.data();
67  size_t fed_size = fed_data.size();
68  for (size_t i = 0; i < fed_size; i += 4)
69  data_32bit.emplace_back(((*(ptr + i) & 0xff) << 0) + (((i + 1) < fed_size) ? ((*(ptr + i + 1) & 0xff) << 8) : 0) +
70  (((i + 2) < fed_size) ? ((*(ptr + i + 2) & 0xff) << 16) : 0) +
71  (((i + 3) < fed_size) ? ((*(ptr + i + 3) & 0xff) << 24) : 0));
72 
73  unpacker_->parseSLink(
74  data_32bit,
75  [this](uint16_t /*sLink*/, uint8_t /*captureBlock*/, uint8_t /*econd*/) { return (1 << numERxsInECOND_) - 1; },
77  const auto elecid_to_detid = [](const HGCalElectronicsId& id) -> HGCalDetId {
78  return HGCalDetId(id.raw());
79  }; //TODO: implement something more relevant
80 
81  auto channeldata = unpacker_->channelData();
82  auto cms = unpacker_->commonModeIndex();
83  for (unsigned int i = 0; i < channeldata.size(); i++) {
84  auto data = channeldata.at(i);
85  auto cm = cms.at(i);
86  const auto& id = data.id();
87  auto idraw = id.raw();
88  auto raw = data.raw();
89  LogDebug("HGCalRawToDigi:produce") << "id=" << idraw << ", raw=" << raw << ", common mode index=" << cm << ".";
90  digis.push_back(HGCROCChannelDataFrameSpec(elecid_to_detid(id), data.raw()));
91  elec_digis.push_back(data);
92  }
93  if (const auto& bad_econds = unpacker_->badECOND(); !bad_econds.empty()) {
94  if (bad_econds.size() > badECONDMax_)
95  throw cms::Exception("HGCalRawToDigi:produce")
96  << "Too many bad ECON-Ds: " << bad_econds.size() << " > " << badECONDMax_ << ".";
97  edm::LogWarning("HGCalRawToDigi:produce").log([&bad_econds](auto& log) {
98  log << "Bad ECON-D: " << std::dec;
100  for (const auto& badECOND : bad_econds)
101  log << prefix << badECOND, prefix = ", ";
102  log << ".";
103  });
104  }
105  }
106  iEvent.emplace(digisToken_, std::move(digis));
107  iEvent.emplace(elecDigisToken_, std::move(elec_digis));
108 }
const edm::EDPutTokenT< HGCalDigiCollection > digisToken_
size_type size() const
void push_back(T const &t)
HGCROCChannelDataFrame< HGCalDetId > HGCROCChannelDataFrameSpec
const std::vector< unsigned int > fedIds_
int iEvent
Definition: GenABIO.cc:224
wrapper for a 32b data word identifying a readout channel in the raw data The format is the following...
const unsigned int badECONDMax_
Namespace of DDCMS conversion namespace.
const edm::EDPutTokenT< HGCalElecDigiCollection > elecDigisToken_
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
static const int elecID
Definition: TopGenEvent.h:18
const std::unique_ptr< HGCalUnpacker< HGCalElectronicsId > > unpacker_
Log< level::Warning, false > LogWarning
const unsigned int numERxsInECOND_
def move(src, dest)
Definition: eostools.py:511
const edm::EDGetTokenT< FEDRawDataCollection > fedRawToken_
#define LogDebug(id)

Member Data Documentation

◆ badECONDMax_

const unsigned int HGCalRawToDigi::badECONDMax_
private

Definition at line 30 of file HGCalRawToDigi.cc.

Referenced by produce().

◆ digisToken_

const edm::EDPutTokenT<HGCalDigiCollection> HGCalRawToDigi::digisToken_
private

Definition at line 26 of file HGCalRawToDigi.cc.

Referenced by produce().

◆ elecDigisToken_

const edm::EDPutTokenT<HGCalElecDigiCollection> HGCalRawToDigi::elecDigisToken_
private

Definition at line 27 of file HGCalRawToDigi.cc.

Referenced by produce().

◆ fedIds_

const std::vector<unsigned int> HGCalRawToDigi::fedIds_
private

Definition at line 29 of file HGCalRawToDigi.cc.

Referenced by produce().

◆ fedRawToken_

const edm::EDGetTokenT<FEDRawDataCollection> HGCalRawToDigi::fedRawToken_
private

Definition at line 25 of file HGCalRawToDigi.cc.

Referenced by produce().

◆ numERxsInECOND_

const unsigned int HGCalRawToDigi::numERxsInECOND_
private

Definition at line 31 of file HGCalRawToDigi.cc.

Referenced by produce().

◆ unpacker_

const std::unique_ptr<HGCalUnpacker<HGCalElectronicsId> > HGCalRawToDigi::unpacker_
private

Definition at line 32 of file HGCalRawToDigi.cc.

Referenced by produce().