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
 
- 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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::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
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
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<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 14 of file EcalSRCondTools.h.

Constructor & Destructor Documentation

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

Constructor

Parameters
psanalyser configuration

Definition at line 61 of file EcalSRCondTools.cc.

61 : ps_(ps), done_(false) {}
edm::ParameterSet ps_
EcalSRCondTools::~EcalSRCondTools ( )
override

Destructor

Definition at line 63 of file EcalSRCondTools.cc.

63 {}

Member Function Documentation

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

Called by CMSSW event loop

Parameters
evtthe event
esevents setup

Definition at line 65 of file EcalSRCondTools.cc.

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

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  es.get<EcalSRSettingsRcd>().get(hSr);
112  if (!hSr.isValid()) {
113  cout << "EcalSRSettings record not found. Check the Cond DB Global tag.\n";
114  } else {
115  const EcalSRSettings* ssr = hSr.product();
116  cout << "ECAL Seletive readout settings:\n";
117  cout << *ssr << "\n" << endl;
118  }
119 
120  //trigger tower thresholds (from FENIX configuration):
122  es.get<EcalTPGPhysicsConstRcd>().get(hTp);
123  if (!hTp.isValid()) {
124  cout << "EcalTPGPhysicsConst record not found. Check the Cond DB Global tag.\n";
125  } else {
126  const EcalTPGPhysicsConst* tp = hTp.product();
127  const EcalTPGPhysicsConstMap& mymap = tp->getMap();
128  if (mymap.size() != 2) {
129  cout << "Error: TPG physics record is of unexpected size: " << mymap.size()
130  << " elements instead of two (one for EB, one for EE)\n";
131  } else {
132  EcalTPGPhysicsConstMap::const_iterator it = mymap.begin();
133  cout << "----------------------------------------------------------------------\n"
134  "Trigger tower Et thresholds extracted from TPG configuration \n"
135  "(EcalSRCondTools modules supports only read mode for these parameters):\n\n";
136  cout << "EB: "
137  << "LT = " << it->second.ttf_threshold_Low << " GeV "
138  << "HT = " << it->second.ttf_threshold_High << " GeV\n";
139  ++it;
140  cout << "EE: "
141  << "LT = " << it->second.ttf_threshold_Low << " GeV "
142  << "HT = " << it->second.ttf_threshold_High << " GeV\n";
143  }
144  }
145  }
146  delete sr;
147 }
T getParameter(std::string const &) const
static void importSrpConfigFile(EcalSRSettings &sr, std::istream &f, bool debug=false)
edm::ParameterSet ps_
static void importParameterSet(EcalSRSettings &sr, const edm::ParameterSet &ps)
unsigned long long Time_t
Definition: Time.h:14
double f[11][100]
const std::map< uint32_t, Item > & getMap() const
string fname
main script
T get() const
Definition: EventSetup.h:73
std::map< uint32_t, EcalTPGPhysicsConst::Item > EcalTPGPhysicsConstMap
bool isValid() const
Definition: ESHandle.h:44
T const * product() const
Definition: ESHandle.h:86
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 149 of file EcalSRCondTools.cc.

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().

