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;
117 <<
"Exception caught when creating FEDSpyBuffer object for FED " << lFedId <<
": "
118 <<
"An exception of category 'FEDBuffer' occurred.\n"
125 <<
"Exception caught when creating FEDSpyBuffer object for FED " << lFedId <<
": "
126 <<
"An exception of category 'FEDSpyBuffer' occurred.\n"
127 <<
"FED Buffer check fails for FED ID " << lFedId <<
".";
133 uint32_t totalEvCount =
buffer.spyHeaderTotalEventCount();
134 uint32_t l1ID =
buffer.spyHeaderL1ID();
136 uint32_t lGRun =
buffer.globalRunNumber();
142 edm::LogError(
"SiStripSpyUnpacker") <<
" -- Global run encoded in buffer for FED " << lFedId <<
": " << lGRun
143 <<
" is different from reference value " << lRef << std::endl;
147 (*pL1ACounts)[lFedId] = l1ID;
148 (*pTotalEventCounts)[lFedId] = totalEvCount;
151 std::vector<FedChannelConnection>::const_iterator iconn = conns.begin();
152 std::vector<FedChannelConnection>::const_iterator endconn = conns.end();
153 for (; iconn != endconn; ++iconn) {
155 if (!iconn->isConnected()) {
160 uint16_t
chan = iconn->fedCh();
163 if (chan > FEDCH_PER_FED || iconn->fedId() != lFedId) {
165 std::ostringstream
ss;
166 ss <<
"Channel connection values invalid: iconn->fedId() = " << iconn->fedId() <<
" for FED " << lFedId
167 <<
", iconn->fedCh() = " << chan << std::endl;
174 if (!
buffer.channelGood(chan)) {
176 std::ostringstream
ss;
177 ss <<
"Channel check failed for FED " << lFedId <<
" channel " << chan << std::endl;
205 pDigis->
swap(*pResult);
static const uint16_t FED_ID_MIN
FEDBufferStatusCode preconstructCheckFEDSpyBuffer(const FEDRawData &fedBuffer)
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.
tuple chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
void newChannel(const uint32_t key, const uint16_t firstItem=0)
static const uint16_t SPY_SAMPLES_PER_CHANNEL
std::vector< uint32_t > Counters
Log< level::Error, false > LogError
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
tuple key
prepare the HTCondor submission files and eventually submit them
void addItem(const T &item)
~SpyUnpacker()
Destructor.
static const uint16_t invalid_
ConnsConstIterRange fedConnections(uint16_t fed_id) const
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
Log< level::Warning, false > LogWarning
A Digi for the silicon strip detector, containing only adc information, and suitable for storing raw ...