CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Static Private Member Functions | Private Attributes
EcalSRCondTools Class Reference

#include <EcalSRCondTools.h>

Inheritance diagram for EcalSRCondTools:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &evt, const edm::EventSetup &es) override
 
 EcalSRCondTools (const edm::ParameterSet &)
 
 ~EcalSRCondTools () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void importParameterSet (EcalSRSettings &sr, const edm::ParameterSet &ps)
 
static void importSrpConfigFile (EcalSRSettings &sr, std::istream &f, bool debug=false)
 
static double normalizeWeights (int hwWeight)
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Static Private Member Functions

static std::string tokenize (const std::string &s, const std::string &delim, int &pos)
 
static std::string trim (std::string s)
 

Private Attributes

bool done_
 
edm::ESGetToken< EcalSRSettings, EcalSRSettingsRcdhSrToken_
 
edm::ParameterSet ps_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 16 of file EcalSRCondTools.h.

Constructor & Destructor Documentation

◆ EcalSRCondTools()

EcalSRCondTools::EcalSRCondTools ( const edm::ParameterSet ps)

Constructor

Parameters
psanalyser configuration

Definition at line 60 of file EcalSRCondTools.cc.

61  : ps_(ps), hSrToken_(esConsumes<EcalSRSettings, EcalSRSettingsRcd>()), done_(false) {}

◆ ~EcalSRCondTools()

EcalSRCondTools::~EcalSRCondTools ( )
override

Destructor

Definition at line 63 of file EcalSRCondTools.cc.

63 {}

Member Function Documentation

◆ analyze()

void EcalSRCondTools::analyze ( const edm::Event evt,
const edm::EventSetup es 
)
overridevirtual

Called by CMSSW event loop

Parameters
evtthe event
esevents setup

Implements edm::one::EDAnalyzerBase.

Definition at line 65 of file EcalSRCondTools.cc.

65  {
66  if (done_)
67  return;
69 
70  string mode = ps_.getParameter<string>("mode");
71 
72  bool iomode_write = true;
73  if (mode == "online_config" || mode == "combine_config") {
74  string fname = ps_.getParameter<string>("onlineSrpConfigFile");
75  ifstream f(fname.c_str());
76  if (!f.good()) {
77  throw cms::Exception("EcalSRCondTools") << "Failed to open file " << fname;
78  }
79  importSrpConfigFile(*sr, f, true);
80  }
81 
82  if (mode == "python_config" || mode == "combine_config") {
83  importParameterSet(*sr, ps_);
84  }
85 
86  if (mode == "read") {
87  iomode_write = false;
88  }
89 
90  if (!(mode == "python_config" || mode == "online_config" || mode == "combine_config" || (mode == "read"))) {
91  throw cms::Exception("Config") << "Invalid value," << mode << ", for parameter mode. "
92  << "Valid values: online_config, python_config, combine_config, read";
93  }
94 
95  if (iomode_write) {
96  sr->bxGlobalOffset_ = ps_.getParameter<int>("bxGlobalOffset");
97  sr->automaticSrpSelect_ = ps_.getParameter<int>("automaticSrpSelect");
98  sr->automaticMasks_ = ps_.getParameter<int>("automaticMasks");
99 
101  if (!db.isAvailable()) {
102  throw cms::Exception("CondDBAccess") << "Failed to connect to PoolDBOutputService\n";
103  }
104  //fillup DB
105  //create new infinite IOV
106  cond::Time_t firstSinceTime = db->beginOfTime();
107  db->writeOne(sr, firstSinceTime, "EcalSRSettingsRcd");
108  done_ = true;
109  } else { //read mode
111  if (!hSr.isValid()) {
112  cout << "EcalSRSettings record not found. Check the Cond DB Global tag.\n";
113  } else {
114  const EcalSRSettings* ssr = hSr.product();
115  cout << "ECAL Seletive readout settings:\n";
116  cout << *ssr << "\n" << endl;
117  }
118 
119  //trigger tower thresholds (from FENIX configuration):
121  es.get<EcalTPGPhysicsConstRcd>().get(hTp);
122  if (!hTp.isValid()) {
123  cout << "EcalTPGPhysicsConst record not found. Check the Cond DB Global tag.\n";
124  } else {
125  const EcalTPGPhysicsConst* tp = hTp.product();
126  const EcalTPGPhysicsConstMap& mymap = tp->getMap();
127  if (mymap.size() != 2) {
128  cout << "Error: TPG physics record is of unexpected size: " << mymap.size()
129  << " elements instead of two (one for EB, one for EE)\n";
130  } else {
131  EcalTPGPhysicsConstMap::const_iterator it = mymap.begin();
132  cout << "----------------------------------------------------------------------\n"
133  "Trigger tower Et thresholds extracted from TPG configuration \n"
134  "(EcalSRCondTools modules supports only read mode for these parameters):\n\n";
135  cout << "EB: "
136  << "LT = " << it->second.ttf_threshold_Low << " GeV "
137  << "HT = " << it->second.ttf_threshold_High << " GeV\n";
138  ++it;
139  cout << "EE: "
140  << "LT = " << it->second.ttf_threshold_Low << " GeV "
141  << "HT = " << it->second.ttf_threshold_High << " GeV\n";
142  }
143  }
144  }
145  delete sr;
146 }

