CMS 3D CMS Logo

DQWorkerClient.cc
Go to the documentation of this file.
2 
8 
13 
14 #include <sstream>
15 
16 namespace ecaldqm {
18  : DQWorker(), sources_(), qualitySummaries_(), hasLumiPlots_(false), statusManager_(nullptr) {}
19 
20  /*static*/
23  _desc.addWildcardUntracked<std::vector<std::string> >("*");
24 
25  edm::ParameterSetDescription sourceParameters;
26  edm::ParameterSetDescription sourceNodeParameters;
27  fillMESetDescriptions(sourceNodeParameters);
28  sourceParameters.addNode(
30  _desc.addUntracked("sources", sourceParameters);
31  }
32 
34  DQWorker::setME(_ps);
35 
36  // Flags the Client ME to run as lumibased:
37  // In offline mode will save the ME client at the end of the LS
38  // See: EcalDQMonitorClient::dqmEndLuminosityBlock
39  for (auto& mItr : MEs_) {
40  if (mItr.second->getLumiFlag()) {
41  hasLumiPlots_ = true;
42  break;
43  }
44  }
45  }
46 
48  std::vector<std::string> const& sourceNames(_params.getParameterNames());
49 
50  for (unsigned iS(0); iS < sourceNames.size(); iS++) {
51  std::string name(sourceNames[iS]);
52  edm::ParameterSet const& params(_params.getUntrackedParameterSet(name));
53 
54  if (onlineMode_ && params.getUntrackedParameter<bool>("online"))
55  continue;
56 
58  }
59 
60  if (verbosity_ > 1) {
61  std::stringstream ss;
62  ss << name_ << ": Using ";
63  for (MESetCollection::const_iterator sItr(sources_.begin()); sItr != sources_.end(); ++sItr)
64  ss << sItr->first << " ";
65  ss << "as sources";
66  edm::LogInfo("EcalDQM") << ss.str();
67  }
68  }
69 
71 // MESetChannel class removed until concurrency issue is finalized
72 #if 0
73  for(MESetCollection::iterator sItr(sources_.begin()); sItr != sources_.end(); ++sItr){
74  if(!sItr->second->getLumiFlag()) continue;
75  MESetChannel const* channel(dynamic_cast<MESetChannel const*>(sItr->second));
76  if(channel) channel->checkDirectory();
77  }
78 #endif
79  }
80 
82  DQWorker::bookMEs(_ibooker);
83  resetMEs();
84  }
85 
88  releaseSource();
89  }
90 
92  for (MESetCollection::iterator sItr(sources_.begin()); sItr != sources_.end(); ++sItr)
93  sItr->second->clear();
94  }
95 
97  std::string failedPath;
98  for (MESetCollection::iterator sItr(sources_.begin()); sItr != sources_.end(); ++sItr) {
99  if (!onlineMode_ && _type == kLumi && !sItr->second->getLumiFlag())
100  continue;
101  if (verbosity_ > 1)
102  edm::LogInfo("EcalDQM") << name_ << ": Retrieving source " << sItr->first;
103  if (!sItr->second->retrieve(GetElectronicsMap(), _igetter, &failedPath)) {
104  if (verbosity_ > 1)
105  edm::LogWarning("EcalDQM") << name_ << ": Could not find source " << sItr->first << "@" << failedPath;
106  return false;
107  }
108  }
109 
110  return true;
111  }
112 
114  for (auto& mItr : MEs_) {
115  MESet* meset(mItr.second.get());
116 
117  // Protects Trend-type Client MEs from being reset at the end of the LS
118  // See: EcalDQMonitorClient::runWorkers
119  if (meset->getBinType() == ecaldqm::binning::kTrend)
120  continue;
121 
122  if (qualitySummaries_.find(mItr.first) != qualitySummaries_.end()) {
123  MESetMulti* multi(dynamic_cast<MESetMulti*>(meset));
124  if (multi) {
125  for (unsigned iS(0); iS < multi->getMultiplicity(); ++iS) {
126  multi->use(iS);
127  if (multi->getKind() == MonitorElement::Kind::TH2F) {
128  multi->resetAll(-1.);
129  multi->reset(GetElectronicsMap(), kUnknown);
130  } else
131  multi->reset(GetElectronicsMap(), -1.);
132  }
133  } else {
134  if (meset->getKind() == MonitorElement::Kind::TH2F) {
135  meset->resetAll(-1.);
136  meset->reset(GetElectronicsMap(), kUnknown);
137  } else
138  meset->reset(GetElectronicsMap(), -1.);
139  }
140  } else
141  meset->reset(GetElectronicsMap());
142  }
143  }
144 
146  for (auto const& meset : MEs_) {
147  int i = 0;
148  while (auto me = meset.second->getME(i)) {
149  if (me->getLumiFlag()) {
150  // reset per-lumi histograms in offline harvesting so that they only show
151  // data of the current lumisection.
152  me->Reset();
153  }
154  i++;
155  }
156  }
157  }
158 
159  void DQWorkerClient::towerAverage_(MESet& _target, MESet const& _source, float _threshold) {
160  bool isQuality(_threshold > 0.);
161 
162  MESet::iterator tEnd(_target.end(GetElectronicsMap()));
163  for (MESet::iterator tItr(_target.beginChannel(GetElectronicsMap())); tItr != tEnd;
165  DetId towerId(tItr->getId());
166 
167  std::vector<DetId> cryIds;
168  if (towerId.subdetId() == EcalTriggerTower)
170  else {
172  }
173 
174  if (cryIds.empty())
175  return;
176 
177  float mean(0.);
178  float nValid(0.);
179  bool masked(false);
180  for (unsigned iId(0); iId < cryIds.size(); ++iId) {
181  float content(_source.getBinContent(getEcalDQMSetupObjects(), cryIds[iId]));
182  if (isQuality) {
183  if (content < 0. || content == 2.)
184  continue;
185  if (content == 5.)
186  masked = true;
187  else {
188  nValid += 1;
189  if (content > 2.) {
190  masked = true;
191  mean += content - 3.;
192  } else
193  mean += content;
194  }
195  } else {
196  mean += content;
197  nValid += 1.;
198  }
199  }
200 
201  if (isQuality) {
202  if (nValid < 1.)
203  tItr->setBinContent(masked ? 5. : 2.);
204  else {
205  mean /= nValid;
206  if (mean < _threshold)
207  tItr->setBinContent(masked ? 3. : 0.);
208  else
209  tItr->setBinContent(masked ? 4. : 1.);
210  }
211  } else
212  tItr->setBinContent(nValid < 1. ? 0. : mean / nValid);
213  }
214  }
215 
216 } // namespace ecaldqm
ecaldqm::DQWorkerClient::setSource
void setSource(edm::ParameterSet const &) override
Definition: DQWorkerClient.cc:47
ecaldqm::DQWorkerClient::setME
void setME(edm::ParameterSet const &_ps) final
Definition: DQWorkerClient.cc:33
mps_fire.i
i
Definition: mps_fire.py:428
ecaldqm::DQWorkerClient::retrieveSource
bool retrieveSource(DQMStore::IGetter &, ProcessType)
Definition: DQWorkerClient.cc:96
MessageLogger.h
SiStripPI::mean
Definition: SiStripPayloadInspectorHelper.h:169
funct::false
false
Definition: Factorize.h:29
ecaldqm
Definition: DQWorker.h:37
ecaldqm::DQWorkerClient::fillDescriptions
static void fillDescriptions(edm::ParameterSetDescription &)
Definition: DQWorkerClient.cc:21
ecaldqm::MESet::iterator::toNextChannel
const_iterator & toNextChannel(EcalElectronicsMapping const *electronicsMap)
Definition: MESet.h:320
ecaldqm::DQWorker::name_
std::string name_
Definition: DQWorker.h:124
edm::ParameterWildcard
Definition: ParameterWildcard.h:23
ecaldqm::MESetCollection::const_iterator
MESetColletionType::const_iterator const_iterator
Definition: MESet.h:385
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
ecaldqm::fillMESetDescriptions
void fillMESetDescriptions(edm::ParameterSetDescription &)
Definition: MESetUtils.cc:144
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
ecaldqm::MESet::getBinContent
virtual double getBinContent(EcalDQMSetupObjects const, DetId const &, int=0) const
Definition: MESet.h:100
MESetChannel.h
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
l1extraParticles_cfi._params
_params
Definition: l1extraParticles_cfi.py:29
ecaldqm::DQWorkerClient::endLuminosityBlock
void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
Definition: DQWorkerClient.cc:70
ecaldqm::DQWorker::bookMEs
virtual void bookMEs(DQMStore::IBooker &)
Definition: DQWorker.cc:96
EcalTrigTowerDetId
Definition: EcalTrigTowerDetId.h:14
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
ecaldqm::DQWorkerClient::bookMEs
void bookMEs(DQMStore::IBooker &) override
Definition: DQWorkerClient.cc:81
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
ecaldqm::DQWorkerClient::hasLumiPlots_
bool hasLumiPlots_
Definition: DQWorkerClient.h:65
ecaldqm::DQWorker::GetElectronicsMap
const EcalElectronicsMapping * GetElectronicsMap()
Definition: DQWorker.cc:118
ecaldqm::DQWorker::releaseMEs
virtual void releaseMEs()
Definition: DQWorker.cc:90
ecaldqm::towerId
unsigned towerId(DetId const &, EcalElectronicsMapping const *)
Definition: EcalDQMCommonUtils.cc:77
MonitorElementData::Kind::TH2F
ecaldqm::DQWorker
Definition: DQWorker.h:41
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
DetId
Definition: DetId.h:17
ecaldqm::MESetCollection::end
auto end() const
Definition: MESet.h:393
StatusManager.h
ecaldqm::DQWorkerClient::qualitySummaries_
std::set< std::string > qualitySummaries_
Definition: DQWorkerClient.h:63
EcalScDetId
Definition: EcalScDetId.h:24
ecaldqm::DQWorkerClient::ProcessType
ProcessType
Definition: DQWorkerClient.h:19
ecaldqm::DQWorker::fillDescriptions
static void fillDescriptions(edm::ParameterSetDescription &_desc)
Definition: DQWorker.cc:37
edm::ParameterSetDescription::addWildcardUntracked
ParameterWildcardBase * addWildcardUntracked(U const &pattern)
Definition: ParameterSetDescription.h:204
ecaldqm::DQWorker::GetTrigTowerMap
const EcalTrigTowerConstituentsMap * GetTrigTowerMap()
Definition: DQWorker.cc:124
ParameterSetDescription.h
ecaldqm::DQWorkerClient::kLumi
Definition: DQWorkerClient.h:19
ecaldqm::DQWorkerClient::resetMEs
virtual void resetMEs()
Definition: DQWorkerClient.cc:113
ecaldqm::DQWorker::MEs_
MESetCollection MEs_
Definition: DQWorker.h:125
ecaldqm::DQWorkerClient::kUnknown
Definition: DQWorkerClient.h:44
ecaldqm::DQWorker::onlineMode_
bool onlineMode_
Definition: DQWorker.h:132
ecaldqm::DQWorkerClient::sources_
MESetCollection sources_
Definition: DQWorkerClient.h:62
edm::ParameterSetDescription::addUntracked
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:100
ecaldqm::MESet::end
virtual const_iterator end(EcalElectronicsMapping const *electronicsMap) const
Definition: MESet.h:354
Skims_PA_cff.content
content
Definition: Skims_PA_cff.py:19
edm::ParameterSet
Definition: ParameterSet.h:47
ecaldqm::MESetMulti
Definition: MESetMulti.h:13
ecaldqm::MESetCollection::insert
void insert(const std::string &key, MESet *ptr)
Definition: MESet.h:387
ecaldqm::MESet::iterator
Definition: MESet.h:297
DQWorkerClient.h
ecaldqm::DQWorkerClient::DQWorkerClient
DQWorkerClient()
Definition: DQWorkerClient.cc:17
ecaldqm::MESetCollection::begin
auto begin()
Definition: MESet.h:392
trackerHitRTTI::multi
Definition: trackerHitRTTI.h:14
edm::EventSetup
Definition: EventSetup.h:58
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ecaldqm::DQWorker::setME
virtual void setME(edm::ParameterSet const &)
Definition: DQWorker.cc:71
ecaldqm::scConstituents
std::vector< DetId > scConstituents(EcalScDetId const &)
Definition: EcalDQMCommonUtils.cc:173
ecaldqm::DQWorker::getEcalDQMSetupObjects
const EcalDQMSetupObjects getEcalDQMSetupObjects()
Definition: DQWorker.cc:142
EcalTriggerTower
Definition: EcalSubdetector.h:10
EcalTrigTowerConstituentsMap::constituentsOf
std::vector< DetId > constituentsOf(const EcalTrigTowerDetId &id) const
Get the constituent detids for this tower id.
Definition: EcalTrigTowerConstituentsMap.cc:162
ecaldqm::createMESet
MESet * createMESet(edm::ParameterSet const &)
Definition: MESetUtils.cc:18
dqm::implementation::IGetter
Definition: DQMStore.h:484
ecaldqm::DQWorkerClient::towerAverage_
void towerAverage_(MESet &, MESet const &, float)
Definition: DQWorkerClient.cc:159
ecaldqm::DQWorkerClient::releaseMEs
void releaseMEs() override
Definition: DQWorkerClient.cc:86
ecaldqm::MESet::beginChannel
virtual const_iterator beginChannel(EcalElectronicsMapping const *electronicsMap) const
Definition: MESet.h:358
MESetUtils.h
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
Exception.h
ecaldqm::DQWorker::verbosity_
int verbosity_
Definition: DQWorker.h:129
MESetMulti.h
dqm::implementation::IBooker
Definition: DQMStore.h:43
ecaldqm::DQWorkerClient::resetPerLumi
void resetPerLumi()
Definition: DQWorkerClient.cc:145
ecaldqm::binning::kTrend
Definition: MESetBinningUtils.h:53
ecaldqm::MESetCollection::iterator
MESetColletionType::iterator iterator
Definition: MESet.h:384
ParameterSet.h
hlt_dqm_clientPB-live_cfg.me
me
Definition: hlt_dqm_clientPB-live_cfg.py:61
edm::RequireZeroOrMore
Definition: ParameterWildcardBase.h:17
edm::Log
Definition: MessageLogger.h:70
ecaldqm::DQWorkerClient::releaseSource
void releaseSource()
Definition: DQWorkerClient.cc:91
EcalDQMCommonUtils.h
ecaldqm::MESet
Definition: MESet.h:42