|
|
Go to the documentation of this file. 1 #ifndef EventFilter_HcalRawToDigi_PackerHelp_h
2 #define EventFilter_HcalRawToDigi_PackerHelp_h
208 for (
int is = 0; is < 8; is++) {
209 outVec.push_back((var64bit >> (is * 8)) & 0xFF);
258 uhtrs.push_back(uhtr);
279 for (
unsigned int iAMC = 0; iAMC <
AMCHeaders.size(); ++iAMC) {
287 for (
unsigned int iAMC = 0; iAMC <
uhtrs.size(); ++iAMC) {
288 unsigned int nWords16 =
uhtrs[iAMC].size();
289 for (
unsigned int amcWord = 0; amcWord < nWords16; ++amcWord) {
296 while (
fedData.size() % 8 != 0)
301 unsigned char* words = reinterpret_cast<unsigned char*>(
rawData.data());
303 for (
unsigned int i = 0;
i <
fedData.size(); ++
i) {
346 bool exist(
int uhtrIndex) {
return uhtrs.count(uhtrIndex) != 0; };
352 int fiber =
eid.fiberIndex() + 1;
353 int fiberchan =
eid.fiberChanId();
360 int fiberErr = qieSample.
er();
361 int capid0 = qieSample.
capid();
374 int adc = qieSample.
adc();
375 int capid = qieSample.
capid();
376 int dv = qieSample.
dv();
377 int er = qieSample.
er();
402 int fiber =
eid.fiberIndex();
403 int fiberchan =
eid.fiberChanId();
419 int fiber =
eid.fiberIndex();
420 int fiberchan =
eid.fiberChanId();
421 int flavor = qiedf[0].
flavor();
431 int capid0 = qiedf[0].capid();
449 uint64_t uhtrCrate = uhtrIndex & 0xFF;
450 uint64_t uhtrSlot = (uhtrIndex & 0xF00) >> 8;
475 for (
unsigned int i = 0;
i < 4; ++
i) {
476 uhtrs[uhtrIndex][
i] = (uhtrHeader1 >> (
i * 16)) & 0xFFFF;
477 uhtrs[uhtrIndex][
i + 4] = (uhtrHeader2 >> (
i * 16)) & 0xFFFF;
480 return &(
uhtrs[uhtrIndex]);
484 uint64_t uhtr_size = uhtr->size() - 8;
487 uhtr->at(0) = uhtr_size & 0xFFFF;
488 uhtr->at(1) |= (uhtr_size >> 16) & 0xF;
490 unsigned int toAdd = 4 - uhtr->size() % 4;
491 for (
unsigned int ia = 0; ia <
toAdd; ia++) {
492 uhtr->push_back(0xD07F);
496 uhtr->push_back(uhtr_size & 0xFFFF);
497 uhtr->push_back((uhtr_size >> 16) & 0xF);
510 if (qiedf->
size() == 0)
512 DetId detid = qiedf->id();
518 for (
int iTS = 0; iTS < qiedf->
size(); ++iTS) {
522 for (
int iTS = 0; iTS < qiedf->
size(); iTS += 2) {
524 int adc0 = qiedf->sample(iTS).adc();
525 int adc1 = qiedf->sample(iTS + 1).adc();
527 cont |= (adc1 & 0xFF) << 8;
538 if (qiedf->
size() == 0)
540 DetId detid = qiedf->id();
546 for (
int iTS = 0; iTS < qiedf->
size(); ++iTS) {
550 for (
int iTS = 0; iTS < qiedf->
size(); iTS += 2) {
552 int adc0 = qiedf->sample(iTS).adc();
553 int adc1 = qiedf->sample(iTS + 1).adc();
555 cont |= (adc1 & 0xFF) << 8;
565 if (qiedf->
size() == 0)
570 for (
int iTS = 0; iTS < qiedf->
size(); iTS++) {
572 auto raw = qiedf->sample(iTS).raw();
574 if (iTS == qiedf->presamples())
576 uhtrs[uhtrIndex].push_back(raw);
594 uhtrs[uhtrIndex].push_back(dfi[0]);
612 uhtrs[uhtrIndex].push_back(dfi[0]);
626 static const int hbflavor = 3;
630 if (it == qiehe.
begin())
632 adc = qiehe[is].adc();
633 tdc = qiehe[is].tdc();
634 soi = qiehe[is].soi();
636 if (tdc >= 0 && tdc <= tdc1)
638 else if (tdc > tdc1 && tdc <= tdc2)
640 else if (tdc > tdc2 && tdc <= tdcmax)
651 int capid = qiehe[0].capid();
constexpr edm::DataFrame::iterator begin()
iterators
uint16_t packQIE8header(const HcalQIESample &qieSample, const HcalElectronicsId &eid, int flavor)
static const int MASK_DATA_LENGTH
static const int OFFSET_PAYLOAD_FORMAT
uint16_t packQIE10header(const HcalElectronicsId &eid)
static const int OFFSET_ER
void addUHTR(uhtrData uhtr, uint64_t crate, uint64_t slot)
static const int OFFSET_EVENT_TYPE
std::vector< T >::const_iterator const_iterator
std::map< int, uhtrData > UHTRMap
static const int MASK_ORN
uint16_t packQIE11header(const QIE11DataFrame &qiedf, const HcalElectronicsId &eid)
constexpr int adc() const
get the ADC sample
constexpr edm::DataFrame::iterator end()
static const int OFFSET_EVN
static const int OFFSET_FW_FLAVOR
void addChannel(int uhtrIndex, edm::SortedCollection< HBHEDataFrame >::const_iterator qiedf, const HcalElectronicsMap *readoutMap, bool premix, int verbosity=0)
constexpr void setCapid0(int cap0)
void addChannel(int uhtrIndex, QIE11DataFrame qiedf, const HcalElectronicsMap *readoutMap, int verbosity=0)
cont
load Luminosity info ##
static const int MASK_PAYLOAD_FORMAT
static const int MASK_ADC
void setNAMC(uint64_t NAMC)
static const int MASK_CRATE_ID
HCalFED(int fedId_, uint64_t EventNum_=9999, uint64_t OrbitNum_=999, uint64_t BxNum_=99)
constexpr bool er() const
is the error bit set?
static const int OFFSET_PRESAMPLES
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
static const int OFFSET_FILED_BY_AMC13
static const int MASK_SLOT_ID
static const int MASK_FILED_BY_AMC13
constexpr edm::DataFrame::iterator end()
constexpr DetId detid() const
Get the detector id.
static const int MASK_CAPID
static const int OFFSET_CRATE_ID
QIE11DataFrame convertHB(QIE11DataFrame qiehe, int tdc1, int tdc2, int tdcmax)
Readout chain identification for Hcal.
void split64bitTo8bit(std::vector< unsigned char > &outVec, const uint64_t &var64bit)
void addChannel(int uhtrIndex, edm::SortedCollection< HcalTriggerPrimitiveDigi >::const_iterator qiedf, int channelid, int verbosity=0)
constexpr void setFlavor(int flavor)
static const int MASK_FW_VERSION
static const int OFFSET_FW_VERSION
constexpr void setSample(edm::DataFrame::size_type isample, int adc, int tdc, bool soi=false)
set the sample contents
static const int HEADER_WORDS
void formatFEDdata(FEDRawData &rawData)
static const int MASK_PRESAMPLES
std::vector< uhtrData > uhtrs
static const int MASK_EVENT_TYPE
constexpr int capid() const
get the Capacitor id
static const int MASK_EVN
const data_type * const_iterator
static const int OFFSET_DV
constexpr DetId detid() const
Get the detector id.
void addChannel(int uhtrIndex, QIE10DataFrame qiedf, const HcalElectronicsMap *readoutMap, int verbosity=0)
constexpr bool dv() const
is the Data Valid bit set?
std::vector< uint16_t > uhtrData
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
static const int OFFSET_ORN
std::vector< unsigned char > fedData
static const int OFFSET_BCN
uint16_t packTPheader(const HcalTriggerPrimitiveSample &tpSample, int channelid)
constexpr int flavor() const
get the flavor of the frame
bool exist(int uhtrIndex)
static const int OFFSET_DATA_LENGTH
static const int OFFSET_SLOT_ID
uint16_t packQIE8sample(const HcalQIESample &qieSample)
constexpr edm::DataFrame::iterator begin()
iterators
static const int MASK_FW_FLAVOR
uhtrData * newUHTR(int uhtrIndex, int ps=0, int orn=0, int bcn=0, uint64_t evt=0)
static const int OFFSET_CAPID
std::vector< uint64_t > AMCHeaders
static const int OFFSET_ADC
unsigned long long uint64_t
static const int FLAG_WORDS
std::vector< uint16_t > uhtrData
static const int HEADER_WORDS
static const int FLAG_WORDS
static const int MASK_BCN
void addAMCHeader(uint64_t crate, uint64_t slot, uint64_t AMCsize, uint64_t presamples=10, uint64_t blockNum=0)
void finalizeHeadTail(uhtrData *uhtr, bool verbosity)
void addChannel(int uhtrIndex, edm::SortedCollection< HFDataFrame >::const_iterator &qiedf, const HcalElectronicsMap *readoutMap, bool premix, int verbosity=0)