9 namespace HcalUnpacker_impl {
10 template <
class DigiClass>
13 digi.setPresamples(presamples);
14 digi.setReadoutIds(eid);
15 int fiber=startPoint->
fiber();
29 while (qie_work!=limit && qie_work->
fiberAndChan()==myFiberChan) {
30 if (ncurr>=startSample && ncurr<=endSample) {
31 digi.setSample(ntaken,*qie_work);
43 return (s.
raw()&0x200)!=0;
67 if (!silent)
edm::LogWarning(
"Invalid Data") <<
"Empty/invalid DCC data, size = " << raw.
size();
79 const unsigned short* daq_first, *daq_last, *tp_first, *tp_last;
88 if (!silent)
edm::LogWarning(
"Invalid Data") <<
"Invalid HTR data (data beyond payload size) observed on spigot " << spigot <<
" of DCC with source id " << dccHeader->
getSourceId();
96 edm::LogWarning(
"Invalid Data") <<
"CRC Error on HTR data observed on spigot " << spigot <<
" of DCC with source id " << dccHeader->
getSourceId();
102 edm::LogWarning(
"Invalid Data") <<
"Invalid HTR data observed on spigot " << spigot <<
" of DCC with source id " << dccHeader->
getSourceId();
107 if (!silent)
edm::LogWarning(
"Invalid Data") <<
"Histogram data passed to non-histogram unpacker on spigot " << spigot <<
" of DCC with source id " << dccHeader->
getSourceId();
116 LogDebug(
"HcalTechTrigProcessor") <<
"Skipping data on spigot " << spigot <<
" of DCC with source id " << dccHeader->
getSourceId() <<
" which is from the TechTrigProcessor (use separate unpacker!)";
129 htr.
dataPointers(&daq_first,&daq_last,&tp_first,&tp_last);
132 int htr_slot=(smid>>1)&0x1F;
133 int htr_cr=(smid>>6)&0x1F;
139 int currFiberChan=0x3F;
151 for (tp_work=tp_begin; tp_work!=tp_end; tp_work++) {
152 if (tp_work->
raw()==0xFFFF)
continue;
154 if (sector>2)
continue;
156 for (
int ibit=0; ibit<8; ibit++) {
157 int linear=sector*8+ibit;
158 if (!unrolled[linear].checked) {
160 int fiber=(linear/3)+1;
164 eid.
setHTR(htr_cr,htr_slot,htr_tb);
169 unrolled[linear].
valid=
true;
177 if (unrolled[linear].valid) {
179 if (tp_work->
raw()&(1<<ibit)) unrolled[linear].
setbit(unrolled[linear].
samples);
184 for (
int i=0;
i<24;
i++) {
185 if (unrolled[
i].valid)
191 unrolled[
i].databits));
194 for (tp_work=tp_begin; tp_work!=tp_end; tp_work++) {
195 if (tp_work->
raw()==0xFFFF)
continue;
205 if (!silent)
edm::LogWarning(
"HCAL") <<
"HcalUnpacker: No trigger primitive match found for electronics id :" << eid;
219 if (!tpgSOIbitInUse) colls.
tpCont->back().setPresamples(nps);
228 colls.
tpCont->back().setSample(colls.
tpCont->back().size(),*tp_work);
229 colls.
tpCont->back().setSize(colls.
tpCont->back().size()+1);
232 if (valid && tpgSOIbitInUse &&
isTPGSOI(*tp_work)) {
233 colls.
tpCont->back().setPresamples(ncurr);
250 for (qie_work=qie_begin; qie_work!=qie_end; ) {
251 if (qie_work->
raw()==0xFFFF) {
260 eid.
setHTR(htr_cr,htr_slot,htr_tb);
301 if (!silent)
edm::LogWarning(
"HCAL") <<
"HcalUnpacker: No match found for electronics id :" << eid;
361 if (retval || !htr.
check()) {
362 edm::LogWarning(
"Invalid Data") <<
"Invalid HTR data observed on spigot " << spigot <<
" of DCC with source id " << dccHeader->
getSourceId();
366 edm::LogWarning(
"Invalid Data") <<
"Non-histogram data passed to histogram unpacker on spigot " << spigot <<
" of DCC with source id " << dccHeader->
getSourceId();
372 int htr_slot=(smid>>1)&0x1F;
373 int htr_cr=(smid>>6)&0x1F;
379 for (
int nf=0; nf<2; nf++) {
380 if (f[nf]<0 || (nf==1 && f[0]==f[1]))
continue;
381 for (fc=0; fc<=2; fc++) {
383 eid.
setHTR(htr_cr,htr_slot,htr_tb);
388 edm::LogWarning(
"HCAL") <<
"HcalHistogramUnpacker: No match found for electronics id :" << eid;
397 for (
int capid=0; capid<4; capid++)
std::set< HcalElectronicsId > unknownIds_
int sourceIdOffset_
number to subtract from the source id to get the dcc id
int endSample_
last sample from fed raw data to copy (if present)
int startSample_
first sample from fed raw data to copy
void countUnmappedTPDigi()
uint16_t raw() const
get the raw word
bool check() const
Check for a good event Requires a minimum length, matching wordcount and length, not an empty event...
std::vector< HcalTTPDigi > * ttp
std::vector< HFDataFrame > * hfCont
int fiberAndChan() const
get the id channel
int fiberChan() const
get the fiber channel number
static bool isTPGSOI(const HcalTriggerPrimitiveSample &s)
std::vector< HBHEDataFrame > * hbheCont
std::vector< HOTriggerPrimitiveDigi > * tphoCont
bool wasMarkAndPassZS(int fiber, int fiberchan) const
Was this channel passed as part of Mark&Pass ZS?
unsigned int getFibOrbMsgBCN(int fiber) const
Get the BCN of the Fiber Orbit Messages.
void getHistogramFibers(int &a, int &b) const
Get the fiber numbers for the data present in this event (only in histogram mode!) ...
int slbChan() const
get the slb channel number
int getFormatVersion() const
Get the version number of this event.
size_t size() const
Lenght of the data buffer in bytes.
void countSpigotFormatError()
bool isUnsuppressed() const
Is this event an unsuppresed event?
bool unpackHistogram(int fiber, int fiberchan, int capid, unsigned short *histogram) const
Unpack special histogramming mode data.
int slbAndChan() const
get the id channel
int expectedOrbitMessageTime_
Expected orbit bunch time (needed to evaluate time differences)
int ieta() const
get the cell ieta
uint16_t raw() const
get the raw word
std::vector< HcalTriggerPrimitiveDigi > * tpCont
int fiber() const
get the fiber number
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
std::set< HcalElectronicsId > unknownIdsTrig_
Recorded to limit number of times a log message is generated.
int iphi() const
get the cell iphi
void setHTR(int crate, int slot, int tb)
void unpack(const FEDRawData &raw, const HcalElectronicsMap &emap, std::vector< HcalHistogramDigi > &histoDigis)
static const int SubdetectorId
std::vector< HcalCalibDataFrame > * calibCont
HcalOtherSubdetector subdet() const
get the category
void dataPointers(const unsigned short **daq_first, const unsigned short **daq_last, const unsigned short **tp_first, const unsigned short **tp_last) const
Obtain the starting and ending pointers for external unpacking of the data.
bool unpack(const HcalHTRData &data, HcalTTPDigi &digi)
bool null() const
is this a null id ?
std::vector< HODataFrame > * hoCont
int getNPS() const
Get the number of presamples in daq data.
static const HcalTrigTowerDetId Undefined
int getFirmwareFlavor() const
Get the HTR firmware flavor.
int slb() const
get the slb site number
bool wasMarkAndPassZSTP(int slb, int slbchan) const
Was this channel passed as part of Mark&Pass ZS?
uint16_t * getArray(int capid)
get the array for the specified capid
uint32_t zsBunchMask() const
ZS Bunch Mask (if available)
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
std::vector< ZDCDataFrame > * zdcCont
const DetId lookupTrigger(HcalElectronicsId fId) const
brief lookup the trigger logical detid associated with the given electronics id
unsigned int getSubmodule() const
Get the HTR submodule number.
Detector det() const
get the detector field from this detid
Readout chain identification for Hcal [31:26] Unused (so far) [25] Trigger-chain id flag [24:20] Read...
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
bool isHistogramEvent() const
Is this event a histogram event? (do not call standard unpack in this case!!!!!)
const HcalQIESample * unpack(const HcalQIESample *startPoint, const HcalQIESample *limit, DigiClass &digi, int presamples, const HcalElectronicsId &eid, int startSample, int endSample, int expectedTime, const HcalHTRData &hhd)