12 namespace CastorUnpacker_impl {
13 template <
class DigiClass>
16 digi.setPresamples(presamples);
17 int fiber=startPoint->
fiber();
32 while (qie_work!=limit && qie_work->
fiberAndChan()==myFiberChan) {
33 if (ncurr>=startSample && ncurr<=endSample) {
34 digi.setSample(ntaken,*qie_work);
46 return (s.
raw()&0x200)!=0;
58 if ( end >= 0 && end <= CastorDataFrame::MAXSAMPLES -1 && end >= beg ) {
70 if (!silent)
edm::LogWarning(
"Invalid Data") <<
"Empty/invalid DCC data, size = " << raw.
size();
82 const unsigned short* daq_first, *daq_last, *tp_first, *tp_last;
91 if (!silent)
edm::LogWarning(
"Invalid Data") <<
"Invalid HTR data (data beyond payload size) observed on spigot " << spigot <<
" of DCC with source id " << dccHeader->
getSourceId();
99 edm::LogWarning(
"Invalid Data") <<
"CRC Error on HTR data observed on spigot " << spigot <<
" of DCC with source id " << dccHeader->
getSourceId();
105 edm::LogWarning(
"Invalid Data") <<
"Invalid HTR data observed on spigot " << spigot <<
" of DCC with source id " << dccHeader->
getSourceId();
111 edm::LogWarning(
"Invalid Data") <<
"Histogram data passed to non-histogram unpacker on spigot " << spigot <<
" of DCC with source id " << dccHeader->
getSourceId();
121 LogDebug(
"CastorUnpackerHcalTechTrigProcessor") <<
"Skipping data on spigot " << spigot <<
" of DCC with source id " << dccHeader->
getSourceId() <<
" which is from the TechTrigProcessor (use separate unpacker!)";
133 htr.
dataPointers(&daq_first,&daq_last,&tp_first,&tp_last);
136 int htr_slot=(smid>>1)&0x1F;
137 int htr_cr=(smid>>6)&0x1F;
143 int currFiberChan=0x3F;
156 eid.
setHTR(htr_cr,htr_slot,htr_tb);
158 if ( did.
null() ) dotp =
false;
161 if ( id1.
module() > 12 ) dotp =
false;
165 for (tp_work=tp_begin; tp_work!=tp_end; tp_work++) {
167 if (tp_work->
raw()==0xFFFF)
continue;
192 if (!tpgSOIbitInUse) colls.
tpCont->back().setPresamples(nps);
201 colls.
tpCont->back().setSample(colls.
tpCont->back().size(),*tp_work);
202 colls.
tpCont->back().setSize(colls.
tpCont->back().size()+1);
205 if (valid && tpgSOIbitInUse &&
isTPGSOI(*tp_work)) {
206 colls.
tpCont->back().setPresamples(ncurr);
222 for (qie_work=qie_begin; qie_work!=qie_end; ) {
223 if (qie_work->
raw()==0xFFFF) {
232 eid.
setHTR(htr_cr,htr_slot,htr_tb);
242 edm::LogWarning(
"CASTOR") <<
"CastorUnpacker: No match found for electronics id :" << eid;
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...
int sector() const
get the sector (1-16)
int fiberAndChan() const
get the id channel
int fiberChan() const
get the fiber channel number
void setHTR(int crate, int slot, int tb)
static bool isTPGSOI(const HcalTriggerPrimitiveSample &s)
int module() const
get the module (1-2 for EM, 1-12 for HAD)
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.
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()
std::set< CastorElectronicsId > unknownIds_
void unpack(const FEDRawData &raw, const CastorElectronicsMap &emap, CastorRawCollections &conts, HcalUnpackerReport &report, bool silent=false)
For histograms, no begin and end.
bool isUnsuppressed() const
Is this event an unsuppresed event?
const DetId lookup(CastorElectronicsId fId) const
lookup the logical detid associated with the given electronics id
int slbAndChan() const
get the id channel
CastorUnpacker(int sourceIdOffset, int beg, int end)
for normal data
int zside() const
get the z-side of the cell (1/-1)
uint16_t raw() const
get the raw word
int fiber() const
get the fiber number
std::vector< CastorDataFrame > * castorCont
std::vector< CastorTriggerPrimitiveDigi > * tpCont
int sourceIdOffset_
number to subtract from the source id to get the dcc id
int expectedOrbitMessageTime_
Expected orbit bunch time (needed to evaluate time differences)
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 ?
int getNPS() const
Get the number of presamples in daq data.
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?
const HcalQIESample * unpack(const HcalQIESample *startPoint, const HcalQIESample *limit, DigiClass &digi, int presamples, const CastorElectronicsId &eid, int startSample, int endSample, int expectedTime, const HcalHTRData &hhd)
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.
Readout chain identification for Castor Bits for the readout chain : some names need change! [31:26] ...
unsigned int getSubmodule() const
Get the HTR submodule number.
static const int MAXSAMPLES
bool isHistogramEvent() const
Is this event a histogram event? (do not call standard unpack in this case!!!!!)
int startSample_
first sample from fed raw data to copy
int endSample_
last sample from fed raw data to copy (if present)
std::vector< HcalTTPDigi > * ttp