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::HcalUnpacker ( int  sourceIdOffset,
int  beg,
int  end 
)
inline

for normal data

Definition at line 46 of file HcalUnpacker.h.

46 : sourceIdOffset_(sourceIdOffset), startSample_(beg), endSample_(end), expectedOrbitMessageTime_(-1), mode_(0), nPrinted_ (0){ }
int sourceIdOffset_
number to subtract from the source id to get the dcc id
Definition: HcalUnpacker.h:60
int endSample_
last sample from fed raw data to copy (if present)
Definition: HcalUnpacker.h:62
int startSample_
first sample from fed raw data to copy
Definition: HcalUnpacker.h:61
int expectedOrbitMessageTime_
Expected orbit bunch time (needed to evaluate time differences)
Definition: HcalUnpacker.h:63
#define end
Definition: vmac.h:39
HcalUnpacker::HcalUnpacker ( int  sourceIdOffset)
inline

For histograms, no begin and end.

Definition at line 48 of file HcalUnpacker.h.

48 : sourceIdOffset_(sourceIdOffset), startSample_(-1), endSample_(-1), expectedOrbitMessageTime_(-1), mode_(0), nPrinted_ (0){ }
int sourceIdOffset_
number to subtract from the source id to get the dcc id
Definition: HcalUnpacker.h:60
int endSample_
last sample from fed raw data to copy (if present)
Definition: HcalUnpacker.h:62
int startSample_
first sample from fed raw data to copy
Definition: HcalUnpacker.h:61
int expectedOrbitMessageTime_
Expected orbit bunch time (needed to evaluate time differences)
Definition: HcalUnpacker.h:63

Member Function Documentation

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

Definition at line 938 of file HcalUnpacker.cc.

References constexpr, and MessageLogger_cfi::limit.

Referenced by setMode().

938  {
939 
940  nPrinted_++;
941 
942  constexpr int limit = 2;//print up to limit-1 messages
943  if( nPrinted_ >= limit ) {
944 
945  if( nPrinted_ == limit ) edm::LogInfo("Invalid Data") << "Suppressing further error messages";
946 
947  return;
948  }
949 
950  std::stringstream message;
951 
952  message << "The default " << coll_type << " Collection has "
953  << default_ns << " samples per digi, while the current data has "
954  << conflict_ns << "! This data cannot be included with the default collection.";
955 
956  if( extended ) {
957  message << "\nIn order to store this data in the event, it must have a unique tag. "
958  << "To accomplish this, provide two lists to HcalRawToDigi \n"
959  << "1) that specifies the number of samples and "
960  << "2) that gives tags with which these data are saved.\n"
961  << "For example in this case you might add \n"
962  << "process.hcalDigis.save" << coll_type << "DataNSamples = cms.untracked.vint32( "
963  << conflict_ns << ") \nprocess.hcalDigis.save" << coll_type << "DataTags = cms.untracked.vstring( \"MYDATA\" )" ;
964  }
965 
966  edm::LogWarning("Invalid Data") << message.str();
967 }
#define constexpr
void HcalUnpacker::setExpectedOrbitMessageTime ( int  time)
inline

Definition at line 49 of file HcalUnpacker.h.

References expectedOrbitMessageTime_, edmIntegrityCheck::report, protons_cff::time, and unpack().

Referenced by HcalRawToDigi::HcalRawToDigi().

int expectedOrbitMessageTime_
Expected orbit bunch time (needed to evaluate time differences)
Definition: HcalUnpacker.h:63
void HcalUnpacker::setMode ( int  mode)
inline
void HcalUnpacker::unpack ( const FEDRawData raw,
const HcalElectronicsMap emap,
std::vector< HcalHistogramDigi > &  histoDigis 
)

Definition at line 863 of file HcalUnpacker.cc.

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

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