References EcalSRSettings::automaticMasks_, EcalSRSettings::automaticSrpSelect_, EcalSRSettings::bxGlobalOffset_, gather_cfg::cout, dqmiodatasetharvest::db, done_, Exception, f, alignmentValidation::fname, edm::EventSetup::get(), get, edm::EventSetup::getHandle(), edm::ParameterSet::getParameter(), hSrToken_, importParameterSet(), importSrpConfigFile(), edm::ESHandleBase::isValid(), ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, edm::ESHandle< T >::product(), ps_, and cmsswSequenceInfo::tp.

◆ importParameterSet()

void EcalSRCondTools::importParameterSet ( EcalSRSettings sr,
const edm::ParameterSet ps 
)
static

Converts CMSSW python file selective readout setting ("parameter set") into a condition database object. Configuration from parameter set covers only part of the config, mainly the configuration needed for SR emulation in the MC. The parameters not supported by python configuration are left untouched in the sr object.

Parameters
sr[in] ECAL selective readout setting object to set
psCMSSW parameter set containing the SR parameters to set

Definition at line 148 of file EcalSRCondTools.cc.

148  {
149  sr.deltaPhi_.resize(1);
150  sr.deltaPhi_[0] = ps.getParameter<int>("deltaPhi");
151  sr.deltaEta_.resize(1);
152  sr.deltaEta_[0] = ps.getParameter<int>("deltaEta");
153  sr.ecalDccZs1stSample_.resize(1);
154  sr.ecalDccZs1stSample_[0] = ps.getParameter<int>("ecalDccZs1stSample");
155  sr.ebDccAdcToGeV_ = ps.getParameter<double>("ebDccAdcToGeV");
156  sr.eeDccAdcToGeV_ = ps.getParameter<double>("eeDccAdcToGeV");
157  sr.dccNormalizedWeights_.resize(1);
158  const std::vector<double>& w = ps.getParameter<std::vector<double> >("dccNormalizedWeights");
159  sr.dccNormalizedWeights_[0].resize(w.size());
160  std::copy(w.begin(), w.end(), sr.dccNormalizedWeights_[0].begin());
161  sr.symetricZS_.resize(1);
162  sr.symetricZS_[0] = ps.getParameter<bool>("symetricZS");
163  sr.srpLowInterestChannelZS_.resize(2);
164  const int eb = 0;
165  const int ee = 1;
166  sr.srpLowInterestChannelZS_[eb] = ps.getParameter<double>("srpBarrelLowInterestChannelZS");
167  sr.srpLowInterestChannelZS_[ee] = ps.getParameter<double>("srpEndcapLowInterestChannelZS");
168  sr.srpHighInterestChannelZS_.resize(2);
169  sr.srpHighInterestChannelZS_[eb] = ps.getParameter<double>("srpBarrelHighInterestChannelZS");
170  sr.srpHighInterestChannelZS_[ee] = ps.getParameter<double>("srpEndcapHighInterestChannelZS");
171  //sr.trigPrimBypass_.resize(1);
172  //sr.trigPrimBypass_[0] = ps.getParameter<bool >("trigPrimBypass");
173  //sr.trigPrimBypassMode_.resize(1);
174  //sr.trigPrimBypassMode_[0] = ps.getParameter<int >("trigPrimBypassMode");
175  //sr.trigPrimBypassLTH_.resize(1);
176  //sr.trigPrimBypassLTH_[0] = ps.getParameter<double >("trigPrimBypassLTH");
177  //sr.trigPrimBypassHTH_.resize(1);
178  //sr.trigPrimBypassHTH_[0] = ps.getParameter<double >("trigPrimBypassHTH");
179  //sr.trigPrimBypassWithPeakFinder_.resize(1);
180  //sr.trigPrimBypassWithPeakFinder_[0] = ps.getParameter<bool >("trigPrimBypassWithPeakFinder");
181  //sr.defaultTtf_.resize(1);
182  //sr.defaultTtf_[0] = ps.getParameter<int >("defaultTtf");
183  sr.actions_ = ps.getParameter<std::vector<int> >("actions");
184 }

