CMS 3D CMS Logo

DCCDataUnpacker.cc
Go to the documentation of this file.
7 #include <set>
8 
9 std::atomic<bool> DCCDataUnpacker::silentMode_(false);
10 
12  bool hU,
13  bool srpU,
14  bool tccU,
15  bool feU,
16  bool memU,
17  bool syncCheck,
18  bool feIdCheck,
19  bool forceToKeepFRdata) {
20  electronicsMapper_ = mapper;
21  ebEventBlock_ = new DCCEBEventBlock(this, mapper, hU, srpU, tccU, feU, memU, forceToKeepFRdata);
22  eeEventBlock_ = new DCCEEEventBlock(this, mapper, hU, srpU, tccU, feU, memU, forceToKeepFRdata);
23  if (syncCheck) {
26  }
27  if (feIdCheck) {
30  }
31 }
32 
33 void DCCDataUnpacker::unpack(const uint64_t* buffer, size_t bufferSize, unsigned int smId, unsigned int fedId) {
34  //buffer is pointer to binary data
35  //See if this fed is on EB or in EE
36 
37  if (smId > 9 && smId < 46) {
40  ebEventBlock_->unpack(buffer, bufferSize, fedId);
41 
42  } else {
45  eeEventBlock_->unpack(buffer, bufferSize, fedId);
46  }
47 }
48 
50  delete ebEventBlock_;
51  delete eeEventBlock_;
52 }
53 
54 uint16_t DCCDataUnpacker::getChannelStatus(const DetId& id) const {
55  // return code for situation of missing channel record
56  // equal to "non responding isolated channel (dead of type other)":
57  // https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideEcalRecoLocalReco#Treatment_of_problematic_channel
58  // TODO: think on a better way how to cover this case
59  const uint16_t NO_DATA = 11;
60 
61  if (chdb_ == nullptr) {
62  edm::LogError("IncorrectMapping") << "ECAL channel status database do not initialized";
63  return NO_DATA;
64  }
65 
67 
68  if (pCh != chdb_->end()) {
69  return pCh->getStatusCode();
70  } else {
71  edm::LogError("IncorrectMapping") << "No channel status record found for detit = " << id.rawId();
72  return NO_DATA;
73  }
74 }
75 
76 uint16_t DCCDataUnpacker::getChannelValue(const DetId& id) const { return getChannelStatus(id) & 0x1F; }
77 
78 uint16_t DCCDataUnpacker::getChannelValue(const int fed, const int ccu, const int strip, const int xtal) const {
79  // conversion FED ID [601 - 654] -> DCC ID [1 - 54]
80  const int dcc = electronicsMapper_->getSMId(fed);
81 
82  // convert (dcc, ccu, strip, xtal) -> DetId
83  const EcalElectronicsId eid(dcc, ccu, strip, xtal);
85 
86  return getChannelStatus(id) & 0x1F;
87 }
88 
89 uint16_t DCCDataUnpacker::getCCUValue(const int fed, const int ccu) const {
90  // get list of crystals (DetId) which correspond to given CCU
91  // (return empty list for MEM channels [CCU > 68])
92  const int dcc = electronicsMapper_->getSMId(fed);
93  const std::vector<DetId> xtals =
94  (ccu <= 68) ? electronicsMapper_->mapping()->dccTowerConstituents(dcc, ccu) : std::vector<DetId>();
95 
96  // collect set of status codes of given CCU
97  std::set<uint16_t> set;
98  for (size_t i = 0; i < xtals.size(); ++i) {
99  const uint16_t val = getChannelValue(xtals[i]);
100  set.insert(val);
101  }
102 
103  // if all crystals in CCU have the same status
104  // then this status is treated as CCU status
105  if (set.size() == 1)
106  return *set.begin();
107 
108  // if there are several or no statuses:
109  return 0;
110 }
EcalCondObjectContainer::end
const_iterator end() const
Definition: EcalCondObjectContainer.h:76
DCCDataUnpacker.h
mps_fire.i
i
Definition: mps_fire.py:355
DCCEEEventBlock::unpack
void unpack(const uint64_t *buffer, size_t bufferSize, unsigned int expFedId) override
Definition: DCCEEEventBlock.cc:35
MessageLogger.h
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
DCCEventBlock::enableSyncChecks
void enableSyncChecks()
Definition: DCCEventBlock.cc:69
EcalElectronicsMapping::dccTowerConstituents
std::vector< DetId > dccTowerConstituents(int dccId, int tower) const
Get the constituent detids for this dccId.
Definition: EcalElectronicsMapping.cc:589
DCCDataUnpacker::ebEventBlock_
DCCEBEventBlock * ebEventBlock_
Definition: DCCDataUnpacker.h:217
ecalcalib_dqm_sourceclient-live_cfg.feIdCheck
feIdCheck
Definition: ecalcalib_dqm_sourceclient-live_cfg.py:99
DCCDataUnpacker::silentMode_
static std::atomic< bool > silentMode_
Definition: DCCDataUnpacker.h:185
EcalElectronicsMapper.h
edmScanValgrind.buffer
buffer
Definition: edmScanValgrind.py:171
DetId
Definition: DetId.h:17
ecalcalib_dqm_sourceclient-live_cfg.syncCheck
syncCheck
Definition: ecalcalib_dqm_sourceclient-live_cfg.py:98
DCCDataUnpacker::DCCDataUnpacker
DCCDataUnpacker(EcalElectronicsMapper *, bool hU, bool srpU, bool tccU, bool feU, bool memU, bool syncCheck, bool feIdCheck, bool forceToKeepFRdata)
Definition: DCCDataUnpacker.cc:11
DCCDataUnpacker::chdb_
const EcalChannelStatusMap * chdb_
Definition: DCCDataUnpacker.h:215
DCCEEEventBlock.h
DCCDataUnpacker::~DCCDataUnpacker
~DCCDataUnpacker()
Definition: DCCDataUnpacker.cc:49
EcalCondObjectContainer::find
const_iterator find(uint32_t rawId) const
Definition: EcalCondObjectContainer.h:53
DCCEventBlock::updateCollectors
void updateCollectors()
Definition: DCCEventBlock.cc:131
DCCDataUnpacker::eeEventBlock_
DCCEEEventBlock * eeEventBlock_
Definition: DCCDataUnpacker.h:218
EcalElectronicsId
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
Definition: EcalElectronicsId.h:18
edm::LogError
Definition: MessageLogger.h:183
DCCDataUnpacker::unpack
void unpack(const uint64_t *buffer, size_t bufferSize, unsigned int smId, unsigned int fedId)
Definition: DCCDataUnpacker.cc:33
DCCEBEventBlock
Definition: DCCEBEventBlock.h:23
EcalElectronicsMapper::mapping
const EcalElectronicsMapping * mapping()
Definition: EcalElectronicsMapper.h:148
EcalElectronicsMapping.h
EcalElectronicsMapping::getDetId
DetId getDetId(const EcalElectronicsId &id) const
Get the detid given an electronicsId.
Definition: EcalElectronicsMapping.cc:410
runTauDisplay.eid
eid
Definition: runTauDisplay.py:298
EcalElectronicsMapper::getSMId
unsigned int getSMId(unsigned int aDCCId) const
Definition: EcalElectronicsMapper.cc:415
l1tstage2_dqm_sourceclient-live_cfg.fedId
fedId
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:82
DCCDataUnpacker::electronicsMapper_
EcalElectronicsMapper * electronicsMapper_
Definition: DCCDataUnpacker.h:214
EcalElectronicsMapper
Definition: EcalElectronicsMapper.h:36
DCCEEEventBlock
Definition: DCCEEEventBlock.h:22
heppy_batch.val
val
Definition: heppy_batch.py:351
DCCDataUnpacker::getChannelValue
uint16_t getChannelValue(const DetId &id) const
Definition: DCCDataUnpacker.cc:76
DCCDataUnpacker::currentEvent_
DCCEventBlock * currentEvent_
Definition: DCCDataUnpacker.h:216
cond::uint64_t
unsigned long long uint64_t
Definition: Time.h:13
EcalCondObjectContainer< EcalChannelStatusCode >::const_iterator
std::vector< Item >::const_iterator const_iterator
Definition: EcalCondObjectContainer.h:19
DCCDataUnpacker::getChannelStatus
uint16_t getChannelStatus(const DetId &id) const
Definition: DCCDataUnpacker.cc:54
DCCEBEventBlock.h
DCCDataUnpacker::getCCUValue
uint16_t getCCUValue(const int fed, const int ccu) const
Definition: DCCDataUnpacker.cc:89
DCCEventBlock::enableFeIdChecks
void enableFeIdChecks()
Definition: DCCEventBlock.cc:76
DCCEBEventBlock::unpack
void unpack(const uint64_t *buffer, size_t bufferSize, unsigned int expFedId) override
Definition: DCCEBEventBlock.cc:38