863  {
864 
865  // get the DCC header
866  const HcalDCCHeader* dccHeader=(const HcalDCCHeader*)(raw.data());
867  int dccid=dccHeader->getSourceId()-sourceIdOffset_;
868 
869  // check the summary status
870 
871  // walk through the HTR data...
872  HcalHTRData htr;
873  for (int spigot=0; spigot<HcalDCCHeader::SPIGOT_COUNT; spigot++) {
874  if (!dccHeader->getSpigotPresent(spigot)) continue;
875 
876  int retval=dccHeader->getSpigotData(spigot,htr,raw.size());
877  // check
878  if (retval || !htr.check()) {
879  edm::LogWarning("Invalid Data") << "Invalid HTR data observed on spigot " << spigot << " of DCC with source id " << dccHeader->getSourceId();
880  continue;
881  }
882  if (!htr.isHistogramEvent()) {
883  edm::LogWarning("Invalid Data") << "Non-histogram data passed to histogram unpacker on spigot " << spigot << " of DCC with source id " << dccHeader->getSourceId();
884  continue;
885  }
886 
887  unsigned int smid=htr.getSubmodule();
888  int htr_tb=smid&0x1;
889  int htr_slot=(smid>>1)&0x1F;
890  int htr_cr=(smid>>6)&0x1F;
891 
892  // find out the fibers
893  int f[2],fc;
894  htr.getHistogramFibers(f[0],f[1]);
895 
896  for (int nf=0; nf<2; nf++) {
897  if (f[nf]<0 || (nf==1 && f[0]==f[1])) continue; // skip if invalid or the same
898  for (fc=0; fc<=2; fc++) {
899  HcalElectronicsId eid(fc,f[nf],spigot,dccid);
900  eid.setHTR(htr_cr,htr_slot,htr_tb);
901  DetId did=emap.lookup(eid);
902 
903  if (did.null() || did.det()!=DetId::Hcal || did.subdetId()==0) {
904  if (unknownIds_.find(eid)==unknownIds_.end()) {
905  edm::LogWarning("HCAL") << "HcalHistogramUnpacker: No match found for electronics id :" << eid;
906  unknownIds_.insert(eid);
907  }
908  continue;
909  }
910  histoDigis.push_back(HcalHistogramDigi(HcalDetId(did))); // add it!
911  HcalHistogramDigi& digi=histoDigis.back();
912 
913  // unpack the four capids
914  for (int capid=0; capid<4; capid++)
915  htr.unpackHistogram(f[nf],fc,capid,digi.getArray(capid));
916 
917  }
918  }
919  }
920 }
std::set< HcalElectronicsId > unknownIds_
Definition: HcalUnpacker.h:65
int sourceIdOffset_
number to subtract from the source id to get the dcc id
Definition: HcalUnpacker.h:60
bool check() const
Check for a good event Requires a minimum length, matching wordcount and length, not an empty event...
Definition: HcalHTRData.cc:62
constexpr bool null() const
is this a null id ?
Definition: DetId.h:52
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:414
int getSpigotData(int nspigot, HcalHTRData &decodeTool, int validSize) const
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
bool unpackHistogram(int fiber, int fiberchan, int capid, unsigned short *histogram) const
Unpack special histogramming mode data.
Definition: HcalHTRData.cc:442
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
double f[11][100]
bool getSpigotPresent(unsigned int nspigot) const
Read the "PRESENT" bit for this spigot.
int getSourceId() const
Definition: HcalDCCHeader.h:32
Definition: DetId.h:18
static const int SPIGOT_COUNT
Definition: HcalDCCHeader.h:19
uint16_t * getArray(int capid)
get the array for the specified capid
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
unsigned int getSubmodule() const
Get the HTR submodule number.
Definition: HcalHTRData.cc:332
Readout chain identification for Hcal.
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
bool isHistogramEvent() const
Is this event a histogram event? (do not call standard unpack in this case!!!!!)
Definition: HcalHTRData.cc:386
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39
void HcalUnpacker::unpack ( const FEDRawData raw,
const HcalElectronicsMap emap,
Collections conts,
HcalUnpackerReport report,
bool  silent = false 
)

Definition at line 190 of file HcalUnpacker.cc.

References HcalDCCHeader::BOEshouldBeZeroAlways(), FEDRawData::data(), and FEDRawData::size().

191  {
192 
193  if (raw.size()<16) {
194  if (!silent) edm::LogWarning("Invalid Data") << "Empty/invalid data, size = " << raw.size();
195  return;
196  }
197 
198  // get the DCC header
199  const HcalDCCHeader* dccHeader=(const HcalDCCHeader*)(raw.data());
200 
201  if (dccHeader->BOEshouldBeZeroAlways()==0) // also includes uTCA before the common AMC13XG firmware
202  unpackVME(raw,emap,colls,report,silent);
203  else unpackUTCA(raw,emap,colls,report,silent);
204 }
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:47
void unpackVME(const FEDRawData &raw, const HcalElectronicsMap &emap, Collections &conts, HcalUnpackerReport &report, bool silent=false)
short BOEshouldBeZeroAlways() const
Definition: HcalDCCHeader.h:50
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
void HcalUnpacker::unpackUMNio ( const FEDRawData raw,
int  slot,
Collections colls 
)
private