References EcalSRSettings::actions_, filterCSVwithJSON::copy, EcalSRSettings::dccNormalizedWeights_, EcalSRSettings::deltaEta_, EcalSRSettings::deltaPhi_, EcalSRSettings::ebDccAdcToGeV_, EcalSRSettings::ecalDccZs1stSample_, EcalSRSettings::eeDccAdcToGeV_, edm::ParameterSet::getParameter(), EcalSRSettings::srpHighInterestChannelZS_, EcalSRSettings::srpLowInterestChannelZS_, EcalSRSettings::symetricZS_, and w.

Referenced by analyze(), and EcalSelectiveReadoutProducer::EcalSelectiveReadoutProducer().

◆ importSrpConfigFile()

void EcalSRCondTools::importSrpConfigFile ( EcalSRSettings sr,
std::istream &  f,
bool  debug = false 
)
static

Imports an SRP configuration file (stored in database "CLOB") into a Selective readout setting object.

Parameters
sr[in] ECAL selective readout setting object to set
fconfiguration file stream. A stringstream can be used if the configuration is available as an stl string of a c-string: stringstream buf; buf << s;
debugverbosity flag. If true, imported parameter are displayed on stdout.

Definition at line 186 of file EcalSRCondTools.cc.

186  {
187  //initialize vectors:
188  sr.deltaEta_ = vector<int>(1, 0);
189  sr.deltaPhi_ = vector<int>(1, 0);
190  sr.actions_ = vector<int>(4, 0);
191  sr.tccMasksFromConfig_ = vector<short>(EcalSRSettings::nTccs_, 0);
192  sr.srpMasksFromConfig_ = vector<vector<short> >(EcalSRSettings::nSrps_, vector<short>(8, 0));
193  sr.dccMasks_ = vector<short>(EcalSRSettings::nDccs_);
194  sr.srfMasks_ = vector<short>(EcalSRSettings::nDccs_);
195  sr.substitutionSrfs_ = vector<vector<short> >(EcalSRSettings::nSrps_, vector<short>(68, 0));
196  sr.testerTccEmuSrpIds_ = vector<int>(EcalSRSettings::nSrps_, 0);
197  sr.testerSrpEmuSrpIds_ = vector<int>(EcalSRSettings::nSrps_, 0);
198  sr.testerDccTestSrpIds_ = vector<int>(EcalSRSettings::nSrps_, 0);
199  sr.testerSrpTestSrpIds_ = vector<int>(EcalSRSettings::nSrps_, 0);
200  sr.bxOffsets_ = vector<short>(EcalSRSettings::nSrps_, 0);
201  sr.automaticMasks_ = 0;
202  sr.automaticSrpSelect_ = 0;
203 
204  //string line;
205  int iLine = 0;
206  int iValueSet = -1;
207  const int nValueSets = 6 * EcalSRSettings::nSrps_ + 9;
208  string line;
209  stringstream sErr("");
210  while (!f.eof() && sErr.str().empty()) {
211  getline(f, line);
212  ++iLine;
213  line = trim(line);
214  if (line[0] == '#' || line.empty()) { //comment line and empty line to ignore
215  continue;
216  } else {
217  ++iValueSet;
218  }
219  if (iValueSet >= nValueSets)
220  break;
221  uint32_t value;
222  string sValue;
223  int pos = 0;
224  int iCh = 0;
225  int nChs[nValueSets] = {
226  //TCC masks: 0-11
227  12,
228  12,
229  12,
230  12,
231  12,
232  12,
233  12,
234  12,
235  12,
236  12,
237  12,
238  12,
239  //SRP masks: 12-23
240  8,
241  8,
242  8,
243  8,
244  8,
245  8,
246  8,
247  8,
248  8,
249  8,
250  8,
251  8,
252  //DCC masks: 24-35
253  12,
254  12,
255  12,
256  12,
257  12,
258  12,
259  12,
260  12,
261  12,
262  12,
263  12,
264  12,
265  //SRF Masks: 36-47
266  6,
267  6,
268  6,
269  6,
270  6,
271  6,
272  6,
273  6,
274  6,
275  6,
276  6,
277  6,
278  //substitution SRFs: 48-59
279  68,
280  68,
281  68,
282  68,
283  68,
284  68,
285  68,
286  68,
287  68,
288  68,
289  68,
290  68,
291  //Tester card to emulate or test: 60-71
292  4,
293  4,
294  4,
295  4,
296  4,
297  4,
298  4,
299  4,
300  4,
301  4,
302  4,
303  4,
304  //Bx offsets: 72
305  12,
306  //algo type: 73
307  1,
308  //action flags: 74
309  4,
310  //pattern file directory: 75
311  1,
312  //VME slots: 76
313  12,
314  //card types: 77
315  12,
316  //config Mode
317  1,
318  //VME Interface card
319  1,
320  //Spy Mode
321  12,
322  };
323 
324  while (((sValue = tokenize(line, " \t", pos)) != string("")) && (iCh < nChs[iValueSet]) && sErr.str().empty()) {
325  value = strtoul(sValue.c_str(), nullptr, 0);
326  const int iSrp = iValueSet % EcalSRSettings::nSrps_;
327  if (iValueSet < 12) { //TCC
328  assert((unsigned)iSrp < sizeof(tccNum) / sizeof(tccNum[0]));
329  assert((unsigned)iCh < sizeof(tccNum[0]) / sizeof(tccNum[0][0]));
330  int tcc = tccNum[iSrp][iCh];
331  if (tcc >= 0) {
332  if (d)
333  cout << "tccMasksFromConfig_[" << tcc << "] <- " << value << "\n";
334  sr.tccMasksFromConfig_[tcc - 1] = value;
335  }
336  } else if (iValueSet < 24) { //SRP-SRP
337  if (d)
338  cout << "srpMasks_[" << iSrp << "][" << iCh << "] <- " << value << "\n";
339  sr.srpMasksFromConfig_[iSrp][iCh] = value;
340  } else if (iValueSet < 36) { //DCC output
341  assert((unsigned)iSrp < sizeof(dccNum) / sizeof(dccNum[0]));
342  assert((unsigned)iCh < sizeof(dccNum[0]) / sizeof(dccNum[0][0]));
343  int dcc = dccNum[iSrp][iCh];
344  if (dcc > 0) {
345  assert((unsigned)(dcc - 1) < sr.dccMasks_.size());
346  if (d)
347  cout << "dccMasks_[" << (dcc - 1) << "] <- " << value << "\n";
348  sr.dccMasks_[dcc - 1] = value;
349  }
350  } else if (iValueSet < 48) { //SRF masks
351  assert((unsigned)iSrp < sizeof(dccNum) / sizeof(dccNum[0]));
352  assert((unsigned)iCh < sizeof(dccNum[0]) / sizeof(dccNum[0][0]));
353  int dcc = dccNum[iSrp][iCh];
354  if (dcc > 0) {
355  if (d)
356  cout << "srfMasks_[" << (dcc - 1) << "] <- " << value << "\n";
357  assert((unsigned)(dcc - 1) < sr.srfMasks_.size());
358  sr.srfMasks_[dcc - 1] = value;
359  }
360  } else if (iValueSet < 60) { //substiution SRFs
361  assert((unsigned)iSrp < sr.substitutionSrfs_.size());
362  assert((unsigned)iCh < sr.substitutionSrfs_[0].size());
363  if (d)
364  cout << "substitutionMasks_[" << iSrp << "][" << iCh << "] <- " << value << "\n";
365  sr.substitutionSrfs_[iSrp][iCh] = value;
366  } else if (iValueSet < 72) { //Tester card config
367  switch (iCh) {
368  case 0:
369  assert((unsigned)iSrp < sr.testerTccEmuSrpIds_.size());
370  if (d)
371  cout << "testerTccEmuSrpIds_[" << iSrp << "] <- " << value << "\n";
372  sr.testerTccEmuSrpIds_[iSrp] = value;
373  break;
374  case 1:
375  assert((unsigned)iSrp < sr.testerSrpEmuSrpIds_.size());
376  if (d)
377  cout << "testerSrpEmuSrpIds_[" << iSrp << "] <- " << value << "\n";
378  sr.testerSrpEmuSrpIds_[iSrp] = value;
379  break;
380  case 2:
381  assert((unsigned)iSrp < sr.testerDccTestSrpIds_.size());
382  if (d)
383  cout << "testerDccTestSrpIds_[" << iSrp << "] <- " << value << "\n";
384  sr.testerDccTestSrpIds_[iSrp] = value;
385  break;
386  case 3:
387  assert((unsigned)iSrp < sr.testerSrpTestSrpIds_.size());
388  if (d)
389  cout << "testerSrpTestSrpIds_[" << iSrp << "] <- " << value << "\n";
390  sr.testerSrpTestSrpIds_[iSrp] = value;
391  break;
392  default:
393  sErr << "Syntax error in SRP system configuration "
394  << " line " << iLine << ".";
395  }
396  } else if (iValueSet < 73) { //bx offsets
397  assert((unsigned)iCh < sr.bxOffsets_.size());
398  if (d)
399  cout << "bxOffset_[" << iCh << "] <- " << value << "\n";
400  sr.bxOffsets_[iCh] = value;
401  } else if (iValueSet < 74) { //algo type
402  int algo = value;
403  switch (algo) {
404  case 0:
405  sr.deltaEta_[0] = sr.deltaPhi_[0] = 1;
406  break;
407  case 1:
408  sr.deltaEta_[0] = sr.deltaPhi_[0] = 2;
409  break;
410  default:
411  throw cms::Exception("OutOfRange")
412  << "Value of parameter algo ," << algo << ", is invalid. Valid values are 0 and 1.";
413  }
414  if (d)
415  cout << "deltaEta_[0] <- " << sr.deltaEta_[0] << "\t"
416  << "deltaPhi_[0] <- " << sr.deltaPhi_[0] << "\n";
417  } else if (iValueSet < 75) { //action flags
418  assert((unsigned)iCh < sr.actions_.size());
419  if (d)
420  cout << "actions_[" << iCh << "] <- " << value << "\n";
421  sr.actions_[iCh] = value;
422  } else if (iValueSet < 76) { //pattern file directory
423  // emuDir_ = sValue;
424  // if(d) cout << "emuDir_ <= "
425  // << value << "\n";
426  } else if (iValueSet < 77) { //VME slots
427  // slotIds_[iCh] = value;
428  // if(d) cout << "slotIds_[" << iCh << "] <= "
429  // << value << "\n";
430  } else if (iValueSet < 78) { //card types
431  // cardTypes_[iCh] = sValue[0];
432  // if(d) cout << "cardTypes_[" << iCh << "] <= "
433  // << value << "\n";
434  } else if (iValueSet < 79) { //config mode
435  //TODO validity check on value
436  // configMode_ = (ConfigMode)value;
437  // if(d) cout << "config mode <= " << value << "\n";
438  } else if (iValueSet < 80) { //VME I/F
439  //TODO validity check on value
440  // vmeInterface_ = (Vme::type_t)value;
441  //if(d) cout << "Vme Interface code <= " << value << "\n";
442  } else if (iValueSet < 81) { //Spy Mode
443  //TODO validity check on value
444  // spyMode_[iCh] = value & 0x3;
445  // if(d) cout << "Spy mode <= " << value << "\n";
446  } else { //should never be reached!
447  assert(false);
448  }
449  ++iCh;
450  }
451  if (iCh != nChs[iValueSet]) { //error
452  sErr << "Syntax error in imported SRP system configuration file "
453  /*<< filename <<*/ " line "
454  << iLine << ".";
455  }
456  }
457  if (sErr.str().empty() && iValueSet != (nValueSets - 1)) { //error
458  sErr << "Syntax Error in imported SRP system configuration file "
459  /*<< filename <<*/ " line "
460  << iLine << ".";
461  }
462  if (!sErr.str().empty())
463  throw cms::Exception("SyntaxError") << sErr.str();
464 }

