23 #include <ext/algorithm> 29 SpyUnpacker::SpyUnpacker(
const bool allowIncompleteEvents) : allowIncompleteEvents_(allowIncompleteEvents) {
31 LogTrace(
"SiStripSpyUnpacker") <<
"[sistrip::SpyUnpacker::" << __func__ <<
"]" 32 <<
" Constructing object...";
38 LogTrace(
"SiStripSpyUnpacker") <<
"[sistrip::SpyUnpacker::" << __func__ <<
"]" 39 <<
" Destructing object...";
46 const std::vector<uint32_t>&
ids,
61 if (cabling.
fedIds().empty()) {
62 edm::LogWarning(
"SiStripSpyUnpacker") <<
"[sistrip::SpyUnpacker::" << __func__ <<
"]" 63 <<
" No FEDs found in cabling map!";
68 std::vector<uint32_t>::const_iterator ifed = ids.begin();
69 std::vector<uint32_t>::const_iterator endfed = ids.end();
79 for (; ifed != endfed; ++ifed) {
80 uint32_t lFedId = (*ifed);
83 if (lFedId < FED_ID_MIN || lFedId >
FED_ID_MAX) {
85 edm::LogWarning(
"SiStripSpyUnpacker") <<
"[sistrip::SpyUnpacker::" << __func__ <<
"]" 86 <<
" Invalid FED id provided: " << lFedId;
96 edm::LogWarning(
"SiStripSpyUnpacker") <<
"[sistrip::SpyUnpacker::" << __func__ <<
"]" 97 <<
" NULL pointer to FEDRawData for FED id " << lFedId;
104 edm::LogWarning(
"SiStripSpyUnpacker") <<
"[sistrip::SpyUnpacker::" << __func__ <<
"]" 105 <<
" FEDRawData has zero size for FED id " << lFedId;
114 std::unique_ptr<sistrip::FEDSpyBuffer>
buffer;
118 throw cms::Exception(
"FEDSpyBuffer") <<
"FED Buffer check fails for FED ID " << lFedId <<
".";
123 <<
"Exception caught when creating FEDSpyBuffer object for FED " << lFedId <<
": " << e.
what();
129 uint32_t totalEvCount = buffer->spyHeaderTotalEventCount();
130 uint32_t l1ID = buffer->spyHeaderL1ID();
132 uint32_t lGRun = buffer->globalRunNumber();
138 edm::LogError(
"SiStripSpyUnpacker") <<
" -- Global run encoded in buffer for FED " << lFedId <<
": " << lGRun
139 <<
" is different from reference value " << lRef << std::endl;
143 (*pL1ACounts)[lFedId] = l1ID;
144 (*pTotalEventCounts)[lFedId] = totalEvCount;
147 std::vector<FedChannelConnection>::const_iterator iconn = conns.begin();
148 std::vector<FedChannelConnection>::const_iterator endconn = conns.end();
149 for (; iconn != endconn; ++iconn) {
151 if (!iconn->isConnected()) {
156 uint16_t
chan = iconn->fedCh();
159 if (chan > FEDCH_PER_FED || iconn->fedId() != lFedId) {
161 std::ostringstream
ss;
162 ss <<
"Channel connection values invalid: iconn->fedId() = " << iconn->fedId() <<
" for FED " << lFedId
163 <<
", iconn->fedCh() = " << chan << std::endl;
170 if (!buffer->channelGood(chan)) {
172 std::ostringstream
ss;
173 ss <<
"Channel check failed for FED " << lFedId <<
" channel " << chan << std::endl;
201 pDigis->
swap(*pResult);
static const uint16_t FED_ID_MIN
void createDigis(const SiStripFedCabling &, const FEDRawDataCollection &, RawDigis *pDigis, const std::vector< uint32_t > &ids, Counters *pTotalEventCounts, Counters *pL1ACounts, uint32_t *aRunRef)
Creates the scope mode digis for the supplied FED IDs or detIds and stores event counters.
void newChannel(const uint32_t key, const uint16_t firstItem=0)
static const uint16_t SPY_SAMPLES_PER_CHANNEL
std::vector< uint32_t > Counters
char const * what() const override
void swap(DetSetVector &other)
size_t size() const
Lenght of the data buffer in bytes.
static std::string const input
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
std::unique_ptr< edm::DetSetVector< T > > createDetSetVector()
const bool allowIncompleteEvents_
FedsConstIterRange fedIds() const
void addItem(const T &item)
~SpyUnpacker()
Destructor.
static const uint16_t invalid_
ConnsConstIterRange fedConnections(uint16_t fed_id) const
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
static const uint16_t FEDCH_PER_FED
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
static const uint16_t FED_ID_MAX