Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

partial technical cleanup of DQMServices/StreamerIO/plugins #40420

Merged
merged 1 commit into from Jan 16, 2023

Conversation

missirol
Copy link
Contributor

@missirol missirol commented Jan 3, 2023

PR description:

This PR applies a partial technical cleanup of the classes in DQMServices/StreamerIO/plugins.

The initial goal was to remove unused class members (e.g.

runNumber_ = pset.getUntrackedParameter<unsigned int>("runNumber");
runInputDir_ = pset.getUntrackedParameter<std::string>("runInputDir");

); then, further technical changes were also included, mainly to clean up #include <header> directives, introduce some const correctness, simplify/modernise small portions of code, and limit (ab)use of using namespace calls.

Merely technical. No changes expected.

PR validation:

None.

If this PR is a backport, please specify the original PR and why you need to backport that PR. If this PR will be backported, please specify to which release cycle the backport is meant for:

N/A

@cmsbuild
Copy link
Contributor

cmsbuild commented Jan 3, 2023

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-40420/33548

  • This PR adds an extra 36KB to repository

@cmsbuild
Copy link
Contributor

cmsbuild commented Jan 3, 2023

A new Pull Request was created by @missirol (Marino Missiroli) for master.

It involves the following packages:

  • DQMServices/StreamerIO (dqm)

@emanueleusai, @ahmad3213, @cmsbuild, @syuvivida, @pmandrik, @micsucmed, @rvenditti can you please review it and eventually sign? Thanks.
@barvic this is something you requested to watch as well.
@perrotta, @dpiparo, @rappoccio you are the release manager for this.

cms-bot commands are listed here

@missirol
Copy link
Contributor Author

missirol commented Jan 3, 2023

please test

@cmsbuild
Copy link
Contributor

cmsbuild commented Jan 3, 2023

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-de3e18/29787/summary.html
COMMIT: d3c247c
CMSSW: CMSSW_13_0_X_2023-01-03-1100/el8_amd64_gcc11
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/40420/29787/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

  • No significant changes to the logs found
  • Reco comparison results: 8 differences found in the comparisons
  • DQMHistoTests: Total files compared: 49
  • DQMHistoTests: Total histograms compared: 3555748
  • DQMHistoTests: Total failures: 157
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 3555569
  • DQMHistoTests: Total skipped: 22
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 48 files compared)
  • Checked 211 log files, 162 edm output root files, 49 DQM output files
  • TriggerResults: no differences found

header->hltTriggerNames(tnames);

pset.addParameter<Strings>("SelectEvents", hltSel_);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realised I introduced a mistake here in d3c247c. Supposedly, the original code needed this because TriggerSelector expects a tracked vector<string> (same goes for the relevant ctor of EventSelector), i.e.

paths = config.getParameter<Strings>("SelectEvents");

: pathspecs_(config.empty() ? Strings() : initPathSpecs(config.getParameter<Strings>("SelectEvents"))),

On the other hand, the PSet of DQMStreamerReader provides an untracked vector<string> (guaranted by its fillDescriptions, afaiu).

This will be fixed in the next push with further cleanup (rather than by reverting this incorrect change).

eventSelector_.reset(new edm::EventSelector(pathspecs, names));
}

TriggerSelector::TriggerSelector(edm::ParameterSet const& config, Strings const& triggernames, bool old_)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ctor becomes unnecessary, and is thus removed. It was only used in

