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"))),
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 
#define LogDebug(id)
iterator end()
Definition: DetSet.h:59
EventNumber_t event() const
Definition: EventID.h:40
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)
Definition: DetSetVector.h:264
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
Definition: DetSet.h:75
void analyze(const edm::Event &, const edm::EventSetup &) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:418
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
Definition: Exception.cc:103
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)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > spyPedSubtrDigisToken_
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
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.
Definition: DetSetVector.h:325
static const uint16_t threshold(const Frame &aFrame)
iterator begin()
Definition: DetSet.h:58
static const uint16_t STRIPS_PER_FEDCH
T const * product() const
Definition: Handle.h:69
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)
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
edm::EventID id() const
Definition: EventBase.h:59
HLT enums.
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)
T get() const
Definition: EventSetup.h:73
static void getMajorityHeader(const edm::DetSetVector< SiStripRawDigi > *aInputDigis, uint16_t &firstHeaderBit, bool printResult=true)
static const uint16_t FED_ID_MAX
edm::EDGetTokenT< std::vector< uint32_t > > spyL1Token_
collection_type::const_iterator const_iterator
Definition: DetSet.h:32
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102
T const * product() const
Definition: ESHandle.h:86
sistrip::SpyUtilities utility_
Definition: Run.h:45
edm::EDGetTokenT< std::vector< uint32_t > > spyTotCountToken_