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")),
161 std::ostringstream pDebugStream;
166 std::ostringstream
lName;
204 LogInfo(
"SiStripSpyMonitorModule") <<
" Histograms will be written in " 206 <<
". Current folder is : " 234 std::ofstream lOutCabling;
235 lOutCabling.open(
"trackerDetId_FEDIdChNum_list.txt",
std::ios::out);
240 uint32_t lDetId = lConnection.
detId();
241 lOutCabling <<
"FED ID = " << lFedId
242 <<
", Channel = " << lFedChannel
243 <<
",fedkey = " << sistrip::FEDCH_PER_FED*lFedId + lFedChannel
244 <<
", detId = " << lDetId
265 const std::vector<uint32_t> & lSpyAPVeVec = *lSpyAPVeHandle;
337 lFEDErrors.
hasOOS =
false;
345 uint32_t lAPVAddrRef = lSpyAPVeVec.at(lFedId);
349 uint32_t lFedIndex = sistrip::FEDCH_PER_FED*lFedId + lFedChannel;
355 uint32_t lDetId = lConnection.
detId();
365 if (lDigis == lInputDigis->
end()) {
366 LogDebug(
"SiStripSpyMonitorModule") <<
" -- digis not found in ScopeRawDigis map for FEDID " 367 << lFedId <<
" and FED channel " << lFedChannel << std::endl;
398 else if (lFrame.
digitalLow == 0 && lRange > 0) {
473 else if ( lFrame.
apvAddress.first != lAPVAddrRef ||
486 outfile_[
outfileMap_[
"APVAddressError"]] << lFedId <<
" " << lFedChannel <<
" " << lDetId << std::endl;
516 lTime =
static_cast<double>(
evt_);
520 lTime =
static_cast<double>(iEvent.
id().
event());
538 for (; iDigi != endChannelDigis; ++iDigi) {
539 const uint16_t
val = iDigi->adc();
541 if (val == 0 && lPair == aPair)
return true;
556 uint16_t nTrailers = 0;
559 for ( ; count == 0; count--){
562 if (iDigi != channelDigis.
end() &&
572 if (nTrailers > 1)
LogDebug(
"SiStripSpyMonitorModule") <<
" -- Found " 573 << nTrailers <<
" trailers every 70 clock cycles for channel " 574 << channelDigis.
detId()
578 return (nTrailers > 1) || (nTrailers == 1 && lastPos < 280);
590 bool foundTrailer =
false;
592 uint8_t aboveThreshold = 0;
594 for (; lStart != endChannelDigis; ++lStart) {
601 if (aboveThreshold == 2) {foundTrailer =
true;
break; }
605 if (foundTrailer)
return lStart;
608 return endChannelDigis;
unsigned int nAPVAddressError
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
void analyze(const edm::Event &, const edm::EventSetup &) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
#define DEFINE_FWK_MODULE(type)
void initialise(const edm::ParameterSet &iConfig, std::ostringstream *pDebugStream) override
uint16_t apvPairNumber() const
SiStripSpyMonitorModule(const edm::ParameterSet &)
unsigned long long EventNumber_t
void bookTopLevelHistograms(DQMStore::IBooker &, const TkDetMap *)
bool identifyTickmarks(const edm::DetSetVector< SiStripRawDigi >::detset &channelDigis, const uint16_t threshold)
static const uint16_t SPY_SAMPLES_PER_CHANNEL
char const * what() const override
void bookAllFEDHistograms(DQMStore::IBooker &)
std::pair< uint8_t, uint8_t > apvAddress
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_
void setCurrentFolder(std::string const &fullpath)
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
edm::InputTag spyPedSubtrDigisTag_
T const * product() const
std::string const & pwd()
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]
~SiStripSpyMonitorModule() override
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)
edm::InputTag spyScopeRawDigisTag_
static const uint16_t FED_ID_MAX
edm::EDGetTokenT< std::vector< uint32_t > > spyL1Token_
collection_type::const_iterator const_iterator
collection_type::const_iterator const_iterator
T const * product() const
sistrip::SpyUtilities utility_
uint16_t firstTrailerBit_
edm::EDGetTokenT< std::vector< uint32_t > > spyTotCountToken_