CMS 3D CMS Logo

EcalSelectiveReadoutProducer.cc
Go to the documentation of this file.
11 
12 #include <memory>
13 #include <vector>
14 
18 
21 
24 
25 //#include "DataFormats/EcalDigi/interface/EcalMGPASample.h"
26 
28 
29 #include <memory>
30 #include <fstream>
31 #include <atomic>
32 
33 namespace esrp {
34  /* All stream instances of the module write to the same files. The writes are guarded
35  by the shared mutex.
36  */
37  struct Cache {
38  CMS_THREAD_GUARD("mutex_") mutable int iEvent_ = 1;
39  mutable std::mutex mutex_;
40  };
41 } // namespace esrp
42 
43 class EcalSelectiveReadoutProducer : public edm::stream::EDProducer<edm::GlobalCache<esrp::Cache>> {
44 public:
49 
53  ~EcalSelectiveReadoutProducer() override;
54 
59  void produce(edm::Event& event, const edm::EventSetup& eventSetup) override;
60 
67  static void printSrFlags(std::ostream& os,
68  const EBSrFlagCollection& ebSrFlags,
69  const EESrFlagCollection& eeSrFlags,
70  int iEvent = -1,
71  bool withHeader = true);
72 
74 
75  static std::unique_ptr<esrp::Cache> initializeGlobalCache(const edm::ParameterSet&);
76  static void globalEndJob(esrp::Cache*) {}
77 
78 private:
84  void checkWeights(const edm::Event& evt, const edm::ProductID& noZSDigiId) const;
85 
91  bool getBinOfMax(const edm::Event& evt, const edm::ProductID& noZsDigiId, int& binOfMax) const;
92 
93  const EBDigiCollection* getEBDigis(edm::Event& event);
94 
95  const EEDigiCollection* getEEDigis(edm::Event& event);
96 
97  const EcalTrigPrimDigiCollection* getTrigPrims(edm::Event& event) const;
98 
102  void checkGeometry(const edm::EventSetup& eventSetup);
103  void checkTriggerMap(const edm::EventSetup& eventSetup);
104  void checkElecMap(const edm::EventSetup& eventSetup);
105 
107 
113  static void checkValidity(const EcalSRSettings& settings);
114 
115  void printTTFlags(const EcalTrigPrimDigiCollection& tp, std::ostream& os) const;
116 
117 private:
119  std::string digiProducer_; // name of module/plugin/producer making digis
120  std::string ebdigiCollection_; // secondary name given to collection of input digis
121  std::string eedigiCollection_; // secondary name given to collection of input digis
122  std::string ebSRPdigiCollection_; // secondary name given to collection of suppressed digis
123  std::string eeSRPdigiCollection_; // secondary name given to collection of suppressed digis
124  std::string ebSrFlagCollection_; // secondary name given to collection of SR flag digis
125  std::string eeSrFlagCollection_; // secondary name given to collection of SR flag digis
126  std::string trigPrimProducer_; // name of module/plugin/producer making triggere primitives
127  std::string trigPrimCollection_; // name of module/plugin/producer making triggere primitives
128 
129  // store the pointer, so we don't have to update it every event
133 
134  bool suppressorSettingsSet_ = false;
135 
137 
139 
143 
147 
152 
156 
161 
166 
171 
175  std::unique_ptr<EcalSRSettings> settingsFromFile_;
176 
177  // Tokens for consumes collection:
178 
186 };
187 
188 using namespace std;
189 using namespace ecalsrcondtools;
190 
192  return std::make_unique<esrp::Cache>();
193 }
194 
196  : suppressor_(params, consumesCollector()), firstCallEB_(true), firstCallEE_(true) {
197  //settings:
198  // settings which are only in python config files:
199  digiProducer_ = params.getParameter<string>("digiProducer");
200  ebdigiCollection_ = params.getParameter<std::string>("EBdigiCollection");
201  eedigiCollection_ = params.getParameter<std::string>("EEdigiCollection");
202  ebSRPdigiCollection_ = params.getParameter<std::string>("EBSRPdigiCollection");
203  eeSRPdigiCollection_ = params.getParameter<std::string>("EESRPdigiCollection");
204  ebSrFlagCollection_ = params.getParameter<std::string>("EBSrFlagCollection");
205  eeSrFlagCollection_ = params.getParameter<std::string>("EESrFlagCollection");
206  trigPrimProducer_ = params.getParameter<string>("trigPrimProducer");
207  trigPrimCollection_ = params.getParameter<string>("trigPrimCollection");
208  trigPrimBypass_ = params.getParameter<bool>("trigPrimBypass");
209  trigPrimBypassMode_ = params.getParameter<int>("trigPrimBypassMode");
210  dumpFlags_ = params.getUntrackedParameter<int>("dumpFlags");
211  writeSrFlags_ = params.getUntrackedParameter<bool>("writeSrFlags");
212  produceDigis_ = params.getUntrackedParameter<bool>("produceDigis");
213  // settings which can come from either condition database or python configuration file:
214  useCondDb_ = params.getParameter<bool>("configFromCondDB");
215  if (!useCondDb_) {
216  settingsFromFile_ = std::make_unique<EcalSRSettings>();
219  }
220 
221  //declares the products made by this producer:
222  if (produceDigis_) {
223  produces<EBDigiCollection>(ebSRPdigiCollection_);
224  produces<EEDigiCollection>(eeSRPdigiCollection_);
225  }
226 
227  if (writeSrFlags_) {
228  produces<EBSrFlagCollection>(ebSrFlagCollection_);
229  produces<EESrFlagCollection>(eeSrFlagCollection_);
230  }
231 
232  useFullReadout_ = params.getParameter<bool>("UseFullReadout");
233 
234  theGeometry = nullptr;
235  theTriggerTowerMap = nullptr;
236  theElecMap = nullptr;
237 
238  EB_token = consumes<EBDigiCollection>(edm::InputTag(digiProducer_, ebdigiCollection_));
239  EE_token = consumes<EEDigiCollection>(edm::InputTag(digiProducer_, eedigiCollection_));
240  ;
241  EcTP_token = consumes<EcalTrigPrimDigiCollection>(edm::InputTag(trigPrimProducer_, trigPrimCollection_));
242  if (useFullReadout_) {
243  hSr_token_ = esConsumes<EcalSRSettings, EcalSRSettingsRcd>(edm::ESInputTag("", "fullReadout"));
244  } else {
245  hSr_token_ = esConsumes<EcalSRSettings, EcalSRSettingsRcd>();
246  }
247  geom_token_ = esConsumes<CaloGeometry, CaloGeometryRecord>();
248  eTTmap_token_ = esConsumes<EcalTrigTowerConstituentsMap, IdealGeometryRecord>();
249  eElecmap_token_ = esConsumes<EcalElectronicsMapping, EcalMappingRcd>();
250  ;
251 }
252 
255 
256  ps.add<string>("digiProducer");
257  ps.add<std::string>("EBdigiCollection");
258  ps.add<std::string>("EEdigiCollection");
259  ps.add<std::string>("EBSRPdigiCollection");
260  ps.add<std::string>("EESRPdigiCollection");
261  ps.add<std::string>("EBSrFlagCollection");
262  ps.add<std::string>("EESrFlagCollection");
263  ps.add<string>("trigPrimProducer");
264  ps.add<string>("trigPrimCollection");
265  ps.add<bool>("trigPrimBypass"); //also used by suppressor
266  ps.add<int>("trigPrimBypassMode"); // also used by suppressor
267  ps.addUntracked<int>("dumpFlags", 0);
268  ps.addUntracked<bool>("writeSrFlags", false);
269  ps.addUntracked<bool>("produceDigis", true);
270  ps.add<bool>("configFromCondDB", false);
271  ps.add<bool>("UseFullReadout");
272 
273  //from suppressor_
274  ps.add<int>("defaultTtf");
275  ps.add<bool>("trigPrimBypassWithPeakFinder");
276  ps.add<double>("trigPrimBypassLTH");
277  ps.add<double>("trigPrimBypassHTH");
278 
279  //from importParameterSet
280  ps.addOptional<int>("deltaPhi");
281  ps.addOptional<int>("deltaEta");
282  ps.addOptional<int>("ecalDccZs1stSample");
283  ps.addOptional<double>("ebDccAdcToGeV");
284  ps.addOptional<double>("eeDccAdcToGeV");
285  ps.addOptional<std::vector<double>>("dccNormalizedWeights");
286  ps.addOptional<bool>("symetricZS");
287  ps.addOptional<double>("srpBarrelLowInterestChannelZS");
288  ps.addOptional<double>("srpEndcapLowInterestChannelZS");
289  ps.addOptional<double>("srpBarrelHighInterestChannelZS");
290  ps.addOptional<double>("srpEndcapHighInterestChannelZS");
291 
292  iDesc.addDefault(ps);
293 }
294 
296 
298  if (useCondDb_) {
299  //getting selective readout configuration:
301 
302  settings_ = hSr.product();
303  }
304 
305  //gets the trigger primitives:
306  EcalTrigPrimDigiCollection emptyTPColl;
307  const EcalTrigPrimDigiCollection* trigPrims =
308  (trigPrimBypass_ && trigPrimBypassMode_ == 0) ? &emptyTPColl : getTrigPrims(event);
309 
310  //gets the digis from the events:
311  EBDigiCollection dummyEbDigiColl;
312  EEDigiCollection dummyEeDigiColl;
313 
314  const EBDigiCollection* ebDigis = produceDigis_ ? getEBDigis(event) : &dummyEbDigiColl;
315  const EEDigiCollection* eeDigis = produceDigis_ ? getEEDigis(event) : &dummyEeDigiColl;
316 
317  //runs the selective readout algorithm:
318  unique_ptr<EBDigiCollection> selectedEBDigis;
319  unique_ptr<EEDigiCollection> selectedEEDigis;
320  unique_ptr<EBSrFlagCollection> ebSrFlags;
321  unique_ptr<EESrFlagCollection> eeSrFlags;
322 
323  if (produceDigis_) {
324  selectedEBDigis = std::make_unique<EBDigiCollection>();
325  selectedEEDigis = std::make_unique<EEDigiCollection>();
326  }
327 
328  if (writeSrFlags_) {
329  ebSrFlags = std::make_unique<EBSrFlagCollection>();
330  eeSrFlags = std::make_unique<EESrFlagCollection>();
331  }
332 
333  if (not suppressorSettingsSet_) {
334  //Check the validity of EcalSRSettings
336 
338  suppressorSettingsSet_ = true;
339 
340  // check that everything is up-to-date
344  }
345 
347  *trigPrims,
348  *ebDigis,
349  *eeDigis,
350  selectedEBDigis.get(),
351  selectedEEDigis.get(),
352  ebSrFlags.get(),
353  eeSrFlags.get());
354 
355  if (dumpFlags_ > 0) {
356  auto* cache = globalCache();
357  std::lock_guard<std::mutex> guard(cache->mutex_);
358  auto iEvent_ = cache->iEvent_;
359  if (dumpFlags_ >= iEvent_) {
360  ofstream ttfFile("TTF.txt", (iEvent_ == 1 ? ios::trunc : ios::app));
361  suppressor_.printTTFlags(ttfFile, iEvent_, iEvent_ == 1 ? true : false);
362 
363  ofstream srfFile("SRF.txt", (iEvent_ == 1 ? ios::trunc : ios::app));
364  if (iEvent_ == 1) {
366  }
367  srfFile << "# Event " << iEvent_ << "\n";
369  srfFile << "\n";
370 
371  ofstream afFile("AF.txt", (iEvent_ == 1 ? ios::trunc : ios::app));
372  printSrFlags(afFile, *ebSrFlags, *eeSrFlags, iEvent_, iEvent_ == 1 ? true : false);
373  ++(cache->iEvent_);
374  } else {
375  //do not want to dump anymore, so can turn off
376  dumpFlags_ = 0;
377  }
378  }
379 
380  if (produceDigis_) {
381  //puts the selected digis into the event:
382  event.put(std::move(selectedEBDigis), ebSRPdigiCollection_);
383  event.put(std::move(selectedEEDigis), eeSRPdigiCollection_);
384  }
385 
386  //puts the SR flags into the event:
387  if (writeSrFlags_) {
388  event.put(std::move(ebSrFlags), ebSrFlagCollection_);
389  event.put(std::move(eeSrFlags), eeSrFlagCollection_);
390  }
391 }
392 
395  event.getByToken(EB_token, hEBDigis);
396  //product() method is called before id() in order to get an exception
397  //if the handle is not available (check not done by id() method).
398  const EBDigiCollection* result = hEBDigis.product();
399  if (firstCallEB_) {
400  checkWeights(event, hEBDigis.id());
401  firstCallEB_ = false;
402  }
403  return result;
404 }
405 
408  event.getByToken(EE_token, hEEDigis);
409  //product() method is called before id() in order to get an exception
410  //if the handle is not available (check not done by id() method).
411  const EEDigiCollection* result = hEEDigis.product();
412  if (firstCallEE_) {
413  checkWeights(event, hEEDigis.id());
414  firstCallEE_ = false;
415  }
416  return result;
417 }
418 
421  event.getByToken(EcTP_token, hTPDigis);
422  return hTPDigis.product();
423 }
424 
426  edm::ESHandle<CaloGeometry> hGeometry = eventSetup.getHandle(geom_token_);
427 
428  const CaloGeometry* pGeometry = &*hGeometry;
429 
430  // see if we need to update
431  if (pGeometry != theGeometry) {
432  theGeometry = pGeometry;
434  }
435 }
436 
439 
440  const EcalTrigTowerConstituentsMap* pMap = &*eTTmap;
441 
442  // see if we need to update
443  if (pMap != theTriggerTowerMap) {
444  theTriggerTowerMap = pMap;
446  }
447 }
448 
451 
452  const EcalElectronicsMapping* pMap = &*eElecmap;
453 
454  // see if we need to update
455  if (pMap != theElecMap) {
456  theElecMap = pMap;
458  }
459 }
460 
462  const char tccFlagMarker[] = {'x', '.', 'S', '?', 'C', 'E', 'E', 'E', 'E'};
465 
466  //static bool firstCall=true;
467  // if(firstCall){
468  // firstCall=false;
469  os << "# TCC flag map\n#\n"
470  "# +-->Phi "
471  << tccFlagMarker[0 + 1]
472  << ": 000 (low interest)\n"
473  "# | "
474  << tccFlagMarker[1 + 1]
475  << ": 001 (mid interest)\n"
476  "# | "
477  << tccFlagMarker[2 + 1]
478  << ": 010 (not valid)\n"
479  "# V Eta "
480  << tccFlagMarker[3 + 1]
481  << ": 011 (high interest)\n"
482  "# "
483  << tccFlagMarker[4 + 1]
484  << ": 1xx forced readout (Hw error)\n"
485  "#\n";
486  //}
487 
488  vector<vector<int>> ttf(nEta, vector<int>(nPhi, -1));
489  for (EcalTrigPrimDigiCollection::const_iterator it = tp.begin(); it != tp.end(); ++it) {
490  const EcalTriggerPrimitiveDigi& trigPrim = *it;
491  if (trigPrim.size() > 0) {
492  int iEta = trigPrim.id().ieta();
493  int iEta0 = iEta < 0 ? iEta + nEta / 2 : iEta + nEta / 2 - 1;
494  int iPhi0 = trigPrim.id().iphi() - 1;
495  ttf[iEta0][iPhi0] = trigPrim.ttFlag();
496  }
497  }
498  for (int iEta = 0; iEta < nEta; ++iEta) {
499  for (int iPhi = 0; iPhi < nPhi; ++iPhi) {
500  os << tccFlagMarker[ttf[iEta][iPhi] + 1];
501  }
502  os << "\n";
503  }
504 }
505 
506 void EcalSelectiveReadoutProducer::checkWeights(const edm::Event& evt, const edm::ProductID& noZsDigiId) const {
507  const vector<float>& weights =
508  settings_->dccNormalizedWeights_[0]; //params_.getParameter<vector<double> >("dccNormalizedWeights");
510  static std::atomic<bool> warnWeightCnt{true};
511  bool expected = true;
512  if ((int)weights.size() > nFIRTaps &&
513  warnWeightCnt.compare_exchange_strong(expected, false, std::memory_order_acq_rel)) {
514  edm::LogWarning("Configuration") << "The list of DCC zero suppression FIR "
515  "weights given in parameter dccNormalizedWeights is longer "
516  "than the expected depth of the FIR filter :("
517  << nFIRTaps
518  << "). "
519  "The last weights will be discarded.";
520  }
521 
522  if (!weights.empty()) {
523  int iMaxWeight = 0;
524  double maxWeight = weights[iMaxWeight];
525  //looks for index of maximum weight
526  for (unsigned i = 0; i < weights.size(); ++i) {
527  if (weights[i] > maxWeight) {
528  iMaxWeight = i;
529  maxWeight = weights[iMaxWeight];
530  }
531  }
532 
533  //position of time sample whose maximum weight is applied:
534  int maxWeightBin = settings_->ecalDccZs1stSample_[0] //params_.getParameter<int>("ecalDccZs1stSample")
535  + iMaxWeight;
536 
537  //gets the bin of maximum (in case of raw data it will not exist)
538  int binOfMax = 0;
539  bool rc = getBinOfMax(evt, noZsDigiId, binOfMax);
540 
541  if (rc && maxWeightBin != binOfMax) {
542  edm::LogWarning("Configuration") << "The maximum weight of DCC zero suppression FIR filter is not "
543  "applied to the expected maximum sample("
544  << binOfMax
545  << (binOfMax == 1 ? "st"
546  : (binOfMax == 2 ? "nd" : (binOfMax == 3 ? "rd" : "th")))
547  << " time sample). This may indicate faulty 'dccNormalizedWeights' "
548  "or 'ecalDccZs1sSample' parameters.";
549  }
550  }
551 }
552 
554  const edm::ProductID& noZsDigiId,
555  int& binOfMax) const {
556  bool rc;
557  const edm::StableProvenance& p = evt.getStableProvenance(noZsDigiId);
559  vector<string> ebDigiParamList = result.getParameterNames();
560  string bofm("binOfMaximum");
561  if (find(ebDigiParamList.begin(), ebDigiParamList.end(), bofm) != ebDigiParamList.end()) { //bofm found
562  binOfMax = result.getParameter<int>("binOfMaximum");
563  rc = true;
564  } else {
565  rc = false;
566  }
567  return rc;
568 }
569 
571  const EBSrFlagCollection& ebSrFlags,
572  const EESrFlagCollection& eeSrFlags,
573  int iEvent,
574  bool withHeader) {
575  const char srpFlagMarker[] = {'.', 'z', 'Z', 'F', '4', '5', '6', '7'};
576  if (withHeader) {
577  time_t t;
578  time(&t);
579  const char* date = ctime(&t);
580  os << "#SRP flag map\n#\n"
581  "# Generatied on: "
582  << date
583  << "\n#\n"
584  "# +-->Phi/Y "
585  << srpFlagMarker[0]
586  << ": suppressed\n"
587  "# | "
588  << srpFlagMarker[1]
589  << ": ZS 1\n"
590  "# | "
591  << srpFlagMarker[2]
592  << ": ZS 2\n"
593  "# V Eta/X "
594  << srpFlagMarker[3]
595  << ": full readout\n"
596  "#\n";
597  }
598 
599  //EE-,EB,EE+ map wil be written onto file in following format:
600  //
601  // 72
602  // <-------------->
603  // 20
604  // <--->
605  // EEE A +-----> Y
606  // EEEEE | |
607  // EE EE | 20 EE- |
608  // EEEEE | |
609  // EEE V V X
610  // BBBBBBBBBBBBBBBBB A
611  // BBBBBBBBBBBBBBBBB | +-----> Phi
612  // BBBBBBBBBBBBBBBBB | |
613  // BBBBBBBBBBBBBBBBB | 34 EB |
614  // BBBBBBBBBBBBBBBBB | |
615  // BBBBBBBBBBBBBBBBB | V Eta
616  // BBBBBBBBBBBBBBBBB |
617  // BBBBBBBBBBBBBBBBB |
618  // BBBBBBBBBBBBBBBBB V
619  // EEE A +-----> Y
620  // EEEEE | |
621  // EE EE | 20 EE+ |
622  // EEEEE | |
623  // EEE V V X
624  //
625  //
626  //
627  //
628  //event header:
629  if (iEvent >= 0) {
630  os << "# Event " << iEvent << "\n";
631  }
632 
633  //retrieve flags:
634  const int nEndcaps = 2;
635  const int nScX = 20;
636  const int nScY = 20;
637  int eeSrf[nEndcaps][nScX][nScY];
638  for (size_t i = 0; i < sizeof(eeSrf) / sizeof(int); ((int*)eeSrf)[i++] = -1) {
639  };
640  for (EESrFlagCollection::const_iterator it = eeSrFlags.begin(); it != eeSrFlags.end(); ++it) {
641  const EESrFlag& flag = *it;
642  int iZ0 = flag.id().zside() > 0 ? 1 : 0;
643  int iX0 = flag.id().ix() - 1;
644  int iY0 = flag.id().iy() - 1;
645  assert(iZ0 >= 0 && iZ0 < nEndcaps);
646  assert(iX0 >= 0 && iX0 < nScX);
647  assert(iY0 >= 0 && iY0 < nScY);
648  eeSrf[iZ0][iX0][iY0] = flag.value();
649  }
650  const int nEbTtEta = 34;
651  const int nEeTtEta = 11;
652  const int nTtEta = nEeTtEta * 2 + nEbTtEta;
653  const int nTtPhi = 72;
654  int ebSrf[nEbTtEta][nTtPhi];
655  for (size_t i = 0; i < sizeof(ebSrf) / sizeof(int); ((int*)ebSrf)[i++] = -1) {
656  };
657  for (EBSrFlagCollection::const_iterator it = ebSrFlags.begin(); it != ebSrFlags.end(); ++it) {
658  const EBSrFlag& flag = *it;
659  int iEta = flag.id().ieta();
660  int iEta0 = iEta + nTtEta / 2 - (iEta >= 0 ? 1 : 0); //0->55 from eta=-3 to eta=3
661  int iEbEta0 = iEta0 - nEeTtEta; //0->33 from eta=-1.48 to eta=1.48
662  int iPhi0 = flag.id().iphi() - 1;
663  assert(iEbEta0 >= 0 && iEbEta0 < nEbTtEta);
664  assert(iPhi0 >= 0 && iPhi0 < nTtPhi);
665 
666  // cout << __FILE__ << ":" << __LINE__ << ": "
667  // << iEta << "\t" << flag.id().iphi() << " -> "
668  // << iEbEta0 << "\t" << iPhi0
669  // << "... Flag: " << flag.value() << "\n";
670 
671  ebSrf[iEbEta0][iPhi0] = flag.value();
672  }
673 
674  //print flags:
675 
676  //EE-
677  for (int iX0 = 0; iX0 < nScX; ++iX0) {
678  for (int iY0 = 0; iY0 < nScY; ++iY0) {
679  int srFlag = eeSrf[0][iX0][iY0];
680  assert(srFlag >= -1 && srFlag < (int)(sizeof(srpFlagMarker) / sizeof(srpFlagMarker[0])));
681  os << (srFlag == -1 ? ' ' : srpFlagMarker[srFlag]);
682  }
683  os << "\n"; //one Y supercystal column per line
684  } //next supercrystal X-index
685 
686  //EB
687  for (int iEta0 = 0; iEta0 < nEbTtEta; ++iEta0) {
688  for (int iPhi0 = 0; iPhi0 < nTtPhi; ++iPhi0) {
689  int srFlag = ebSrf[iEta0][iPhi0];
690  assert(srFlag >= -1 && srFlag < (int)(sizeof(srpFlagMarker) / sizeof(srpFlagMarker[0])));
691  os << (srFlag == -1 ? '?' : srpFlagMarker[srFlag]);
692  }
693  os << "\n"; //one phi per line
694  }
695 
696  //EE+
697  for (int iX0 = 0; iX0 < nScX; ++iX0) {
698  for (int iY0 = 0; iY0 < nScY; ++iY0) {
699  int srFlag = eeSrf[1][iX0][iY0];
700  assert(srFlag >= -1 && srFlag < (int)(sizeof(srpFlagMarker) / sizeof(srpFlagMarker[0])));
701  os << (srFlag == -1 ? ' ' : srpFlagMarker[srFlag]);
702  }
703  os << "\n"; //one Y supercystal column per line
704  } //next supercrystal X-index
705 
706  //event trailer:
707  os << "\n";
708 }
709 
711  if (settings.dccNormalizedWeights_.size() != 1) {
712  throw cms::Exception("Configuration")
713  << "Selective readout emulator, EcalSelectiveReadout, supports only single set of ZS weights. "
714  "while the configuration contains "
715  << settings.dccNormalizedWeights_.size() << " set(s)\n";
716  }
717 
718  // if(settings.dccNormalizedWeights_.size() != 1
719  // && settings.dccNormalizedWeights_.size() != 2
720  // && settings.dccNormalizedWeights_.size() != 54
721  // && settings.dccNormalizedWeights_.size() != 75848){
722  // throw cms::Exception("Configuration") << "Invalid number of DCC weight set (" << settings.dccNormalizedWeights_.size()
723  // << ") in condition object EcalSRSetting::dccNormalizedWeights_. "
724  // << "Valid counts are: 1 (single set), 2 (EB and EE), 54 (one per DCC) and 75848 "
725  // "(one per crystal)\n";
726  // }
727 
728  if (settings.dccNormalizedWeights_.size() != settings.ecalDccZs1stSample_.size()) {
729  throw cms::Exception("Configuration")
730  << "Inconsistency between number of weigth sets (" << settings.dccNormalizedWeights_.size() << ") and "
731  << "number of ecalDccZs1Sample values (" << settings.ecalDccZs1stSample_.size() << ").";
732  }
733 }
734 
void setGeometry(const CaloGeometry *caloGeometry)
void setSettings(const EcalSRSettings *settings)
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
edm::ESGetToken< EcalSRSettings, EcalSRSettingsRcd > hSr_token_
void printHeader(std::ostream &os) const
print out header for the map: see print(std::ostream&)
ProductID id() const
Definition: HandleBase.cc:29
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
int ieta() const
get the tower ieta
const EBDigiCollection * getEBDigis(edm::Event &event)
void checkTriggerMap(const edm::EventSetup &eventSetup)
EcalSelectiveReadout * getEcalSelectiveReadout()
edm::ESGetToken< EcalTrigTowerConstituentsMap, IdealGeometryRecord > eTTmap_token_
void checkGeometry(const edm::EventSetup &eventSetup)
static std::mutex mutex
Definition: Proxy.cc:8
const EcalTrigTowerDetId & id() const
T const * product() const
Definition: Handle.h:70
void produce(edm::Event &event, const edm::EventSetup &eventSetup) override
std::vector< T >::const_iterator const_iterator
std::vector< std::vector< float > > dccNormalizedWeights_
const char tccFlagMarker[]
Definition: GenABIO.cc:164
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
assert(be >=bs)
ParameterSet const & parameterSet(StableProvenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:11
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geom_token_
edm::EDGetTokenT< EBDigiCollection > EB_token
void setTriggerMap(const EcalTrigTowerConstituentsMap *map)
edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcd > eElecmap_token_
void checkElecMap(const edm::EventSetup &eventSetup)
void run(const edm::EventSetup &eventSetup, const EcalTrigPrimDigiCollection &trigPrims, EBDigiCollection &barrelDigis, EEDigiCollection &endcapDigis)
int iEvent
Definition: GenABIO.cc:224
T const * product() const
Definition: ESHandle.h:86
void addDefault(ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &iDesc)
const EcalTrigTowerConstituentsMap * theTriggerTowerMap
static void globalEndJob(esrp::Cache *)
std::vector< int > ecalDccZs1stSample_
const EEDigiCollection * getEEDigis(edm::Event &event)
#define CMS_THREAD_GUARD(_var_)
void checkWeights(const edm::Event &evt, const edm::ProductID &noZSDigiId) const
const EcalElectronicsMapping * theElecMap
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
const_iterator begin() const
bool getBinOfMax(const edm::Event &evt, const edm::ProductID &noZsDigiId, int &binOfMax) const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static std::unique_ptr< esrp::Cache > initializeGlobalCache(const edm::ParameterSet &)
const_iterator end() const
static const int nEndcaps
Definition: GenABIO.cc:115
const EcalTrigPrimDigiCollection * getTrigPrims(edm::Event &event) const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::unique_ptr< EcalSRSettings > settingsFromFile_
void printTTFlags(const EcalTrigPrimDigiCollection &tp, std::ostream &os) const
static const size_t nTriggerTowersInEta
static const size_t nTriggerTowersInPhi
void print(std::ostream &os) const
print out the map
EcalSelectiveReadoutProducer(const edm::ParameterSet &params, esrp::Cache const *)
edm::EDGetTokenT< EcalTrigPrimDigiCollection > EcTP_token
HLT enums.
edm::EDGetTokenT< EEDigiCollection > EE_token
int ttFlag() const
get the Trigger tower Flag of interesting sample
def cache(function)
Definition: utilities.py:3
static void printSrFlags(std::ostream &os, const EBSrFlagCollection &ebSrFlags, const EESrFlagCollection &eeSrFlags, int iEvent=-1, bool withHeader=true)
void setElecMap(const EcalElectronicsMapping *map)
Log< level::Warning, false > LogWarning
int iphi() const
get the tower iphi
void importParameterSet(EcalSRSettings &sr, const edm::ParameterSet &ps)
void printTTFlags(std::ostream &os, int iEvent=-1, bool withHeader=true) const
static void checkValidity(const EcalSRSettings &settings)
EcalSelectiveReadoutSuppressor suppressor_
ProcessHistory const & processHistory() const override
Definition: Event.cc:250
def move(src, dest)
Definition: eostools.py:511
StableProvenance const & getStableProvenance(BranchID const &theID) const
Definition: Event.cc:124
const char srpFlagMarker[]
Definition: GenABIO.cc:163
Definition: event.py:1