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 ) {
75 if (!silent)
edm::LogWarning(
"Invalid Data") <<
"Empty/invalid DCC data, size = " << raw.
size();
87 const unsigned short* daq_first, *daq_last, *tp_first, *tp_last;
96 if (!silent)
edm::LogWarning(
"Invalid Data") <<
"Invalid HTR data (data beyond payload size) observed on spigot " << spigot <<
" of DCC with source id " << dccHeader->
getSourceId();
104 edm::LogWarning(
"Invalid Data") <<
"CRC Error on HTR data observed on spigot " << spigot <<
" of DCC with source id " << dccHeader->
getSourceId();
110 edm::LogWarning(
"Invalid Data") <<
"Invalid HTR data observed on spigot " << spigot <<
" of DCC with source id " << dccHeader->
getSourceId();
116 edm::LogWarning(
"Invalid Data") <<
"Histogram data passed to non-histogram unpacker on spigot " << spigot <<
" of DCC with source id " << dccHeader->
getSourceId();
126 LogDebug(
"CastorUnpackerHcalTechTrigProcessor") <<
"Skipping data on spigot " << spigot <<
" of DCC with source id " << dccHeader->
getSourceId() <<
" which is from the TechTrigProcessor (use separate unpacker!)";
138 htr.
dataPointers(&daq_first,&daq_last,&tp_first,&tp_last);
141 int htr_slot=(smid>>1)&0x1F;
142 int htr_cr=(smid>>6)&0x1F;
148 int currFiberChan=0x3F;
161 eid.
setHTR(htr_cr,htr_slot,htr_tb);
163 if ( did.
null() ) dotp =
false;
166 if ( id1.
module() > 12 ) dotp =
false;
170 for (tp_work=tp_begin; tp_work!=tp_end; tp_work++) {
172 if (tp_work->
raw()==0xFFFF)
continue;
197 if (!tpgSOIbitInUse) colls.
tpCont->back().setPresamples(nps);
206 colls.
tpCont->back().setSample(colls.
tpCont->back().size(),*tp_work);
207 colls.
tpCont->back().setSize(colls.
tpCont->back().size()+1);
210 if (valid && tpgSOIbitInUse &&
isTPGSOI(*tp_work)) {
211 colls.
tpCont->back().setPresamples(ncurr);
224 for (qie_work=qie_begin; qie_work!=qie_end; ) {
225 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...
static int slb(const HcalTriggerPrimitiveSample &theSample)
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.
static int slbChan(const HcalTriggerPrimitiveSample &theSample)
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
CastorUnpacker(int sourceIdOffset, int beg, int end)
for normal data
static int slbAndChan(const HcalTriggerPrimitiveSample &theSample)
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.
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