void DQMStreamerReader::openFileImp_(const DQMFileIterator::LumiEntry& entry) {

and this PR changes that to use the ctor TriggerSelector(Strings,..) instead.

Rationale: in the one case where TriggerSelector(ParameterSet,..) was used

TriggerSelector::TriggerSelector(edm::ParameterSet const& config, Strings const& triggernames, bool old_)

old_ == false (default value of argument) and config.empty() == false (because of
pset.addParameter<Strings>("SelectEvents", hltSel_);

), so what is used is
Strings paths;
paths = config.getParameter<Strings>("SelectEvents");
if (!paths.empty()) {
useOld_ = true;
eventSelector_.reset(new edm::EventSelector(config, triggernames));
return;
}

That is effectively equivalent to the TriggerSelector(Strings,..) ctor. There is slight difference between the two constructors: if paths.empty() == true, the PSet-based ctor uses acceptAll_ == true and does not create an EventSelector; on the other hand, the behavior is the same, because TriggerSelector(Strings,..) (the other ctor) would create an EventSelector with an empty pathspecs

eventSelector_.reset(new edm::EventSelector(pathspecs, names));

and in that case EventSelector will accept all events anyway (as one would naively expect)
: pathspecs_(initPathSpecs(pathspecs)),
results_from_current_process_(true),
accept_all_(initAcceptAll()),

bool EventSelector::initAcceptAll() {
if (pathspecs_.empty()) {
return true;
}

The added value of this cleanup is that (1) TriggerSelector becomes independent of ParameterSet, and (2) two static-analyzer warnings (use of catch(...)) are removed.

Comment on lines -32 to -39
try {
std::string myPath = trim(config.getParameter<std::string>("TriggerSelector"));
if (!myPath.empty()) {
init(myPath, triggernames);
return;
}
} catch (...) {
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A string configuration-parameter named TriggerSelector is not used anywhere in CMSSW, as far as I can see. Not sure if I need to worry about client code outside CMSSW in this case.

Comment on lines 75 to 80
: EventSelector(
[&config]() {
auto const& pset = config.getUntrackedParameterSet("SelectEvents");
return (pset.empty() ? Strings() : pset.getParameter<Strings>("SelectEvents"));
}(),
pathNames) {}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tentatively added ecb204a, because I noticed that the PSet-based constructor of EventSelector is somewhat inconsistent with its fillDescription method (the latter defines SelectEvents.SelectEvents, while the ctor expects SelectEvents). This required small changes to 3 FWCore unit tests. With this PR, the PSet-based ctor of EventSelector would not be used anywhere, I think (outside those unit tests), so it could even be removed. To be clear, ecb204a is not necessary for this PR, so I could remove it if preferred.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On a quick look I agree that with this PR the PSet-based constructor of EventSelector becomes unused (besides the unit tests). My preference would be to just remove it (probably cleaner to do in a separate PR). Thanks!

Copy link
Contributor Author

@missirol missirol Jan 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I will remove ecb204a from this PR, to keep it 'DQM only' (although I could use review comments on this PR too, e.g. #40420 (comment)), and I'll open a separate PR for the small changes in FWCore.

Edit: done in #40432.

Comment on lines -118 to +116
} catch (...) {
// pass
} catch (std::exception const& exc) {
LogDebug("DQMMonitoringService") << "Exception thrown in outputUpdate method: " << exc.what();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more static-analyzer warning (catch(...)) is coming from here, but I'm not sure how to fix this one. The change in 3de6025 is tentative, and I welcome feedback.

@cmsbuild
Copy link
Contributor

cmsbuild commented Jan 5, 2023

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-40420/33565

  • This PR adds an extra 52KB to repository

@cmsbuild
Copy link
Contributor

cmsbuild commented Jan 5, 2023

Pull request #40420 was updated. @smuzaffar, @Dr15Jones, @makortel, @emanueleusai, @ahmad3213, @cmsbuild, @syuvivida, @pmandrik, @micsucmed, @rvenditti can you please check and sign again.

@cmsbuild
Copy link
Contributor

cmsbuild commented Jan 5, 2023

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-40420/33570

  • This PR adds an extra 36KB to repository

@cmsbuild
Copy link
Contributor

cmsbuild commented Jan 5, 2023

Pull request #40420 was updated. @emanueleusai, @ahmad3213, @cmsbuild, @syuvivida, @pmandrik, @micsucmed, @rvenditti can you please check and sign again.

@missirol
Copy link
Contributor Author

@cms-sw/dqm-l2, could you please review this PR? Thanks!

@emanueleusai
Copy link
Member

please test

@cmsbuild
Copy link
Contributor

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-de3e18/29956/summary.html
COMMIT: 5f0af33
CMSSW: CMSSW_13_0_X_2023-01-12-2300/el8_amd64_gcc11
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/40420/29956/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

  • No significant changes to the logs found
  • Reco comparison results: 9 differences found in the comparisons
  • DQMHistoTests: Total files compared: 49
  • DQMHistoTests: Total histograms compared: 3555538
  • DQMHistoTests: Total failures: 6
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 3555510
  • DQMHistoTests: Total skipped: 22
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 48 files compared)
  • Checked 211 log files, 162 edm output root files, 49 DQM output files
  • TriggerResults: no differences found

@emanueleusai
Copy link
Member

+1

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @perrotta, @dpiparo, @rappoccio (and backports should be raised in the release meeting by the corresponding L2)

@rappoccio
Copy link
Contributor

+1

@cmsbuild cmsbuild merged commit a0ac635 into cms-sw:master Jan 16, 2023
@missirol missirol deleted the devel_dqmStreamerCleanup branch January 16, 2023 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants