57 static constexpr
int tdcmax_ = 49;
70 : _verbosity(iConfig.getUntrackedParameter<
int>(
"Verbosity", 0)),
71 tdc1_(iConfig.getParameter<
vector<
int>>(
"tdc1")),
72 tdc2_(iConfig.getParameter<
vector<
int>>(
"tdc2")),
73 packHBTDC_(iConfig.getParameter<
bool>(
"packHBTDC")),
74 tok_QIE10DigiCollection_(
76 tok_QIE11DigiCollection_(
83 premix_(iConfig.getParameter<
bool>(
"premix")) {
84 produces<FEDRawDataCollection>(
"");
85 for (
size_t i = 0;
i <
tdc1_.size();
i++) {
88 <<
" incorrect TDC ranges " <<
i <<
"-th element: " <<
tdc1_.at(
i) <<
", " <<
tdc2_.at(
i) <<
", " <<
tdcmax_;
117 map<int, unique_ptr<HCalFED>> fedMap;
124 if (qie10DigiCollection.
isValid()) {
126 for (
unsigned int j = 0;
j < qie10dc.
size();
j++) {
130 int crateId =
eid.crateId();
131 int slotId =
eid.slot();
132 int uhtrIndex = ((slotId & 0xF) << 8) | (crateId & 0xFF);
140 if (!uhtrs.
exist(uhtrIndex)) {
151 if (qie11DigiCollection.
isValid()) {
153 for (
unsigned int j = 0;
j < qie11dc.
size();
j++) {
157 int crateId =
eid.crateId();
158 int slotId =
eid.slot();
159 int uhtrIndex = ((slotId & 0xF) << 8) | (crateId & 0xFF);
166 if (!uhtrs.
exist(uhtrIndex)) {
176 if (hfDigiCollection.
isValid()) {
179 DetId detid = qiedf->id();
182 int crateId =
eid.crateId();
183 int slotId =
eid.slot();
184 int uhtrIndex = (crateId & 0xFF) | ((slotId & 0xF) << 8);
187 if (!uhtrs.
exist(uhtrIndex)) {
197 if (hbheDigiCollection.
isValid()) {
200 DetId detid = qiedf->id();
203 int crateId =
eid.crateId();
204 int slotId =
eid.slot();
205 int uhtrIndex = (crateId & 0xFF) | ((slotId & 0xF) << 8);
208 if (!uhtrs.
exist(uhtrIndex)) {
221 DetId detid = qiedf->id();
224 int crateId =
eid.crateId();
225 int slotId =
eid.slot();
226 int uhtrIndex = (crateId & 0xFF) | ((slotId & 0xF) << 8);
227 int ilink =
eid.fiberIndex();
228 int itower =
eid.fiberChanId();
229 int channelid = (itower & 0xF) | ((ilink & 0xF) << 4);
232 if (!uhtrs.
exist(uhtrIndex)) {
244 for (UHTRpacker::UHTRMap::iterator uhtr = uhtrs.
uhtrs.begin(); uhtr != uhtrs.
uhtrs.end(); ++uhtr) {
245 uint64_t crateId = (uhtr->first) & 0xFF;
246 uint64_t slotId = (uhtr->first & 0xF00) >> 8;
250 if (fedMap.find(
fedId) == fedMap.end()) {
255 fedMap[
fedId]->addUHTR(uhtr->second, crateId, slotId);
263 for (
map<
int, unique_ptr<HCalFED>>::iterator fed = fedMap.begin(); fed != fedMap.end(); ++fed) {
264 int fedId = fed->first;
267 fed->second->formatFEDdata(
rawData);
288 desc.addUntracked<
int>(
"Verbosity", 0);
289 desc.add<vector<int>>(
"tdc1", {12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
290 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
291 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12});
292 desc.add<vector<int>>(
"tdc2", {14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
293 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
294 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14});
295 desc.add<
bool>(
"packHBTDC",
true);
302 desc.add<
bool>(
"premix",
false);
303 descriptions.
add(
"hcalDigiToRawuHTR",
desc);
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
constexpr DetId detid() const
Get the detector id.
const edm::EDGetTokenT< HBHEDigiCollection > tok_HBHEDigiCollection_
void finalizeHeadTail(uhtrData *uhtr, bool verbosity)
QIE11DataFrame convertHB(QIE11DataFrame qiehe, std::vector< int > const &tdc1, std::vector< int > const &tdc2, const int tdcmax)
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
uhtrData * newUHTR(int uhtrIndex, int ps=0, int orn=0, int bcn=0, uint64_t evt=0)
std::vector< T >::const_iterator const_iterator
static constexpr int tdcmax_
constexpr int presamples() const
for backward compatibility
constexpr DetId detid() const
Get the detector id.
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void addDefault(ParameterSetDescription const &psetDescription)
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.
unsigned short compute_crc(unsigned char *buffer, unsigned int bufSize)
const edm::ESGetToken< HcalElectronicsMap, HcalElectronicsMapRcd > tok_electronicsMap_
~HcalDigiToRawuHTR() override
#define DEFINE_FWK_MODULE(type)
const_iterator begin() const
HcalDigiToRawuHTR(const edm::ParameterSet &)
constexpr int presamples() const
for backward compatibility
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
const_iterator end() const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
unsigned long long uint64_t
constexpr uint32_t rawId() const
get the raw id
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void addChannel(int uhtrIndex, edm::SortedCollection< HFDataFrame >::const_iterator &qiedf, const HcalElectronicsMap *readoutMap, bool premix, int verbosity=0)
bool exist(int uhtrIndex)
const vector< int > tdc1_
const DetId lookupTrigger(HcalElectronicsId fId) const
brief lookup the trigger logical detid associated with the given electronics id
Log< level::Warning, false > LogWarning
Readout chain identification for Hcal.
const edm::EDGetTokenT< HcalDataFrameContainer< QIE11DataFrame > > tok_QIE11DigiCollection_
const edm::EDGetTokenT< HcalTrigPrimDigiCollection > tok_TPDigiCollection_
const edm::EDGetTokenT< HFDigiCollection > tok_HFDigiCollection_
const vector< int > tdc2_
const edm::EDGetTokenT< HcalDataFrameContainer< QIE10DataFrame > > tok_QIE10DigiCollection_