149  {
150  sr.deltaPhi_.resize(1);
151  sr.deltaPhi_[0] = ps.getParameter<int>("deltaPhi");
152  sr.deltaEta_.resize(1);
153  sr.deltaEta_[0] = ps.getParameter<int>("deltaEta");
154  sr.ecalDccZs1stSample_.resize(1);
155  sr.ecalDccZs1stSample_[0] = ps.getParameter<int>("ecalDccZs1stSample");
156  sr.ebDccAdcToGeV_ = ps.getParameter<double>("ebDccAdcToGeV");
157  sr.eeDccAdcToGeV_ = ps.getParameter<double>("eeDccAdcToGeV");
158  sr.dccNormalizedWeights_.resize(1);
159  const std::vector<double>& w = ps.getParameter<std::vector<double> >("dccNormalizedWeights");
160  sr.dccNormalizedWeights_[0].resize(w.size());
161  std::copy(w.begin(), w.end(), sr.dccNormalizedWeights_[0].begin());
162  sr.symetricZS_.resize(1);
163  sr.symetricZS_[0] = ps.getParameter<bool>("symetricZS");
164  sr.srpLowInterestChannelZS_.resize(2);
165  const int eb = 0;
166  const int ee = 1;
167  sr.srpLowInterestChannelZS_[eb] = ps.getParameter<double>("srpBarrelLowInterestChannelZS");
168  sr.srpLowInterestChannelZS_[ee] = ps.getParameter<double>("srpEndcapLowInterestChannelZS");
169  sr.srpHighInterestChannelZS_.resize(2);
170  sr.srpHighInterestChannelZS_[eb] = ps.getParameter<double>("srpBarrelHighInterestChannelZS");
171  sr.srpHighInterestChannelZS_[ee] = ps.getParameter<double>("srpEndcapHighInterestChannelZS");
172  //sr.trigPrimBypass_.resize(1);
173  //sr.trigPrimBypass_[0] = ps.getParameter<bool >("trigPrimBypass");
174  //sr.trigPrimBypassMode_.resize(1);
175  //sr.trigPrimBypassMode_[0] = ps.getParameter<int >("trigPrimBypassMode");
176  //sr.trigPrimBypassLTH_.resize(1);
177  //sr.trigPrimBypassLTH_[0] = ps.getParameter<double >("trigPrimBypassLTH");
178  //sr.trigPrimBypassHTH_.resize(1);
179  //sr.trigPrimBypassHTH_[0] = ps.getParameter<double >("trigPrimBypassHTH");
180  //sr.trigPrimBypassWithPeakFinder_.resize(1);
181  //sr.trigPrimBypassWithPeakFinder_[0] = ps.getParameter<bool >("trigPrimBypassWithPeakFinder");
182  //sr.defaultTtf_.resize(1);
183  //sr.defaultTtf_[0] = ps.getParameter<int >("defaultTtf");
184  sr.actions_ = ps.getParameter<std::vector<int> >("actions");
185 }
T getParameter(std::string const &) const
const double w
Definition: UKUtility.cc:23
std::vector< std::vector< float > > dccNormalizedWeights_
std::vector< float > srpHighInterestChannelZS_
std::vector< int > actions_
std::vector< int > ecalDccZs1stSample_
std::vector< int > deltaPhi_
std::vector< int > symetricZS_
float ebDccAdcToGeV_
ADC to GeV conversion factor used in ZS filter for EB.
std::vector< float > srpLowInterestChannelZS_
std::vector< int > deltaEta_
float eeDccAdcToGeV_
ADC to GeV conversion factor used in ZS filter for EE.
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 187 of file EcalSRCondTools.cc.

References EcalSRSettings::actions_, ecalcalib_dqm_sourceclient-live_cfg::algo, EcalSRSettings::automaticMasks_, EcalSRSettings::automaticSrpSelect_, EcalSRSettings::bxOffsets_, gather_cfg::cout, EcalSRSettings::dccMasks_, dccNum, EcalSRSettings::deltaEta_, EcalSRSettings::deltaPhi_, Exception, 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().

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

467  {
468  //Fix sign bit in case only the 12 least significant bits of hwWeight were set
469  //(hardware reprensentation uses only 12 bits)
470  if (hwWeight & (1 << 11))
471  hwWeight |= ~0xEFF;
472  return hwWeight / 1024.;
473 }
string EcalSRCondTools::tokenize ( const std::string &  s,
const std::string &  delim,
int &  pos 
)
staticprivate

Help function to tokenize a string

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

Definition at line 475 of file EcalSRCondTools.cc.

References spr::find().

Referenced by importSrpConfigFile().

475  {
476  if (pos < 0)
477  return "";
478  int pos0 = pos;
479  int len = s.size();
480  //eats delimeters at beginning of the string
481  while (pos0 < len && find(delim.begin(), delim.end(), s[pos0]) != delim.end()) {
482  ++pos0;
483  }
484  if (pos0 == len)
485  return "";
486  pos = s.find_first_of(delim, pos0);
487  return s.substr(pos0, (pos > 0 ? pos : len) - pos0);
488 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
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 490 of file EcalSRCondTools.cc.

Referenced by importSrpConfigFile().

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

Member Data Documentation

bool EcalSRCondTools::done_
private

Definition at line 71 of file EcalSRCondTools.h.

Referenced by analyze().

edm::ParameterSet EcalSRCondTools::ps_
private

Definition at line 69 of file EcalSRCondTools.h.

Referenced by analyze().