CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
HcalUnpacker Class Reference

#include <HcalUnpacker.h>

Classes

struct  Collections
 

Public Member Functions

 HcalUnpacker (int sourceIdOffset, int beg, int end)
 for normal data More...
 
 HcalUnpacker (int sourceIdOffset)
 For histograms, no begin and end. More...
 
void setExpectedOrbitMessageTime (int time)
 
void setMode (int mode)
 
void unpack (const FEDRawData &raw, const HcalElectronicsMap &emap, std::vector< HcalHistogramDigi > &histoDigis)
 
void unpack (const FEDRawData &raw, const HcalElectronicsMap &emap, Collections &conts, HcalUnpackerReport &report, bool silent=false)
 

Private Member Functions

void printInvalidDataMessage (const std::string &coll_type, int default_ns, int conflict_ns, bool extended=false)
 
void unpackUMNio (const FEDRawData &raw, int slot, Collections &colls)
 
void unpackUTCA (const FEDRawData &raw, const HcalElectronicsMap &emap, Collections &conts, HcalUnpackerReport &report, bool silent=false)
 
void unpackVME (const FEDRawData &raw, const HcalElectronicsMap &emap, Collections &conts, HcalUnpackerReport &report, bool silent=false)
 

Private Attributes

int endSample_
 last sample from fed raw data to copy (if present) More...
 
int expectedOrbitMessageTime_
 Expected orbit bunch time (needed to evaluate time differences) More...
 
int mode_
 
int nPrinted_
 
int sourceIdOffset_
 number to subtract from the source id to get the dcc id More...
 
int startSample_
 first sample from fed raw data to copy More...
 
std::set< HcalElectronicsIdunknownIds_
 
std::set< HcalElectronicsIdunknownIdsTrig_
 Recorded to limit number of times a log message is generated. More...
 

Detailed Description

Definition at line 21 of file HcalUnpacker.h.

Constructor & Destructor Documentation

◆ HcalUnpacker() [1/2]

HcalUnpacker::HcalUnpacker ( int  sourceIdOffset,
int  beg,
int  end 
)
inline

for normal data

Definition at line 44 of file HcalUnpacker.h.

45  : sourceIdOffset_(sourceIdOffset),
46  startSample_(beg),
47  endSample_(end),
49  mode_(0),
50  nPrinted_(0) {}
int sourceIdOffset_
number to subtract from the source id to get the dcc id
Definition: HcalUnpacker.h:83
int endSample_
last sample from fed raw data to copy (if present)
Definition: HcalUnpacker.h:85
int startSample_
first sample from fed raw data to copy
Definition: HcalUnpacker.h:84
int expectedOrbitMessageTime_
Expected orbit bunch time (needed to evaluate time differences)
Definition: HcalUnpacker.h:86

◆ HcalUnpacker() [2/2]

HcalUnpacker::HcalUnpacker ( int  sourceIdOffset)
inline

For histograms, no begin and end.

Definition at line 52 of file HcalUnpacker.h.

53  : sourceIdOffset_(sourceIdOffset),
54  startSample_(-1),
55  endSample_(-1),
57  mode_(0),
58  nPrinted_(0) {}
int sourceIdOffset_
number to subtract from the source id to get the dcc id
Definition: HcalUnpacker.h:83
int endSample_
last sample from fed raw data to copy (if present)
Definition: HcalUnpacker.h:85
int startSample_
first sample from fed raw data to copy
Definition: HcalUnpacker.h:84
int expectedOrbitMessageTime_
Expected orbit bunch time (needed to evaluate time differences)
Definition: HcalUnpacker.h:86

Member Function Documentation

◆ printInvalidDataMessage()

void HcalUnpacker::printInvalidDataMessage ( const std::string &  coll_type,
int  default_ns,
int  conflict_ns,
bool  extended = false 
)
private

Definition at line 1074 of file HcalUnpacker.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), remoteMonitoring_LASER_era2018_cfg::limit, and nPrinted_.

Referenced by unpackUTCA().

1077  {
1078  nPrinted_++;
1079 
1080  constexpr int limit = 2; //print up to limit-1 messages
1081  if (nPrinted_ >= limit) {
1082  if (nPrinted_ == limit)
1083  edm::LogInfo("Invalid Data") << "Suppressing further error messages";
1084 
1085  return;
1086  }
1087 
1088  std::stringstream message;
1089 
1090  message << "The default " << coll_type << " Collection has " << default_ns
1091  << " samples per digi, while the current data has " << conflict_ns
1092  << "! This data cannot be included with the default collection.";
1093 
1094  if (extended) {
1095  message << "\nIn order to store this data in the event, it must have a unique tag. "
1096  << "To accomplish this, provide two lists to HcalRawToDigi \n"
1097  << "1) that specifies the number of samples and "
1098  << "2) that gives tags with which these data are saved.\n"
1099  << "For example in this case you might add \n"
1100  << "process.hcalDigis.save" << coll_type << "DataNSamples = cms.untracked.vint32( " << conflict_ns
1101  << ") \nprocess.hcalDigis.save" << coll_type << "DataTags = cms.untracked.vstring( \"MYDATA\" )";
1102  }
1103 
1104  edm::LogWarning("Invalid Data") << message.str();
1105 }
Log< level::Info, false > LogInfo
Log< level::Warning, false > LogWarning

◆ setExpectedOrbitMessageTime()

void HcalUnpacker::setExpectedOrbitMessageTime ( int  time)
inline

Definition at line 59 of file HcalUnpacker.h.

References expectedOrbitMessageTime_, and hcalRecHitTable_cff::time.

Referenced by HcalRawToDigi::HcalRawToDigi().

int expectedOrbitMessageTime_
Expected orbit bunch time (needed to evaluate time differences)
Definition: HcalUnpacker.h:86

◆ setMode()

void HcalUnpacker::setMode ( int  mode)
inline

◆ unpack() [1/2]

void HcalUnpacker::unpack ( const FEDRawData raw,
const HcalElectronicsMap emap,
std::vector< HcalHistogramDigi > &  histoDigis 
)

Definition at line 995 of file HcalUnpacker.cc.

References HcalHTRData::check(), FEDRawData::data(), DetId::det(), runTauDisplay::eid, f, HcalHistogramDigi::getArray(), HcalHTRData::getHistogramFibers(), HcalDCCHeader::getSourceId(), HcalDCCHeader::getSpigotData(), HcalDCCHeader::getSpigotPresent(), HcalHTRData::getSubmodule(), DetId::Hcal, HcalHTRData::isHistogramEvent(), HcalElectronicsMap::lookup(), DetId::null(), FEDRawData::size(), sourceIdOffset_, HcalDCCHeader::SPIGOT_COUNT, DetId::subdetId(), unknownIds_, and HcalHTRData::unpackHistogram().

Referenced by HcalHistogramRawToDigi::produce(), and HcalRawToDigi::produce().