References EcalSRSettings::actions_, cms::cuda::assert(), EcalSRSettings::automaticMasks_, EcalSRSettings::automaticSrpSelect_, EcalSRSettings::bxOffsets_, gather_cfg::cout, ztail::d, EcalSRSettings::dccMasks_, dccNum, EcalSRSettings::deltaEta_, EcalSRSettings::deltaPhi_, Exception, f, mps_splice::line, nChs, EcalSRSettings::nDccs_, EcalSRSettings::nSrps_, EcalSRSettings::nTccs_, EcalSRSettings::srfMasks_, EcalSRSettings::srpMasksFromConfig_, EcalSRSettings::substitutionSrfs_, EcalSRSettings::tccMasksFromConfig_, tccNum, EcalSRSettings::testerDccTestSrpIds_, EcalSRSettings::testerSrpEmuSrpIds_, EcalSRSettings::testerSrpTestSrpIds_, EcalSRSettings::testerTccEmuSrpIds_, tokenize(), trim(), and relativeConstraints::value.

Referenced by analyze(), and popcon::EcalSRPHandler::getNewObjects().

◆ normalizeWeights()

double EcalSRCondTools::normalizeWeights ( int  hwWeight)
static

convert hardware weights (interger weights) into normalized weights. The former reprensentation is used in DCC firmware and in online databaser, while the later is used in offline software.

