23 #include <ext/algorithm> 29 SpyUnpacker::SpyUnpacker(
const bool allowIncompleteEvents) :
30 allowIncompleteEvents_(allowIncompleteEvents)
34 <<
"[sistrip::SpyUnpacker::"<<__func__<<
"]" 35 <<
" Constructing object...";
42 <<
"[sistrip::SpyUnpacker::"<<__func__<<
"]" 43 <<
" Destructing object...";
50 const std::vector<uint32_t> & ids,
66 if ( cabling.
fedIds().empty() ) {
68 <<
"[sistrip::SpyUnpacker::" << __func__ <<
"]" 69 <<
" No FEDs found in cabling map!";
74 std::vector<uint32_t>::const_iterator ifed = ids.begin();
75 std::vector<uint32_t>::const_iterator endfed = ids.end();
85 for ( ; ifed != endfed; ++ifed ) {
87 uint32_t lFedId = (*ifed);
90 if (lFedId < FED_ID_MIN || lFedId >
FED_ID_MAX) {
93 <<
"[sistrip::SpyUnpacker::" << __func__ <<
"]" 94 <<
" Invalid FED id provided: " 103 if ( !input.
data() ) {
106 <<
"[sistrip::SpyUnpacker::" << __func__ <<
"]" 107 <<
" NULL pointer to FEDRawData for FED id " 113 if ( !input.
size() ) {
116 <<
"[sistrip::SpyUnpacker::" << __func__ <<
"]" 117 <<
" FEDRawData has zero size for FED id " 127 std::auto_ptr<sistrip::FEDSpyBuffer> buffer;
131 throw cms::Exception(
"FEDSpyBuffer") <<
"FED Buffer check fails for FED ID " << lFedId <<
".";
136 <<
"Exception caught when creating FEDSpyBuffer object for FED " << lFedId <<
": " << e.
what();
142 uint32_t totalEvCount = buffer->spyHeaderTotalEventCount();
143 uint32_t l1ID = buffer->spyHeaderL1ID();
145 uint32_t lGRun = buffer->globalRunNumber();
148 if (lRef == 0) lRef = lGRun;
151 <<
" -- Global run encoded in buffer for FED " << lFedId <<
": " 152 << lGRun <<
" is different from reference value " << lRef
157 (*pL1ACounts)[lFedId] = l1ID;
158 (*pTotalEventCounts)[lFedId] = totalEvCount;
161 std::vector<FedChannelConnection>::const_iterator iconn = conns.begin();
162 std::vector<FedChannelConnection>::const_iterator endconn = conns.end();
163 for ( ; iconn != endconn; ++iconn ) {
166 if ( !iconn->isConnected()) {
continue; }
169 uint16_t
chan = iconn->fedCh();
172 if (chan > FEDCH_PER_FED || iconn->fedId() != lFedId){
174 std::ostringstream ss;
175 ss <<
"Channel connection values invalid: iconn->fedId() = " << iconn->fedId() <<
" for FED " << lFedId <<
", iconn->fedCh() = " << chan << std::endl;
182 if (!buffer->channelGood(chan)) {
184 std::ostringstream ss;
185 ss <<
"Channel check failed for FED " << lFedId <<
" channel " << chan << std::endl;
212 pDigis->
swap(*pResult);
virtual char const * what() const
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
static uint32_t fedIndex(const uint16_t &fed_id, const uint16_t &fed_ch)
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::auto_ptr< edm::DetSetVector< T > > createDetSetVector()
const bool allowIncompleteEvents_
FedsConstIterRange fedIds() const
void addItem(const T &item)
~SpyUnpacker()
Destructor.
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