997  {
998  // get the DCC header
999  const HcalDCCHeader* dccHeader = (const HcalDCCHeader*)(raw.data());
1000  int dccid = dccHeader->getSourceId() - sourceIdOffset_;
1001 
1002  // check the summary status
1003 
1004  // walk through the HTR data...
1005  HcalHTRData htr;
1006  for (int spigot = 0; spigot < HcalDCCHeader::SPIGOT_COUNT; spigot++) {
1007  if (!dccHeader->getSpigotPresent(spigot))
1008  continue;
1009 
1010  int retval = dccHeader->getSpigotData(spigot, htr, raw.size());
1011  // check
1012  if (retval || !htr.check()) {
1013  edm::LogWarning("Invalid Data") << "Invalid HTR data observed on spigot " << spigot << " of DCC with source id "
1014  << dccHeader->getSourceId();
1015  continue;
1016  }
1017  if (!htr.isHistogramEvent()) {
1018  edm::LogWarning("Invalid Data") << "Non-histogram data passed to histogram unpacker on spigot " << spigot
1019  << " of DCC with source id " << dccHeader->getSourceId();
1020  continue;
1021  }
1022 
1023  unsigned int smid = htr.getSubmodule();
1024  int htr_tb = smid & 0x1;
1025  int htr_slot = (smid >> 1) & 0x1F;
1026  int htr_cr = (smid >> 6) & 0x1F;
1027 
1028  // find out the fibers
1029  int f[2], fc;
1030  htr.getHistogramFibers(f[0], f[1]);
1031 
1032  for (int nf = 0; nf < 2; nf++) {
1033  if (f[nf] < 0 || (nf == 1 && f[0] == f[1]))
1034  continue; // skip if invalid or the same
1035  for (fc = 0; fc <= 2; fc++) {
1036  HcalElectronicsId eid(fc, f[nf], spigot, dccid);
1037  eid.setHTR(htr_cr, htr_slot, htr_tb);
1038  DetId did = emap.lookup(eid);
1039 
1040  if (did.null() || did.det() != DetId::Hcal || did.subdetId() == 0) {
1041  if (unknownIds_.find(eid) == unknownIds_.end()) {
1042  edm::LogWarning("HCAL") << "HcalHistogramUnpacker: No match found for electronics id :" << eid;
1043  unknownIds_.insert(eid);
1044  }
1045  continue;
1046  }
1047  histoDigis.push_back(HcalHistogramDigi(HcalDetId(did))); // add it!
1048  HcalHistogramDigi& digi = histoDigis.back();
1049 
1050  // unpack the four capids
1051  for (int capid = 0; capid < 4; capid++)
1052  htr.unpackHistogram(f[nf], fc, capid, digi.getArray(capid));
1053  }
1054  }
1055  }
1056 }
bool isHistogramEvent() const
Is this event a histogram event? (do not call standard unpack in this case!!!!!)
Definition: HcalHTRData.cc:409
std::set< HcalElectronicsId > unknownIds_
Definition: HcalUnpacker.h:88
int sourceIdOffset_
number to subtract from the source id to get the dcc id
Definition: HcalUnpacker.h:83
int getSpigotData(int nspigot, HcalHTRData &decodeTool, int validSize) const
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:48
bool unpackHistogram(int fiber, int fiberchan, int capid, unsigned short *histogram) const
Unpack special histogramming mode data.
Definition: HcalHTRData.cc:464
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
constexpr bool null() const
is this a null id ?
Definition: DetId.h:59
int getSourceId() const
Definition: HcalDCCHeader.h:33
double f[11][100]
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
void getHistogramFibers(int &a, int &b) const
Get the fiber numbers for the data present in this event (only in histogram mode!) ...
Definition: HcalHTRData.cc:435
Definition: DetId.h:17
static const int SPIGOT_COUNT
Definition: HcalDCCHeader.h:20
uint16_t * getArray(int capid)
get the array for the specified capid
bool getSpigotPresent(unsigned int nspigot) const
Read the "PRESENT" bit for this spigot.
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
unsigned int getSubmodule() const
Get the HTR submodule number.
Definition: HcalHTRData.cc:355
Log< level::Warning, false > LogWarning
Readout chain identification for Hcal.
bool check() const
Check for a good event Requires a minimum length, matching wordcount and length, not an empty event...
Definition: HcalHTRData.cc:63

◆ unpack() [2/2]

void HcalUnpacker::unpack ( const FEDRawData raw,
const HcalElectronicsMap emap,
Collections conts,
HcalUnpackerReport report,
bool  silent = false 
)

Definition at line 207 of file HcalUnpacker.cc.

References HcalDCCHeader::BOEshouldBeZeroAlways(), FEDRawData::data(), edmIntegrityCheck::report, CastorRawToDigi_cfi::silent, FEDRawData::size(), unpackUTCA(), and unpackVME().

211  {
212  if (raw.size() < 16) {
213  if (!silent)
214  edm::LogWarning("Invalid Data") << "Empty/invalid data, size = " << raw.size();
215  return;
216  }
217 
218  // get the DCC header
219  const HcalDCCHeader* dccHeader = (const HcalDCCHeader*)(raw.data());
220 
221  if (dccHeader->BOEshouldBeZeroAlways() == 0) // also includes uTCA before the common AMC13XG firmware
222  unpackVME(raw, emap, colls, report, silent);
223  else
224  unpackUTCA(raw, emap, colls, report, silent);
225 }
void unpackUTCA(const FEDRawData &raw, const HcalElectronicsMap &emap, Collections &conts, HcalUnpackerReport &report, bool silent=false)
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:48
void unpackVME(const FEDRawData &raw, const HcalElectronicsMap &emap, Collections &conts, HcalUnpackerReport &report, bool silent=false)
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
Log< level::Warning, false > LogWarning
short BOEshouldBeZeroAlways() const
Definition: HcalDCCHeader.h:51

◆ unpackUMNio()

void HcalUnpacker::unpackUMNio ( const FEDRawData raw,
int  slot,
Collections colls 
)
private

Definition at line 1058 of file HcalUnpacker.cc.

References FEDRawData::data(), data, FCDTask_cfi::slot, and HcalUnpacker::Collections::umnio.

Referenced by unpackUTCA().

1058  {
1059  const hcal::AMC13Header* amc13 = (const hcal::AMC13Header*)(raw.data());
1060  int namc = amc13->NAMC();
1061  //Find AMC corresponding to uMNio slot
1062  for (int iamc = 0; iamc < namc; iamc++) {
1063  if (amc13->AMCSlot(iamc) == slot)
1064  namc = iamc;
1065  }
1066  if (namc == amc13->NAMC()) {
1067  return;
1068  }
1069  const uint16_t* data = (const uint16_t*)(amc13->AMCPayload(namc));
1070  size_t nwords = amc13->AMCSize(namc) * (sizeof(uint64_t) / sizeof(uint16_t));
1071  *(colls.umnio) = HcalUMNioDigi(data, nwords);
1072 }
unsigned long long uint64_t
Definition: Time.h:13
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24

◆ unpackUTCA()

void HcalUnpacker::unpackUTCA ( const FEDRawData raw,
const HcalElectronicsMap emap,
Collections conts,
HcalUnpackerReport report,
bool  silent = false 
)
private

Definition at line 679 of file HcalUnpacker.cc.

