75 const uint16_t threshold,
138 : spyScopeRawDigisTag_(iConfig.getUntrackedParameter<edm::InputTag>(
"SpyScopeRawDigisTag",edm::InputTag(
"SiStripSpyUnpacker",
"ScopeRawDigis"))),
139 spyPedSubtrDigisTag_(iConfig.getUntrackedParameter<edm::InputTag>(
"SpyPedSubtrDigisTag",edm::InputTag(
"SiStripFEDEmulator",
""))),
140 spyL1Tag_(iConfig.getUntrackedParameter<edm::InputTag>(
"SpyL1Tag",edm::InputTag(
"SiStripSpyDigiConverter",
"L1ACount"))),
141 spyTotCountTag_(iConfig.getUntrackedParameter<edm::InputTag>(
"SpyTotalEventCountTag",edm::InputTag(
"SiStripSpyDigiConverter",
"TotalEventCount"))),
142 spyAPVeTag_(iConfig.getUntrackedParameter<edm::InputTag>(
"SpyAPVeTag",edm::InputTag(
"SiStripSpyDigiConverter",
"APVAddress"))),
143 folderName_(iConfig.getUntrackedParameter<std::
string>(
"HistogramFolderName",
"SiStrip/ReadoutView/SpyMonitoringSummary")),
144 fillAllDetailedHistograms_(iConfig.getUntrackedParameter<bool>(
"FillAllDetailedHistograms",
false)),
145 fillWithEvtNum_(iConfig.getUntrackedParameter<bool>(
"FillWithEventNumber",
false)),
146 fillWithLocalEvtNum_(iConfig.getUntrackedParameter<bool>(
"FillWithLocalEventNumber",
false)),
149 outfileNames_(iConfig.getUntrackedParameter<std::vector<std::
string> >(
"OutputErrors")),
150 writeCabling_(iConfig.getUntrackedParameter<bool>(
"WriteCabling",
false))
161 std::ostringstream pDebugStream;
165 for (
unsigned int i(0);
i<nFiles;
i++){
166 std::ostringstream lName;
184 for (
unsigned int i(0);
i<nFiles;
i++){
204 LogInfo(
"SiStripSpyMonitorModule") <<
" Histograms will be written in "
206 <<
". Current folder is : "
230 std::ofstream lOutCabling;
231 lOutCabling.open(
"trackerDetId_FEDIdChNum_list.txt",
std::ios::out);
236 uint32_t lDetId = lConnection.
detId();
237 lOutCabling <<
"FED ID = " << lFedId
238 <<
", Channel = " << lFedChannel
239 <<
",fedkey = " << sistrip::FEDCH_PER_FED*lFedId + lFedChannel
240 <<
", detId = " << lDetId
261 const std::vector<uint32_t> & lSpyAPVeVec = *lSpyAPVeHandle;
316 for (
unsigned int i(0);
i<nFiles;
i++){
333 lFEDErrors.
hasOOS =
false;
341 uint32_t lAPVAddrRef = lSpyAPVeVec.at(lFedId);
345 uint32_t lFedIndex = sistrip::FEDCH_PER_FED*lFedId + lFedChannel;
351 uint32_t lDetId = lConnection.
detId();
361 if (lDigis == lInputDigis->
end()) {
362 LogDebug(
"SiStripSpyMonitorModule") <<
" -- digis not found in ScopeRawDigis map for FEDID "
363 << lFedId <<
" and FED channel " << lFedChannel << std::endl;
394 else if (lFrame.
digitalLow == 0 && lRange > 0) {
469 else if ( lFrame.
apvAddress.first != lAPVAddrRef ||
482 outfile_[
outfileMap_[
"APVAddressError"]] << lFedId <<
" " << lFedChannel <<
" " << lDetId << std::endl;
512 lTime =
static_cast<double>(
evt_);
516 lTime =
static_cast<double>(iEvent.
id().
event());
534 for (; iDigi != endChannelDigis; ++iDigi) {
535 const uint16_t val = iDigi->adc();
537 if (val == 0 && lPair == aPair)
return true;
552 uint16_t nTrailers = 0;
555 for ( ; count == 0; count--){
558 if (iDigi != channelDigis.
end() &&
568 if (nTrailers > 1)
LogDebug(
"SiStripSpyMonitorModule") <<
" -- Found "
569 << nTrailers <<
" trailers every 70 clock cycles for channel "
570 << channelDigis.
detId()
574 return (nTrailers > 1) || (nTrailers == 1 && lastPos < 280);
586 bool foundTrailer =
false;
588 uint8_t aboveThreshold = 0;
590 for (; lStart != endChannelDigis; ++lStart) {
597 if (aboveThreshold == 2) {foundTrailer =
true;
break; }
601 if (foundTrailer)
return lStart;
604 return endChannelDigis;
unsigned int nAPVAddressError
virtual char const * what() const
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) const
static const uint16_t FED_ID_MIN
iterator find(det_id_type id)
bool fillAllDetailedHistograms_
edm::DetSetVector< SiStripRawDigi >::detset::const_iterator findTwoConsecutive(const edm::DetSetVector< SiStripRawDigi >::detset &channelDigis, const uint16_t threshold, uint16_t &aCounter)
FedChannelConnection fedConnection(uint16_t fed_id, uint16_t fed_ch) const
det_id_type detId() const
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
void bookTopLevelHistograms(DQMStore::IBooker &)
const std::string & pwd(void)
uint16_t apvPairNumber() const
SiStripSpyMonitorModule(const edm::ParameterSet &)
unsigned long long EventNumber_t
bool identifyTickmarks(const edm::DetSetVector< SiStripRawDigi >::detset &channelDigis, const uint16_t threshold)
static const uint16_t SPY_SAMPLES_PER_CHANNEL
void bookAllFEDHistograms(DQMStore::IBooker &)
std::pair< uint8_t, uint8_t > apvAddress
void dqmBeginRun(const edm::Run &, const edm::EventSetup &)
void initialise(const edm::ParameterSet &iConfig, std::ostringstream *pDebugStream)
bool hasNegativePedSubtr(const edm::DetSetVector< SiStripRawDigi >::detset &channelDigis, uint16_t aPair)
edm::EDGetTokenT< std::vector< uint32_t > > spyAPVeToken_
void fillCountersHistograms(const ErrorCounters &aCounter, const double aTime)
SPYHistograms histManager_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > spyPedSubtrDigisToken_
static const Frame extractFrameInfo(const edm::DetSetVector< SiStripRawDigi >::detset &channelDigis, bool aPrintDebug=false)
const uint32_t & detId() const
std::map< std::string, unsigned int > outfileMap_
Class containning control, module, detector and connection information, at the level of a FED channel...
sistrip::SpyUtilities::FrameQuality frameQuality_
static const uint16_t range(const Frame &aFrame)
std::vector< std::string > outfileNames_
void bookFEDHistograms(DQMStore::IBooker &, const unsigned int fedId, const Errors &aErr, bool doAll=false)
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > spyScopeRawDigisToken_
iterator end()
Return the off-the-end iterator.
static const uint16_t threshold(const Frame &aFrame)
edm::InputTag spyTotCountTag_
edm::InputTag spyAPVeTag_
static const uint16_t STRIPS_PER_FEDCH
void setCurrentFolder(const std::string &fullpath)
edm::InputTag spyPedSubtrDigisTag_
T const * product() const
Constants and enumerated types for FED/FEC systems.
const SiStripFedCabling * getCabling(const edm::EventSetup &)
Updates the cabling object from the DB.
void fillFEDHistograms(const Errors &aErr, const unsigned int aFedId)
std::pair< bool, bool > apvErrorBit
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
std::ofstream outfile_[20]
bool fillWithLocalEvtNum_
static const uint16_t FEDCH_PER_FED
void fillDetailedHistograms(const Errors &aErr, const sistrip::SpyUtilities::Frame &aFrame, const unsigned int aFedId, const unsigned int aFedChannel)
static void getMajorityHeader(const edm::DetSetVector< SiStripRawDigi > *aInputDigis, uint16_t &firstHeaderBit, bool printResult=true)
~SiStripSpyMonitorModule()
edm::InputTag spyScopeRawDigisTag_
static const uint16_t FED_ID_MAX
edm::EDGetTokenT< std::vector< uint32_t > > spyL1Token_
volatile std::atomic< bool > shutdown_flag false
collection_type::const_iterator const_iterator
collection_type::const_iterator const_iterator
sistrip::SpyUtilities utility_
uint16_t firstTrailerBit_
edm::EDGetTokenT< std::vector< uint32_t > > spyTotCountToken_