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)) {
245 for (UHTRpacker::UHTRMap::iterator uhtr = uhtrs.
uhtrs.begin(); uhtr != uhtrs.
uhtrs.end(); ++uhtr) {
248 uint64_t crateId = (uhtr->first) & 0xFF;
249 uint64_t slotId = (uhtr->first & 0xF00) >> 8;
253 if (fedMap.find(
fedId) == fedMap.end()) {
258 fedMap[
fedId]->addUHTR(uhtr->second, crateId, slotId);
266 for (
map<
int, unique_ptr<HCalFED>>::iterator fed = fedMap.begin(); fed != fedMap.end(); ++fed) {
267 int fedId = fed->first;
270 fed->second->formatFEDdata(
rawData);
291 desc.addUntracked<
int>(
"Verbosity", 0);
292 desc.add<vector<int>>(
"tdc1", {8, 14, 15, 17, 8, 14, 15, 17, 8, 14, 14, 17, 8, 14, 14, 17, 8, 13, 14, 16, 8, 13,
293 14, 16, 8, 12, 14, 15, 8, 12, 14, 15, 7, 12, 13, 15, 7, 12, 13, 15, 7, 12, 13, 15,
294 7, 12, 13, 15, 7, 11, 12, 14, 7, 11, 12, 14, 7, 11, 12, 14, 7, 11, 12, 7});
295 desc.add<vector<int>>(
"tdc2", {10, 16, 17, 19, 10, 16, 17, 19, 10, 16, 16, 19, 10, 16, 16, 19, 10, 15, 16, 18, 10, 15,
296 16, 18, 10, 14, 16, 17, 10, 14, 16, 17, 9, 14, 15, 17, 9, 14, 15, 17, 9, 14, 15, 17,
297 9, 14, 15, 17, 9, 13, 14, 16, 9, 13, 14, 16, 9, 13, 14, 16, 9, 13, 14, 9});
298 desc.add<
bool>(
"packHBTDC",
true);
305 desc.add<
bool>(
"premix",
false);
306 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)
#define DEFINE_FWK_MODULE(type)
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
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_