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

RPC-validation migration to use ESGetToken #33785

Merged
merged 1 commit into from
May 21, 2021

Conversation

jhgoh
Copy link
Contributor

@jhgoh jhgoh commented May 19, 2021

PR description:

This PR is for the migration of RPC validation modules to use the esConsumes, as described in the https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideHowToGetDataFromES#In_ED_module

Related issue: #31061

PR validation:

Minimal checks were done with runTheMatrix.py command with WF 1325.0

@andresib @mileva

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-33785/22756

  • This PR adds an extra 24KB to repository

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @jhgoh (Junghwan John Goh) for master.

It involves the following packages:

Validation/MuonRPCDigis
Validation/RPCRecHits

@andrius-k, @kmaeshima, @ErnestaP, @ahmad3213, @cmsbuild, @jfernan2, @rvenditti can you please review it and eventually sign? Thanks.
@silviodonato, @dpiparo, @qliphy you are the release manager for this.

cms-bot commands are listed here

@@ -31,6 +29,9 @@ RPCRecHitValid::RPCRecHitValid(const edm::ParameterSet &pset) {
muonToken_ = consumes<reco::MuonCollection>(pset.getParameter<edm::InputTag>("muon"));

subDir_ = pset.getParameter<std::string>("subDir");

rpcGeomToken_ = esConsumes();
rpcGeomTokenInRun_ = esConsumes<edm::Transition::BeginRun>();
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure why you need here a Transition since bookHistograms are not a real beginRun, though MEs are booked at the beginning, I guess it does not harm

Copy link
Contributor

Choose a reason for hiding this comment

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

@makortel since bookHistograms is not a genuine beginRun function, could this type of lines (or its omision) introduce differences in MEs when the code is run in the multi-thread case? Thanks

Copy link
Contributor

Choose a reason for hiding this comment

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

bookHistograms() is called from beginRun() so framework sees it as code run at beginRun and therefore BeginRun transition is correct. Framework throws an exception if the token is used in a different transition than the consumes was declared for.

Copy link
Contributor

Choose a reason for hiding this comment

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

And the other way around? I mean, if BeginRun transition is set (but not needed) instead of a simple esConsumes() is set, would it harm? Harm = likely to produce wrong results?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure I understand what you mean with "if BeginRun transition is set but not needed". The default transition for esConsumes is Event transition (i.e. in analyze()/produce()/filter()). Using a token declared for BeginRun transition at Event transitions (or vice versa) leads to an exception.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks, understood!

@@ -355,8 +355,7 @@ void RPCRecHitValid::analyze(const edm::Event &event, const edm::EventSetup &eve
h_eventCount->Fill(1);

// Get the RPC Geometry
edm::ESHandle<RPCGeometry> rpcGeom;
eventSetup.get<MuonGeometryRecord>().get(rpcGeom);
auto rpcGeom = eventSetup.getHandle(rpcGeomToken_);
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure why two exact geometries are needed in the class, couldn't we recycle them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no problem to make a member variable for a cache, to keep the pointer to the geometry taken at the bookHistogram().

Actually, from the sentence in the twiki page, I assumed values are taken from a cache, probably I misunderstand.

Behind the scenes, the EventSetup system only runs the algorithm used to create the data in a Record the first time that data is requested after a Record has changed its IOV. All subsequent requests will get the cached value.

A fix is made in my local branch and small test is ongoing.

Copy link
Contributor

@makortel makortel May 20, 2021

Choose a reason for hiding this comment

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

EventSetup system indeed caches the products, and the overhead of getting it again for each event is negligible. Getting the products directly from EventSetup on each necessary transition is the best general pattern as developer does not have to assume anything about the IOVs of the concerned EventSetup Records. (imagine taking a pointer at beginRun for a product that changes at lumi boundaries)

@jfernan2
Copy link
Contributor

please test

@cmsbuild
Copy link
Contributor

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-ddfd9f/15203/summary.html
COMMIT: 677cb9f
CMSSW: CMSSW_12_0_X_2021-05-19-2300/slc7_amd64_gcc900
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/33785/15203/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: 7 differences found in the comparisons
  • DQMHistoTests: Total files compared: 37
  • DQMHistoTests: Total histograms compared: 2648902
  • DQMHistoTests: Total failures: 12
  • DQMHistoTests: Total nulls: 1
  • DQMHistoTests: Total successes: 2648867
  • DQMHistoTests: Total skipped: 22
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.004 KiB( 36 files compared)
  • DQMHistoSizes: changed ( 312.0 ): 0.004 KiB MessageLogger/Warnings
  • Checked 155 log files, 37 edm output root files, 37 DQM output files
  • TriggerResults: no differences found

@jfernan2
Copy link
Contributor

+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. @silviodonato, @dpiparo, @qliphy (and backports should be raised in the release meeting by the corresponding L2)

@qliphy
Copy link
Contributor

qliphy commented May 21, 2021

+1

@jhgoh jhgoh deleted the MigrateESGetTokenRPCValidation branch May 31, 2021 07:22
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