CMS 3D CMS Logo

SiStripSpyMonitorModule.cc
Go to the documentation of this file.
1 // Original Author: Anne-Marie Magnan
2 // Created: 2010/01/11
3 //
4 
5 #include <sstream>
6 #include <memory>
7 #include <list>
8 #include <algorithm>
9 #include <cassert>
10 
21 
29 
34 
36 
37 // For plotting.
39 
43 
45 
46 //
47 // Class declaration
48 //
49 
51 public:
53  ~SiStripSpyMonitorModule() override;
54 
55 private:
56  void analyze(const edm::Event&, const edm::EventSetup&) override;
57  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
58  void dqmBeginRun(const edm::Run&, const edm::EventSetup&) override;
59 
60  //check if contains pedsubtr data = 0
61  bool hasNegativePedSubtr(const edm::DetSetVector<SiStripRawDigi>::detset& channelDigis, uint16_t aPair);
62 
63  bool identifyTickmarks(const edm::DetSetVector<SiStripRawDigi>::detset& channelDigis, const uint16_t threshold);
64 
66  const edm::DetSetVector<SiStripRawDigi>::detset& channelDigis, const uint16_t threshold, uint16_t& aCounter);
67 
68  //tag of spydata collection
71 
74 
75  //tag of l1A and apveAddress counters
79 
83 
84  uint32_t minDigiRange_;
85  uint32_t maxDigiRange_;
86  uint32_t minDigitalLow_;
87  uint32_t maxDigitalLow_;
88  uint32_t minDigitalHigh_;
89  uint32_t maxDigitalHigh_;
90 
92 
93  //folder name for histograms in DQMStore
95  //book detailed histograms even if they will be empty (for merging)
97  //do histos vs time with time=event number. Default time = orbit number (s)
100 
102  uint16_t firstHeaderBit_;
104 
107 
108  std::ofstream outfile_[20];
109  std::vector<std::string> outfileNames_;
110  std::map<std::string, unsigned int> outfileMap_;
111 
113 };
114 
115 using edm::LogError;
116 using edm::LogInfo;
117 using edm::LogWarning;
118 //
119 // Constructors and destructor
120 //
121 
123  : spyScopeRawDigisTag_(iConfig.getUntrackedParameter<edm::InputTag>(
124  "SpyScopeRawDigisTag", edm::InputTag("SiStripSpyUnpacker", "ScopeRawDigis"))),
125  spyPedSubtrDigisTag_(
126  iConfig.getUntrackedParameter<edm::InputTag>("SpyPedSubtrDigisTag", edm::InputTag("SiStripFEDEmulator", ""))),
127  spyL1Tag_(iConfig.getUntrackedParameter<edm::InputTag>("SpyL1Tag",
128  edm::InputTag("SiStripSpyDigiConverter", "L1ACount"))),
129  spyTotCountTag_(iConfig.getUntrackedParameter<edm::InputTag>(
130  "SpyTotalEventCountTag", edm::InputTag("SiStripSpyDigiConverter", "TotalEventCount"))),
131  spyAPVeTag_(iConfig.getUntrackedParameter<edm::InputTag>("SpyAPVeTag",
132  edm::InputTag("SiStripSpyDigiConverter", "APVAddress"))),
133  folderName_(iConfig.getUntrackedParameter<std::string>("HistogramFolderName",
134  "SiStrip/ReadoutView/SpyMonitoringSummary")),
135  fillAllDetailedHistograms_(iConfig.getUntrackedParameter<bool>("FillAllDetailedHistograms", false)),
136  fillWithEvtNum_(iConfig.getUntrackedParameter<bool>("FillWithEventNumber", false)),
137  fillWithLocalEvtNum_(iConfig.getUntrackedParameter<bool>("FillWithLocalEventNumber", false)),
138  firstHeaderBit_(0),
139  firstTrailerBit_(0),
140  outfileNames_(iConfig.getUntrackedParameter<std::vector<std::string> >("OutputErrors")),
141  writeCabling_(iConfig.getUntrackedParameter<bool>("WriteCabling", false)) {
142  spyScopeRawDigisToken_ = consumes<edm::DetSetVector<SiStripRawDigi> >(spyScopeRawDigisTag_);
143  spyPedSubtrDigisToken_ = consumes<edm::DetSetVector<SiStripRawDigi> >(spyPedSubtrDigisTag_);
144 
145  spyL1Token_ = consumes<std::vector<uint32_t> >(spyL1Tag_);
146  spyTotCountToken_ = consumes<std::vector<uint32_t> >(spyTotCountTag_);
147  spyAPVeToken_ = consumes<std::vector<uint32_t> >(spyAPVeTag_);
148 
149  evt_ = 0;
150  std::ostringstream pDebugStream;
151  histManager_.initialise(iConfig, &pDebugStream);
152  const unsigned int nFiles = outfileNames_.size();
153 
154  for (unsigned int i(0); i < nFiles; i++) {
155  std::ostringstream lName;
156  lName << outfileNames_.at(i) << ".out";
157  if (i < 20)
158  outfile_[i].open(lName.str().c_str(), std::ios::out);
159  outfileMap_[outfileNames_.at(i)] = i;
160  }
161 
162  frameQuality_.minDigiRange = static_cast<uint16_t>(iConfig.getUntrackedParameter<uint32_t>("MinDigiRange", 100));
163  frameQuality_.maxDigiRange = static_cast<uint16_t>(iConfig.getUntrackedParameter<uint32_t>("MaxDigiRange", 1024));
164  frameQuality_.minZeroLight = static_cast<uint16_t>(iConfig.getUntrackedParameter<uint32_t>("MinZeroLight", 0));
165  frameQuality_.maxZeroLight = static_cast<uint16_t>(iConfig.getUntrackedParameter<uint32_t>("MaxZeroLight", 1024));
166  frameQuality_.minTickHeight = static_cast<uint16_t>(iConfig.getUntrackedParameter<uint32_t>("MinTickHeight", 0));
167  frameQuality_.maxTickHeight = static_cast<uint16_t>(iConfig.getUntrackedParameter<uint32_t>("MaxTickHeight", 1024));
168 }
169 
171  const unsigned int nFiles = outfileNames_.size();
172  for (unsigned int i(0); i < nFiles; i++) {
173  outfile_[i].close();
174  }
175 
176  outfileMap_.clear();
177  outfileNames_.clear();
178 }
179 
181  evt_ = 0;
182  firstHeaderBit_ = 0;
183  firstTrailerBit_ = 0;
184 }
185 
187  const edm::Run& run,
188  const edm::EventSetup& eSetup) {
189  ibooker.setCurrentFolder(folderName_);
190 
191  LogInfo("SiStripSpyMonitorModule") << " Histograms will be written in " << folderName_
192  << ". Current folder is : " << ibooker.pwd() << std::endl;
193 
194  edm::ESHandle<TkDetMap> tkDetMapHandle;
195  eSetup.get<TrackerTopologyRcd>().get(tkDetMapHandle);
196  const TkDetMap* tkDetMap = tkDetMapHandle.product();
197 
198  //this propagates dqm_ to the histoclass, must be called !
199  histManager_.bookTopLevelHistograms(ibooker, tkDetMap);
200 
203 
204  //dummy error object
205  SPYHistograms::Errors lError;
206  for (uint16_t lFedId = sistrip::FED_ID_MIN; lFedId <= sistrip::FED_ID_MAX; ++lFedId)
207  histManager_.bookFEDHistograms(ibooker, lFedId, lError, true);
208 }
209 
210 // ------------ method called to for each event ------------
212  //update cabling and pedestals
213  const SiStripFedCabling* lCabling = utility_.getCabling(iSetup);
214  if (evt_ == 0 && writeCabling_) {
215  std::ofstream lOutCabling;
216  lOutCabling.open("trackerDetId_FEDIdChNum_list.txt", std::ios::out);
217  for (uint16_t lFedId = sistrip::FED_ID_MIN; lFedId <= sistrip::FED_ID_MAX; ++lFedId) { //loop on feds
218  for (uint16_t lFedChannel = 0; lFedChannel < sistrip::FEDCH_PER_FED; lFedChannel++) { //loop on channels
219  const FedChannelConnection& lConnection = lCabling->fedConnection(lFedId, lFedChannel);
220  if (!lConnection.isConnected())
221  continue;
222  uint32_t lDetId = lConnection.detId();
223  lOutCabling << "FED ID = " << lFedId << ", Channel = " << lFedChannel
224  << ",fedkey = " << sistrip::FEDCH_PER_FED * lFedId + lFedChannel << ", detId = " << lDetId
225  << std::endl;
226  }
227  }
228  lOutCabling.close();
229  }
230 
231  //For spy data
232  //get map of TotalEventCount and L1ID, indexed by fedId, and APVaddress indexed by fedIndex.
233  edm::Handle<std::vector<uint32_t> > lSpyL1IDHandle, lSpyTotCountHandle, lSpyAPVeHandle;
234  try {
235  iEvent.getByToken(spyL1Token_, lSpyL1IDHandle);
236  iEvent.getByToken(spyTotCountToken_, lSpyTotCountHandle);
237  iEvent.getByToken(spyAPVeToken_, lSpyAPVeHandle);
238  } catch (const cms::Exception& e) {
239  LogError("SiStripSpyMonitorModule") << e.what();
240  return;
241  }
242  //const std::map<uint32_t,uint32_t> & lSpyMaxCountMap = *lSpyL1IDHandle;
243  //const std::map<uint32_t,uint32_t> & lSpyMinCountMap = *lSpyTotCountHandle;
244  const std::vector<uint32_t>& lSpyAPVeVec = *lSpyAPVeHandle;
245 
246  //retrieve the scope digis
248  try {
249  iEvent.getByToken(spyScopeRawDigisToken_, digisHandle);
250  } catch (const cms::Exception& e) {
251  LogError("SiStripSpyMonitorModule") << e.what();
252  return;
253  }
254  const edm::DetSetVector<SiStripRawDigi>* lInputDigis = digisHandle.product();
255 
256  //retrieve the reordered payload digis
258  try {
259  iEvent.getByToken(spyPedSubtrDigisToken_, payloadHandle);
260  } catch (const cms::Exception& e) {
261  LogError("SiStripSpyMonitorModule") << e.what();
262  return;
263  }
264  const edm::DetSetVector<SiStripRawDigi>* lPayloadDigis = payloadHandle.product();
265 
266  //for first event only
267  //loop first on channels to calculate majority value of when the first header bit is found.
268  //output info message to give the value found
269  //should currently be 6 but may vary in the futur
270  //then we can check firstTrailerBit is +256+24 after
271 
272  if (evt_ == 0) {
275  }
276 
277  //initialise some counters, filled in histos eventually
279  lCounters.nNoData = 0;
280  lCounters.nLowRange = 0;
281  lCounters.nHighRange = 0;
282  lCounters.nMinZero = 0;
283  lCounters.nMaxSat = 0;
284  lCounters.nLowPb = 0;
285  lCounters.nHighPb = 0;
286  lCounters.nOOS = 0;
287  lCounters.nOtherPbs = 0;
288  lCounters.nAPVError = 0;
289  lCounters.nAPVAddressError = 0;
290  lCounters.nNegPeds = 0;
291 
292  //fill event number for output text files
293  const unsigned int nFiles = outfileNames_.size();
294  for (unsigned int i(0); i < nFiles; i++) {
295  outfile_[i] << "**** evt " << iEvent.id().event() << " ****" << std::endl;
296  }
297 
298  //loop over all FEDs and channels
299 
300  for (uint16_t lFedId = sistrip::FED_ID_MIN; lFedId <= sistrip::FED_ID_MAX; ++lFedId) { //loop on feds
301 
302  SPYHistograms::Errors lFEDErrors;
303  lFEDErrors.hasNoData = false;
304  lFEDErrors.hasLowRange = false;
305  lFEDErrors.hasHighRange = false;
306  lFEDErrors.hasMinZero = false;
307  lFEDErrors.hasMaxSat = false;
308  lFEDErrors.hasLowPb = false;
309  lFEDErrors.hasHighPb = false;
310  lFEDErrors.hasOOS = false;
311  lFEDErrors.hasOtherPbs = false;
312  lFEDErrors.hasErrorBit0 = false;
313  lFEDErrors.hasErrorBit1 = false;
314  lFEDErrors.hasAPVAddressError0 = false;
315  lFEDErrors.hasAPVAddressError1 = false;
316  lFEDErrors.hasNegPeds = false;
317 
318  uint32_t lAPVAddrRef = lSpyAPVeVec.at(lFedId);
319 
320  for (uint16_t lFedChannel = 0; lFedChannel < sistrip::FEDCH_PER_FED; lFedChannel++) { //loop on channels
321 
322  uint32_t lFedIndex = sistrip::FEDCH_PER_FED * lFedId + lFedChannel;
323 
324  const FedChannelConnection& lConnection = lCabling->fedConnection(lFedId, lFedChannel);
325 
326  if (!lConnection.isConnected())
327  continue;
328 
329  uint32_t lDetId = lConnection.detId();
330  //uint16_t lNPairs = lConnection.nApvPairs();
331  uint16_t lPair = lConnection.apvPairNumber();
332 
333  edm::DetSetVector<SiStripRawDigi>::const_iterator lDigis = lInputDigis->find(lFedIndex);
334 
335  //pedsubtr digis
336  edm::DetSetVector<SiStripRawDigi>::const_iterator lPayload = lPayloadDigis->find(lDetId);
337 
338  //no digis found, continue.
339  if (lDigis == lInputDigis->end()) {
340  LogDebug("SiStripSpyMonitorModule") << " -- digis not found in ScopeRawDigis map for FEDID " << lFedId
341  << " and FED channel " << lFedChannel << std::endl;
342  continue;
343  }
344 
346 
347  SPYHistograms::Errors lErrors;
348  lErrors.hasNoData = false;
349  lErrors.hasLowRange = false;
350  lErrors.hasHighRange = false;
351  lErrors.hasMinZero = false;
352  lErrors.hasMaxSat = false;
353  lErrors.hasLowPb = false;
354  lErrors.hasHighPb = false;
355  lErrors.hasOOS = false;
356  lErrors.hasOtherPbs = false;
357  lErrors.hasErrorBit0 = false;
358  lErrors.hasErrorBit1 = false;
359  lErrors.hasAPVAddressError0 = false;
360  lErrors.hasAPVAddressError1 = false;
361  lErrors.hasNegPeds = false;
362 
363  uint16_t lRange = sistrip::SpyUtilities::range(lFrame);
364  uint16_t lThreshold = sistrip::SpyUtilities::threshold(lFrame);
365 
366  if (lRange == 0) {
367  lCounters.nNoData++;
368  lErrors.hasNoData = true;
369  lFEDErrors.hasNoData = true;
370  if (outfileMap_.find("NoData") != outfileMap_.end())
371  outfile_[outfileMap_["NoData"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl;
372  } else if (lFrame.digitalLow == 0 && lRange > 0) {
373  lCounters.nMinZero++;
374  lErrors.hasMinZero = true;
375  lFEDErrors.hasMinZero = true;
376  if (outfileMap_.find("MinZero") != outfileMap_.end())
377  outfile_[outfileMap_["MinZero"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl;
378  } else if (lFrame.digitalHigh >= 1023) {
379  lCounters.nMaxSat++;
380  lErrors.hasMaxSat = true;
381  lFEDErrors.hasMaxSat = true;
382  if (outfileMap_.find("MaxSat") != outfileMap_.end())
383  outfile_[outfileMap_["MaxSat"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl;
384  } else if (lRange > 0 && lRange < frameQuality_.minDigiRange) {
385  lCounters.nLowRange++;
386  lErrors.hasLowRange = true;
387  lFEDErrors.hasLowRange = true;
388  if (outfileMap_.find("LowRange") != outfileMap_.end())
389  outfile_[outfileMap_["LowRange"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl;
390  } else if (lRange > frameQuality_.maxDigiRange) {
391  lCounters.nHighRange++;
392  lErrors.hasHighRange = true;
393  lFEDErrors.hasHighRange = true;
394  if (outfileMap_.find("HighRange") != outfileMap_.end())
395  outfile_[outfileMap_["HighRange"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl;
396  } else if (lFrame.digitalLow < frameQuality_.minZeroLight || lFrame.digitalLow > frameQuality_.maxZeroLight) {
397  lCounters.nLowPb++;
398  lErrors.hasLowPb = true;
399  lFEDErrors.hasLowPb = true;
400  if (outfileMap_.find("LowPb") != outfileMap_.end())
401  outfile_[outfileMap_["LowPb"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl;
403  lCounters.nHighPb++;
404  lErrors.hasHighPb = true;
405  lFEDErrors.hasHighPb = true;
406  if (outfileMap_.find("HighPb") != outfileMap_.end())
407  outfile_[outfileMap_["HighPb"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl;
408  } else if (lFrame.firstHeaderBit != firstHeaderBit_ && //header in wrong position
409  ((lFrame.firstHeaderBit != sistrip::SPY_SAMPLES_PER_CHANNEL && //header and
410  lFrame.firstTrailerBit != sistrip::SPY_SAMPLES_PER_CHANNEL && //trailer found
411  lFrame.firstTrailerBit - lFrame.firstHeaderBit == 280) || //+ right distance between them
412  (lFrame.firstHeaderBit != sistrip::SPY_SAMPLES_PER_CHANNEL && // or header found
413  lFrame.firstTrailerBit == sistrip::SPY_SAMPLES_PER_CHANNEL && // and trailer not found
414  lFrame.firstHeaderBit > 16) || // corresponding to back-to-back frame late enough
415  (lFrame.firstHeaderBit == sistrip::SPY_SAMPLES_PER_CHANNEL && // or header not found
416  identifyTickmarks(*lDigis, lThreshold)) // but such that tickmark compatible with OOS frame
417  )) {
418  lCounters.nOOS++;
419  lErrors.hasOOS = true;
420  lFEDErrors.hasOOS = true;
421  if (outfileMap_.find("OOS") != outfileMap_.end())
422  outfile_[outfileMap_["OOS"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl;
423  } else if (!(lFrame.firstHeaderBit == firstHeaderBit_ && lFrame.firstTrailerBit == firstTrailerBit_)) {
424  lCounters.nOtherPbs++;
425  lErrors.hasOtherPbs = true;
426  lFEDErrors.hasOtherPbs = true;
427  if (outfileMap_.find("OtherPbs") != outfileMap_.end())
428  outfile_[outfileMap_["OtherPbs"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl;
429  } else if (lFrame.apvErrorBit.first || lFrame.apvErrorBit.second) {
430  if (lFrame.apvErrorBit.first) {
431  lCounters.nAPVError++;
432  lErrors.hasErrorBit0 = true;
433  lFEDErrors.hasErrorBit0 = true;
434  }
435  if (lFrame.apvErrorBit.second) {
436  lCounters.nAPVError++;
437  lErrors.hasErrorBit1 = true;
438  lFEDErrors.hasErrorBit1 = true;
439  }
440  if (outfileMap_.find("APVError") != outfileMap_.end()) {
441  outfile_[outfileMap_["APVError"]] << lFedId << " " << lFedChannel << " " << lDetId;
442  if (lFrame.apvErrorBit.first)
443  outfile_[outfileMap_["APVError"]] << " APV0" << std::endl;
444  if (lFrame.apvErrorBit.second)
445  outfile_[outfileMap_["APVError"]] << " APV1" << std::endl;
446  }
447  } else if (lFrame.apvAddress.first != lAPVAddrRef || lFrame.apvAddress.second != lAPVAddrRef) {
448  if (lFrame.apvAddress.first != lAPVAddrRef) {
449  lCounters.nAPVAddressError++;
450  lErrors.hasAPVAddressError0 = true;
451  lFEDErrors.hasAPVAddressError0 = true;
452  }
453  if (lFrame.apvAddress.second != lAPVAddrRef) {
454  lCounters.nAPVAddressError++;
455  lErrors.hasAPVAddressError1 = true;
456  lFEDErrors.hasAPVAddressError1 = true;
457  }
458  if (outfileMap_.find("APVAddressError") != outfileMap_.end()) {
459  outfile_[outfileMap_["APVAddressError"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl;
460  if (lFrame.apvAddress.first != lAPVAddrRef)
461  outfile_[outfileMap_["APVAddressError"]] << " APV0" << std::endl;
462  if (lFrame.apvAddress.second != lAPVAddrRef)
463  outfile_[outfileMap_["APVAddressError"]] << " APV1" << std::endl;
464  }
465  } else if (lPayload != lPayloadDigis->end() && hasNegativePedSubtr(*lPayload, lPair)) {
466  lCounters.nNegPeds++;
467  lErrors.hasNegPeds = true;
468  lFEDErrors.hasNegPeds = true;
469  if (outfileMap_.find("NegPeds") != outfileMap_.end())
470  outfile_[outfileMap_["NegPeds"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl;
471  }
472 
473  histManager_.fillDetailedHistograms(lErrors, lFrame, lFedId, lFedChannel);
474 
475  } //loop on channels
476 
477  histManager_.fillFEDHistograms(lFEDErrors, lFedId);
478 
479  } //loop on feds
480 
481  double lTime;
482  //if (fillWithEvtNum_)
483  //lTime = iEvent.id().event();
484  //else if (fillWithLocalEvtNum_) lTime = evt_;
485  //no orbit number for spy data !!
486  //else lTime = iEvent.orbitNumber()/11223.;
487  if (fillWithLocalEvtNum_) {
488  // casting from unsigned long long to a double here
489  // doing it explicitely
490  lTime = static_cast<double>(evt_);
491  } else {
492  // casting from unsigned long long to a double here
493  // doing it explicitely
494  lTime = static_cast<double>(iEvent.id().event());
495  }
496 
497  histManager_.fillCountersHistograms(lCounters, lTime);
498 
499  //used to fill histo vs time with local event number....
500  evt_++;
501 
502 } //analyze method
503 
505  uint16_t aPair) {
507  const edm::DetSetVector<SiStripRawDigi>::detset::const_iterator endChannelDigis = channelDigis.end();
508 
509  uint32_t count = 0;
510  for (; iDigi != endChannelDigis; ++iDigi) {
511  const uint16_t val = iDigi->adc();
512  uint16_t lPair = static_cast<uint16_t>(count / sistrip::STRIPS_PER_FEDCH);
513  if (val == 0 && lPair == aPair)
514  return true;
515  count++;
516  }
517 
518  return false;
519 }
520 
522  const uint16_t threshold) {
523  //start from the end
525  uint16_t lastPos = sistrip::SPY_SAMPLES_PER_CHANNEL;
526  uint16_t nTrailers = 0;
528 
529  for (; count == 0; count--) {
530  iDigi = findTwoConsecutive(channelDigis, threshold, count);
531  //if found, in different position = 70 before than previous value, go and look 70 before
532  if (iDigi != channelDigis.end() && (lastPos == sistrip::SPY_SAMPLES_PER_CHANNEL || count == lastPos + 1 - 70)) {
533  nTrailers++;
534  lastPos = count - 1;
535  count -= 70;
536  }
537  //else keep looking
538  else
539  count--;
540  }
541 
542  if (nTrailers > 1)
543  LogDebug("SiStripSpyMonitorModule") << " -- Found " << nTrailers << " trailers every 70 clock cycles for channel "
544  << channelDigis.detId() << ", evt " << evt_ << std::endl;
545  //if only one found, should be < 280 otherwise header should have been found and this method would not be called
546  return (nTrailers > 1) || (nTrailers == 1 && lastPos < 280);
547 }
548 
550  const edm::DetSetVector<SiStripRawDigi>::detset& channelDigis, const uint16_t threshold, uint16_t& aCounter) {
551  const edm::DetSetVector<SiStripRawDigi>::detset::const_iterator endChannelDigis = channelDigis.end();
552  edm::DetSetVector<SiStripRawDigi>::detset::const_iterator lStart = channelDigis.begin() + aCounter;
553 
554  bool foundTrailer = false;
555  // Loop over digis looking for last two above threshold
556  uint8_t aboveThreshold = 0;
557 
558  for (; lStart != endChannelDigis; ++lStart) {
559  if (lStart->adc() > threshold) {
560  aboveThreshold++;
561  } else {
562  aboveThreshold = 0;
563  }
564  if (aboveThreshold == 2) {
565  foundTrailer = true;
566  break;
567  }
568  aCounter++;
569  } //end of loop over digis
570 
571  if (foundTrailer)
572  return lStart;
573  else {
575  return endChannelDigis;
576  }
577 }
578 
579 //
580 // Define as a plug-in
581 //
582 
SiStripSpyMonitorModule::spyL1Tag_
edm::InputTag spyL1Tag_
Definition: SiStripSpyMonitorModule.cc:76
FEDNumbering.h
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
edm::DetSetVector< SiStripRawDigi >
SiStripSpyMonitorModule::spyTotCountToken_
edm::EDGetTokenT< std::vector< uint32_t > > spyTotCountToken_
Definition: SiStripSpyMonitorModule.cc:81
SPYHistograms::ErrorCounters::nHighPb
unsigned int nHighPb
Definition: SPYHistograms.h:26
SPYHistograms::ErrorCounters::nOOS
unsigned int nOOS
Definition: SPYHistograms.h:27
electrons_cff.bool
bool
Definition: electrons_cff.py:372
mps_fire.i
i
Definition: mps_fire.py:355
MessageLogger.h
SiStripSpyMonitorModule::findTwoConsecutive
edm::DetSetVector< SiStripRawDigi >::detset::const_iterator findTwoConsecutive(const edm::DetSetVector< SiStripRawDigi >::detset &channelDigis, const uint16_t threshold, uint16_t &aCounter)
Definition: SiStripSpyMonitorModule.cc:549
funct::false
false
Definition: Factorize.h:34
sistrip::SpyUtilities::Frame::firstTrailerBit
uint16_t firstTrailerBit
Definition: SiStripSpyUtilities.h:31
edm::Handle::product
T const * product() const
Definition: Handle.h:70
SPYHistograms::Errors::hasAPVAddressError1
bool hasAPVAddressError1
Definition: SPYHistograms.h:50
ESHandle.h
edm::DetSetVector::end
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:325
sistrip::SpyUtilities::Frame::digitalLow
uint16_t digitalLow
Definition: SiStripSpyUtilities.h:28
SPYHistograms::ErrorCounters::nOtherPbs
unsigned int nOtherPbs
Definition: SPYHistograms.h:30
edm::DetSet
Definition: DetSet.h:23
SiStripSpyMonitorModule::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: SiStripSpyMonitorModule.cc:211
edm::Run
Definition: Run.h:45
SPYHistograms::ErrorCounters::nMaxSat
unsigned int nMaxSat
Definition: SPYHistograms.h:24
SiStripSpyMonitorModule::maxDigiRange_
uint32_t maxDigiRange_
Definition: SiStripSpyMonitorModule.cc:85
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
SiStripSpyMonitorModule::firstHeaderBit_
uint16_t firstHeaderBit_
Definition: SiStripSpyMonitorModule.cc:102
SiStripSpyMonitorModule::dqmBeginRun
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
Definition: SiStripSpyMonitorModule.cc:180
SiStripSpyMonitorModule::fillAllDetailedHistograms_
bool fillAllDetailedHistograms_
Definition: SiStripSpyMonitorModule.cc:96
SPYHistograms::ErrorCounters
Definition: SPYHistograms.h:19
SiStripRawDigi.h
SPYHistograms::ErrorCounters::nAPVError
unsigned int nAPVError
Definition: SPYHistograms.h:31
sistrip::SpyUtilities::FrameQuality
Definition: SiStripSpyUtilities.h:37
edm::DetSet::begin
iterator begin()
Definition: DetSet.h:57
edm::LogInfo
Definition: MessageLogger.h:254
SiStripSpyMonitorModule::SiStripSpyMonitorModule
SiStripSpyMonitorModule(const edm::ParameterSet &)
Definition: SiStripSpyMonitorModule.cc:122
SiStripFedCabling.h
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
SiStripSpyMonitorModule::identifyTickmarks
bool identifyTickmarks(const edm::DetSetVector< SiStripRawDigi >::detset &channelDigis, const uint16_t threshold)
Definition: SiStripSpyMonitorModule.cc:521
SiStripSpyMonitorModule::maxDigitalHigh_
uint32_t maxDigitalHigh_
Definition: SiStripSpyMonitorModule.cc:89
sistrip::SpyUtilities::Frame::apvAddress
std::pair< uint8_t, uint8_t > apvAddress
Definition: SiStripSpyUtilities.h:34
DQMStore.h
SPYHistograms::ErrorCounters::nAPVAddressError
unsigned int nAPVAddressError
Definition: SPYHistograms.h:32
SiStripFedCabling::fedConnection
FedChannelConnection fedConnection(uint16_t fed_id, uint16_t fed_ch) const
Definition: SiStripFedCabling.cc:171
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
sistrip::FED_ID_MIN
static const uint16_t FED_ID_MIN
Definition: ConstantsForHardwareSystems.h:21
SPYHistograms::fillCountersHistograms
void fillCountersHistograms(const ErrorCounters &aCounter, const double aTime)
Definition: SPYHistograms.cc:86
SiStripSpyMonitorModule::minDigitalLow_
uint32_t minDigitalLow_
Definition: SiStripSpyMonitorModule.cc:86
ConstantsForHardwareSystems.h
Constants and enumerated types for FED/FEC systems.
SiStripFedCabling
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses,...
Definition: SiStripFedCabling.h:25
FEDRawData.h
edm::Handle
Definition: AssociativeIterator.h:50
SPYHistograms::Errors::hasAPVAddressError0
bool hasAPVAddressError0
Definition: SPYHistograms.h:49
SiStripSpyUtilities.h
SiStripSpyMonitorModule::fillWithEvtNum_
bool fillWithEvtNum_
Definition: SiStripSpyMonitorModule.cc:98
SPYHistograms::bookTopLevelHistograms
void bookTopLevelHistograms(DQMStore::IBooker &, const TkDetMap *)
Definition: SPYHistograms.cc:227
SiStripSpyMonitorModule::outfileMap_
std::map< std::string, unsigned int > outfileMap_
Definition: SiStripSpyMonitorModule.cc:110
SiStripSpyMonitorModule::spyAPVeToken_
edm::EDGetTokenT< std::vector< uint32_t > > spyAPVeToken_
Definition: SiStripSpyMonitorModule.cc:82
SiStripSpyMonitorModule::hasNegativePedSubtr
bool hasNegativePedSubtr(const edm::DetSetVector< SiStripRawDigi >::detset &channelDigis, uint16_t aPair)
Definition: SiStripSpyMonitorModule.cc:504
SPYHistograms::ErrorCounters::nLowRange
unsigned int nLowRange
Definition: SPYHistograms.h:21
SPYHistograms::Errors::hasNoData
bool hasNoData
Definition: SPYHistograms.h:38
MakerMacros.h
SPYHistograms::Errors::hasNegPeds
bool hasNegPeds
Definition: SPYHistograms.h:51
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
SiStripSpyMonitorModule::minDigiRange_
uint32_t minDigiRange_
Definition: SiStripSpyMonitorModule.cc:84
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
sistrip::SPY_SAMPLES_PER_CHANNEL
static const uint16_t SPY_SAMPLES_PER_CHANNEL
Definition: SiStripFEDSpyBuffer.h:23
SPYHistograms::bookAllFEDHistograms
void bookAllFEDHistograms(DQMStore::IBooker &)
Definition: SPYHistograms.cc:680
SiStripSpyMonitorModule
Definition: SiStripSpyMonitorModule.cc:50
SiStripSpyMonitorModule::histManager_
SPYHistograms histManager_
Definition: SiStripSpyMonitorModule.cc:101
SiStripFEDBuffer.h
Service.h
sistrip::SpyUtilities
Definition: SiStripSpyUtilities.h:24
SiStripSpyMonitorModule::spyPedSubtrDigisToken_
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > spyPedSubtrDigisToken_
Definition: SiStripSpyMonitorModule.cc:73
SiStripSpyMonitorModule::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: SiStripSpyMonitorModule.cc:186
edm::ESHandle
Definition: DTSurvey.h:22
SiStripPedestalsRcd.h
SiStripSpyMonitorModule::maxDigitalLow_
uint32_t maxDigitalLow_
Definition: SiStripSpyMonitorModule.cc:87
TkDetMap
Definition: TkDetMap.h:175
edm::EventNumber_t
unsigned long long EventNumber_t
Definition: RunLumiEventNumber.h:12
SPYHistograms::Errors::hasLowPb
bool hasLowPb
Definition: SPYHistograms.h:43
SPYHistograms::Errors::hasOOS
bool hasOOS
Definition: SPYHistograms.h:45
SPYHistograms::Errors::hasHighPb
bool hasHighPb
Definition: SPYHistograms.h:44
EDGetToken.h
dqm::implementation::NavigatorBase::pwd
virtual std::string pwd()
Definition: DQMStore.cc:16
sistrip::SpyUtilities::extractFrameInfo
static const Frame extractFrameInfo(const edm::DetSetVector< SiStripRawDigi >::detset &channelDigis, bool aPrintDebug=false)
Definition: SiStripSpyUtilities.cc:109
simpleEdmComparison.lName
lName
Definition: simpleEdmComparison.py:125
SPYHistograms::Errors
Definition: SPYHistograms.h:37
SPYHistograms::ErrorCounters::nLowPb
unsigned int nLowPb
Definition: SPYHistograms.h:25
SiStripSpyMonitorModule::outfileNames_
std::vector< std::string > outfileNames_
Definition: SiStripSpyMonitorModule.cc:109
DQMEDAnalyzer.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiStripSpyMonitorModule::frameQuality_
sistrip::SpyUtilities::FrameQuality frameQuality_
Definition: SiStripSpyMonitorModule.cc:106
SPYHistograms::Errors::hasMaxSat
bool hasMaxSat
Definition: SPYHistograms.h:42
SPYHistograms::Errors::hasErrorBit1
bool hasErrorBit1
Definition: SPYHistograms.h:48
edm::LogWarning
Definition: MessageLogger.h:141
DQMEDAnalyzer
Definition: DQMEDAnalyzer.py:1
FedChannelConnection
Class containning control, module, detector and connection information, at the level of a FED channel...
Definition: FedChannelConnection.h:26
SPYHistograms::fillDetailedHistograms
void fillDetailedHistograms(const Errors &aErr, const sistrip::SpyUtilities::Frame &aFrame, const unsigned int aFedId, const unsigned int aFedChannel)
Definition: SPYHistograms.cc:158
FedChannelConnection::isConnected
bool isConnected() const
Definition: FedChannelConnection.h:196
SPYHistograms::ErrorCounters::nMinZero
unsigned int nMinZero
Definition: SPYHistograms.h:23
FedChannelConnection::detId
const uint32_t & detId() const
Definition: FedChannelConnection.h:212
sistrip::SpyUtilities::range
static const uint16_t range(const Frame &aFrame)
Definition: SiStripSpyUtilities.cc:174
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
SiStripFedKey.h
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
SiStripSpyMonitorModule::spyScopeRawDigisToken_
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > spyScopeRawDigisToken_
Definition: SiStripSpyMonitorModule.cc:72
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
Event.h
KineDebug3::count
void count()
Definition: KinematicConstrainedVertexUpdatorT.h:21
edm::DetSetVector::const_iterator
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102
sistrip::STRIPS_PER_FEDCH
static const uint16_t STRIPS_PER_FEDCH
Definition: ConstantsForHardwareSystems.h:44
SPYHistograms::ErrorCounters::nNegPeds
unsigned int nNegPeds
Definition: SPYHistograms.h:33
SPYHistograms::ErrorCounters::nHighRange
unsigned int nHighRange
Definition: SPYHistograms.h:22
edm::DetSetVector::find
iterator find(det_id_type id)
Definition: DetSetVector.h:264
iEvent
int iEvent
Definition: GenABIO.cc:224
SiStripSpyMonitorModule::spyTotCountTag_
edm::InputTag spyTotCountTag_
Definition: SiStripSpyMonitorModule.cc:77
SPYHistograms::Errors::hasHighRange
bool hasHighRange
Definition: SPYHistograms.h:40
FEDRawDataCollection.h
sistrip::SpyUtilities::threshold
static const uint16_t threshold(const Frame &aFrame)
Definition: SiStripSpyUtilities.cc:181
SPYHistograms::ErrorCounters::nNoData
unsigned int nNoData
Definition: SPYHistograms.h:20
SPYHistograms.h
SiStripSpyMonitorModule::spyAPVeTag_
edm::InputTag spyAPVeTag_
Definition: SiStripSpyMonitorModule.cc:78
edm::EventSetup
Definition: EventSetup.h:57
edm::DetSet::detId
det_id_type detId() const
Definition: DetSet.h:74
DetSetVector.h
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
SiStripSpyMonitorModule::spyPedSubtrDigisTag_
edm::InputTag spyPedSubtrDigisTag_
Definition: SiStripSpyMonitorModule.cc:70
get
#define get
sistrip::SpyUtilities::FrameQuality::maxTickHeight
uint16_t maxTickHeight
Definition: SiStripSpyUtilities.h:43
sistrip::FED_ID_MAX
static const uint16_t FED_ID_MAX
Definition: ConstantsForHardwareSystems.h:22
sistrip::SpyUtilities::FrameQuality::minZeroLight
uint16_t minZeroLight
Definition: SiStripSpyUtilities.h:40
InputTag.h
alignCSCRings.r
r
Definition: alignCSCRings.py:93
sistrip::SpyUtilities::getCabling
const SiStripFedCabling * getCabling(const edm::EventSetup &)
Updates the cabling object from the DB.
Definition: SiStripSpyUtilities.cc:37
SiStripSpyMonitorModule::~SiStripSpyMonitorModule
~SiStripSpyMonitorModule() override
Definition: SiStripSpyMonitorModule.cc:170
SiStripSpyMonitorModule::outfile_
std::ofstream outfile_[20]
Definition: SiStripSpyMonitorModule.cc:108
SiStripSpyMonitorModule::writeCabling_
bool writeCabling_
Definition: SiStripSpyMonitorModule.cc:112
SPYHistograms::Errors::hasLowRange
bool hasLowRange
Definition: SPYHistograms.h:39
sistrip::SpyUtilities::Frame::firstHeaderBit
uint16_t firstHeaderBit
Definition: SiStripSpyUtilities.h:30
heppy_batch.val
val
Definition: heppy_batch.py:351
std
Definition: JetResolutionObject.h:76
writedatasetfile.run
run
Definition: writedatasetfile.py:27
sistrip::SpyUtilities::FrameQuality::minDigiRange
uint16_t minDigiRange
Definition: SiStripSpyUtilities.h:38
Frameworkfwd.h
SiStripSpyMonitorModule::folderName_
std::string folderName_
Definition: SiStripSpyMonitorModule.cc:94
SiStripSpyMonitorModule::evt_
edm::EventNumber_t evt_
Definition: SiStripSpyMonitorModule.cc:91
SPYHistograms::Errors::hasErrorBit0
bool hasErrorBit0
Definition: SPYHistograms.h:47
sistrip::SpyUtilities::Frame::digitalHigh
uint16_t digitalHigh
Definition: SiStripSpyUtilities.h:29
SiStripSpyMonitorModule::minDigitalHigh_
uint32_t minDigitalHigh_
Definition: SiStripSpyMonitorModule.cc:88
sistrip::SpyUtilities::getMajorityHeader
static void getMajorityHeader(const edm::DetSetVector< SiStripRawDigi > *aInputDigis, uint16_t &firstHeaderBit, bool printResult=true)
Definition: SiStripSpyUtilities.cc:195
SiStripPedestals.h
cmsBatch.nFiles
nFiles
Definition: cmsBatch.py:308
SPYHistograms::fillFEDHistograms
void fillFEDHistograms(const Errors &aErr, const unsigned int aFedId)
Definition: SPYHistograms.cc:114
sistrip::SpyUtilities::Frame::apvErrorBit
std::pair< bool, bool > apvErrorBit
Definition: SiStripSpyUtilities.h:33
EventSetup.h
SiStripSpyMonitorModule::fillWithLocalEvtNum_
bool fillWithLocalEvtNum_
Definition: SiStripSpyMonitorModule.cc:99
Exception.h
SiStripFedCablingRcd.h
dqm::implementation::IBooker
Definition: DQMStore.h:43
SPYHistograms::bookFEDHistograms
void bookFEDHistograms(DQMStore::IBooker &, const unsigned int fedId, const Errors &aErr, bool doAll=false)
Definition: SPYHistograms.cc:503
sistrip::FEDCH_PER_FED
static const uint16_t FEDCH_PER_FED
Definition: ConstantsForHardwareSystems.h:30
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
FedChannelConnection::apvPairNumber
uint16_t apvPairNumber() const
Definition: FedChannelConnection.cc:125
SPYHistograms::initialise
void initialise(const edm::ParameterSet &iConfig, std::ostringstream *pDebugStream) override
Definition: SPYHistograms.cc:17
cms::Exception
Definition: Exception.h:70
SiStripSpyMonitorModule::spyL1Token_
edm::EDGetTokenT< std::vector< uint32_t > > spyL1Token_
Definition: SiStripSpyMonitorModule.cc:80
edm::DetSet::end
iterator end()
Definition: DetSet.h:58
sistrip::SpyUtilities::Frame
Definition: SiStripSpyUtilities.h:26
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
ParameterSet.h
SiStripSpyMonitorModule::spyScopeRawDigisTag_
edm::InputTag spyScopeRawDigisTag_
Definition: SiStripSpyMonitorModule.cc:69
SPYHistograms
Definition: SPYHistograms.h:13
sistrip::SpyUtilities::FrameQuality::maxZeroLight
uint16_t maxZeroLight
Definition: SiStripSpyUtilities.h:41
remoteMonitoring_LED_IterMethod_cfg.threshold
threshold
Definition: remoteMonitoring_LED_IterMethod_cfg.py:426
edm::Event
Definition: Event.h:73
sistrip::SpyUtilities::FrameQuality::maxDigiRange
uint16_t maxDigiRange
Definition: SiStripSpyUtilities.h:39
SiStripFEDSpyBuffer.h
SPYHistograms::Errors::hasMinZero
bool hasMinZero
Definition: SPYHistograms.h:41
SiStripSpyMonitorModule::firstTrailerBit_
uint16_t firstTrailerBit_
Definition: SiStripSpyMonitorModule.cc:103
edm::InputTag
Definition: InputTag.h:15
sistrip::SpyUtilities::FrameQuality::minTickHeight
uint16_t minTickHeight
Definition: SiStripSpyUtilities.h:42
SPYHistograms::Errors::hasOtherPbs
bool hasOtherPbs
Definition: SPYHistograms.h:46
SiStripSpyMonitorModule::utility_
sistrip::SpyUtilities utility_
Definition: SiStripSpyMonitorModule.cc:105
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
edm::DetSet::const_iterator
collection_type::const_iterator const_iterator
Definition: DetSet.h:31