124 "SpyScopeRawDigisTag",
edm::
InputTag(
"SiStripSpyUnpacker",
"ScopeRawDigis"))),
126 iConfig.getUntrackedParameter<
edm::
InputTag>(
"SpyPedSubtrDigisTag",
edm::
InputTag(
"SiStripFEDEmulator",
""))),
128 edm::
InputTag(
"SiStripSpyDigiConverter",
"L1ACount"))),
130 "SpyTotalEventCountTag",
edm::
InputTag(
"SiStripSpyDigiConverter",
"TotalEventCount"))),
132 edm::
InputTag(
"SiStripSpyDigiConverter",
"APVAddress"))),
134 "SiStrip/ReadoutView/SpyMonitoringSummary")),
150 std::ostringstream pDebugStream;
154 for (
unsigned int i(0);
i <
nFiles;
i++) {
155 std::ostringstream
lName;
172 for (
unsigned int i(0);
i <
nFiles;
i++) {
191 LogInfo(
"SiStripSpyMonitorModule") <<
" Histograms will be written in " <<
folderName_ 192 <<
". Current folder is : " << ibooker.
pwd() << std::endl;
215 std::ofstream lOutCabling;
216 lOutCabling.open(
"trackerDetId_FEDIdChNum_list.txt",
std::ios::out);
222 uint32_t lDetId = lConnection.
detId();
223 lOutCabling <<
"FED ID = " << lFedId <<
", Channel = " << lFedChannel
224 <<
",fedkey = " << sistrip::FEDCH_PER_FED * lFedId + lFedChannel <<
", detId = " << lDetId
244 const std::vector<uint32_t>& lSpyAPVeVec = *lSpyAPVeHandle;
294 for (
unsigned int i(0);
i <
nFiles;
i++) {
310 lFEDErrors.
hasOOS =
false;
318 uint32_t lAPVAddrRef = lSpyAPVeVec.at(lFedId);
322 uint32_t lFedIndex = sistrip::FEDCH_PER_FED * lFedId + lFedChannel;
329 uint32_t lDetId = lConnection.
detId();
339 if (lDigis == lInputDigis->
end()) {
340 LogDebug(
"SiStripSpyMonitorModule") <<
" -- digis not found in ScopeRawDigis map for FEDID " << lFedId
341 <<
" and FED channel " << lFedChannel << std::endl;
371 outfile_[
outfileMap_[
"NoData"]] << lFedId <<
" " << lFedChannel <<
" " << lDetId << std::endl;
372 }
else if (lFrame.
digitalLow == 0 && lRange > 0) {
377 outfile_[
outfileMap_[
"MinZero"]] << lFedId <<
" " << lFedChannel <<
" " << lDetId << std::endl;
383 outfile_[
outfileMap_[
"MaxSat"]] << lFedId <<
" " << lFedChannel <<
" " << lDetId << std::endl;
389 outfile_[
outfileMap_[
"LowRange"]] << lFedId <<
" " << lFedChannel <<
" " << lDetId << std::endl;
395 outfile_[
outfileMap_[
"HighRange"]] << lFedId <<
" " << lFedChannel <<
" " << lDetId << std::endl;
401 outfile_[
outfileMap_[
"LowPb"]] << lFedId <<
" " << lFedChannel <<
" " << lDetId << std::endl;
407 outfile_[
outfileMap_[
"HighPb"]] << lFedId <<
" " << lFedChannel <<
" " << lDetId << std::endl;
422 outfile_[
outfileMap_[
"OOS"]] << lFedId <<
" " << lFedChannel <<
" " << lDetId << std::endl;
428 outfile_[
outfileMap_[
"OtherPbs"]] << lFedId <<
" " << lFedChannel <<
" " << lDetId << std::endl;
453 if (lFrame.
apvAddress.second != lAPVAddrRef) {
459 outfile_[
outfileMap_[
"APVAddressError"]] << lFedId <<
" " << lFedChannel <<
" " << lDetId << std::endl;
470 outfile_[
outfileMap_[
"NegPeds"]] << lFedId <<
" " << lFedChannel <<
" " << lDetId << std::endl;
490 lTime =
static_cast<double>(
evt_);
494 lTime =
static_cast<double>(iEvent.
id().
event());
510 for (; iDigi != endChannelDigis; ++iDigi) {
511 const uint16_t
val = iDigi->adc();
513 if (val == 0 && lPair == aPair)
526 uint16_t nTrailers = 0;
529 for (; count == 0; count--) {
543 LogDebug(
"SiStripSpyMonitorModule") <<
" -- Found " << nTrailers <<
" trailers every 70 clock cycles for channel " 544 << channelDigis.
detId() <<
", evt " <<
evt_ << std::endl;
546 return (nTrailers > 1) || (nTrailers == 1 && lastPos < 280);
554 bool foundTrailer =
false;
556 uint8_t aboveThreshold = 0;
558 for (; lStart != endChannelDigis; ++lStart) {
564 if (aboveThreshold == 2) {
575 return endChannelDigis;
unsigned int nAPVAddressError
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) const
std::pair< uint8_t, uint8_t > apvAddress
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
void setCurrentFolder(std::string const &fullpath)
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
std::map< std::string, unsigned int > outfileMap_
void bookAllFEDHistograms(DQMStore::IBooker &)
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_
#define DEFINE_FWK_MODULE(type)
std::pair< bool, bool > apvErrorBit
static const Frame extractFrameInfo(const edm::DetSetVector< SiStripRawDigi >::detset &channelDigis, bool aPrintDebug=false)
const uint32_t & detId() const
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
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::string const & pwd()
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_