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(_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(kUnknown);
130  } else
131  multi->reset(-1.);
132  }
133  } else {
134  if (meset->getKind() == MonitorElement::Kind::TH2F) {
135  meset->resetAll(-1.);
136  meset->reset(kUnknown);
137  } else
138  meset->reset(-1.);
139  }
140  } else
141  meset->reset();
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());
163  for (MESet::iterator tItr(_target.beginChannel()); tItr != tEnd; tItr.toNextChannel()) {
164  DetId towerId(tItr->getId());
165 
166  std::vector<DetId> cryIds;
167  if (towerId.subdetId() == EcalTriggerTower)
169  else {
171  }
172 
173  if (cryIds.empty())
174  return;
175 
176  float mean(0.);
177  float nValid(0.);
178  bool masked(false);
179  for (unsigned iId(0); iId < cryIds.size(); ++iId) {
180  float content(_source.getBinContent(cryIds[iId]));
181  if (isQuality) {
182  if (content < 0. || content == 2.)
183  continue;
184  if (content == 5.)
185  masked = true;
186  else {
187  nValid += 1;
188  if (content > 2.) {
189  masked = true;
190  mean += content - 3.;
191  } else
192  mean += content;
193  }
194  } else {
195  mean += content;
196  nValid += 1.;
197  }
198  }
199 
200  if (isQuality) {
201  if (nValid < 1.)
202  tItr->setBinContent(masked ? 5. : 2.);
203  else {
204  mean /= nValid;
205  if (mean < _threshold)
206  tItr->setBinContent(masked ? 3. : 0.);
207  else
208  tItr->setBinContent(masked ? 4. : 1.);
209  }
210  } else
211  tItr->setBinContent(nValid < 1. ? 0. : mean / nValid);
212  }
213  }
214 
215 } // 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:24
ecaldqm::DQWorkerClient::fillDescriptions
static void fillDescriptions(edm::ParameterSetDescription &)
Definition: DQWorkerClient.cc:21
ecaldqm::DQWorker::name_
std::string name_
Definition: DQWorker.h:77
edm::ParameterWildcard
Definition: ParameterWildcard.h:23
ecaldqm::MESetCollection::const_iterator
MESetColletionType::const_iterator const_iterator
Definition: MESet.h:348
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
MESetChannel.h
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
l1extraParticles_cfi._params
_params
Definition: l1extraParticles_cfi.py:29
ecaldqm::MESet::end
virtual const_iterator end() const
Definition: MESet.h:321
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:66
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:58
ecaldqm::DQWorker::releaseMEs
virtual void releaseMEs()
Definition: DQWorker.cc:60
MonitorElementData::Kind::TH2F
ecaldqm::DQWorker
Definition: DQWorker.h:28
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
DetId
Definition: DetId.h:17
ecaldqm::MESet::getBinContent
virtual double getBinContent(DetId const &, int=0) const
Definition: MESet.h:72
ecaldqm::MESetCollection::end
auto end() const
Definition: MESet.h:356
StatusManager.h
ecaldqm::DQWorkerClient::qualitySummaries_
std::set< std::string > qualitySummaries_
Definition: DQWorkerClient.h:56
EcalScDetId
Definition: EcalScDetId.h:24
ecaldqm::DQWorkerClient::ProcessType
ProcessType
Definition: DQWorkerClient.h:15
ecaldqm::DQWorker::fillDescriptions
static void fillDescriptions(edm::ParameterSetDescription &_desc)
Definition: DQWorker.cc:19
ecaldqm::MESet::iterator::toNextChannel
const_iterator & toNextChannel()
Definition: MESet.h:289
edm::ParameterSetDescription::addWildcardUntracked
ParameterWildcardBase * addWildcardUntracked(U const &pattern)
Definition: ParameterSetDescription.h:204
ParameterSetDescription.h
ecaldqm::DQWorkerClient::kLumi
Definition: DQWorkerClient.h:15
ecaldqm::DQWorkerClient::resetMEs
virtual void resetMEs()
Definition: DQWorkerClient.cc:113
ecaldqm::DQWorker::MEs_
MESetCollection MEs_
Definition: DQWorker.h:78
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ecaldqm::DQWorkerClient::kUnknown
Definition: DQWorkerClient.h:37
ecaldqm::DQWorker::onlineMode_
bool onlineMode_
Definition: DQWorker.h:85
ecaldqm::DQWorkerClient::sources_
MESetCollection sources_
Definition: DQWorkerClient.h:55
edm::ParameterSetDescription::addUntracked
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:100
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:350
ecaldqm::MESet::iterator
Definition: MESet.h:268
DQWorkerClient.h
ecaldqm::DQWorkerClient::DQWorkerClient
DQWorkerClient()
Definition: DQWorkerClient.cc:17
ecaldqm::MESetCollection::begin
auto begin()
Definition: MESet.h:355
trackerHitRTTI::multi
Definition: trackerHitRTTI.h:14
edm::EventSetup
Definition: EventSetup.h:57
ecaldqm::getTrigTowerMap
const EcalTrigTowerConstituentsMap * getTrigTowerMap()
Definition: EcalDQMCommonUtils.cc:458
ecaldqm::DQWorker::setME
virtual void setME(edm::ParameterSet const &)
Definition: DQWorker.cc:41
ecaldqm::scConstituents
std::vector< DetId > scConstituents(EcalScDetId const &)
Definition: EcalDQMCommonUtils.cc:173
ecaldqm::towerId
unsigned towerId(DetId const &)
Definition: EcalDQMCommonUtils.cc:79
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
MESetUtils.h
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
ecaldqm::MESet::beginChannel
virtual const_iterator beginChannel() const
Definition: MESet.h:323
Exception.h
ecaldqm::DQWorker::verbosity_
int verbosity_
Definition: DQWorker.h:82
MESetMulti.h
dqm::implementation::IBooker
Definition: DQMStore.h:43
ecaldqm::DQWorkerClient::resetPerLumi
void resetPerLumi()
Definition: DQWorkerClient.cc:145
ecaldqm::binning::kTrend
Definition: MESetBinningUtils.h:52
ecaldqm::MESetCollection::iterator
MESetColletionType::iterator iterator
Definition: MESet.h:347
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:27