CMS 3D CMS Logo

MESetUtils.cc
Go to the documentation of this file.
2 
12 
15 
16 namespace ecaldqm {
18  MESet *createMESet(edm::ParameterSet const &_MEParam) {
23 
25  bool hasXaxis(_MEParam.existsAs<edm::ParameterSet>("xaxis", false));
26  if (hasXaxis)
28  bool hasYaxis(_MEParam.existsAs<edm::ParameterSet>("yaxis", false));
29  if (hasYaxis)
31  bool hasZaxis(_MEParam.existsAs<edm::ParameterSet>("zaxis", false));
32  if (hasZaxis)
34 
35  MESet *set(nullptr);
36 
37  if (btype == binning::kTrend) {
38  MESetTrend *setTrend(new MESetTrend(path, otype, btype, kind, hasYaxis ? &yaxis : nullptr));
39  if (_MEParam.existsAs<bool>("minutely", false) && _MEParam.getUntrackedParameter<bool>("minutely"))
40  setTrend->setMinutely();
41  if (_MEParam.existsAs<bool>("cumulative", false) && _MEParam.getUntrackedParameter<bool>("cumulative"))
42  setTrend->setCumulative();
43  if (_MEParam.existsAs<bool>("shiftAxis", false) && _MEParam.getUntrackedParameter<bool>("shiftAxis"))
44  setTrend->setShiftAxis();
45  set = setTrend;
46  } else if (otype == binning::nObjType)
47  set = new MESetNonObject(path,
48  otype,
49  btype,
50  kind,
51  hasXaxis ? &xaxis : nullptr,
52  hasYaxis ? &yaxis : nullptr,
53  hasZaxis ? &zaxis : nullptr);
54  else if (otype == binning::kChannel)
55 // Class removed until concurrency issue is finalized
56 #if 0
57  set = new MESetChannel(path, otype, btype, kind);
58 #else
59  set = nullptr;
60 #endif
61  else if (btype == binning::kProjEta || btype == binning::kProjPhi) set =
62  new MESetProjection(path, otype, btype, kind, hasYaxis ? &yaxis : nullptr);
63  else {
64  unsigned logicalDimensions(-1);
65  switch (kind) {
67  logicalDimensions = 0;
68  break;
71  logicalDimensions = 1;
72  break;
75  logicalDimensions = 2;
76  break;
77  default:
78  break;
79  }
80 
81  // example case: Ecal/TriggerPrimitives/EmulMatching/TrigPrimTask matching
82  // index
83  if (logicalDimensions == 2 && hasYaxis && btype != binning::kUser)
84  logicalDimensions = 1;
85 
86  if (logicalDimensions > 2 || (btype == binning::kReport && logicalDimensions != 0))
87  throw cms::Exception("InvalidConfiguration") << "Cannot create MESet at " << path;
88 
89  if (btype == binning::kUser)
90  set = new MESetEcal(path,
91  otype,
92  btype,
93  kind,
94  logicalDimensions,
95  hasXaxis ? &xaxis : nullptr,
96  hasYaxis ? &yaxis : nullptr,
97  hasZaxis ? &zaxis : nullptr);
98  else if (logicalDimensions == 0)
99  set = new MESetDet0D(path, otype, btype, kind);
100  else if (logicalDimensions == 1)
101  set = new MESetDet1D(path, otype, btype, kind, hasYaxis ? &yaxis : nullptr);
102  else if (logicalDimensions == 2)
103  set = new MESetDet2D(path, otype, btype, kind, hasZaxis ? &zaxis : nullptr);
104  }
105 
106  if (_MEParam.existsAs<edm::ParameterSet>("multi", false)) {
107  typedef std::vector<std::string> VString;
108 
109  edm::ParameterSet const &multiParams(_MEParam.getUntrackedParameterSet("multi"));
110  VString replacementNames(multiParams.getParameterNames());
111  if (replacementNames.empty())
112  throw cms::Exception("InvalidConfiguration") << "0 multiplicity for MESet at " << path;
113 
115  for (unsigned iD(0); iD != replacementNames.size(); ++iD) {
116  VString reps;
117  if (multiParams.existsAs<VString>(replacementNames[iD], false))
118  reps = multiParams.getUntrackedParameter<VString>(replacementNames[iD]);
119  else if (multiParams.existsAs<std::vector<int>>(replacementNames[iD], false)) {
120  std::vector<int> repInts(multiParams.getUntrackedParameter<std::vector<int>>(replacementNames[iD]));
121  for (unsigned iR(0); iR != repInts.size(); ++iR)
122  reps.push_back(std::to_string(repInts[iR]));
123  }
124 
125  if (reps.empty())
126  throw cms::Exception("InvalidConfiguration") << "0 multiplicity for MESet at " << path;
127 
128  candidates[replacementNames[iD]] = reps;
129  }
130  MESetMulti *multi(new MESetMulti(*set, candidates));
131  delete set;
132  set = multi;
133  }
134 
135  if (!set)
136  throw cms::Exception("InvalidConfiguration") << "MESet " << path << " could not be initialized";
137 
138  if (_MEParam.getUntrackedParameter<bool>("perLumi"))
139  set->setLumiFlag();
140 
141  return set;
142  }
143 
145  _desc.addUntracked<std::string>("path");
146  _desc.addUntracked<std::string>("kind");
147  _desc.addUntracked<std::string>("otype");
148  _desc.addUntracked<std::string>("btype");
149  _desc.addUntracked<std::string>("description");
150  _desc.addUntracked<bool>("online", false);
151  _desc.addUntracked<bool>("perLumi", false);
152  _desc.addOptionalUntracked<bool>("minutely");
153  _desc.addOptionalUntracked<bool>("cumulative");
154  _desc.addOptionalUntracked<bool>("shiftAxis");
155 
156  edm::ParameterSetDescription axisParameters;
157  binning::fillAxisDescriptions(axisParameters);
158  _desc.addOptionalUntracked("xaxis", axisParameters);
159  _desc.addOptionalUntracked("yaxis", axisParameters);
160  _desc.addOptionalUntracked("zaxis", axisParameters);
161 
162  edm::ParameterSetDescription multiParameters;
163  multiParameters.addWildcardUntracked<std::vector<std::string>>("*");
164  multiParameters.addWildcardUntracked<std::vector<int>>("*");
165  _desc.addOptionalUntracked("multi", multiParameters);
166  }
167 } // namespace ecaldqm
ecaldqm
Definition: DQWorker.h:24
edm::ParameterSet::getUntrackedParameterSet
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
Definition: ParameterSet.cc:2136
ecaldqm::fillMESetDescriptions
void fillMESetDescriptions(edm::ParameterSetDescription &)
Definition: MESetUtils.cc:144
MESetChannel.h
MonitorElementData::Kind::TH1F
ecaldqm::MESetEcal
Definition: MESetEcal.h:15
ecaldqm::MESetNonObject
Definition: MESetNonObject.h:7
ecaldqm::MESetDet1D
Definition: MESetDet1D.h:13
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
ecaldqm::binning::kProjEta
Definition: MESetBinningUtils.h:47
edm::ParameterSet::existsAs
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
TimingClient_cfi.yaxis
yaxis
Definition: TimingClient_cfi.py:52
dqm::reco::MonitorElement
dqm::impl::MonitorElement MonitorElement
Definition: MonitorElement.h:458
MESetProjection.h
LaserClient_cfi.zaxis
zaxis
Definition: LaserClient_cfi.py:91
edm::ParameterSetDescription::addOptionalUntracked
ParameterDescriptionBase * addOptionalUntracked(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:110
ecaldqm::binning::kReport
Definition: MESetBinningUtils.h:51
MonitorElementData::Kind::TH2F
ecaldqm::binning::kProjPhi
Definition: MESetBinningUtils.h:48
ecaldqm::MESetTrend
Definition: MESetTrend.h:12
ecaldqm::binning::translateObjectType
ObjectType translateObjectType(std::string const &)
Definition: MESetBinningUtils.cc:851
MESetDet0D.h
MESetEcal.h
edm::ParameterSetDescription::addWildcardUntracked
ParameterWildcardBase * addWildcardUntracked(U const &pattern)
Definition: ParameterSetDescription.h:204
ParameterSetDescription.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSetDescription::addUntracked
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:100
ecaldqm::MESetProjection
Definition: MESetProjection.h:12
edm::ParameterSet
Definition: ParameterSet.h:47
ecaldqm::MESetMulti
Definition: MESetMulti.h:13
ecaldqm::binning::ObjectType
ObjectType
Definition: MESetBinningUtils.h:17
MESetTrend.h
MonitorElementData::Kind
Kind
Definition: MonitorElementCollection.h:129
ecaldqm::binning::translateKind
dqm::legacy::MonitorElement::Kind translateKind(std::string const &)
Definition: MESetBinningUtils.cc:925
ecaldqm::MESetDet0D
Definition: MESetDet0D.h:13
MESetDet2D.h
ecaldqm::binning::AxisSpecs
Definition: MESetBinningUtils.h:72
trackerHitRTTI::multi
Definition: trackerHitRTTI.h:14
ecaldqm::MESetTrend::setShiftAxis
void setShiftAxis()
Definition: MESetTrend.h:42
CalibrationSummaryClient_cfi.kind
kind
Definition: CalibrationSummaryClient_cfi.py:37
ecaldqm::binning::kUser
Definition: MESetBinningUtils.h:50
ecaldqm::binning::translateBinningType
BinningType translateBinningType(std::string const &)
Definition: MESetBinningUtils.cc:896
ecaldqm::MESetTrend::setCumulative
void setCumulative()
Definition: MESetTrend.cc:171
CalibrationSummaryClient_cfi.btype
btype
Definition: CalibrationSummaryClient_cfi.py:39
ecaldqm::binning::formAxis
AxisSpecs formAxis(edm::ParameterSet const &)
Definition: MESetBinningUtils.cc:803
ecaldqm::MESetDet2D
Definition: MESetDet2D.h:11
CalibrationSummaryClient_cfi.otype
otype
Definition: CalibrationSummaryClient_cfi.py:38
MonitorElementData::Kind::TPROFILE2D
ecaldqm::createMESet
MESet * createMESet(edm::ParameterSet const &)
Definition: MESetUtils.cc:18
ecaldqm::binning::nObjType
Definition: MESetBinningUtils.h:37
HLT_FULL_cff.candidates
candidates
Definition: HLT_FULL_cff.py:55048
Exception
Definition: hltDiff.cc:246
MESetUtils.h
MESetMulti.h
MESetNonObject.h
MESetDet1D.h
ecaldqm::binning::fillAxisDescriptions
void fillAxisDescriptions(edm::ParameterSetDescription &)
Definition: MESetBinningUtils.cc:840
ecaldqm::binning::kTrend
Definition: MESetBinningUtils.h:52
cms::Exception
Definition: Exception.h:70
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
LaserClient_cfi.xaxis
xaxis
Definition: LaserClient_cfi.py:49
ParameterSet.h
ecaldqm::binning::BinningType
BinningType
Definition: MESetBinningUtils.h:40
ecaldqm::MESetTrend::setMinutely
void setMinutely()
Definition: MESetTrend.h:41
MonitorElementData::Kind::TPROFILE
MonitorElementData::Kind::REAL
ecaldqm::MESetMulti::ReplCandidates
std::map< std::string, std::vector< std::string > > ReplCandidates
Definition: MESetMulti.h:15
ecaldqm::binning::kChannel
Definition: MESetBinningUtils.h:36
ecaldqm::MESet
Definition: MESet.h:27