References HcalDataFrameContainer< Digi >::addDataFrame(), HcalUnpacker::Collections::calibCont, HcalCalibDetId::calibFlavor(), DetId::Calo, gather_cfg::cout, FCDTask_cfi::crate, FEDRawData::data(), DetId::det(), runTauDisplay::eid, endSample_, HcalUnpacker::Collections::hbheCont, DetId::Hcal, HcalBarrel, HcalCalibration, HcalEmpty, HcalEndcap, HcalForward, HcalOther, HcalOuter, HcalUnpacker::Collections::hfCont, HcalUnpacker::Collections::hoCont, mps_fire::i, l1ctLayer2EG_cff::id, l1ctLayer1_patternWriters_cff::ilink, dqmiolumiharvest::j, HcalElectronicsMap::lookup(), HcalElectronicsMap::lookupTrigger(), DetId::null(), printInvalidDataMessage(), HcalUnpacker::Collections::qie10, HcalUnpacker::Collections::qie10Addtl, HcalUnpacker::Collections::qie10Lasermon, HcalUnpacker::Collections::qie10ZDC, HcalUnpacker::Collections::qie11, HcalUnpacker::Collections::qie11Addtl, edmIntegrityCheck::report, HcalDataFrameContainer< Digi >::samples(), CastorRawToDigi_cfi::silent, FCDTask_cfi::slot, startSample_, HcalOtherDetId::subdet(), HcalZDCDetId::SubdetectorId, DetId::subdetId(), HcalUnpacker::Collections::tpCont, HcalTrigTowerDetId::Undefined, unknownIds_, unknownIdsTrig_, unpackUMNio(), and HcalUnpacker::Collections::zdcCont.

Referenced by unpack().

