|
|
Go to the documentation of this file. 1 #ifndef EventFilter_HcalRawToDigi_PackerHelp_h
2 #define EventFilter_HcalRawToDigi_PackerHelp_h
209 for (
int is = 0; is < 8; is++) {
210 outVec.push_back((var64bit >> (is * 8)) & 0xFF);
259 uhtrs.push_back(uhtr);
280 for (
unsigned int iAMC = 0; iAMC <
AMCHeaders.size(); ++iAMC) {
288 for (
unsigned int iAMC = 0; iAMC <
uhtrs.size(); ++iAMC) {
289 unsigned int nWords16 =
uhtrs[iAMC].size();
290 for (
unsigned int amcWord = 0; amcWord < nWords16; ++amcWord) {
297 while (
fedData.size() % 8 != 0)
302 unsigned char* words = reinterpret_cast<unsigned char*>(
rawData.data());
304 for (
unsigned int i = 0;
i <
fedData.size(); ++
i) {
347 bool exist(
int uhtrIndex) {
return uhtrs.count(uhtrIndex) != 0; };
353 int fiber =
eid.fiberIndex() + 1;
354 int fiberchan =
eid.fiberChanId();
361 int fiberErr = qieSample.
er();
362 int capid0 = qieSample.
capid();
375 int adc = qieSample.
adc();
376 int capid = qieSample.
capid();
377 int dv = qieSample.
dv();
378 int er = qieSample.
er();
403 int fiber =
eid.fiberIndex();
404 int fiberchan =
eid.fiberChanId();
420 int fiber =
eid.fiberIndex();
421 int fiberchan =
eid.fiberChanId();
422 int flavor = qiedf[0].
flavor();
432 int capid0 = qiedf[0].capid();
450 uint64_t uhtrCrate = uhtrIndex & 0xFF;
451 uint64_t uhtrSlot = (uhtrIndex & 0xF00) >> 8;
476 for (
unsigned int i = 0;
i < 4; ++
i) {
477 uhtrs[uhtrIndex][
i] = (uhtrHeader1 >> (
i * 16)) & 0xFFFF;
478 uhtrs[uhtrIndex][
i + 4] = (uhtrHeader2 >> (
i * 16)) & 0xFFFF;
481 return &(
uhtrs[uhtrIndex]);
485 uint64_t uhtr_size = uhtr->size() - 8;
488 uhtr->at(0) = uhtr_size & 0xFFFF;
489 uhtr->at(1) |= (uhtr_size >> 16) & 0xF;
491 unsigned int toAdd = 4 - uhtr->size() % 4;
492 for (
unsigned int ia = 0; ia <
toAdd; ia++) {
493 uhtr->push_back(0xD07F);
497 uhtr->push_back(uhtr_size & 0xFFFF);
498 uhtr->push_back((uhtr_size >> 16) & 0xF);
511 if (qiedf->
size() == 0)
513 DetId detid = qiedf->id();
519 for (
int iTS = 0; iTS < qiedf->
size(); ++iTS) {
523 for (
int iTS = 0; iTS < qiedf->
size(); iTS += 2) {
525 int adc0 = qiedf->sample(iTS).adc();
526 int adc1 = qiedf->sample(iTS + 1).adc();
528 cont |= (adc1 & 0xFF) << 8;
539 if (qiedf->
size() == 0)
541 DetId detid = qiedf->id();
547 for (
int iTS = 0; iTS < qiedf->
size(); ++iTS) {
551 for (
int iTS = 0; iTS < qiedf->
size(); iTS += 2) {
553 int adc0 = qiedf->sample(iTS).adc();
554 int adc1 = qiedf->sample(iTS + 1).adc();
556 cont |= (adc1 & 0xFF) << 8;
566 if (qiedf->
size() == 0)
571 for (
int iTS = 0; iTS < qiedf->
size(); iTS++) {
573 auto raw = qiedf->sample(iTS).raw();
575 if (iTS == qiedf->presamples())
577 uhtrs[uhtrIndex].push_back(raw);
595 uhtrs[uhtrIndex].push_back(dfi[0]);
613 uhtrs[uhtrIndex].push_back(dfi[0]);
621 std::vector<int>
const& tdc1,
622 std::vector<int>
const& tdc2,
629 int capid = qiehe[0].capid();
631 static const int hbflavor = 3;
633 static const int maxHBdepth = 4;
641 if (it == qiehe.
begin())
643 adc = qiehe[is].adc();
644 tdc = qiehe[is].tdc();
645 soi = qiehe[is].soi();
647 if (tdc >= 0 && tdc <=
first)
651 else if (tdc >
second && tdc <= tdcmax)
constexpr edm::DataFrame::iterator begin()
iterators
QIE11DataFrame convertHB(QIE11DataFrame qiehe, std::vector< int > const &tdc1, std::vector< int > const &tdc2, const int tdcmax)
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
uint16_t *__restrict__ uint16_t const *__restrict__ adc
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
U second(std::pair< T, U > const &p)
static const int MASK_ADC
constexpr int depth() const
get the tower depth
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
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
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
constexpr int ieta() const
get the cell ieta
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
Abs< T >::type abs(const T &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)