Definition at line 466 of file EcalSRCondTools.cc.

466  {
467  //Fix sign bit in case only the 12 least significant bits of hwWeight were set
468  //(hardware reprensentation uses only 12 bits)
469  if (hwWeight & (1 << 11))
470  hwWeight |= ~0xEFF;
471  return hwWeight / 1024.;
472 }

◆ tokenize()

string EcalSRCondTools::tokenize ( const std::string &  s,
const std::string &  delim,
int &  pos 
)
staticprivate

Help function to tokenize a string

Parameters
sstring to parse @delim token delimiters @pos internal string position pointer. Must be set to zero before the first call

Definition at line 474 of file EcalSRCondTools.cc.

474  {
475  if (pos < 0)
476  return "";
477  int pos0 = pos;
478  int len = s.size();
479  //eats delimeters at beginning of the string
480  while (pos0 < len && find(delim.begin(), delim.end(), s[pos0]) != delim.end()) {
481  ++pos0;
482  }
483  if (pos0 == len)
484  return "";
485  pos = s.find_first_of(delim, pos0);
486  return s.substr(pos0, (pos > 0 ? pos : len) - pos0);
487 }

References spr::find(), and alignCSCRings::s.

Referenced by importSrpConfigFile().

◆ trim()

std::string EcalSRCondTools::trim ( std::string  s)
staticprivate