Definition at line 922 of file HcalUnpacker.cc.

References hcal::AMC13Header::AMCPayload(), hcal::AMC13Header::AMCSize(), hcal::AMC13Header::AMCSlot(), FEDRawData::data(), data, hcal::AMC13Header::NAMC(), and HcalUnpacker::Collections::umnio.

Referenced by setMode().

922  {
923  const hcal::AMC13Header* amc13=(const hcal::AMC13Header*)(raw.data());
924  int namc=amc13->NAMC();
925  //Find AMC corresponding to uMNio slot
926  for (int iamc=0; iamc<namc; iamc++) {
927  if (amc13->AMCSlot(iamc) == slot) namc = iamc;
928  }
929  if (namc==amc13->NAMC()) {
930  return;
931  }
932  const uint16_t* data = (const uint16_t*)(amc13->AMCPayload(namc));
933  size_t nwords = amc13->AMCSize(namc) * ( sizeof(uint64_t) / sizeof(uint16_t) );
934  *(colls.umnio) = HcalUMNioDigi(data, nwords);
935 
936 }
int AMCSize(int i) const
Definition: AMC13Header.h:37
unsigned long long uint64_t
Definition: Time.h:15
int NAMC() const
Definition: AMC13Header.h:25
int AMCSlot(int i) const
Definition: AMC13Header.h:33
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
const uint64_t * AMCPayload(int i) const
Definition: AMC13Header.cc:4
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
void HcalUnpacker::unpackUTCA ( const FEDRawData raw,
const HcalElectronicsMap emap,
Collections conts,
HcalUnpackerReport report,
bool  silent = false 
)
private

Definition at line 566 of file HcalUnpacker.cc.

References HcalDataFrameContainer< Digi >::addDataFrame(), hcal::AMC13Header::AMCCRCOk(), hcal::AMC13Header::AMCDataPresent(), hcal::AMC13Header::AMCEnabled(), hcal::AMC13Header::AMCId(), hcal::AMC13Header::AMCPayload(), hcal::AMC13Header::AMCSegmented(), hcal::AMC13Header::AMCSize(), hcal::AMC13Header::AMCSlot(), HcalUnpacker::Collections::calibCont, HcalCalibDetId::calibFlavor(), DetId::Calo, HcalUHTRData::const_iterator::channelid(), HcalUnpackerReport::countSpigotFormatError(), HcalUnpackerReport::countUnmappedDigi(), HcalUnpackerReport::countUnmappedTPDigi(), gather_cfg::cout, FEDRawData::data(), DetId::det(), runTauDisplay::eid, funct::false, HcalUHTRData::const_iterator::flavor(), HcalUnpacker::Collections::hbheCont, DetId::Hcal, HcalBarrel, HcalCalibration, HcalEmpty, HcalEndcap, HcalForward, HcalOther, HcalOuter, HcalUnpacker::Collections::hfCont, HcalUnpacker::Collections::hoCont, mps_fire::i, triggerObjects_cff::id, HcalUHTRData::const_iterator::isHeader(), HcalElectronicsMap::lookup(), HcalElectronicsMap::lookupTrigger(), hcal::AMC13Header::NAMC(), DetId::null(), HcalUnpacker::Collections::qie10, HcalUnpacker::Collections::qie10Addtl, HcalUnpacker::Collections::qie10Lasermon, HcalUnpacker::Collections::qie10ZDC, HcalUnpacker::Collections::qie11, HcalUnpacker::Collections::qie11Addtl, HcalUHTRData::const_iterator::raw(), HcalDataFrameContainer< Digi >::samples(), HcalUHTRData::const_iterator::soi(), hcal::AMC13Header::sourceId(), HcalOtherDetId::subdet(), HcalZDCDetId::SubdetectorId, DetId::subdetId(), HcalUHTRData::const_iterator::technicalDataType(), HcalUnpacker::Collections::tpCont, funct::true, HcalTrigTowerDetId::Undefined, HcalUHTRData::const_iterator::value(), and HcalUnpacker::Collections::zdcCont.

Referenced by setMode().

