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 
106 
107  std::ofstream outfile_[20];
108  std::vector<std::string> outfileNames_;
109  std::map<std::string, unsigned int> outfileMap_;
110 
112 
117  void updateFedCabling(const SiStripFedCablingRcd& rcd);
118 };
119 
120 using edm::LogError;
121 using edm::LogInfo;
122 using edm::LogWarning;
123 //
124 // Constructors and destructor
125 //
126 
128  : spyScopeRawDigisTag_(iConfig.getUntrackedParameter<edm::InputTag>(
129  "SpyScopeRawDigisTag", edm::InputTag("SiStripSpyUnpacker", "ScopeRawDigis"))),
130  spyPedSubtrDigisTag_(
131  iConfig.getUntrackedParameter<edm::InputTag>("SpyPedSubtrDigisTag", edm::InputTag("SiStripFEDEmulator", ""))),
132  spyL1Tag_(iConfig.getUntrackedParameter<edm::InputTag>("SpyL1Tag",
133  edm::InputTag("SiStripSpyDigiConverter", "L1ACount"))),
134  spyTotCountTag_(iConfig.getUntrackedParameter<edm::InputTag>(
135  "SpyTotalEventCountTag", edm::InputTag("SiStripSpyDigiConverter", "TotalEventCount"))),
136  spyAPVeTag_(iConfig.getUntrackedParameter<edm::InputTag>("SpyAPVeTag",
137  edm::InputTag("SiStripSpyDigiConverter", "APVAddress"))),
138  folderName_(iConfig.getUntrackedParameter<std::string>("HistogramFolderName",
139  "SiStrip/ReadoutView/SpyMonitoringSummary")),
140  fillAllDetailedHistograms_(iConfig.getUntrackedParameter<bool>("FillAllDetailedHistograms", false)),
141  fillWithEvtNum_(iConfig.getUntrackedParameter<bool>("FillWithEventNumber", false)),
142  fillWithLocalEvtNum_(iConfig.getUntrackedParameter<bool>("FillWithLocalEventNumber", false)),
143  firstHeaderBit_(0),
144  firstTrailerBit_(0),
145  outfileNames_(iConfig.getUntrackedParameter<std::vector<std::string> >("OutputErrors")),
146  writeCabling_(iConfig.getUntrackedParameter<bool>("WriteCabling", false)),
147  tkDetMapToken_(esConsumes<edm::Transition::BeginRun>()),
148  fedCablingToken_(esConsumes<>()),
149  cablingWatcher_(this, &SiStripSpyMonitorModule::updateFedCabling) {
150  spyScopeRawDigisToken_ = consumes<edm::DetSetVector<SiStripRawDigi> >(spyScopeRawDigisTag_);
151  spyPedSubtrDigisToken_ = consumes<edm::DetSetVector<SiStripRawDigi> >(spyPedSubtrDigisTag_);
152 
153  spyL1Token_ = consumes<std::vector<uint32_t> >(spyL1Tag_);
154  spyTotCountToken_ = consumes<std::vector<uint32_t> >(spyTotCountTag_);
155  spyAPVeToken_ = consumes<std::vector<uint32_t> >(spyAPVeTag_);
156 
157  evt_ = 0;
158  std::ostringstream pDebugStream;
159  histManager_.initialise(iConfig, &pDebugStream);
160  const unsigned int nFiles = outfileNames_.size();
161 
162  for (unsigned int i(0); i < nFiles; i++) {
163  std::ostringstream lName;
164  lName << outfileNames_.at(i) << ".out";
165  if (i < 20)
166  outfile_[i].open(lName.str().c_str(), std::ios::out);
167  outfileMap_[outfileNames_.at(i)] = i;
168  }
169 
170  frameQuality_.minDigiRange = static_cast<uint16_t>(iConfig.getUntrackedParameter<uint32_t>("MinDigiRange", 100));
171  frameQuality_.maxDigiRange = static_cast<uint16_t>(iConfig.getUntrackedParameter<uint32_t>("MaxDigiRange", 1024));
172  frameQuality_.minZeroLight = static_cast<uint16_t>(iConfig.getUntrackedParameter<uint32_t>("MinZeroLight", 0));
173  frameQuality_.maxZeroLight = static_cast<uint16_t>(iConfig.getUntrackedParameter<uint32_t>("MaxZeroLight", 1024));
174  frameQuality_.minTickHeight = static_cast<uint16_t>(iConfig.getUntrackedParameter<uint32_t>("MinTickHeight", 0));
175  frameQuality_.maxTickHeight = static_cast<uint16_t>(iConfig.getUntrackedParameter<uint32_t>("MaxTickHeight", 1024));
176 }
177 
179  const unsigned int nFiles = outfileNames_.size();
180  for (unsigned int i(0); i < nFiles; i++) {
181  outfile_[i].close();
182  }
183 
184  outfileMap_.clear();
185  outfileNames_.clear();
186 }
187 
190 }
191 
193  evt_ = 0;
194  firstHeaderBit_ = 0;
195  firstTrailerBit_ = 0;
196 }
197 
199  const edm::Run& run,
200  const edm::EventSetup& eSetup) {
201  ibooker.setCurrentFolder(folderName_);
202 
203  LogInfo("SiStripSpyMonitorModule") << " Histograms will be written in " << folderName_
204  << ". Current folder is : " << ibooker.pwd() << std::endl;
205 
206  const auto tkDetMap = &eSetup.getData(tkDetMapToken_);
207  //this propagates dqm_ to the histoclass, must be called !
208  histManager_.bookTopLevelHistograms(ibooker, tkDetMap);
209 
212 
213  //dummy error object
214  SPYHistograms::Errors lError;
215  for (uint16_t lFedId = sistrip::FED_ID_MIN; lFedId <= sistrip::FED_ID_MAX; ++lFedId)
216  histManager_.bookFEDHistograms(ibooker, lFedId, lError, true);
217 }
218 
219 // ------------ method called to for each event ------------
221  //update cabling and pedestals
222  cablingWatcher_.check(iSetup);
223  if (evt_ == 0 && writeCabling_) {
224  std::ofstream lOutCabling;
225  lOutCabling.open("trackerDetId_FEDIdChNum_list.txt", std::ios::out);
226  for (uint16_t lFedId = sistrip::FED_ID_MIN; lFedId <= sistrip::FED_ID_MAX; ++lFedId) { //loop on feds
227  for (uint16_t lFedChannel = 0; lFedChannel < sistrip::FEDCH_PER_FED; lFedChannel++) { //loop on channels
228  const FedChannelConnection& lConnection = fedCabling_->fedConnection(lFedId, lFedChannel);
229  if (!lConnection.isConnected())
230  continue;
231  uint32_t lDetId = lConnection.detId();
232  lOutCabling << "FED ID = " << lFedId << ", Channel = " << lFedChannel
233  << ",fedkey = " << sistrip::FEDCH_PER_FED * lFedId + lFedChannel << ", detId = " << lDetId
234  << std::endl;
235  }
236  }
237  lOutCabling.close();
238  }
239 
240  //For spy data
241  //get map of TotalEventCount and L1ID, indexed by fedId, and APVaddress indexed by fedIndex.
242  edm::Handle<std::vector<uint32_t> > lSpyL1IDHandle, lSpyTotCountHandle, lSpyAPVeHandle;
243  try {
244  iEvent.getByToken(spyL1Token_, lSpyL1IDHandle);
245  iEvent.getByToken(spyTotCountToken_, lSpyTotCountHandle);
246  iEvent.getByToken(spyAPVeToken_, lSpyAPVeHandle);
247  } catch (const cms::Exception& e) {
248  LogError("SiStripSpyMonitorModule") << e.what();
249  return;
250  }
251  //const std::map<uint32_t,uint32_t> & lSpyMaxCountMap = *lSpyL1IDHandle;
252  //const std::map<uint32_t,uint32_t> & lSpyMinCountMap = *lSpyTotCountHandle;
253  const std::vector<uint32_t>& lSpyAPVeVec = *lSpyAPVeHandle;
254 
255  //retrieve the scope digis
257  try {
258  iEvent.getByToken(spyScopeRawDigisToken_, digisHandle);
259  } catch (const cms::Exception& e) {
260  LogError("SiStripSpyMonitorModule") << e.what();
261  return;
262  }
263  const edm::DetSetVector<SiStripRawDigi>* lInputDigis = digisHandle.product();
264 
265  //retrieve the reordered payload digis
267  try {
268  iEvent.getByToken(spyPedSubtrDigisToken_, payloadHandle);
269  } catch (const cms::Exception& e) {
270  LogError("SiStripSpyMonitorModule") << e.what();
271  return;
272  }
273  const edm::DetSetVector<SiStripRawDigi>* lPayloadDigis = payloadHandle.product();
274 
275  //for first event only
276  //loop first on channels to calculate majority value of when the first header bit is found.
277  //output info message to give the value found
278  //should currently be 6 but may vary in the futur
279  //then we can check firstTrailerBit is +256+24 after
280 
281  if (evt_ == 0) {
284  }
285 
286  //initialise some counters, filled in histos eventually
288  lCounters.nNoData = 0;
289  lCounters.nLowRange = 0;
290  lCounters.nHighRange = 0;
291  lCounters.nMinZero = 0;
292  lCounters.nMaxSat = 0;
293  lCounters.nLowPb = 0;
294  lCounters.nHighPb = 0;
295  lCounters.nOOS = 0;
296  lCounters.nOtherPbs = 0;
297  lCounters.nAPVError = 0;
298  lCounters.nAPVAddressError = 0;
299  lCounters.nNegPeds = 0;
300 
301  //fill event number for output text files
302  const unsigned int nFiles = outfileNames_.size();
303  for (unsigned int i(0); i < nFiles; i++) {
304  outfile_[i] << "**** evt " << iEvent.id().event() << " ****" << std::endl;
305  }
306 
307  //loop over all FEDs and channels
308 
309  for (uint16_t lFedId = sistrip::FED_ID_MIN; lFedId <= sistrip::FED_ID_MAX; ++lFedId) { //loop on feds
310 
311  SPYHistograms::Errors lFEDErrors;
312  lFEDErrors.hasNoData = false;
313  lFEDErrors.hasLowRange = false;
314  lFEDErrors.hasHighRange = false;
315  lFEDErrors.hasMinZero = false;
316  lFEDErrors.hasMaxSat = false;
317  lFEDErrors.hasLowPb = false;
318  lFEDErrors.hasHighPb = false;
319  lFEDErrors.hasOOS = false;
320  lFEDErrors.hasOtherPbs = false;
321  lFEDErrors.hasErrorBit0 = false;
322  lFEDErrors.hasErrorBit1 = false;
323  lFEDErrors.hasAPVAddressError0 = false;
324  lFEDErrors.hasAPVAddressError1 = false;
325  lFEDErrors.hasNegPeds = false;
326 
327  uint32_t lAPVAddrRef = lSpyAPVeVec.at(lFedId);
328 
329  for (uint16_t lFedChannel = 0; lFedChannel < sistrip::FEDCH_PER_FED; lFedChannel++) { //loop on channels
330 
331  uint32_t lFedIndex = sistrip::FEDCH_PER_FED * lFedId + lFedChannel;
332 
333  const FedChannelConnection& lConnection = fedCabling_->fedConnection(lFedId, lFedChannel);
334 
335  if (!lConnection.isConnected())
336  continue;
337 
338  uint32_t lDetId = lConnection.detId();
339  //uint16_t lNPairs = lConnection.nApvPairs();
340  uint16_t lPair = lConnection.apvPairNumber();
341 
342  edm::DetSetVector<SiStripRawDigi>::const_iterator lDigis = lInputDigis->find(lFedIndex);
343 
344  //pedsubtr digis
345  edm::DetSetVector<SiStripRawDigi>::const_iterator lPayload = lPayloadDigis->find(lDetId);
346 
347  //no digis found, continue.
348  if (lDigis == lInputDigis->end()) {
349  LogDebug("SiStripSpyMonitorModule") << " -- digis not found in ScopeRawDigis map for FEDID " << lFedId
350  << " and FED channel " << lFedChannel << std::endl;
351  continue;
352  }
353 
355 
356  SPYHistograms::Errors lErrors;
357  lErrors.hasNoData = false;
358  lErrors.hasLowRange = false;
359  lErrors.hasHighRange = false;
360  lErrors.hasMinZero = false;
361  lErrors.hasMaxSat = false;
362  lErrors.hasLowPb = false;
363  lErrors.hasHighPb = false;
364  lErrors.hasOOS = false;
365  lErrors.hasOtherPbs = false;
366  lErrors.hasErrorBit0 = false;
367  lErrors.hasErrorBit1 = false;
368  lErrors.hasAPVAddressError0 = false;
369  lErrors.hasAPVAddressError1 = false;
370  lErrors.hasNegPeds = false;
371 
372  uint16_t lRange = sistrip::SpyUtilities::range(lFrame);
373  uint16_t lThreshold = sistrip::SpyUtilities::threshold(lFrame);
374 
375  if (lRange == 0) {
376  lCounters.nNoData++;
377  lErrors.hasNoData = true;
378  lFEDErrors.hasNoData = true;
379  if (outfileMap_.find("NoData") != outfileMap_.end())
380  outfile_[outfileMap_["NoData"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl;
381  } else if (lFrame.digitalLow == 0 && lRange > 0) {
382  lCounters.nMinZero++;
383  lErrors.hasMinZero = true;
384  lFEDErrors.hasMinZero = true;
385  if (outfileMap_.find("MinZero") != outfileMap_.end())
386  outfile_[outfileMap_["MinZero"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl;
387  } else if (lFrame.digitalHigh >= 1023) {
388  lCounters.nMaxSat++;
389  lErrors.hasMaxSat = true;
390  lFEDErrors.hasMaxSat = true;
391  if (outfileMap_.find("MaxSat") != outfileMap_.end())
392  outfile_[outfileMap_["MaxSat"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl;
393  } else if (lRange > 0 && lRange < frameQuality_.minDigiRange) {
394  lCounters.nLowRange++;
395  lErrors.hasLowRange = true;
396  lFEDErrors.hasLowRange = true;
397  if (outfileMap_.find("LowRange") != outfileMap_.end())
398  outfile_[outfileMap_["LowRange"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl;
399  } else if (lRange > frameQuality_.maxDigiRange) {
400  lCounters.nHighRange++;
401  lErrors.hasHighRange = true;
402  lFEDErrors.hasHighRange = true;
403  if (outfileMap_.find("HighRange") != outfileMap_.end())
404  outfile_[outfileMap_["HighRange"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl;
405  } else if (lFrame.digitalLow < frameQuality_.minZeroLight || lFrame.digitalLow > frameQuality_.maxZeroLight) {
406  lCounters.nLowPb++;
407  lErrors.hasLowPb = true;
408  lFEDErrors.hasLowPb = true;
409  if (outfileMap_.find("LowPb") != outfileMap_.end())
410  outfile_[outfileMap_["LowPb"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl;
412  lCounters.nHighPb++;
413  lErrors.hasHighPb = true;
414  lFEDErrors.hasHighPb = true;
415  if (outfileMap_.find("HighPb") != outfileMap_.end())
416  outfile_[outfileMap_["HighPb"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl;
417  } else if (lFrame.firstHeaderBit != firstHeaderBit_ && //header in wrong position
418  ((lFrame.firstHeaderBit != sistrip::SPY_SAMPLES_PER_CHANNEL && //header and
419  lFrame.firstTrailerBit != sistrip::SPY_SAMPLES_PER_CHANNEL && //trailer found
420  lFrame.firstTrailerBit - lFrame.firstHeaderBit == 280) || //+ right distance between them
421  (lFrame.firstHeaderBit != sistrip::SPY_SAMPLES_PER_CHANNEL && // or header found
422  lFrame.firstTrailerBit == sistrip::SPY_SAMPLES_PER_CHANNEL && // and trailer not found
423  lFrame.firstHeaderBit > 16) || // corresponding to back-to-back frame late enough
424  (lFrame.firstHeaderBit == sistrip::SPY_SAMPLES_PER_CHANNEL && // or header not found
425  identifyTickmarks(*lDigis, lThreshold)) // but such that tickmark compatible with OOS frame
426  )) {
427  lCounters.nOOS++;
428  lErrors.hasOOS = true;
429  lFEDErrors.hasOOS = true;
430  if (outfileMap_.find("OOS") != outfileMap_.end())
431  outfile_[outfileMap_["OOS"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl;
432  } else if (!(lFrame.firstHeaderBit == firstHeaderBit_ && lFrame.firstTrailerBit == firstTrailerBit_)) {
433  lCounters.nOtherPbs++;
434  lErrors.hasOtherPbs = true;
435  lFEDErrors.hasOtherPbs = true;
436  if (outfileMap_.find("OtherPbs") != outfileMap_.end())
437  outfile_[outfileMap_["OtherPbs"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl;
438  } else if (lFrame.apvErrorBit.first || lFrame.apvErrorBit.second) {
439  if (lFrame.apvErrorBit.first) {
440  lCounters.nAPVError++;
441  lErrors.hasErrorBit0 = true;
442  lFEDErrors.hasErrorBit0 = true;
443  }
444  if (lFrame.apvErrorBit.second) {
445  lCounters.nAPVError++;
446  lErrors.hasErrorBit1 = true;
447  lFEDErrors.hasErrorBit1 = true;
448  }
449  if (outfileMap_.find("APVError") != outfileMap_.end()) {
450  outfile_[outfileMap_["APVError"]] << lFedId << " " << lFedChannel << " " << lDetId;
451  if (lFrame.apvErrorBit.first)
452  outfile_[outfileMap_["APVError"]] << " APV0" << std::endl;
453  if (lFrame.apvErrorBit.second)
454  outfile_[outfileMap_["APVError"]] << " APV1" << std::endl;
455  }
456  } else if (lFrame.apvAddress.first != lAPVAddrRef || lFrame.apvAddress.second != lAPVAddrRef) {
457  if (lFrame.apvAddress.first != lAPVAddrRef) {
458  lCounters.nAPVAddressError++;
459  lErrors.hasAPVAddressError0 = true;
460  lFEDErrors.hasAPVAddressError0 = true;
461  }
462  if (lFrame.apvAddress.second != lAPVAddrRef) {
463  lCounters.nAPVAddressError++;
464  lErrors.hasAPVAddressError1 = true;
465  lFEDErrors.hasAPVAddressError1 = true;
466  }
467  if (outfileMap_.find("APVAddressError") != outfileMap_.end()) {
468  outfile_[outfileMap_["APVAddressError"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl;
469  if (lFrame.apvAddress.first != lAPVAddrRef)
470  outfile_[outfileMap_["APVAddressError"]] << " APV0" << std::endl;
471  if (lFrame.apvAddress.second != lAPVAddrRef)
472  outfile_[outfileMap_["APVAddressError"]] << " APV1" << std::endl;
473  }
474  } else if (lPayload != lPayloadDigis->end() && hasNegativePedSubtr(*lPayload, lPair)) {
475  lCounters.nNegPeds++;
476  lErrors.hasNegPeds = true;
477  lFEDErrors.hasNegPeds = true;
478  if (outfileMap_.find("NegPeds") != outfileMap_.end())
479  outfile_[outfileMap_["NegPeds"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl;
480  }
481 
482  histManager_.fillDetailedHistograms(lErrors, lFrame, lFedId, lFedChannel);
483 
484  } //loop on channels
485 
486  histManager_.fillFEDHistograms(lFEDErrors, lFedId);
487 
488  } //loop on feds
489 
490  double lTime;
491  //if (fillWithEvtNum_)
492  //lTime = iEvent.id().event();
493  //else if (fillWithLocalEvtNum_) lTime = evt_;
494  //no orbit number for spy data !!
495  //else lTime = iEvent.orbitNumber()/11223.;
496  if (fillWithLocalEvtNum_) {
497  // casting from unsigned long long to a double here
498  // doing it explicitely
499  lTime = static_cast<double>(evt_);
500  } else {
501  // casting from unsigned long long to a double here
502  // doing it explicitely
503  lTime = static_cast<double>(iEvent.id().event());
504  }
505 
506  histManager_.fillCountersHistograms(lCounters, lTime);
507 
508  //used to fill histo vs time with local event number....
509  evt_++;
510 
511 } //analyze method
512 
514  uint16_t aPair) {
516  const edm::DetSetVector<SiStripRawDigi>::detset::const_iterator endChannelDigis = channelDigis.end();
517 
518  uint32_t count = 0;
519  for (; iDigi != endChannelDigis; ++iDigi) {
520  const uint16_t val = iDigi->adc();
521  uint16_t lPair = static_cast<uint16_t>(count / sistrip::STRIPS_PER_FEDCH);
522  if (val == 0 && lPair == aPair)
523  return true;
524  count++;
525  }
526 
527  return false;
528 }
529 
531  const uint16_t threshold) {
532  //start from the end
534  uint16_t lastPos = sistrip::SPY_SAMPLES_PER_CHANNEL;
535  uint16_t nTrailers = 0;
537 
538  for (; count == 0; count--) {
539  iDigi = findTwoConsecutive(channelDigis, threshold, count);
540  //if found, in different position = 70 before than previous value, go and look 70 before
541  if (iDigi != channelDigis.end() && (lastPos == sistrip::SPY_SAMPLES_PER_CHANNEL || count == lastPos + 1 - 70)) {
542  nTrailers++;
543  lastPos = count - 1;
544  count -= 70;
545  }
546  //else keep looking
547  else
548  count--;
549  }
550 
551  if (nTrailers > 1)
552  LogDebug("SiStripSpyMonitorModule") << " -- Found " << nTrailers << " trailers every 70 clock cycles for channel "
553  << channelDigis.detId() << ", evt " << evt_ << std::endl;
554  //if only one found, should be < 280 otherwise header should have been found and this method would not be called
555  return (nTrailers > 1) || (nTrailers == 1 && lastPos < 280);
556 }
557 
559  const edm::DetSetVector<SiStripRawDigi>::detset& channelDigis, const uint16_t threshold, uint16_t& aCounter) {
560  const edm::DetSetVector<SiStripRawDigi>::detset::const_iterator endChannelDigis = channelDigis.end();
561  edm::DetSetVector<SiStripRawDigi>::detset::const_iterator lStart = channelDigis.begin() + aCounter;
562 
563  bool foundTrailer = false;
564  // Loop over digis looking for last two above threshold
565  uint8_t aboveThreshold = 0;
566 
567  for (; lStart != endChannelDigis; ++lStart) {
568  if (lStart->adc() > threshold) {
569  aboveThreshold++;
570  } else {
571  aboveThreshold = 0;
572  }
573  if (aboveThreshold == 2) {
574  foundTrailer = true;
575  break;
576  }
577  aCounter++;
578  } //end of loop over digis
579 
580  if (foundTrailer)
581  return lStart;
582  else {
584  return endChannelDigis;
585  }
586 }
587 
588 //
589 // Define as a plug-in
590 //
591 
iterator end()
Definition: DetSet.h:58
edm::ESGetToken< TkDetMap, TrackerTopologyRcd > tkDetMapToken_
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
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)
void updateFedCabling(const SiStripFedCablingRcd &rcd)
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
void analyze(const edm::Event &, const edm::EventSetup &) override
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
void initialise(const edm::ParameterSet &iConfig, std::ostringstream *pDebugStream) override
FedChannelConnection fedConnection(uint16_t fed_id, uint16_t fed_ch) const
virtual std::string pwd()
Definition: DQMStore.cc:20
T const * product() const
Definition: Handle.h:70
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
const Frame extractFrameInfo(const edm::DetSetVector< SiStripRawDigi >::detset &channelDigis, bool aPrintDebug=false)
std::map< std::string, unsigned int > outfileMap_
Log< level::Error, false > LogError
void bookAllFEDHistograms(DQMStore::IBooker &)
bool hasNegativePedSubtr(const edm::DetSetVector< SiStripRawDigi >::detset &channelDigis, uint16_t aPair)
det_id_type detId() const
Definition: DetSet.h:74
edm::EDGetTokenT< std::vector< uint32_t > > spyAPVeToken_
void fillCountersHistograms(const ErrorCounters &aCounter, const double aTime)
const uint16_t threshold(const Frame &aFrame)
const uint16_t range(const Frame &aFrame)
T getUntrackedParameter(std::string const &, T const &) const
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > spyPedSubtrDigisToken_
int iEvent
Definition: GenABIO.cc:224
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
std::pair< bool, bool > apvErrorBit
Class containning control, module, detector and connection information, at the level of a FED channel...
void getMajorityHeader(const edm::DetSetVector< SiStripRawDigi > *aInputDigis, uint16_t &firstHeaderBit, bool printResult=true)
sistrip::SpyUtilities::FrameQuality frameQuality_
Transition
Definition: Transition.h:12
std::vector< std::string > outfileNames_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
bool getData(T &iHolder) const
Definition: EventSetup.h:122
edm::ESWatcher< SiStripFedCablingRcd > cablingWatcher_
void bookFEDHistograms(DQMStore::IBooker &, const unsigned int fedId, const Errors &aErr, bool doAll=false)
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > spyScopeRawDigisToken_
edm::ESGetToken< SiStripFedCabling, SiStripFedCablingRcd > fedCablingToken_
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:325
const uint32_t & detId() const
iterator begin()
Definition: DetSet.h:57
Log< level::Info, false > LogInfo
static const uint16_t STRIPS_PER_FEDCH
Constants and enumerated types for FED/FEC systems.
void fillFEDHistograms(const Errors &aErr, const unsigned int aFedId)
uint16_t apvPairNumber() const
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
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)
static const uint16_t FED_ID_MAX
edm::EDGetTokenT< std::vector< uint32_t > > spyL1Token_
Log< level::Warning, false > LogWarning
collection_type::const_iterator const_iterator
Definition: DetSet.h:31
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102
const SiStripFedCabling * fedCabling_
Definition: Run.h:45
edm::EDGetTokenT< std::vector< uint32_t > > spyTotCountToken_
#define LogDebug(id)