683  {
684  const hcal::AMC13Header* amc13 = (const hcal::AMC13Header*)(raw.data());
685 
686  // how many AMC in this packet
687  int namc = amc13->NAMC();
688  for (int iamc = 0; iamc < namc; iamc++) {
689  // if not enabled, ignore
690  if (!amc13->AMCEnabled(iamc))
691  continue;
692 
693  if (!amc13->AMCDataPresent(iamc)) {
694  if (!silent)
695  edm::LogWarning("Invalid Data") << "Missing data observed on iamc " << iamc << " of AMC13 with source id "
696  << amc13->sourceId();
697  report.countSpigotFormatError();
698  continue;
699  }
700  if (!amc13->AMCCRCOk(iamc)) {
701  if (!silent)
702  edm::LogWarning("Invalid Data") << "CRC Error on uHTR data observed on iamc " << iamc
703  << " of AMC13 with source id " << amc13->sourceId();
704  report.countSpigotFormatError();
705  // continue;
706  }
707  // this unpacker cannot handle segmented data!
708  if (amc13->AMCSegmented(iamc)) {
709  if (!silent)
710  edm::LogWarning("Invalid Data") << "Unpacker cannot handle segmented data observed on iamc " << iamc
711  << " of AMC13 with source id " << amc13->sourceId();
712  report.countSpigotFormatError();
713  continue;
714  }
715 
716  if (!amc13->AMCLengthOk(iamc)) {
717  if (!silent)
718  edm::LogWarning("Invalid Data") << "Length mismatch between uHTR and AMC13 observed on iamc " << iamc
719  << " of AMC13 with source id " << amc13->sourceId();
720  report.countSpigotFormatError();
721  continue;
722  }
723 
724  // ok, now we're work-able
725  int slot = amc13->AMCSlot(iamc);
726  int crate = amc13->AMCId(iamc) & 0xFF;
727 
728  HcalUHTRData uhtr(amc13->AMCPayload(iamc), amc13->AMCSize(iamc));
729  //Check to make sure uMNio is not unpacked here
730  if (uhtr.getFormatVersion() != 1) {
731  unpackUMNio(raw, slot, colls);
732  continue;
733  }
734 #ifdef DebugLog
735  //debug printouts
736  int nwords = uhtr.getRawLengthBytes() / 2;
737  for (int iw = 0; iw < nwords; iw++)
738  printf("%04d %04x\n", iw, uhtr.getRawData16()[iw]);
739 #endif
740 
741  //use uhtr presamples since amc header not properly packed in simulation
742  int nps = uhtr.presamples();
743 
744  HcalUHTRData::const_iterator i = uhtr.begin(), iend = uhtr.end();
745  while (i != iend) {
746 #ifdef DebugLog
747  std::cout << "This data is flavored:" << i.flavor() << std::endl;
748 #endif
749 
750  if (!i.isHeader()) {
751  ++i;
752 #ifdef DebugLog
753  std::cout << "its not a header" << std::endl;
754 #endif
755  continue;
756  }
758  if (i.flavor() == 1 || i.flavor() == 0 || i.flavor() == 3) {
759  int ifiber = ((i.channelid() >> 3) & 0x1F);
760  int ichan = (i.channelid() & 0x7);
761  HcalElectronicsId eid(crate, slot, ifiber, ichan, false);
762  DetId did = emap.lookup(eid);
763  // Count from current position to next header, or equal to end
764  const uint16_t* head_pos = i.raw();
765  int ns = 0;
766  for (++i; i != iend && !i.isHeader(); ++i) {
767  ns++;
768  }
769  // Check QEI11 container exists
770  if (colls.qie11 == nullptr) {
771  colls.qie11 = new QIE11DigiCollection(ns);
772  } else if (colls.qie11->samples() != ns) {
773  // if this sample type hasn't been requested to be saved
774  // warn the user to provide a configuration that prompts it to be saved
775  if (colls.qie11Addtl.find(ns) == colls.qie11Addtl.end()) {
776  printInvalidDataMessage("QIE11", colls.qie11->samples(), ns, true);
777  }
778  }
779 
780  // Insert data
782  if (!did.null()) { // unpack and store...
783  // only fill the default collection if we have the correct number of samples
784  if (colls.qie11->samples() == ns) {
785  colls.qie11->addDataFrame(did, head_pos);
786  }
787  // fill the additional qie11 collections
788  if (colls.qie11Addtl.find(ns) != colls.qie11Addtl.end()) {
789  colls.qie11Addtl[ns]->addDataFrame(did, head_pos);
790  }
791  } else {
792  report.countUnmappedDigi(eid);
793  if (unknownIds_.find(eid) == unknownIds_.end()) {
794  if (!silent)
795  edm::LogWarning("HCAL") << "HcalUnpacker: No match found for electronics id :" << eid;
796  unknownIds_.insert(eid);
797 #ifdef DebugLog
798  std::cout << "HcalUnpacker: No match found for electronics id :" << eid << std::endl;
799 #endif
800  }
801 #ifdef DebugLog
802  std::cout << "OH NO! detector id is null!" << std::endl;
803 #endif
804  }
805  } else if (i.flavor() == 2) {
807 
808  int ifiber = ((i.channelid() >> 3) & 0x1F);
809  int ichan = (i.channelid() & 0x7);
810  HcalElectronicsId eid(crate, slot, ifiber, ichan, false);
811  DetId did = emap.lookup(eid);
812 
813  // Count from current position to next header, or equal to end
814  const uint16_t* head_pos = i.raw();
815  int ns = 0;
816  for (++i; i != iend && !i.isHeader(); ++i) {
817  ns++;
818  }
819 
820  bool isZDC = (did.det() == DetId::Calo && did.subdetId() == HcalZDCDetId::SubdetectorId);
821  bool isLasmon = (did.det() == DetId::Hcal && (HcalSubdetector)did.subdetId() == HcalOther &&
822  HcalCalibDetId(did).calibFlavor() == 5);
823 
824  if (isZDC) {
825  if (colls.qie10ZDC == nullptr) {
826  colls.qie10ZDC = new QIE10DigiCollection(ns);
827  } else if (colls.qie10ZDC->samples() != ns) {
828  printInvalidDataMessage("QIE10ZDC", colls.qie10ZDC->samples(), ns, false);
829  }
830  } else if (isLasmon) {
831  if (colls.qie10Lasermon == nullptr) {
832  colls.qie10Lasermon = new QIE10DigiCollection(ns);
833  } else if (colls.qie10Lasermon->samples() != ns) {
834  printInvalidDataMessage("QIE10LASMON", colls.qie10Lasermon->samples(), ns, false);
835  }
836  } else { // these are the default qie10 channels
837  if (colls.qie10 == nullptr) {
838  colls.qie10 = new QIE10DigiCollection(ns);
839  } else if (colls.qie10->samples() != ns) {
840  // if this sample type hasn't been requested to be saved
841  // warn the user to provide a configuration that prompts it to be saved
842  if (colls.qie10Addtl.find(ns) == colls.qie10Addtl.end()) {
843  printInvalidDataMessage("QIE10", colls.qie10->samples(), ns, true);
844  }
845  }
846  }
847 
848  // Insert data
850  if (!did.null()) { // unpack and store...
851  // fill the additional qie10 collections
852  if (isZDC)
853  colls.qie10ZDC->addDataFrame(did, head_pos);
854  else if (isLasmon)
855  colls.qie10Lasermon->addDataFrame(did, head_pos);
856  else {
857  // only fill the default collection if we have the correct number of samples
858  if (colls.qie10->samples() == ns) {
859  colls.qie10->addDataFrame(did, head_pos);
860  }
861 
862  // fill the additional qie10 collections
863  if (colls.qie10Addtl.find(ns) != colls.qie10Addtl.end()) {
864  colls.qie10Addtl[ns]->addDataFrame(did, head_pos);
865  }
866  }
867  } else {
868  report.countUnmappedDigi(eid);
869  if (unknownIds_.find(eid) == unknownIds_.end()) {
870  if (!silent)
871  edm::LogWarning("HCAL") << "HcalUnpacker: No match found for electronics id :" << eid;
872  unknownIds_.insert(eid);
873 #ifdef DebugLog
874  std::cout << "HcalUnpacker: No match found for electronics id :" << eid << std::endl;
875 #endif
876  }
877 #ifdef DebugLog
878  std::cout << "OH NO! HcalUnpacker: No match found for electronics id :" << eid << std::endl;
879 #endif
880  }
881  } else if (i.flavor() == 5 || (i.flavor() == 7 && i.technicalDataType() == 15)) { // Old-style digis
882  int ifiber = ((i.channelid() >> 2) & 0x1F);
883  int ichan = (i.channelid() & 0x3);
884  HcalElectronicsId eid(crate, slot, ifiber, ichan, false);
885  DetId did = emap.lookup(eid);
886 
887  if (!did.null()) { // unpack and store...
888  if (did.det() == DetId::Calo && did.subdetId() == HcalZDCDetId::SubdetectorId) {
889  colls.zdcCont->push_back(ZDCDataFrame(HcalZDCDetId(did)));
890  HcalUnpacker_impl::unpack_compact<ZDCDataFrame>(
891  i, iend, colls.zdcCont->back(), nps, eid, startSample_, endSample_);
892  } else if (did.det() == DetId::Hcal) {
893  switch (((HcalSubdetector)did.subdetId())) {
894  case (HcalBarrel):
895  case (HcalEndcap): {
896  colls.hbheCont->push_back(HBHEDataFrame(HcalDetId(did)));
897  HcalUnpacker_impl::unpack_compact<HBHEDataFrame>(
898  i, iend, colls.hbheCont->back(), nps, eid, startSample_, endSample_);
899  } break;
900  case (HcalOuter): {
901  colls.hoCont->push_back(HODataFrame(HcalDetId(did)));
902  HcalUnpacker_impl::unpack_compact<HODataFrame>(
903  i, iend, colls.hoCont->back(), nps, eid, startSample_, endSample_);
904  } break;
905  case (HcalForward): {
906  colls.hfCont->push_back(HFDataFrame(HcalDetId(did)));
907  HcalUnpacker_impl::unpack_compact<HFDataFrame>(
908  i, iend, colls.hfCont->back(), nps, eid, startSample_, endSample_);
909  } break;
910  case (HcalOther): {
911  HcalOtherDetId odid(did);
912  if (odid.subdet() == HcalCalibration) {
913  colls.calibCont->push_back(HcalCalibDataFrame(HcalCalibDetId(did)));
914  HcalUnpacker_impl::unpack_compact<HcalCalibDataFrame>(
915  i, iend, colls.calibCont->back(), nps, eid, startSample_, endSample_);
916  }
917  } break;
918  case (HcalEmpty):
919  default: {
920  for (++i; i != iend && !i.isHeader(); ++i)
921  ;
922  } break;
923  }
924  }
925  } else {
926  report.countUnmappedDigi(eid);
927  if (unknownIds_.find(eid) == unknownIds_.end()) {
928  if (!silent)
929  edm::LogWarning("HCAL") << "HcalUnpacker: No match found for electronics id :" << eid;
930  unknownIds_.insert(eid);
931  }
932  for (++i; i != iend && !i.isHeader(); ++i)
933  ;
934  }
935  } else if (i.flavor() == 0x4) { // TP digis
936  int ilink = ((i.channelid() >> 4) & 0xF);
937  int itower = (i.channelid() & 0xF);
938  HcalElectronicsId eid(crate, slot, ilink, itower, true);
939  DetId did = emap.lookupTrigger(eid);
940 #ifdef DebugLog
941  std::cout << "Unpacking " << eid << " " << i.channelid() << std::endl;
942 #endif
943  if (did.null()) {
944  report.countUnmappedTPDigi(eid);
945  if (unknownIdsTrig_.find(eid) == unknownIdsTrig_.end()) {
946  if (!silent)
947  edm::LogWarning("HCAL") << "HcalUnpacker: No trigger primitive match found for electronics id :" << eid;
948  unknownIdsTrig_.insert(eid);
949  }
950  // Skip it
951  for (++i; i != iend && !i.isHeader(); ++i)
952  ;
953  } else if (did == HcalTrigTowerDetId::Undefined || (did.det() == DetId::Hcal && did.subdetId() == 0)) {
954  for (++i; i != iend && !i.isHeader(); ++i)
955  ;
956  } else {
957  HcalTrigTowerDetId id(did);
958 #ifdef DebugLog
959  std::cout << "Unpacking " << id << std::endl;
960 #endif
961  colls.tpCont->push_back(HcalTriggerPrimitiveDigi(id));
962  int j = 0;
963  for (++i; i != iend && !i.isHeader(); ++i) {
964  colls.tpCont->back().setSample(j, i.value());
965  if (i.soi())
966  colls.tpCont->back().setPresamples(j);
967  j++;
968  }
969  colls.tpCont->back().setSize(j);
970  }
971  } else {
972  // consume any not-understood channel data
973  for (++i; i != iend && !i.isHeader(); ++i)
974  ;
975  }
976  }
977  }
978 }
std::set< HcalElectronicsId > unknownIds_
Definition: HcalUnpacker.h:88
int endSample_
last sample from fed raw data to copy (if present)
Definition: HcalUnpacker.h:85
int startSample_
first sample from fed raw data to copy
Definition: HcalUnpacker.h:84
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
void printInvalidDataMessage(const std::string &coll_type, int default_ns, int conflict_ns, bool extended=false)
HcalDataFrameContainer< QIE10DataFrame > QIE10DigiCollection
constexpr bool null() const
is this a null id ?
Definition: DetId.h:59
HcalSubdetector
Definition: HcalAssistant.h:31
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
std::set< HcalElectronicsId > unknownIdsTrig_
Recorded to limit number of times a log message is generated.
Definition: HcalUnpacker.h:88
HcalDataFrameContainer< QIE11DataFrame > QIE11DigiCollection
Definition: DetId.h:17
CalibDetType calibFlavor() const
get the flavor of this calibration detid
static const HcalTrigTowerDetId Undefined
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
static constexpr int32_t SubdetectorId
Definition: HcalZDCDetId.h:35
void unpackUMNio(const FEDRawData &raw, int slot, Collections &colls)
const DetId lookupTrigger(HcalElectronicsId fId) const
brief lookup the trigger logical detid associated with the given electronics id
Log< level::Warning, false > LogWarning
Readout chain identification for Hcal.