Help function to trim spaces at beginning and end of a string

Parameters
sstring to trim

Definition at line 489 of file EcalSRCondTools.cc.

489  {
490  std::string::size_type pos0 = s.find_first_not_of(" \t");
491  if (pos0 == string::npos) {
492  pos0 = 0;
493  }
494  string::size_type pos1 = s.find_last_not_of(" \t") + 1;
495  if (pos1 == string::npos) {
496  pos1 = pos0;
497  }
498  return s.substr(pos0, pos1 - pos0);
499 }

References alignCSCRings::s.

Referenced by importSrpConfigFile().

Member Data Documentation

◆ done_

bool EcalSRCondTools::done_
private

Definition at line 74 of file EcalSRCondTools.h.

Referenced by analyze().

◆ hSrToken_

edm::ESGetToken<EcalSRSettings, EcalSRSettingsRcd> EcalSRCondTools::hSrToken_
private

Definition at line 72 of file EcalSRCondTools.h.

Referenced by analyze().

◆ ps_

edm::ParameterSet EcalSRCondTools::ps_
private

Definition at line 71 of file EcalSRCondTools.h.

Referenced by analyze().

edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
EcalSRCondTools::importParameterSet
static void importParameterSet(EcalSRSettings &sr, const edm::ParameterSet &ps)
Definition: EcalSRCondTools.cc:148
EcalSRSettings::srpLowInterestChannelZS_
std::vector< float > srpLowInterestChannelZS_
Definition: EcalSRSettings.h:121
EcalSRSettings::substitutionSrfs_
std::vector< std::vector< short > > substitutionSrfs_
Definition: EcalSRSettings.h:189
EcalSRCondTools::done_
bool done_
Definition: EcalSRCondTools.h:74
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
gather_cfg.cout
cout
Definition: gather_cfg.py:144
pos
Definition: PixelAliasList.h:18
ALCARECOPromptCalibProdSiPixelAli0T_cff.mode
mode
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:96
cms::cuda::assert
assert(be >=bs)
EcalSRSettings::srpMasksFromConfig_
std::vector< std::vector< short > > srpMasksFromConfig_
Definition: EcalSRSettings.h:177
EcalSRSettings::nTccs_
static const int nTccs_
Definition: EcalSRSettings.h:49
EcalSRSettings::actions_
std::vector< int > actions_
Definition: EcalSRSettings.h:168
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
dqmiodatasetharvest.db
db
Definition: dqmiodatasetharvest.py:119
cmsdt::algo
algo
Definition: constants.h:164
EcalSRSettings::deltaEta_
std::vector< int > deltaEta_
Definition: EcalSRSettings.h:58
alignCSCRings.s
s
Definition: alignCSCRings.py:92
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
w
const double w
Definition: UKUtility.cc:23
nChs
const int nChs
Definition: recycleTccEmu.cc:11
EcalSRCondTools::ps_
edm::ParameterSet ps_
Definition: EcalSRCondTools.h:71
edm::ESHandle
Definition: DTSurvey.h:22
cmsswSequenceInfo.tp
tp
Definition: cmsswSequenceInfo.py:17
EcalSRSettings::symetricZS_
std::vector< int > symetricZS_
Definition: EcalSRSettings.h:111
EcalSRSettings::testerSrpTestSrpIds_
std::vector< int > testerSrpTestSrpIds_
Definition: EcalSRSettings.h:197
EcalSRSettings::srfMasks_
std::vector< short > srfMasks_
Definition: EcalSRSettings.h:185
tccNum
constexpr int tccNum[12][12]
Definition: EcalSRCondTools.cc:24
EcalSRSettings::testerDccTestSrpIds_
std::vector< int > testerDccTestSrpIds_
Definition: EcalSRSettings.h:196
cond::Time_t
unsigned long long Time_t
Definition: Time.h:14
edm::Service< cond::service::PoolDBOutputService >
EcalSRSettings::dccMasks_
std::vector< short > dccMasks_
Definition: EcalSRSettings.h:181
EcalSRCondTools::importSrpConfigFile
static void importSrpConfigFile(EcalSRSettings &sr, std::istream &f, bool debug=false)
Definition: EcalSRCondTools.cc:186
value
Definition: value.py:1
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:148
EcalSRSettings::bxGlobalOffset_
short bxGlobalOffset_
Definition: EcalSRSettings.h:208
dccNum
constexpr int dccNum[12][12]
Definition: EcalSRCondTools.cc:43
EcalSRSettings::deltaPhi_
std::vector< int > deltaPhi_
Definition: EcalSRSettings.h:71
get
#define get
EcalSRSettings::ebDccAdcToGeV_
float ebDccAdcToGeV_
ADC to GeV conversion factor used in ZS filter for EB.
Definition: EcalSRSettings.h:83
edm::ESHandleBase::isValid
bool isValid() const
Definition: ESHandle.h:44
EcalSRSettings::testerSrpEmuSrpIds_
std::vector< int > testerSrpEmuSrpIds_
Definition: EcalSRSettings.h:195
EcalSRCondTools::trim
static std::string trim(std::string s)
Definition: EcalSRCondTools.cc:489
EcalSRSettings::nSrps_
static const int nSrps_
Definition: EcalSRSettings.h:47
EcalSRCondTools::hSrToken_
edm::ESGetToken< EcalSRSettings, EcalSRSettingsRcd > hSrToken_
Definition: EcalSRCondTools.h:72
EcalSRSettings::bxOffsets_
std::vector< short > bxOffsets_
Definition: EcalSRSettings.h:203
EcalTPGPhysicsConst
Definition: EcalTPGPhysicsConst.h:9
alignmentValidation.fname
string fname
main script
Definition: alignmentValidation.py:959
EcalTPGPhysicsConstMap
std::map< uint32_t, EcalTPGPhysicsConst::Item > EcalTPGPhysicsConstMap
Definition: EcalTPGPhysicsConst.h:36
EcalSRSettings
Definition: EcalSRSettings.h:29
EcalSRSettings::dccNormalizedWeights_
std::vector< std::vector< float > > dccNormalizedWeights_
Definition: EcalSRSettings.h:99
EcalSRSettings::ecalDccZs1stSample_
std::vector< int > ecalDccZs1stSample_
Definition: EcalSRSettings.h:80
EcalSRSettings::eeDccAdcToGeV_
float eeDccAdcToGeV_
ADC to GeV conversion factor used in ZS filter for EE.
Definition: EcalSRSettings.h:85
relativeConstraints.value
value
Definition: relativeConstraints.py:53
EcalSRSettings::testerTccEmuSrpIds_
std::vector< int > testerTccEmuSrpIds_
Definition: EcalSRSettings.h:194
Exception
Definition: hltDiff.cc:246
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
EcalSRSettings::srpHighInterestChannelZS_
std::vector< float > srpHighInterestChannelZS_
Definition: EcalSRSettings.h:131
ztail.d
d
Definition: ztail.py:151
cms::Exception
Definition: Exception.h:70
EcalSRSettings::automaticMasks_
int automaticMasks_
Definition: EcalSRSettings.h:213
EcalSRSettings::automaticSrpSelect_
int automaticSrpSelect_
Definition: EcalSRSettings.h:218
mps_splice.line
line
Definition: mps_splice.py:76
EcalSRCondTools::tokenize
static std::string tokenize(const std::string &s, const std::string &delim, int &pos)
Definition: EcalSRCondTools.cc:474
EcalTPGPhysicsConstRcd
Definition: EcalTPGPhysicsConstRcd.h:5
EcalSRSettings::tccMasksFromConfig_
std::vector< short > tccMasksFromConfig_
Definition: EcalSRSettings.h:172
EcalSRSettings::nDccs_
static const int nDccs_
Definition: EcalSRSettings.h:48