567  {
568 
569  const hcal::AMC13Header* amc13=(const hcal::AMC13Header*)(raw.data());
570 
571  // how many AMC in this packet
572  int namc=amc13->NAMC();
573  for (int iamc=0; iamc<namc; iamc++) {
574  // if not enabled, ignore
575  if (!amc13->AMCEnabled(iamc)) continue;
576 
577  if (!amc13->AMCDataPresent(iamc)) {
578  if (!silent)
579  edm::LogWarning("Invalid Data") << "Missing data observed on iamc " << iamc << " of AMC13 with source id " << amc13->sourceId();
580  report.countSpigotFormatError();
581  continue;
582  }
583  if (!amc13->AMCCRCOk(iamc)) {
584  if (!silent)
585  edm::LogWarning("Invalid Data") << "CRC Error on uHTR data observed on iamc " << iamc << " of AMC13 with source id " << amc13->sourceId();
586  report.countSpigotFormatError();
587  // continue;
588  }
589  // this unpacker cannot handle segmented data!
590  if (amc13->AMCSegmented(iamc)) {
591  if (!silent)
592  edm::LogWarning("Invalid Data") << "Unpacker cannot handle segmented data observed on iamc " << iamc << " of AMC13 with source id " << amc13->sourceId();
593  report.countSpigotFormatError();
594  continue;
595  }
596 
597  // ok, now we're work-able
598  int slot=amc13->AMCSlot(iamc);
599  int crate=amc13->AMCId(iamc)&0xFF;
600 
601  HcalUHTRData uhtr(amc13->AMCPayload(iamc),amc13->AMCSize(iamc));
602  //Check to make sure uMNio is not unpacked here
603  if(uhtr.getFormatVersion() != 1) {
604  unpackUMNio(raw, slot, colls);
605  continue;
606  }
607 #ifdef DebugLog
608  //debug printouts
609  int nwords=uhtr.getRawLengthBytes()/2;
610  for (int iw=0; iw<nwords; iw++)
611  printf("%04d %04x\n",iw,uhtr.getRawData16()[iw]);
612 #endif
613 
614  //use uhtr presamples since amc header not properly packed in simulation
615  int nps = uhtr.presamples();
616 
617  HcalUHTRData::const_iterator i=uhtr.begin(), iend=uhtr.end();
618  while (i!=iend) {
619 #ifdef DebugLog
620  std::cout << "This data is flavored:" << i.flavor() << std::endl;
621 #endif
622 
623  if (!i.isHeader()) {
624  ++i;
625 #ifdef DebugLog
626  std::cout << "its not a header" << std::endl;
627 #endif
628  continue;
629  }
631  if (i.flavor() == 1 || i.flavor() == 0 || i.flavor() == 3) {
632  int ifiber=((i.channelid()>>3)&0x1F);
633  int ichan=(i.channelid()&0x7);
634  HcalElectronicsId eid(crate,slot,ifiber,ichan, false);
635  DetId did=emap.lookup(eid);
636  // Count from current position to next header, or equal to end
637  const uint16_t* head_pos = i.raw();
638  int ns = 0;
639  for (++i; i != iend && !i.isHeader(); ++i) {
640  ns++;
641  }
642  // Check QEI11 container exists
643  if (colls.qie11 == nullptr) {
644  colls.qie11 = new QIE11DigiCollection(ns);
645  }
646  else if (colls.qie11->samples() != ns) {
647  // if this sample type hasn't been requested to be saved
648  // warn the user to provide a configuration that prompts it to be saved
649  if( colls.qie11Addtl.find( ns ) == colls.qie11Addtl.end() ) {
650  printInvalidDataMessage( "QIE11", colls.qie11->samples(), ns, true );
651  }
652  }
653 
654  // Insert data
656  if (!did.null()) { // unpack and store...
657  // only fill the default collection if we have the correct number of samples
658  if (colls.qie11->samples() == ns) {
659  colls.qie11->addDataFrame(did, head_pos);
660  }
661  // fill the additional qie11 collections
662  if( colls.qie11Addtl.find( ns ) != colls.qie11Addtl.end() ) {
663  colls.qie11Addtl[ns]->addDataFrame( did, head_pos );
664  }
665  } else {
666  report.countUnmappedDigi(eid);
667  if (unknownIds_.find(eid)==unknownIds_.end()) {
668  if (!silent) edm::LogWarning("HCAL") << "HcalUnpacker: No match found for electronics id :" << eid;
669  unknownIds_.insert(eid);
670 #ifdef DebugLog
671  std::cout << "HcalUnpacker: No match found for electronics id :" << eid << std::endl;
672 #endif
673  }
674 #ifdef DebugLog
675  std::cout << "OH NO! detector id is null!" << std::endl;
676 #endif
677  }
678  } else if (i.flavor() == 2){
680 
681  int ifiber=((i.channelid()>>3)&0x1F);
682  int ichan=(i.channelid()&0x7);
683  HcalElectronicsId eid(crate,slot,ifiber,ichan, false);
684  DetId did=emap.lookup(eid);
685 
686  // Count from current position to next header, or equal to end
687  const uint16_t* head_pos = i.raw();
688  int ns = 0;
689  for (++i; i != iend && !i.isHeader(); ++i) {
690  ns++;
691  }
692 
693  bool isZDC = (did.det()==DetId::Calo && did.subdetId()==HcalZDCDetId::SubdetectorId);
694  bool isLasmon = (did.det()==DetId::Hcal && (HcalSubdetector)did.subdetId() == HcalOther && HcalCalibDetId( did ).calibFlavor() == 5);
695 
696  if( isZDC ) {
697  if( colls.qie10ZDC == nullptr ) {
698  colls.qie10ZDC = new QIE10DigiCollection(ns);
699  } else if (colls.qie10ZDC->samples() != ns) {
700  printInvalidDataMessage( "QIE10ZDC", colls.qie10ZDC->samples(), ns, false );
701  }
702  }
703  else if( isLasmon ) {
704  if (colls.qie10Lasermon == nullptr ) {
705  colls.qie10Lasermon = new QIE10DigiCollection(ns);
706  } else if (colls.qie10Lasermon->samples() != ns) {
707  printInvalidDataMessage( "QIE10LASMON", colls.qie10Lasermon->samples(), ns, false );
708  }
709  } else { // these are the default qie10 channels
710  if (colls.qie10 == nullptr) {
711  colls.qie10 = new QIE10DigiCollection(ns);
712  }
713  else if (colls.qie10->samples() != ns) {
714  // if this sample type hasn't been requested to be saved
715  // warn the user to provide a configuration that prompts it to be saved
716  if( colls.qie10Addtl.find( ns ) == colls.qie10Addtl.end() ) {
717  printInvalidDataMessage( "QIE10", colls.qie10->samples(), ns, true );
718  }
719  }
720  }
721 
722  // Insert data
724  if (!did.null()) { // unpack and store...
725  // fill the additional qie10 collections
726  if( isZDC ) colls.qie10ZDC->addDataFrame( did, head_pos );
727  else if( isLasmon) colls.qie10Lasermon->addDataFrame( did, head_pos );
728  else {
729 
730  // only fill the default collection if we have the correct number of samples
731  if (colls.qie10->samples() == ns) {
732  colls.qie10->addDataFrame(did, head_pos);
733  }
734 
735  // fill the additional qie10 collections
736  if( colls.qie10Addtl.find( ns ) != colls.qie10Addtl.end() ) {
737  colls.qie10Addtl[ns]->addDataFrame( did, head_pos );
738  }
739  }
740  } else {
741  report.countUnmappedDigi(eid);
742  if (unknownIds_.find(eid)==unknownIds_.end()) {
743  if (!silent) edm::LogWarning("HCAL") << "HcalUnpacker: No match found for electronics id :" << eid;
744  unknownIds_.insert(eid);
745 #ifdef DebugLog
746  std::cout << "HcalUnpacker: No match found for electronics id :" << eid << std::endl;
747 #endif
748  }
749 #ifdef DebugLog
750  std::cout << "OH NO! HcalUnpacker: No match found for electronics id :" << eid << std::endl;
751 #endif
752  }
753  }
754  else if (i.flavor()==5 || (i.flavor()==7 && i.technicalDataType()==15)) { // Old-style digis
755  int ifiber=((i.channelid()>>2)&0x1F);
756  int ichan=(i.channelid()&0x3);
757  HcalElectronicsId eid(crate,slot,ifiber,ichan, false);
758  DetId did=emap.lookup(eid);
759 
760  if (!did.null()) { // unpack and store...
761  if (did.det()==DetId::Calo && did.subdetId()==HcalZDCDetId::SubdetectorId) {
762  colls.zdcCont->push_back(ZDCDataFrame(HcalZDCDetId(did)));
763  HcalUnpacker_impl::unpack_compact<ZDCDataFrame>(i,iend, colls.zdcCont->back(), nps, eid, startSample_, endSample_);
764  } else if (did.det()==DetId::Hcal) {
765  switch (((HcalSubdetector)did.subdetId())) {
766  case (HcalBarrel):
767  case (HcalEndcap): {
768  colls.hbheCont->push_back(HBHEDataFrame(HcalDetId(did)));
769  HcalUnpacker_impl::unpack_compact<HBHEDataFrame>(i, iend, colls.hbheCont->back(), nps, eid, startSample_, endSample_);
770  } break;
771  case (HcalOuter): {
772  colls.hoCont->push_back(HODataFrame(HcalDetId(did)));
773  HcalUnpacker_impl::unpack_compact<HODataFrame>(i, iend, colls.hoCont->back(), nps, eid, startSample_, endSample_);
774  } break;
775  case (HcalForward): {
776  colls.hfCont->push_back(HFDataFrame(HcalDetId(did)));
777  HcalUnpacker_impl::unpack_compact<HFDataFrame>(i, iend, colls.hfCont->back(), nps, eid, startSample_, endSample_);
778  } break;
779  case (HcalOther) : {
780  HcalOtherDetId odid(did);
781  if (odid.subdet()==HcalCalibration) {
782  colls.calibCont->push_back(HcalCalibDataFrame(HcalCalibDetId(did)));
783  HcalUnpacker_impl::unpack_compact<HcalCalibDataFrame>(i, iend, colls.calibCont->back(), nps, eid, startSample_, endSample_);
784  }
785  } break;
786  case (HcalEmpty):
787  default: {
788  for (++i;
789  i!=iend && !i.isHeader();
790  ++i);
791  }
792  break;
793  }
794  }
795  } else {
796  report.countUnmappedDigi(eid);
797  if (unknownIds_.find(eid)==unknownIds_.end()) {
798  if (!silent) edm::LogWarning("HCAL") << "HcalUnpacker: No match found for electronics id :" << eid;
799  unknownIds_.insert(eid);
800  }
801  for (++i;
802  i!=iend && !i.isHeader();
803  ++i);
804  }
805  } else if (i.flavor()==0x4) { // TP digis
806  int ilink=((i.channelid()>>4)&0xF);
807  int itower=(i.channelid()&0xF);
808  HcalElectronicsId eid(crate,slot,ilink,itower,true);
809  DetId did=emap.lookupTrigger(eid);
810 #ifdef DebugLog
811  std::cout << "Unpacking " << eid << " " << i.channelid() << std::endl;
812 #endif
813  if (did.null()) {
814  report.countUnmappedTPDigi(eid);
815  if (unknownIdsTrig_.find(eid)==unknownIdsTrig_.end()) {
816  if (!silent) edm::LogWarning("HCAL") << "HcalUnpacker: No trigger primitive match found for electronics id :" << eid;
817  unknownIdsTrig_.insert(eid);
818  }
819  // Skip it
820  for (++i; i!=iend && !i.isHeader(); ++i);
821  } else if (did==HcalTrigTowerDetId::Undefined ||
822  (did.det()==DetId::Hcal && did.subdetId()==0)) {
823  for (++i; i!=iend && !i.isHeader(); ++i);
824  } else {
825  HcalTrigTowerDetId id(did);
826 #ifdef DebugLog
827  std::cout << "Unpacking " << id << std::endl;
828 #endif
829  colls.tpCont->push_back(HcalTriggerPrimitiveDigi(id));
830  int j=0;
831  for (++i; i!=iend && !i.isHeader(); ++i) {
832  colls.tpCont->back().setSample(j,i.value());
833  if (i.soi()) colls.tpCont->back().setPresamples(j);
834  j++;
835  }
836  colls.tpCont->back().setSize(j);
837  }
838  } else {
839  // consume any not-understood channel data
840  for (++i;
841  i!=iend && !i.isHeader();
842  ++i);
843  }
844  }
845  }
846 }
std::set< HcalElectronicsId > unknownIds_
Definition: HcalUnpacker.h:65
int endSample_
last sample from fed raw data to copy (if present)
Definition: HcalUnpacker.h:62
int startSample_
first sample from fed raw data to copy
Definition: HcalUnpacker.h:61
CalibDetType calibFlavor() const
get the flavor of this calibration detid
constexpr bool null() const
is this a null id ?
Definition: DetId.h:52
void printInvalidDataMessage(const std::string &coll_type, int default_ns, int conflict_ns, bool extended=false)
int AMCSize(int i) const
Definition: AMC13Header.h:37
HcalDataFrameContainer< QIE10DataFrame > QIE10DigiCollection
bool AMCDataPresent(int i) const
Definition: AMC13Header.h:47
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
HcalSubdetector
Definition: HcalAssistant.h:31
std::set< HcalElectronicsId > unknownIdsTrig_
Recorded to limit number of times a log message is generated.
Definition: HcalUnpacker.h:65
HcalDataFrameContainer< QIE11DataFrame > QIE11DigiCollection
Definition: DetId.h:18
static const int SubdetectorId
Definition: HcalZDCDetId.h:25
int sourceId() const
Definition: AMC13Header.h:15
static const HcalTrigTowerDetId Undefined
bool AMCSegmented(int i) const
Definition: AMC13Header.h:41
int NAMC() const
Definition: AMC13Header.h:25
int AMCSlot(int i) const
Definition: AMC13Header.h:33
const uint64_t * AMCPayload(int i) const
Definition: AMC13Header.cc:4
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
bool AMCCRCOk(int i) const
Definition: AMC13Header.h:45
const DetId lookupTrigger(HcalElectronicsId fId) const
brief lookup the trigger logical detid associated with the given electronics id
bool AMCEnabled(int i) const
Definition: AMC13Header.h:51
void unpackUMNio(const FEDRawData &raw, int slot, Collections &colls)
uint16_t AMCId(int i) const
Definition: AMC13Header.h:31
const uint16_t * raw() const
Definition: HcalUHTRData.h:68
Readout chain identification for Hcal.
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:39
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 211 of file HcalUnpacker.cc.