◆ unpackVME()

void HcalUnpacker::unpackVME ( const FEDRawData raw,
const HcalElectronicsMap emap,
Collections conts,
HcalUnpackerReport report,
bool  silent = false 
)
private

work through the samples

branch point between 2006-2011 data format and 2012+ data format

work through the samples

Definition at line 231 of file HcalUnpacker.cc.

References HcalUnpacker::Collections::calibCont, DetId::Calo, HcalHTRData::check(), HOUnrolledTP::checked, FEDRawData::data(), HcalHTRData::dataPointers(), DetId::det(), runTauDisplay::eid, endSample_, expectedOrbitMessageTime_, HcalQIESample::fiber(), FCDTask_cfi::fiber, HcalQIESample::fiberAndChan(), HcalQIESample::fiberChan(), HcalHTRData::FORMAT_VERSION_COMPACT_DATA, HcalDCCHeader::getDCCDataFormatVersion(), HcalHTRData::getFirmwareFlavor(), HcalHTRData::getFormatVersion(), HcalHTRData::getNPS(), HcalDTCHeader::getSlotCRCError(), HcalDTCHeader::getSlotData(), HcalDTCHeader::getSlotPresent(), HcalDCCHeader::getSourceId(), HcalDTCHeader::getSourceId(), HcalDCCHeader::getSpigotCRCError(), HcalDCCHeader::getSpigotData(), HcalDCCHeader::getSpigotPresent(), HcalHTRData::getSubmodule(), HcalUnpacker::Collections::hbheCont, DetId::Hcal, HcalBarrel, HcalCalibration, HcalEmpty, HcalEndcap, HcalForward, HcalOther, HcalOuter, HcalUnpacker::Collections::hfCont, HcalUnpacker::Collections::hoCont, mps_fire::i, l1ctLayer2EG_cff::id, hcalRecHitTable_cff::ieta, HcalDetId::ieta(), HOUnrolledTP::ieta, hcalRecHitTable_cff::iphi, HcalDetId::iphi(), HOUnrolledTP::iphi, HcalHTRData::is_channel_header(), HcalHTRData::isBusy(), HcalHTRData::isEmptyEvent(), HcalHTRData::isHistogramEvent(), HcalHTRData::isOverflowWarning(), isTPGSOI(), HcalHTRData::isUnsuppressed(), linear(), LogDebug, HcalElectronicsMap::lookup(), HcalElectronicsMap::lookupTrigger(), HcalDTCHeader::MAXIMUM_SLOT, mode_, DetId::null(), HcalTriggerPrimitiveSample::raw(), HcalQIESample::raw(), edmIntegrityCheck::report, EgammaValidation_cff::samples, HOUnrolledTP::samples, nano_mu_digi_cff::sector, HOUnrolledTP::setbit(), CastorRawToDigi_cfi::silent, FEDRawData::size(), slb(), slbAndChan(), slbChan(), FCDTask_cfi::slot, HOUnrolledTP::soi, sourceIdOffset_, HcalDCCHeader::SPIGOT_COUNT, startSample_, HcalOtherDetId::subdet(), HcalZDCDetId::SubdetectorId, DetId::subdetId(), HcalUnpacker::Collections::tpCont, HcalUnpacker::Collections::tphoCont, HcalUnpacker::Collections::ttp, HcalTrigTowerDetId::Undefined, unknownIds_, unknownIdsTrig_, HcalTTPUnpacker::unpack(), HcalHTRData::unpack_per_channel_header(), validateGeometry_cfg::valid, HOUnrolledTP::valid, HcalHTRData::wasMarkAndPassZSTP(), testProducerWithPsetDescEmpty_cfi::x1, and HcalUnpacker::Collections::zdcCont.

Referenced by unpack().

