74 const uint16_t threshold,
132 : spyScopeRawDigisTag_(iConfig.getUntrackedParameter<edm::InputTag>(
"SpyScopeRawDigisTag",edm::InputTag(
"SiStripSpyUnpacker",
"ScopeRawDigis"))),
133 spyPedSubtrDigisTag_(iConfig.getUntrackedParameter<edm::InputTag>(
"SpyPedSubtrDigisTag",edm::InputTag(
"SiStripFEDEmulator",
""))),
134 spyL1Tag_(iConfig.getUntrackedParameter<edm::InputTag>(
"SpyL1Tag",edm::InputTag(
"SiStripSpyDigiConverter",
"L1ACount"))),
135 spyTotCountTag_(iConfig.getUntrackedParameter<edm::InputTag>(
"SpyTotalEventCountTag",edm::InputTag(
"SiStripSpyDigiConverter",
"TotalEventCount"))),
136 spyAPVeTag_(iConfig.getUntrackedParameter<edm::InputTag>(
"SpyAPVeTag",edm::InputTag(
"SiStripSpyDigiConverter",
"APVAddress"))),
138 folderName_(iConfig.getUntrackedParameter<std::
string>(
"HistogramFolderName",
"SiStrip/ReadoutView/SpyMonitoringSummary")),
139 fillAllDetailedHistograms_(iConfig.getUntrackedParameter<bool>(
"FillAllDetailedHistograms",
false)),
140 fillWithEvtNum_(iConfig.getUntrackedParameter<bool>(
"FillWithEventNumber",
false)),
141 fillWithLocalEvtNum_(iConfig.getUntrackedParameter<bool>(
"FillWithLocalEventNumber",
false)),
142 writeDQMStore_(iConfig.getUntrackedParameter<bool>(
"WriteDQMStore",
false)),
143 dqmStoreFileName_(iConfig.getUntrackedParameter<std::
string>(
"DQMStoreFileName",
"DQMStore.root")),
146 outfileNames_(iConfig.getUntrackedParameter<std::vector<std::
string> >(
"OutputErrors")),
147 writeCabling_(iConfig.getUntrackedParameter<bool>(
"WriteCabling",
false))
151 std::ostringstream pDebugStream;
155 for (
unsigned int i(0);
i<nFiles;
i++){
156 std::ostringstream lName;
174 for (
unsigned int i(0);
i<nFiles;
i++){
193 LogInfo(
"SiStripSpyMonitorModule") <<
" Histograms will be written in "
195 <<
". Current folder is : "
221 std::ofstream lOutCabling;
222 lOutCabling.open(
"trackerDetId_FEDIdChNum_list.txt",
std::ios::out);
227 uint32_t lDetId = lConnection.
detId();
228 lOutCabling <<
"FED ID = " << lFedId
229 <<
", Channel = " << lFedChannel
230 <<
",fedkey = " << sistrip::FEDCH_PER_FED*lFedId + lFedChannel
231 <<
", detId = " << lDetId
252 const std::vector<uint32_t> & lSpyAPVeVec = *lSpyAPVeHandle;
307 for (
unsigned int i(0);
i<nFiles;
i++){
324 lFEDErrors.
hasOOS =
false;
332 uint32_t lAPVAddrRef = lSpyAPVeVec.at(lFedId);
336 uint32_t lFedIndex = sistrip::FEDCH_PER_FED*lFedId + lFedChannel;
342 uint32_t lDetId = lConnection.
detId();
352 if (lDigis == lInputDigis->
end()) {
353 LogDebug(
"SiStripSpyMonitorModule") <<
" -- digis not found in ScopeRawDigis map for FEDID "
354 << lFedId <<
" and FED channel " << lFedChannel << std::endl;
385 else if (lFrame.
digitalLow == 0 && lRange > 0) {
460 else if ( lFrame.
apvAddress.first != lAPVAddrRef ||
473 outfile_[
outfileMap_[
"APVAddressError"]] << lFedId <<
" " << lFedChannel <<
" " << lDetId << std::endl;
525 for (
unsigned int i(0);
i<nFiles;
i++){
543 for (; iDigi != endChannelDigis; ++iDigi) {
544 const uint16_t val = iDigi->adc();
546 if (val == 0 && lPair == aPair)
return true;
561 uint16_t nTrailers = 0;
564 for ( ; count == 0; count--){
567 if (iDigi != channelDigis.
end() &&
577 if (nTrailers > 1)
LogDebug(
"SiStripSpyMonitorModule") <<
" -- Found "
578 << nTrailers <<
" trailers every 70 clock cycles for channel "
579 << channelDigis.
detId()
583 return (nTrailers > 1) || (nTrailers == 1 && lastPos < 280);
595 bool foundTrailer =
false;
597 uint8_t aboveThreshold = 0;
599 for (; lStart != endChannelDigis; ++lStart) {
606 if (aboveThreshold == 2) {foundTrailer =
true;
break; }
610 if (foundTrailer)
return lStart;
613 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)
det_id_type detId() const
#define DEFINE_FWK_MODULE(type)
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
uint16_t apvPairNumber() const
SiStripSpyMonitorModule(const edm::ParameterSet &)
bool identifyTickmarks(const edm::DetSetVector< SiStripRawDigi >::detset &channelDigis, const uint16_t threshold)
static const uint16_t SPY_SAMPLES_PER_CHANNEL
const FedChannelConnection & connection(uint16_t fed_id, uint16_t fed_ch) const
std::pair< uint8_t, uint8_t > apvAddress
void initialise(const edm::ParameterSet &iConfig, std::ostringstream *pDebugStream)
bool hasNegativePedSubtr(const edm::DetSetVector< SiStripRawDigi >::detset &channelDigis, uint16_t aPair)
void fillCountersHistograms(const ErrorCounters &aCounter, const double aTime)
SPYHistograms histManager_
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...
void bookAllFEDHistograms()
std::string dqmStoreFileName_
sistrip::SpyUtilities::FrameQuality frameQuality_
static const uint16_t range(const Frame &aFrame)
std::vector< std::string > outfileNames_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
iterator end()
Return the off-the-end iterator.
static const uint16_t threshold(const Frame &aFrame)
virtual void analyze(const edm::Event &, const edm::EventSetup &)
edm::InputTag spyTotCountTag_
edm::InputTag spyAPVeTag_
static const uint16_t STRIPS_PER_FEDCH
edm::InputTag spyPedSubtrDigisTag_
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
T const * product() const
void bookTopLevelHistograms(DQMStore *dqm)
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
collection_type::const_iterator const_iterator
collection_type::const_iterator const_iterator
sistrip::SpyUtilities utility_
uint16_t firstTrailerBit_
void setCurrentFolder(const std::string &fullpath)
const std::string & pwd(void) const