References HcalUnpacker::Collections::calibCont, DetId::Calo, HcalHTRData::check(), HOUnrolledTP::checked, HcalUnpackerReport::countBusySpigot(), HcalUnpackerReport::countEmptyEventSpigot(), HcalUnpackerReport::countOFWSpigot(), HcalUnpackerReport::countSpigotFormatError(), HcalUnpackerReport::countUnmappedDigi(), HcalUnpackerReport::countUnmappedTPDigi(), FEDRawData::data(), HcalHTRData::dataPointers(), DetId::det(), runTauDisplay::eid, benchmark_cfg::fc, HcalQIESample::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, triggerObjects_cff::id, HcalDetId::ieta(), HOUnrolledTP::ieta, 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, DetId::null(), HcalTriggerPrimitiveSample::raw(), HcalQIESample::raw(), hcalTTPDigis_cfi::samples, HOUnrolledTP::samples, HOUnrolledTP::setbit(), HcalElectronicsId::setHTR(), FEDRawData::size(), slb(), slbAndChan(), slbChan(), HOUnrolledTP::soi, HcalDCCHeader::SPIGOT_COUNT, HcalOtherDetId::subdet(), HcalZDCDetId::SubdetectorId, DetId::subdetId(), HcalUnpacker::Collections::tpCont, HcalUnpacker::Collections::tphoCont, HcalUnpacker::Collections::ttp, HcalTrigTowerDetId::Undefined, HcalTTPUnpacker::unpack(), HcalHTRData::unpack_per_channel_header(), HOUnrolledTP::valid, HcalHTRData::wasMarkAndPassZSTP(), globals_cff::x1, and HcalUnpacker::Collections::zdcCont.

Referenced by setMode().

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

Member Data Documentation

int HcalUnpacker::endSample_
private

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

Definition at line 62 of file HcalUnpacker.h.

int HcalUnpacker::expectedOrbitMessageTime_
private

Expected orbit bunch time (needed to evaluate time differences)

Definition at line 63 of file HcalUnpacker.h.

Referenced by setExpectedOrbitMessageTime().

int HcalUnpacker::mode_
private

Definition at line 64 of file HcalUnpacker.h.

Referenced by setMode().

int HcalUnpacker::nPrinted_
private

Definition at line 67 of file HcalUnpacker.h.

int HcalUnpacker::sourceIdOffset_
private

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

Definition at line 60 of file HcalUnpacker.h.

int HcalUnpacker::startSample_
private

first sample from fed raw data to copy

Definition at line 61 of file HcalUnpacker.h.

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

Definition at line 65 of file HcalUnpacker.h.

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

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

Definition at line 65 of file HcalUnpacker.h.