235  {
236  // get the DCC header
237  const HcalDCCHeader* dccHeader = (const HcalDCCHeader*)(raw.data());
238  const HcalDTCHeader* dtcHeader = (const HcalDTCHeader*)(raw.data());
239  bool is_VME_DCC = (dccHeader->getDCCDataFormatVersion() < 0x10) || ((mode_ & 0x1) == 0);
240 
241  int dccid =
242  (is_VME_DCC) ? (dccHeader->getSourceId() - sourceIdOffset_) : (dtcHeader->getSourceId() - sourceIdOffset_);
243 
244  // check the summary status
245 
246  // walk through the HTR data. For the uTCA, use spigot=slot+1
247  HcalHTRData htr;
248  const unsigned short *daq_first, *daq_last, *tp_first, *tp_last;
249  const HcalQIESample *qie_begin, *qie_end, *qie_work;
250  const HcalTriggerPrimitiveSample *tp_begin, *tp_end, *tp_work;
251  for (int spigot = 0; spigot < HcalDCCHeader::SPIGOT_COUNT; spigot++) {
252  if (is_VME_DCC) {
253  if (!dccHeader->getSpigotPresent(spigot))
254  continue;
255 
256  int retval = dccHeader->getSpigotData(spigot, htr, raw.size());
257  if (retval != 0) {
258  if (retval == -1) {
259  if (!silent)
260  edm::LogWarning("Invalid Data") << "Invalid HTR data (data beyond payload size) observed on spigot "
261  << spigot << " of DCC with source id " << dccHeader->getSourceId();
262  report.countSpigotFormatError();
263  }
264  continue;
265  }
266  // check
267  if (dccHeader->getSpigotCRCError(spigot)) {
268  if (!silent)
269  edm::LogWarning("Invalid Data") << "CRC Error on HTR data observed on spigot " << spigot
270  << " of DCC with source id " << dccHeader->getSourceId();
271  report.countSpigotFormatError();
272  continue;
273  }
274  } else { // is_uTCA (!is_VME_DCC)
275  int slot = spigot + 1;
277  continue;
278 
279  if (!dtcHeader->getSlotPresent(slot))
280  continue;
281 
282  int retval = dtcHeader->getSlotData(slot, htr, raw.size());
283  if (retval != 0) {
284  if (retval == -1) {
285  if (!silent)
286  edm::LogWarning("Invalid Data") << "Invalid uHTR data (data beyond payload size) observed on slot " << slot
287  << " of DTC with source id " << dtcHeader->getSourceId();
288  report.countSpigotFormatError();
289  }
290  continue;
291  }
292  // check
293  if (dtcHeader->getSlotCRCError(slot)) {
294  if (!silent)
295  edm::LogWarning("Invalid Data") << "CRC Error on uHTR data observed on slot " << slot
296  << " of DTC with source id " << dtcHeader->getSourceId();
297  report.countSpigotFormatError();
298  continue;
299  }
300  }
301 
302  // check for EE
303  if (htr.isEmptyEvent()) {
304  report.countEmptyEventSpigot();
305  }
306  if (htr.isOverflowWarning()) {
307  report.countOFWSpigot();
308  }
309  if (htr.isBusy()) {
310  report.countBusySpigot();
311  }
312  if (!htr.check()) {
313  if (!silent)
314  edm::LogWarning("Invalid Data") << "Invalid HTR data observed on spigot " << spigot << " of DCC with source id "
315  << dccHeader->getSourceId();
316  report.countSpigotFormatError();
317  continue;
318  }
319  if (htr.isHistogramEvent()) {
320  if (!silent)
321  edm::LogWarning("Invalid Data") << "Histogram data passed to non-histogram unpacker on spigot " << spigot
322  << " of DCC with source id " << dccHeader->getSourceId();
323  continue;
324  }
325  if ((htr.getFirmwareFlavor() & 0xE0) == 0x80) { // some kind of TTP data
326  if (colls.ttp != nullptr) {
327  HcalTTPUnpacker ttpUnpack;
328  colls.ttp->push_back(HcalTTPDigi());
329  ttpUnpack.unpack(htr, colls.ttp->back());
330  } else {
331  LogDebug("HcalTechTrigProcessor")
332  << "Skipping data on spigot " << spigot << " of DCC with source id " << dccHeader->getSourceId()
333  << " which is from the TechTrigProcessor (use separate unpacker!)";
334  }
335  continue;
336  }
337  if (htr.getFirmwareFlavor() >= 0x80) {
338  if (!silent)
339  edm::LogWarning("HcalUnpacker") << "Skipping data on spigot " << spigot << " of DCC with source id "
340  << dccHeader->getSourceId() << " which is of unknown flavor "
341  << htr.getFirmwareFlavor();
342  continue;
343  }
344 
345  // calculate "real" number of presamples
346  int nps = htr.getNPS() - startSample_;
347 
348  // get pointers
349  htr.dataPointers(&daq_first, &daq_last, &tp_first, &tp_last);
350  unsigned int smid = htr.getSubmodule();
351  int htr_tb = smid & 0x1;
352  int htr_slot = (smid >> 1) & 0x1F;
353  int htr_cr = (smid >> 6) & 0x1F;
354 
355  tp_begin = (const HcalTriggerPrimitiveSample*)tp_first;
356  tp_end = (const HcalTriggerPrimitiveSample*)(tp_last + 1); // one beyond last..
357 
359  int currFiberChan = 0x3F; // invalid fiber+channel...
360  int ncurr = 0;
361  bool valid = false;
362 
363  bool tpgSOIbitInUse = htr.getFormatVersion() >= 3; // version 3 and later
364  bool isHOtpg = htr.getFormatVersion() >= 3 && htr.getFirmwareFlavor() == 0; // HO is flavor zero
365  /*
366  Unpack the trigger primitives
367  */
368  if (isHOtpg) {
369  HOUnrolledTP unrolled[24];
370  for (tp_work = tp_begin; tp_work != tp_end; tp_work++) {
371  if (tp_work->raw() == 0xFFFF)
372  continue; // filler word
373  int sector = slbChan(tp_work->raw());
374  if (sector > 2)
375  continue;
376 
377  for (int ibit = 0; ibit < 8; ibit++) {
378  int linear = sector * 8 + ibit;
379  if (!unrolled[linear].checked) {
380  unrolled[linear].checked = true;
381  int fiber = (linear / 3) + 1;
382  int fc = (linear % 3);
383  // electronics id (use precision match for HO TP)
384  HcalElectronicsId eid(fc, fiber, spigot, dccid);
385  eid.setHTR(htr_cr, htr_slot, htr_tb);
386  DetId did = emap.lookup(eid);
387  if (!did.null()) {
388  if (did.det() == DetId::Hcal && ((HcalSubdetector)did.subdetId()) == HcalOuter) {
389  HcalDetId hid(did);
390  unrolled[linear].valid = true;
391  unrolled[linear].ieta = hid.ieta();
392  unrolled[linear].iphi = hid.iphi();
393  }
394  } else {
395  report.countUnmappedTPDigi(eid);
396  }
397  }
398  if (unrolled[linear].valid) {
399  if (isTPGSOI(*tp_work))
400  unrolled[linear].soi = unrolled[linear].samples;
401  if (tp_work->raw() & (1 << ibit))
402  unrolled[linear].setbit(unrolled[linear].samples);
403  unrolled[linear].samples++;
404  }
405  }
406  }
407  for (int i = 0; i < 24; i++) {
408  if (unrolled[i].valid)
409  colls.tphoCont->push_back(HOTriggerPrimitiveDigi(
410  unrolled[i].ieta, unrolled[i].iphi, unrolled[i].samples, unrolled[i].soi, unrolled[i].databits));
411  }
412  } else { // regular TPs (not HO)
413  for (tp_work = tp_begin; tp_work != tp_end; tp_work++) {
414  if (tp_work->raw() == 0xFFFF)
415  continue; // filler word
416  if (slbAndChan(tp_work->raw()) != currFiberChan) { // start new set
417  currFiberChan = slbAndChan(tp_work->raw());
418  // lookup the right channel
419  HcalElectronicsId eid(slbChan(tp_work->raw()), slb(tp_work->raw()), spigot, dccid, htr_cr, htr_slot, htr_tb);
420  DetId did = emap.lookupTrigger(eid);
421  if (did.null()) {
422  report.countUnmappedTPDigi(eid);
423  if (unknownIdsTrig_.find(eid) == unknownIdsTrig_.end()) {
424  if (!silent)
425  edm::LogWarning("HCAL") << "HcalUnpacker: No trigger primitive match found for electronics id :" << eid;
426  unknownIdsTrig_.insert(eid);
427  }
428  valid = false;
429  continue;
430  } else if (did == HcalTrigTowerDetId::Undefined || (did.det() == DetId::Hcal && did.subdetId() == 0)) {
431  // known to be unmapped
432  valid = false;
433  continue;
434  }
435  HcalTrigTowerDetId id(did);
436  colls.tpCont->push_back(HcalTriggerPrimitiveDigi(id));
437  // set the various bits
438  if (!tpgSOIbitInUse)
439  colls.tpCont->back().setPresamples(nps);
440  colls.tpCont->back().setZSInfo(htr.isUnsuppressed(),
441  htr.wasMarkAndPassZSTP(slb(tp_work->raw()), slbChan(tp_work->raw())));
442 
443  // no hits recorded for current
444  ncurr = 0;
445  valid = true;
446  }
447  // add the word (if within settings or recent firmware [recent firmware ignores startSample/endSample])
448  if (valid && ((tpgSOIbitInUse && ncurr < 10) || (ncurr >= startSample_ && ncurr <= endSample_))) {
449  colls.tpCont->back().setSample(colls.tpCont->back().size(), *tp_work);
450  colls.tpCont->back().setSize(colls.tpCont->back().size() + 1);
451  }
452  // set presamples,if SOI
453  if (valid && tpgSOIbitInUse && isTPGSOI(*tp_work)) {
454  colls.tpCont->back().setPresamples(ncurr);
455  }
456  ncurr++;
457  }
458  }
459 
462  qie_begin = (const HcalQIESample*)daq_first;
463  qie_end = (const HcalQIESample*)(daq_last + 1); // one beyond last..
464 
466 
467  for (qie_work = qie_begin; qie_work != qie_end;) {
468  if (qie_work->raw() == 0xFFFF) {
469  qie_work++;
470  continue; // filler word
471  }
472  // always at the beginning ...
473 
474  // lookup the right channel
475  HcalElectronicsId eid(qie_work->fiberChan(), qie_work->fiber(), spigot, dccid);
476  eid.setHTR(htr_cr, htr_slot, htr_tb);
477  DetId did = emap.lookup(eid);
478 
479  if (!did.null()) {
480  if (did.det() == DetId::Calo && did.subdetId() == HcalZDCDetId::SubdetectorId) {
481  colls.zdcCont->push_back(ZDCDataFrame(HcalZDCDetId(did)));
482  qie_work = HcalUnpacker_impl::unpack<ZDCDataFrame>(qie_work,
483  qie_end,
484  colls.zdcCont->back(),
485  nps,
486  eid,
487  startSample_,
488  endSample_,
490  htr);
491  } else if (did.det() == DetId::Hcal) {
492  switch (((HcalSubdetector)did.subdetId())) {
493  case (HcalBarrel):
494  case (HcalEndcap): {
495  colls.hbheCont->push_back(HBHEDataFrame(HcalDetId(did)));
496  qie_work = HcalUnpacker_impl::unpack<HBHEDataFrame>(qie_work,
497  qie_end,
498  colls.hbheCont->back(),
499  nps,
500  eid,
501  startSample_,
502  endSample_,
504  htr);
505  } break;
506  case (HcalOuter): {
507  colls.hoCont->push_back(HODataFrame(HcalDetId(did)));
508  qie_work = HcalUnpacker_impl::unpack<HODataFrame>(qie_work,
509  qie_end,
510  colls.hoCont->back(),
511  nps,
512  eid,
513  startSample_,
514  endSample_,
516  htr);
517  } break;
518  case (HcalForward): {
519  colls.hfCont->push_back(HFDataFrame(HcalDetId(did)));
520  qie_work = HcalUnpacker_impl::unpack<HFDataFrame>(qie_work,
521  qie_end,
522  colls.hfCont->back(),
523  nps,
524  eid,
525  startSample_,
526  endSample_,
528  htr);
529  } break;
530  case (HcalOther): {
531  HcalOtherDetId odid(did);
532  if (odid.subdet() == HcalCalibration) {
533  colls.calibCont->push_back(HcalCalibDataFrame(HcalCalibDetId(did)));
534  qie_work = HcalUnpacker_impl::unpack<HcalCalibDataFrame>(qie_work,
535  qie_end,
536  colls.calibCont->back(),
537  nps,
538  eid,
539  startSample_,
540  endSample_,
542  htr);
543  }
544  } break;
545  case (HcalEmpty):
546  default: {
547  for (int fiberC = qie_work->fiberAndChan(); qie_work != qie_end && qie_work->fiberAndChan() == fiberC;
548  qie_work++)
549  ;
550  } break;
551  }
552  }
553  } else {
554  report.countUnmappedDigi(eid);
555  if (unknownIds_.find(eid) == unknownIds_.end()) {
556  if (!silent)
557  edm::LogWarning("HCAL") << "HcalUnpacker: No match found for electronics id :" << eid;
558  unknownIds_.insert(eid);
559  }
560  for (int fiberC = qie_work->fiberAndChan(); qie_work != qie_end && qie_work->fiberAndChan() == fiberC;
561  qie_work++)
562  ;
563  }
564  }
565  } else {
566  // this is the branch for unpacking the compact data format with per-channel headers
567  const unsigned short* ptr_header = daq_first;
568  const unsigned short* ptr_end = daq_last + 1;
569  int flavor, error_flags, capid0, channelid;
570 
571  while (ptr_header != ptr_end) {
572  if (*ptr_header == 0xFFFF) { // impossible filler word
573  ptr_header++;
574  continue;
575  }
576  // unpack the header word
577  bool isheader = HcalHTRData::unpack_per_channel_header(*ptr_header, flavor, error_flags, capid0, channelid);
578  if (!isheader) {
579  ptr_header++;
580  continue;
581  }
582 
583  int fiberchan = channelid & 0x3;
584  int fiber = ((channelid >> 2) & 0x7) + 1;
585 
586  // lookup the right channel
587  HcalElectronicsId eid(fiberchan, fiber, spigot, dccid);
588  eid.setHTR(htr_cr, htr_slot, htr_tb);
589  DetId did = emap.lookup(eid);
590 
591  if (!did.null()) {
592  if (did.det() == DetId::Calo && did.subdetId() == HcalZDCDetId::SubdetectorId) {
593  colls.zdcCont->push_back(ZDCDataFrame(HcalZDCDetId(did)));
594  ptr_header = HcalUnpacker_impl::unpack_compact<ZDCDataFrame>(ptr_header,
595  ptr_end,
596  colls.zdcCont->back(),
597  nps,
598  eid,
599  startSample_,
600  endSample_,
602  htr);
603  } else if (did.det() == DetId::Hcal) {
604  switch (((HcalSubdetector)did.subdetId())) {
605  case (HcalBarrel):
606  case (HcalEndcap): {
607  colls.hbheCont->push_back(HBHEDataFrame(HcalDetId(did)));
608  ptr_header = HcalUnpacker_impl::unpack_compact<HBHEDataFrame>(ptr_header,
609  ptr_end,
610  colls.hbheCont->back(),
611  nps,
612  eid,
613  startSample_,
614  endSample_,
616  htr);
617  } break;
618  case (HcalOuter): {
619  colls.hoCont->push_back(HODataFrame(HcalDetId(did)));
620  ptr_header = HcalUnpacker_impl::unpack_compact<HODataFrame>(ptr_header,
621  ptr_end,
622  colls.hoCont->back(),
623  nps,
624  eid,
625  startSample_,
626  endSample_,
628  htr);
629  } break;
630  case (HcalForward): {
631  colls.hfCont->push_back(HFDataFrame(HcalDetId(did)));
632  ptr_header = HcalUnpacker_impl::unpack_compact<HFDataFrame>(ptr_header,
633  ptr_end,
634  colls.hfCont->back(),
635  nps,
636  eid,
637  startSample_,
638  endSample_,
640  htr);
641  } break;
642  case (HcalOther): {
643  HcalOtherDetId odid(did);
644  if (odid.subdet() == HcalCalibration) {
645  colls.calibCont->push_back(HcalCalibDataFrame(HcalCalibDetId(did)));
646  ptr_header = HcalUnpacker_impl::unpack_compact<HcalCalibDataFrame>(ptr_header,
647  ptr_end,
648  colls.calibCont->back(),
649  nps,
650  eid,
651  startSample_,
652  endSample_,
654  htr);
655  }
656  } break;
657  case (HcalEmpty):
658  default: {
659  for (ptr_header++; ptr_header != ptr_end && !HcalHTRData::is_channel_header(*ptr_header); ptr_header++)
660  ;
661  } break;
662  }
663  }
664  } else {
665  report.countUnmappedDigi(eid);
666  if (unknownIds_.find(eid) == unknownIds_.end()) {
667  if (!silent)
668  edm::LogWarning("HCAL") << "HcalUnpacker: No match found for electronics id :" << eid;
669  unknownIds_.insert(eid);
670  }
671  for (ptr_header++; ptr_header != ptr_end && !HcalHTRData::is_channel_header(*ptr_header); ptr_header++)
672  ;
673  }
674  }
675  }
676  }
677 }
bool isHistogramEvent() const
Is this event a histogram event? (do not call standard unpack in this case!!!!!)
Definition: HcalHTRData.cc:409
std::set< HcalElectronicsId > unknownIds_
Definition: HcalUnpacker.h:88
int sourceIdOffset_
number to subtract from the source id to get the dcc id
Definition: HcalUnpacker.h:83
int getSourceId() const
Definition: HcalDTCHeader.h:35
int endSample_
last sample from fed raw data to copy (if present)
Definition: HcalUnpacker.h:85
int getSpigotData(int nspigot, HcalHTRData &decodeTool, int validSize) const
int startSample_
first sample from fed raw data to copy
Definition: HcalUnpacker.h:84
static int slbAndChan(uint16_t theSample)
constexpr int fiberChan() const
get the fiber channel number
Definition: HcalQIESample.h:55
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
static bool isTPGSOI(const HcalTriggerPrimitiveSample &s)
int getNPS() const
Get the number of presamples in daq data.
Definition: HcalHTRData.cc:426
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:48
static bool unpack_per_channel_header(unsigned short, int &flav, int &error_flags, int &capid0, int &channelid)
Unpack a per-channel header word (compact format)
Definition: HcalHTRData.cc:455
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
int getFirmwareFlavor() const
Get the HTR firmware flavor.
Definition: HcalHTRData.cc:433
bool isOverflowWarning() const
Definition: HcalHTRData.cc:115
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.
Definition: HcalHTRData.cc:161
constexpr bool null() const
is this a null id ?
Definition: DetId.h:59
uint16_t raw() const
get the raw word
static bool is_channel_header(unsigned short value)
check top bit to see if this is a compact format channel header word
Definition: HcalHTRData.h:92
int expectedOrbitMessageTime_
Expected orbit bunch time (needed to evaluate time differences)
Definition: HcalUnpacker.h:86
int getSourceId() const
Definition: HcalDCCHeader.h:33
int getFormatVersion() const
Get the version number of this event.
Definition: HcalHTRData.h:36
bool wasMarkAndPassZSTP(int slb, int slbchan) const
Was this channel passed as part of Mark&Pass ZS?
Definition: HcalHTRData.cc:389
HcalSubdetector
Definition: HcalAssistant.h:31
bool getSlotCRCError(unsigned int nslot) const
Read the "CRC-Mismatch" bit for this slot.
Definition: HcalDTCHeader.h:93
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
bool getSlotPresent(unsigned int nslot) const
Read the "PRESENT" bit for this slot.
Definition: HcalDTCHeader.h:85
std::set< HcalElectronicsId > unknownIdsTrig_
Recorded to limit number of times a log message is generated.
Definition: HcalUnpacker.h:88
short getDCCDataFormatVersion() const
Definition: HcalDCCHeader.h:60
Definition: DetId.h:17
constexpr uint16_t raw() const
get the raw word
Definition: HcalQIESample.h:41
static int slb(uint16_t theSample)
bool getSpigotCRCError(unsigned int nspigot) const
Read the "CRC-Mismatch" bit for this spigot.
constexpr int fiber() const
get the fiber number
Definition: HcalQIESample.h:53
bool unpack(const HcalHTRData &data, HcalTTPDigi &digi)
bool isBusy() const
Definition: HcalHTRData.cc:123
void setbit(int i)
static const HcalTrigTowerDetId Undefined
static const int FORMAT_VERSION_COMPACT_DATA
Definition: HcalHTRData.h:20
static const int SPIGOT_COUNT
Definition: HcalDCCHeader.h:20
bool getSpigotPresent(unsigned int nspigot) const
Read the "PRESENT" bit for this spigot.
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
static constexpr int32_t SubdetectorId
Definition: HcalZDCDetId.h:35
unsigned int getSubmodule() const
Get the HTR submodule number.
Definition: HcalHTRData.cc:355
int getSlotData(int nslot, HcalHTRData &decodeTool, int validSize) const
bool isEmptyEvent() const
Definition: HcalHTRData.cc:107
float linear(float x)
const DetId lookupTrigger(HcalElectronicsId fId) const
brief lookup the trigger logical detid associated with the given electronics id
Log< level::Warning, false > LogWarning
Readout chain identification for Hcal.
bool check() const
Check for a good event Requires a minimum length, matching wordcount and length, not an empty event...
Definition: HcalHTRData.cc:63
static const int MAXIMUM_SLOT
Definition: HcalDTCHeader.h:22
static int slbChan(uint16_t theSample)
#define LogDebug(id)
bool isUnsuppressed() const
Is this event an unsuppresed event?
Definition: HcalHTRData.cc:378

