Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-08-30 02:37:16

0001 #include "SimCalorimetry/EcalSelectiveReadoutProducers/interface/EcalSelectiveReadoutProducer.h"
0002 #include "FWCore/Common/interface/Provenance.h"
0003 #include "FWCore/Framework/interface/Event.h"
0004 #include "FWCore/Framework/interface/EventSetup.h"
0005 
0006 #include "FWCore/Framework/interface/ESHandle.h"
0007 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0008 
0009 //#include "DataFormats/EcalDigi/interface/EcalMGPASample.h"
0010 
0011 #include "SimCalorimetry/EcalSelectiveReadoutProducers/interface/EcalSRCondTools.h"
0012 
0013 #include <memory>
0014 #include <fstream>
0015 #include <atomic>
0016 
0017 using namespace std;
0018 
0019 EcalSelectiveReadoutProducer::EcalSelectiveReadoutProducer(const edm::ParameterSet& params)
0020     : suppressor_(params, consumesCollector()), firstCallEB_(true), firstCallEE_(true), iEvent_(1) {
0021   //settings:
0022   //  settings which are only in python config files:
0023   digiProducer_ = params.getParameter<string>("digiProducer");
0024   ebdigiCollection_ = params.getParameter<std::string>("EBdigiCollection");
0025   eedigiCollection_ = params.getParameter<std::string>("EEdigiCollection");
0026   ebSRPdigiCollection_ = params.getParameter<std::string>("EBSRPdigiCollection");
0027   eeSRPdigiCollection_ = params.getParameter<std::string>("EESRPdigiCollection");
0028   ebSrFlagCollection_ = params.getParameter<std::string>("EBSrFlagCollection");
0029   eeSrFlagCollection_ = params.getParameter<std::string>("EESrFlagCollection");
0030   trigPrimProducer_ = params.getParameter<string>("trigPrimProducer");
0031   trigPrimCollection_ = params.getParameter<string>("trigPrimCollection");
0032   trigPrimBypass_ = params.getParameter<bool>("trigPrimBypass");
0033   trigPrimBypassMode_ = params.getParameter<int>("trigPrimBypassMode");
0034   dumpFlags_ = params.getUntrackedParameter<int>("dumpFlags", 0);
0035   writeSrFlags_ = params.getUntrackedParameter<bool>("writeSrFlags", false);
0036   produceDigis_ = params.getUntrackedParameter<bool>("produceDigis", true);
0037   //   settings which can come from either condition database or python configuration file:
0038   useCondDb_ = false;
0039   try {
0040     if (params.getParameter<bool>("configFromCondDB")) {
0041       useCondDb_ = true;
0042     }
0043   } catch (cms::Exception const&) {
0044     /* pameter not found */
0045     edm::LogWarning("EcalSelectiveReadout") << "Parameter configFromCondDB of EcalSelectiveReadout module not found. "
0046                                                "Selective readout configuration will be read from python file.";
0047   }
0048   if (!useCondDb_) {
0049     settingsFromFile_ = std::make_unique<EcalSRSettings>();
0050     EcalSRCondTools::importParameterSet(*settingsFromFile_, params);
0051     settings_ = settingsFromFile_.get();
0052   }
0053 
0054   //declares the products made by this producer:
0055   if (produceDigis_) {
0056     produces<EBDigiCollection>(ebSRPdigiCollection_);
0057     produces<EEDigiCollection>(eeSRPdigiCollection_);
0058   }
0059 
0060   if (writeSrFlags_) {
0061     produces<EBSrFlagCollection>(ebSrFlagCollection_);
0062     produces<EESrFlagCollection>(eeSrFlagCollection_);
0063   }
0064 
0065   useFullReadout_ = false;
0066   useFullReadout_ = params.getParameter<bool>("UseFullReadout");
0067 
0068   theGeometry = nullptr;
0069   theTriggerTowerMap = nullptr;
0070   theElecMap = nullptr;
0071 
0072   EB_token = consumes<EBDigiCollection>(edm::InputTag(digiProducer_, ebdigiCollection_));
0073   EE_token = consumes<EEDigiCollection>(edm::InputTag(digiProducer_, eedigiCollection_));
0074   ;
0075   EcTP_token = consumes<EcalTrigPrimDigiCollection>(edm::InputTag(trigPrimProducer_, trigPrimCollection_));
0076   if (useFullReadout_) {
0077     hSr_token_ = esConsumes<EcalSRSettings, EcalSRSettingsRcd>(edm::ESInputTag("", "fullReadout"));
0078   } else {
0079     hSr_token_ = esConsumes<EcalSRSettings, EcalSRSettingsRcd>();
0080   }
0081   geom_token_ = esConsumes<CaloGeometry, CaloGeometryRecord>();
0082   eTTmap_token_ = esConsumes<EcalTrigTowerConstituentsMap, IdealGeometryRecord>();
0083   eElecmap_token_ = esConsumes<EcalElectronicsMapping, EcalMappingRcd>();
0084   ;
0085 }
0086 
0087 EcalSelectiveReadoutProducer::~EcalSelectiveReadoutProducer() {}
0088 
0089 void EcalSelectiveReadoutProducer::produce(edm::Event& event, const edm::EventSetup& eventSetup) {
0090   if (useCondDb_) {
0091     //getting selective readout configuration:
0092     edm::ESHandle<EcalSRSettings> hSr = eventSetup.getHandle(hSr_token_);
0093 
0094     settings_ = hSr.product();
0095   }
0096 
0097   //gets the trigger primitives:
0098   EcalTrigPrimDigiCollection emptyTPColl;
0099   const EcalTrigPrimDigiCollection* trigPrims =
0100       (trigPrimBypass_ && trigPrimBypassMode_ == 0) ? &emptyTPColl : getTrigPrims(event);
0101 
0102   //gets the digis from the events:
0103   EBDigiCollection dummyEbDigiColl;
0104   EEDigiCollection dummyEeDigiColl;
0105 
0106   const EBDigiCollection* ebDigis = produceDigis_ ? getEBDigis(event) : &dummyEbDigiColl;
0107   const EEDigiCollection* eeDigis = produceDigis_ ? getEEDigis(event) : &dummyEeDigiColl;
0108 
0109   //runs the selective readout algorithm:
0110   unique_ptr<EBDigiCollection> selectedEBDigis;
0111   unique_ptr<EEDigiCollection> selectedEEDigis;
0112   unique_ptr<EBSrFlagCollection> ebSrFlags;
0113   unique_ptr<EESrFlagCollection> eeSrFlags;
0114 
0115   if (produceDigis_) {
0116     selectedEBDigis = std::make_unique<EBDigiCollection>();
0117     selectedEEDigis = std::make_unique<EEDigiCollection>();
0118   }
0119 
0120   if (writeSrFlags_) {
0121     ebSrFlags = std::make_unique<EBSrFlagCollection>();
0122     eeSrFlags = std::make_unique<EESrFlagCollection>();
0123   }
0124 
0125   if (not suppressorSettingsSet_) {
0126     //Check the validity of EcalSRSettings
0127     checkValidity(*settings_);
0128 
0129     suppressor_.setSettings(settings_);
0130     suppressorSettingsSet_ = true;
0131 
0132     // check that everything is up-to-date
0133     checkGeometry(eventSetup);
0134     checkTriggerMap(eventSetup);
0135     checkElecMap(eventSetup);
0136   }
0137 
0138   suppressor_.run(eventSetup,
0139                   *trigPrims,
0140                   *ebDigis,
0141                   *eeDigis,
0142                   selectedEBDigis.get(),
0143                   selectedEEDigis.get(),
0144                   ebSrFlags.get(),
0145                   eeSrFlags.get());
0146 
0147   if (dumpFlags_ >= iEvent_) {
0148     ofstream ttfFile("TTF.txt", (iEvent_ == 1 ? ios::trunc : ios::app));
0149     suppressor_.printTTFlags(ttfFile, iEvent_, iEvent_ == 1 ? true : false);
0150 
0151     ofstream srfFile("SRF.txt", (iEvent_ == 1 ? ios::trunc : ios::app));
0152     if (iEvent_ == 1) {
0153       suppressor_.getEcalSelectiveReadout()->printHeader(srfFile);
0154     }
0155     srfFile << "# Event " << iEvent_ << "\n";
0156     suppressor_.getEcalSelectiveReadout()->print(srfFile);
0157     srfFile << "\n";
0158 
0159     ofstream afFile("AF.txt", (iEvent_ == 1 ? ios::trunc : ios::app));
0160     printSrFlags(afFile, *ebSrFlags, *eeSrFlags, iEvent_, iEvent_ == 1 ? true : false);
0161   }
0162 
0163   ++iEvent_;  //event counter
0164 
0165   if (produceDigis_) {
0166     //puts the selected digis into the event:
0167     event.put(std::move(selectedEBDigis), ebSRPdigiCollection_);
0168     event.put(std::move(selectedEEDigis), eeSRPdigiCollection_);
0169   }
0170 
0171   //puts the SR flags into the event:
0172   if (writeSrFlags_) {
0173     event.put(std::move(ebSrFlags), ebSrFlagCollection_);
0174     event.put(std::move(eeSrFlags), eeSrFlagCollection_);
0175   }
0176 }
0177 
0178 const EBDigiCollection* EcalSelectiveReadoutProducer::getEBDigis(edm::Event& event) {
0179   edm::Handle<EBDigiCollection> hEBDigis;
0180   event.getByToken(EB_token, hEBDigis);
0181   //product() method is called before id() in order to get an exception
0182   //if the handle is not available (check not done by id() method).
0183   const EBDigiCollection* result = hEBDigis.product();
0184   if (firstCallEB_) {
0185     checkWeights(event, hEBDigis.id());
0186     firstCallEB_ = false;
0187   }
0188   return result;
0189 }
0190 
0191 const EEDigiCollection* EcalSelectiveReadoutProducer::getEEDigis(edm::Event& event) {
0192   edm::Handle<EEDigiCollection> hEEDigis;
0193   event.getByToken(EE_token, hEEDigis);
0194   //product() method is called before id() in order to get an exception
0195   //if the handle is not available (check not done by id() method).
0196   const EEDigiCollection* result = hEEDigis.product();
0197   if (firstCallEE_) {
0198     checkWeights(event, hEEDigis.id());
0199     firstCallEE_ = false;
0200   }
0201   return result;
0202 }
0203 
0204 const EcalTrigPrimDigiCollection* EcalSelectiveReadoutProducer::getTrigPrims(edm::Event& event) const {
0205   edm::Handle<EcalTrigPrimDigiCollection> hTPDigis;
0206   event.getByToken(EcTP_token, hTPDigis);
0207   return hTPDigis.product();
0208 }
0209 
0210 void EcalSelectiveReadoutProducer::checkGeometry(const edm::EventSetup& eventSetup) {
0211   edm::ESHandle<CaloGeometry> hGeometry = eventSetup.getHandle(geom_token_);
0212 
0213   const CaloGeometry* pGeometry = &*hGeometry;
0214 
0215   // see if we need to update
0216   if (pGeometry != theGeometry) {
0217     theGeometry = pGeometry;
0218     suppressor_.setGeometry(theGeometry);
0219   }
0220 }
0221 
0222 void EcalSelectiveReadoutProducer::checkTriggerMap(const edm::EventSetup& eventSetup) {
0223   edm::ESHandle<EcalTrigTowerConstituentsMap> eTTmap = eventSetup.getHandle(eTTmap_token_);
0224 
0225   const EcalTrigTowerConstituentsMap* pMap = &*eTTmap;
0226 
0227   // see if we need to update
0228   if (pMap != theTriggerTowerMap) {
0229     theTriggerTowerMap = pMap;
0230     suppressor_.setTriggerMap(theTriggerTowerMap);
0231   }
0232 }
0233 
0234 void EcalSelectiveReadoutProducer::checkElecMap(const edm::EventSetup& eventSetup) {
0235   edm::ESHandle<EcalElectronicsMapping> eElecmap = eventSetup.getHandle(eElecmap_token_);
0236 
0237   const EcalElectronicsMapping* pMap = &*eElecmap;
0238 
0239   // see if we need to update
0240   if (pMap != theElecMap) {
0241     theElecMap = pMap;
0242     suppressor_.setElecMap(theElecMap);
0243   }
0244 }
0245 
0246 void EcalSelectiveReadoutProducer::printTTFlags(const EcalTrigPrimDigiCollection& tp, ostream& os) const {
0247   const char tccFlagMarker[] = {'x', '.', 'S', '?', 'C', 'E', 'E', 'E', 'E'};
0248   const int nEta = EcalSelectiveReadout::nTriggerTowersInEta;
0249   const int nPhi = EcalSelectiveReadout::nTriggerTowersInPhi;
0250 
0251   //static bool firstCall=true;
0252   //  if(firstCall){
0253   //  firstCall=false;
0254   os << "# TCC flag map\n#\n"
0255         "# +-->Phi            "
0256      << tccFlagMarker[0 + 1]
0257      << ": 000 (low interest)\n"
0258         "# |                  "
0259      << tccFlagMarker[1 + 1]
0260      << ": 001 (mid interest)\n"
0261         "# |                  "
0262      << tccFlagMarker[2 + 1]
0263      << ": 010 (not valid)\n"
0264         "# V Eta              "
0265      << tccFlagMarker[3 + 1]
0266      << ": 011 (high interest)\n"
0267         "#                    "
0268      << tccFlagMarker[4 + 1]
0269      << ": 1xx forced readout (Hw error)\n"
0270         "#\n";
0271   //}
0272 
0273   vector<vector<int> > ttf(nEta, vector<int>(nPhi, -1));
0274   for (EcalTrigPrimDigiCollection::const_iterator it = tp.begin(); it != tp.end(); ++it) {
0275     const EcalTriggerPrimitiveDigi& trigPrim = *it;
0276     if (trigPrim.size() > 0) {
0277       int iEta = trigPrim.id().ieta();
0278       int iEta0 = iEta < 0 ? iEta + nEta / 2 : iEta + nEta / 2 - 1;
0279       int iPhi0 = trigPrim.id().iphi() - 1;
0280       ttf[iEta0][iPhi0] = trigPrim.ttFlag();
0281     }
0282   }
0283   for (int iEta = 0; iEta < nEta; ++iEta) {
0284     for (int iPhi = 0; iPhi < nPhi; ++iPhi) {
0285       os << tccFlagMarker[ttf[iEta][iPhi] + 1];
0286     }
0287     os << "\n";
0288   }
0289 }
0290 
0291 void EcalSelectiveReadoutProducer::checkWeights(const edm::Event& evt, const edm::ProductID& noZsDigiId) const {
0292   const vector<float>& weights =
0293       settings_->dccNormalizedWeights_[0];  //params_.getParameter<vector<double> >("dccNormalizedWeights");
0294   int nFIRTaps = EcalSelectiveReadoutSuppressor::getFIRTapCount();
0295   static std::atomic<bool> warnWeightCnt{true};
0296   bool expected = true;
0297   if ((int)weights.size() > nFIRTaps &&
0298       warnWeightCnt.compare_exchange_strong(expected, false, std::memory_order_acq_rel)) {
0299     edm::LogWarning("Configuration") << "The list of DCC zero suppression FIR "
0300                                         "weights given in parameter dccNormalizedWeights is longer "
0301                                         "than the expected depth of the FIR filter :("
0302                                      << nFIRTaps
0303                                      << "). "
0304                                         "The last weights will be discarded.";
0305   }
0306 
0307   if (!weights.empty()) {
0308     int iMaxWeight = 0;
0309     double maxWeight = weights[iMaxWeight];
0310     //looks for index of maximum weight
0311     for (unsigned i = 0; i < weights.size(); ++i) {
0312       if (weights[i] > maxWeight) {
0313         iMaxWeight = i;
0314         maxWeight = weights[iMaxWeight];
0315       }
0316     }
0317 
0318     //position of time sample whose maximum weight is applied:
0319     int maxWeightBin = settings_->ecalDccZs1stSample_[0]  //params_.getParameter<int>("ecalDccZs1stSample")
0320                        + iMaxWeight;
0321 
0322     //gets the bin of maximum (in case of raw data it will not exist)
0323     int binOfMax = 0;
0324     bool rc = getBinOfMax(evt, noZsDigiId, binOfMax);
0325 
0326     if (rc && maxWeightBin != binOfMax) {
0327       edm::LogWarning("Configuration") << "The maximum weight of DCC zero suppression FIR filter is not "
0328                                           "applied to the expected maximum sample("
0329                                        << binOfMax
0330                                        << (binOfMax == 1 ? "st"
0331                                                          : (binOfMax == 2 ? "nd" : (binOfMax == 3 ? "rd" : "th")))
0332                                        << " time sample). This may indicate faulty 'dccNormalizedWeights' "
0333                                           "or 'ecalDccZs1sSample' parameters.";
0334     }
0335   }
0336 }
0337 
0338 bool EcalSelectiveReadoutProducer::getBinOfMax(const edm::Event& evt,
0339                                                const edm::ProductID& noZsDigiId,
0340                                                int& binOfMax) const {
0341   bool rc;
0342   const edm::StableProvenance& p = evt.getStableProvenance(noZsDigiId);
0343   const edm::ParameterSet& result = parameterSet(p, evt.processHistory());
0344   vector<string> ebDigiParamList = result.getParameterNames();
0345   string bofm("binOfMaximum");
0346   if (find(ebDigiParamList.begin(), ebDigiParamList.end(), bofm) != ebDigiParamList.end()) {  //bofm found
0347     binOfMax = result.getParameter<int>("binOfMaximum");
0348     rc = true;
0349   } else {
0350     rc = false;
0351   }
0352   return rc;
0353 }
0354 
0355 void EcalSelectiveReadoutProducer::printSrFlags(ostream& os,
0356                                                 const EBSrFlagCollection& ebSrFlags,
0357                                                 const EESrFlagCollection& eeSrFlags,
0358                                                 int iEvent,
0359                                                 bool withHeader) {
0360   const char srpFlagMarker[] = {'.', 'z', 'Z', 'F', '4', '5', '6', '7'};
0361   if (withHeader) {
0362     time_t t;
0363     time(&t);
0364     const char* date = ctime(&t);
0365     os << "#SRP flag map\n#\n"
0366           "# Generatied on: "
0367        << date
0368        << "\n#\n"
0369           "# +-->Phi/Y "
0370        << srpFlagMarker[0]
0371        << ": suppressed\n"
0372           "# |         "
0373        << srpFlagMarker[1]
0374        << ": ZS 1\n"
0375           "# |         "
0376        << srpFlagMarker[2]
0377        << ": ZS 2\n"
0378           "# V Eta/X   "
0379        << srpFlagMarker[3]
0380        << ": full readout\n"
0381           "#\n";
0382   }
0383 
0384   //EE-,EB,EE+ map wil be written onto file in following format:
0385   //
0386   //      72
0387   // <-------------->
0388   //  20
0389   // <--->
0390   //  EEE                A             +-----> Y
0391   // EEEEE               |             |
0392   // EE EE               | 20   EE-    |
0393   // EEEEE               |             |
0394   //  EEE                V             V X
0395   // BBBBBBBBBBBBBBBBB   A
0396   // BBBBBBBBBBBBBBBBB   |             +-----> Phi
0397   // BBBBBBBBBBBBBBBBB   |             |
0398   // BBBBBBBBBBBBBBBBB   | 34  EB      |
0399   // BBBBBBBBBBBBBBBBB   |             |
0400   // BBBBBBBBBBBBBBBBB   |             V Eta
0401   // BBBBBBBBBBBBBBBBB   |
0402   // BBBBBBBBBBBBBBBBB   |
0403   // BBBBBBBBBBBBBBBBB   V
0404   //  EEE                A             +-----> Y
0405   // EEEEE               |             |
0406   // EE EE               | 20 EE+      |
0407   // EEEEE               |             |
0408   //  EEE                V             V X
0409   //
0410   //
0411   //
0412   //
0413   //event header:
0414   if (iEvent >= 0) {
0415     os << "# Event " << iEvent << "\n";
0416   }
0417 
0418   //retrieve flags:
0419   const int nEndcaps = 2;
0420   const int nScX = 20;
0421   const int nScY = 20;
0422   int eeSrf[nEndcaps][nScX][nScY];
0423   for (size_t i = 0; i < sizeof(eeSrf) / sizeof(int); ((int*)eeSrf)[i++] = -1) {
0424   };
0425   for (EESrFlagCollection::const_iterator it = eeSrFlags.begin(); it != eeSrFlags.end(); ++it) {
0426     const EESrFlag& flag = *it;
0427     int iZ0 = flag.id().zside() > 0 ? 1 : 0;
0428     int iX0 = flag.id().ix() - 1;
0429     int iY0 = flag.id().iy() - 1;
0430     assert(iZ0 >= 0 && iZ0 < nEndcaps);
0431     assert(iX0 >= 0 && iX0 < nScX);
0432     assert(iY0 >= 0 && iY0 < nScY);
0433     eeSrf[iZ0][iX0][iY0] = flag.value();
0434   }
0435   const int nEbTtEta = 34;
0436   const int nEeTtEta = 11;
0437   const int nTtEta = nEeTtEta * 2 + nEbTtEta;
0438   const int nTtPhi = 72;
0439   int ebSrf[nEbTtEta][nTtPhi];
0440   for (size_t i = 0; i < sizeof(ebSrf) / sizeof(int); ((int*)ebSrf)[i++] = -1) {
0441   };
0442   for (EBSrFlagCollection::const_iterator it = ebSrFlags.begin(); it != ebSrFlags.end(); ++it) {
0443     const EBSrFlag& flag = *it;
0444     int iEta = flag.id().ieta();
0445     int iEta0 = iEta + nTtEta / 2 - (iEta >= 0 ? 1 : 0);  //0->55 from eta=-3 to eta=3
0446     int iEbEta0 = iEta0 - nEeTtEta;                       //0->33 from eta=-1.48 to eta=1.48
0447     int iPhi0 = flag.id().iphi() - 1;
0448     assert(iEbEta0 >= 0 && iEbEta0 < nEbTtEta);
0449     assert(iPhi0 >= 0 && iPhi0 < nTtPhi);
0450 
0451     //     cout << __FILE__ << ":" << __LINE__ << ": "
0452     //   <<  iEta << "\t" << flag.id().iphi() << " -> "
0453     //   << iEbEta0 << "\t" << iPhi0
0454     //   << "... Flag: " << flag.value() << "\n";
0455 
0456     ebSrf[iEbEta0][iPhi0] = flag.value();
0457   }
0458 
0459   //print flags:
0460 
0461   //EE-
0462   for (int iX0 = 0; iX0 < nScX; ++iX0) {
0463     for (int iY0 = 0; iY0 < nScY; ++iY0) {
0464       int srFlag = eeSrf[0][iX0][iY0];
0465       assert(srFlag >= -1 && srFlag < (int)(sizeof(srpFlagMarker) / sizeof(srpFlagMarker[0])));
0466       os << (srFlag == -1 ? ' ' : srpFlagMarker[srFlag]);
0467     }
0468     os << "\n";  //one Y supercystal column per line
0469   }              //next supercrystal X-index
0470 
0471   //EB
0472   for (int iEta0 = 0; iEta0 < nEbTtEta; ++iEta0) {
0473     for (int iPhi0 = 0; iPhi0 < nTtPhi; ++iPhi0) {
0474       int srFlag = ebSrf[iEta0][iPhi0];
0475       assert(srFlag >= -1 && srFlag < (int)(sizeof(srpFlagMarker) / sizeof(srpFlagMarker[0])));
0476       os << (srFlag == -1 ? '?' : srpFlagMarker[srFlag]);
0477     }
0478     os << "\n";  //one phi per line
0479   }
0480 
0481   //EE+
0482   for (int iX0 = 0; iX0 < nScX; ++iX0) {
0483     for (int iY0 = 0; iY0 < nScY; ++iY0) {
0484       int srFlag = eeSrf[1][iX0][iY0];
0485       assert(srFlag >= -1 && srFlag < (int)(sizeof(srpFlagMarker) / sizeof(srpFlagMarker[0])));
0486       os << (srFlag == -1 ? ' ' : srpFlagMarker[srFlag]);
0487     }
0488     os << "\n";  //one Y supercystal column per line
0489   }              //next supercrystal X-index
0490 
0491   //event trailer:
0492   os << "\n";
0493 }
0494 
0495 void EcalSelectiveReadoutProducer::checkValidity(const EcalSRSettings& settings) {
0496   if (settings.dccNormalizedWeights_.size() != 1) {
0497     throw cms::Exception("Configuration")
0498         << "Selective readout emulator, EcalSelectiveReadout, supports only single set of ZS weights. "
0499            "while the configuration contains "
0500         << settings.dccNormalizedWeights_.size() << " set(s)\n";
0501   }
0502 
0503   //   if(settings.dccNormalizedWeights_.size() != 1
0504   //      && settings.dccNormalizedWeights_.size() != 2
0505   //      && settings.dccNormalizedWeights_.size() != 54
0506   //      && settings.dccNormalizedWeights_.size() != 75848){
0507   //     throw cms::Exception("Configuration") << "Invalid number of DCC weight set (" << settings.dccNormalizedWeights_.size()
0508   //       << ") in condition object EcalSRSetting::dccNormalizedWeights_. "
0509   //       << "Valid counts are: 1 (single set), 2 (EB and EE), 54 (one per DCC) and 75848 "
0510   //       "(one per crystal)\n";
0511   //   }
0512 
0513   if (settings.dccNormalizedWeights_.size() != settings.ecalDccZs1stSample_.size()) {
0514     throw cms::Exception("Configuration")
0515         << "Inconsistency between number of weigth sets (" << settings.dccNormalizedWeights_.size() << ") and "
0516         << "number of ecalDccZs1Sample values (" << settings.ecalDccZs1stSample_.size() << ").";
0517   }
0518 }