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
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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_
 
bool iomode_write_
 
const std::string mode_
 
const edm::ParameterSet ps_
 
edm::ESGetToken< EcalTPGPhysicsConst, EcalTPGPhysicsConstRcdtpgPhysicsConstToken_
 

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)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 19 of file EcalSRCondTools.h.

Constructor & Destructor Documentation

◆ EcalSRCondTools()

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

Constructor

Parameters
psanalyser configuration

Definition at line 55 of file EcalSRCondTools.cc.

References edm::EDConsumerBase::esConsumes(), hSrToken_, iomode_write_, mode_, and tpgPhysicsConstToken_.

56  : ps_(ps), mode_(ps.getParameter<string>("mode")), iomode_write_(true), done_(false) {
57  if (mode_ == "read") {
58  iomode_write_ = false;
61  }
62 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const std::string mode_
const edm::ParameterSet ps_
edm::ESGetToken< EcalSRSettings, EcalSRSettingsRcd > hSrToken_
edm::ESGetToken< EcalTPGPhysicsConst, EcalTPGPhysicsConstRcd > tpgPhysicsConstToken_

◆ ~EcalSRCondTools()

EcalSRCondTools::~EcalSRCondTools ( )
override

Destructor

Definition at line 64 of file EcalSRCondTools.cc.

64 {}

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 66 of file EcalSRCondTools.cc.

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

66  {
67  if (done_)
68  return;
69  EcalSRSettings sr;
70 
71  if (mode_ == "online_config" || mode_ == "combine_config") {
72  string fname = ps_.getParameter<string>("onlineSrpConfigFile");
73  ifstream f(fname.c_str());
74  if (!f.good()) {
75  throw cms::Exception("EcalSRCondTools") << "Failed to open file " << fname;
76  }
77  importSrpConfigFile(sr, f, true);
78  }
79 
80  if (mode_ == "python_config" || mode_ == "combine_config") {
82  }
83 
84  if (!(mode_ == "python_config" || mode_ == "online_config" || mode_ == "combine_config" || (mode_ == "read"))) {
85  throw cms::Exception("Config") << "Invalid value," << mode_ << ", for parameter mode. "
86  << "Valid values: online_config, python_config, combine_config, read";
87  }
88 
89  if (iomode_write_) {
90  sr.bxGlobalOffset_ = ps_.getParameter<int>("bxGlobalOffset");
91  sr.automaticSrpSelect_ = ps_.getParameter<int>("automaticSrpSelect");
92  sr.automaticMasks_ = ps_.getParameter<int>("automaticMasks");
93 
95  if (!db.isAvailable()) {
96  throw cms::Exception("CondDBAccess") << "Failed to connect to PoolDBOutputService\n";
97  }
98  //fillup DB
99  //create new infinite IOV
100  cond::Time_t firstSinceTime = db->beginOfTime();
101  db->writeOneIOV(sr, firstSinceTime, "EcalSRSettingsRcd");
102  done_ = true;
103  } else { //read mode
105  if (!hSr.isValid()) {
106  cout << "EcalSRSettings record not found. Check the Cond DB Global tag.\n";
107  } else {
108  const EcalSRSettings* ssr = hSr.product();
109  cout << "ECAL Seletive readout settings:\n";
110  cout << *ssr << "\n" << endl;
111  }
112 
113  //trigger tower thresholds (from FENIX configuration):
115  if (!hTp.isValid()) {
116  cout << "EcalTPGPhysicsConst record not found. Check the Cond DB Global tag.\n";
117  } else {
118  const EcalTPGPhysicsConst* tp = hTp.product();
119  const EcalTPGPhysicsConstMap& mymap = tp->getMap();
120  if (mymap.size() != 2) {
121  cout << "Error: TPG physics record is of unexpected size: " << mymap.size()
122  << " elements instead of two (one for EB, one for EE)\n";
123  } else {
124  EcalTPGPhysicsConstMap::const_iterator it = mymap.begin();
125  cout << "----------------------------------------------------------------------\n"
126  "Trigger tower Et thresholds extracted from TPG configuration \n"
127  "(EcalSRCondTools modules supports only read mode for these parameters):\n\n";
128  cout << "EB: "
129  << "LT = " << it->second.ttf_threshold_Low << " GeV "
130  << "HT = " << it->second.ttf_threshold_High << " GeV\n";
131  ++it;
132  cout << "EE: "
133  << "LT = " << it->second.ttf_threshold_Low << " GeV "
134  << "HT = " << it->second.ttf_threshold_High << " GeV\n";
135  }
136  }
137  }
138 }
static void importSrpConfigFile(EcalSRSettings &sr, std::istream &f, bool debug=false)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const std::string mode_
const edm::ParameterSet ps_
static void importParameterSet(EcalSRSettings &sr, const edm::ParameterSet &ps)
edm::ESGetToken< EcalSRSettings, EcalSRSettingsRcd > hSrToken_
T const * product() const
Definition: ESHandle.h:86
unsigned long long Time_t
Definition: Time.h:14
double f[11][100]
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
bool isValid() const
Definition: ESHandle.h:44
string fname
main script
edm::ESGetToken< EcalTPGPhysicsConst, EcalTPGPhysicsConstRcd > tpgPhysicsConstToken_
std::map< uint32_t, EcalTPGPhysicsConst::Item > EcalTPGPhysicsConstMap

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

140  {
141  sr.deltaPhi_.resize(1);
142  sr.deltaPhi_[0] = ps.getParameter<int>("deltaPhi");
143  sr.deltaEta_.resize(1);
144  sr.deltaEta_[0] = ps.getParameter<int>("deltaEta");
145  sr.ecalDccZs1stSample_.resize(1);
146  sr.ecalDccZs1stSample_[0] = ps.getParameter<int>("ecalDccZs1stSample");
147  sr.ebDccAdcToGeV_ = ps.getParameter<double>("ebDccAdcToGeV");
148  sr.eeDccAdcToGeV_ = ps.getParameter<double>("eeDccAdcToGeV");
149  sr.dccNormalizedWeights_.resize(1);
150  const std::vector<double>& w = ps.getParameter<std::vector<double> >("dccNormalizedWeights");
151  sr.dccNormalizedWeights_[0].resize(w.size());
152  std::copy(w.begin(), w.end(), sr.dccNormalizedWeights_[0].begin());
153  sr.symetricZS_.resize(1);
154  sr.symetricZS_[0] = ps.getParameter<bool>("symetricZS");
155  sr.srpLowInterestChannelZS_.resize(2);
156  const int eb = 0;
157  const int ee = 1;
158  sr.srpLowInterestChannelZS_[eb] = ps.getParameter<double>("srpBarrelLowInterestChannelZS");
159  sr.srpLowInterestChannelZS_[ee] = ps.getParameter<double>("srpEndcapLowInterestChannelZS");
160  sr.srpHighInterestChannelZS_.resize(2);
161  sr.srpHighInterestChannelZS_[eb] = ps.getParameter<double>("srpBarrelHighInterestChannelZS");
162  sr.srpHighInterestChannelZS_[ee] = ps.getParameter<double>("srpEndcapHighInterestChannelZS");
163  //sr.trigPrimBypass_.resize(1);
164  //sr.trigPrimBypass_[0] = ps.getParameter<bool >("trigPrimBypass");
165  //sr.trigPrimBypassMode_.resize(1);
166  //sr.trigPrimBypassMode_[0] = ps.getParameter<int >("trigPrimBypassMode");
167  //sr.trigPrimBypassLTH_.resize(1);
168  //sr.trigPrimBypassLTH_[0] = ps.getParameter<double >("trigPrimBypassLTH");
169  //sr.trigPrimBypassHTH_.resize(1);
170  //sr.trigPrimBypassHTH_[0] = ps.getParameter<double >("trigPrimBypassHTH");
171  //sr.trigPrimBypassWithPeakFinder_.resize(1);
172  //sr.trigPrimBypassWithPeakFinder_[0] = ps.getParameter<bool >("trigPrimBypassWithPeakFinder");
173  //sr.defaultTtf_.resize(1);
174  //sr.defaultTtf_[0] = ps.getParameter<int >("defaultTtf");
175  sr.actions_ = ps.getParameter<std::vector<int> >("actions");
176 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
T w() const
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.

◆ 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 178 of file EcalSRCondTools.cc.

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

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

◆ 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 458 of file EcalSRCondTools.cc.

458  {
459  //Fix sign bit in case only the 12 least significant bits of hwWeight were set
460  //(hardware reprensentation uses only 12 bits)
461  if (hwWeight & (1 << 11))
462  hwWeight |= ~0xEFF;
463  return hwWeight / 1024.;
464 }

◆ 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 token delimiters internal string position pointer. Must be set to zero before the first call

Definition at line 466 of file EcalSRCondTools.cc.

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

Referenced by importSrpConfigFile().

466  {
467  if (pos < 0)
468  return "";
469  int pos0 = pos;
470  int len = s.size();
471  //eats delimeters at beginning of the string
472  while (pos0 < len && find(delim.begin(), delim.end(), s[pos0]) != delim.end()) {
473  ++pos0;
474  }
475  if (pos0 == len)
476  return "";
477  pos = s.find_first_of(delim, pos0);
478  return s.substr(pos0, (pos > 0 ? pos : len) - pos0);
479 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19

◆ 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 481 of file EcalSRCondTools.cc.

References alignCSCRings::s.

Referenced by importSrpConfigFile().

481  {
482  std::string::size_type pos0 = s.find_first_not_of(" \t");
483  if (pos0 == string::npos) {
484  pos0 = 0;
485  }
486  string::size_type pos1 = s.find_last_not_of(" \t") + 1;
487  if (pos1 == string::npos) {
488  pos1 = pos0;
489  }
490  return s.substr(pos0, pos1 - pos0);
491 }
uint16_t size_type

Member Data Documentation

◆ done_

bool EcalSRCondTools::done_
private

Definition at line 78 of file EcalSRCondTools.h.

Referenced by analyze().

◆ hSrToken_

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

Definition at line 80 of file EcalSRCondTools.h.

Referenced by analyze(), and EcalSRCondTools().

◆ iomode_write_

bool EcalSRCondTools::iomode_write_
private

Definition at line 77 of file EcalSRCondTools.h.

Referenced by analyze(), and EcalSRCondTools().

◆ mode_

const std::string EcalSRCondTools::mode_
private

Definition at line 76 of file EcalSRCondTools.h.

Referenced by analyze(), and EcalSRCondTools().

◆ ps_

const edm::ParameterSet EcalSRCondTools::ps_
private

Definition at line 74 of file EcalSRCondTools.h.

Referenced by analyze().

◆ tpgPhysicsConstToken_

edm::ESGetToken<EcalTPGPhysicsConst, EcalTPGPhysicsConstRcd> EcalSRCondTools::tpgPhysicsConstToken_
private

Definition at line 81 of file EcalSRCondTools.h.

Referenced by analyze(), and EcalSRCondTools().