Member Data Documentation

◆ endSample_

int HcalUnpacker::endSample_
private

last sample from fed raw data to copy (if present)

Definition at line 85 of file HcalUnpacker.h.

Referenced by unpackUTCA(), and unpackVME().

◆ expectedOrbitMessageTime_

int HcalUnpacker::expectedOrbitMessageTime_
private

Expected orbit bunch time (needed to evaluate time differences)

Definition at line 86 of file HcalUnpacker.h.

Referenced by setExpectedOrbitMessageTime(), and unpackVME().

◆ mode_

int HcalUnpacker::mode_
private

Definition at line 87 of file HcalUnpacker.h.

Referenced by setMode(), and unpackVME().

◆ nPrinted_

int HcalUnpacker::nPrinted_
private

Definition at line 91 of file HcalUnpacker.h.

Referenced by printInvalidDataMessage().

◆ sourceIdOffset_

int HcalUnpacker::sourceIdOffset_
private

number to subtract from the source id to get the dcc id

Definition at line 83 of file HcalUnpacker.h.

Referenced by unpack(), and unpackVME().

◆ startSample_

int HcalUnpacker::startSample_
private

first sample from fed raw data to copy

Definition at line 84 of file HcalUnpacker.h.

Referenced by unpackUTCA(), and unpackVME().

◆ unknownIds_

std::set<HcalElectronicsId> HcalUnpacker::unknownIds_
private

Definition at line 88 of file HcalUnpacker.h.

Referenced by unpack(), unpackUTCA(), and unpackVME().

◆ unknownIdsTrig_

std::set<HcalElectronicsId> HcalUnpacker::unknownIdsTrig_
private

Recorded to limit number of times a log message is generated.

Definition at line 88 of file HcalUnpacker.h.

Referenced by unpackUTCA(), and unpackVME().