-
Notifications
You must be signed in to change notification settings - Fork 4.4k
move online beam spot arbitration to the edproducer #47378
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
Conversation
cms-bot internal usage |
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-47378/43735
|
A new Pull Request was created by @lguzzi for master. It involves the following packages:
@Martin-Grunewald, @antoniovagnerini, @antoniovilela, @atpathak, @cmsbuild, @consuegs, @davidlange6, @fabiocos, @francescobrivio, @jfernan2, @mandrenguyen, @mmusich, @perrotta, @rappoccio, @rseidita can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for tackling this issue. I left a couple of comments as a non-expert.
@@ -12,7 +12,10 @@ ________________________________________________________________**/ | |||
|
|||
#include "CondFormats/BeamSpotObjects/interface/BeamSpotObjects.h" | |||
#include "CondFormats/DataRecord/interface/BeamSpotObjectsRcd.h" | |||
#include "CondFormats/BeamSpotObjects/interface/BeamSpotOnlineObjects.h" | |||
#include "CondFormats/DataRecord/interface/BeamSpotTransientObjectsRcd.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this (and any refs to "transient") be removed from this file ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, does the BeamSpotTransientObjectsRcd
still serve any purpose after this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well at DQM we are still using the ESProducer for the monitoring plots (we could in principle change that code to take the EDProducer actually). In fact, now that I think about it, we should also check the code that is run at HLT for the monitorElements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well at DQM we are still using the ESProducer for the monitoring plots
which DQM? this PR seems to have removed it from the clients:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line has been removed
@@ -114,10 +114,6 @@ | |||
# process.dqmSaverPB.tag = 'OnlineBeamMonitor' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(The comment is not on this line specifically, but it applies to this file.)
This DQM config and the HLT menu used online both include an instance of the plugin OnlineBeamMonitor
. Does the latter need any updates in light of this PR ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so.
Who produces this product now
if (auto bsTransientHandle = iSetup.getHandle(bsTransientToken_)) { |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So , as I was writing before, both at HLT and in DQM that module is run. In DQM the configuration may still have the ESProducer, at HLT if nobody has changed the menu in confDB the ESProducer is still present.
Of course it would be better to modify the code of the OnlineBeamMonitor.cc to access the beam spot through the EDProducer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at HLT if nobody has changed the menu in confDB the ESProducer is still present.
but this assumption is incorrect. The customization function here (proposed in this very PR) removes it:
cmssw/HLTrigger/Configuration/python/customizeHLTforCMSSW.py
Lines 161 to 162 in fa5f00f
for esprod in list(esproducers_by_type(process, "OnlineBeamSpotESProducer")): | |
delattr(process, esprod.label()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't actually think about the DQM monitoring plots. I can leave it in the menu if it is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can leave it in the menu if it is needed.
I'd rather remove it and change the monitoring module, such that we monitor the same mechanism we use when running the HLT.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the online beam monitor has been updated to fetch information from the hlt collection instead of the transient record. This is done at the first event of each lumisection.
if (useTransientRecord_) { | ||
fallBackToDB = processTransientRecord(iSetup, *result, shoutMODE); | ||
if (useBSOnlineRecords_) { | ||
fallBackToDB = processRecords(iEvent, iSetup, *result, shoutMODE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the arbitration be done 1 time per lumisection, instead of 1 time per event ? (or, have you observed that the latter is not significantly slower than the former ?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If desired, the arbitration could also be done only when either BeamSpotOnlineLegacyObjectsRcd
or BeamSpotOnlineHLTObjectsRcd
(or both) have transitioned to their next IOV.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In principle the checks need to be repeated for each lumisection, because the records may become stale (older than timeThreshold
hours) at any moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that I don't really like that we cannot do these checks in an ESProducer
, and we have to implement them in an EDProducer
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the arbitration has been moved to beginLuminosityBlock.
@lguzzi try doing this: export CMS_PATH="/cvmfs/cms-ib.cern.ch"
export SITECONFIG_PATH="/cvmfs/cms-ib.cern.ch/SITECONF/local" before executing the |
auto const spotDBLegacy = getBeamSpotFromRecord(beamTokenLegacy_, iEvent, iSetup); | ||
auto const spotDBHLT = getBeamSpotFromRecord(beamTokenHLT_, iEvent, iSetup); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the BeamSpotOnlineObjects
objects copied (as opposed to passed by const reference) on purpose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, I thought there were no difference. I will change it to const&
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
if (useTransientRecord_) { | ||
fallBackToDB = processTransientRecord(iSetup, *result, shoutMODE); | ||
if (useBSOnlineRecords_) { | ||
fallBackToDB = processRecords(iEvent, iSetup, *result, shoutMODE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If desired, the arbitration could also be done only when either BeamSpotOnlineLegacyObjectsRcd
or BeamSpotOnlineHLTObjectsRcd
(or both) have transitioned to their next IOV.
test parameters:
|
thanks, all tests succeed now |
return false; // No fallback needed | ||
} | ||
|
||
void BeamSpotOnlineProducer::createBeamSpotFromTransient(const BeamSpotObjects& spotDB, reco::BeamSpot& result) const { | ||
template <typename TokenType> | ||
const BeamSpotOnlineObjects BeamSpotOnlineProducer::getBeamSpotFromRecord(const TokenType& token, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const BeamSpotOnlineObjects BeamSpotOnlineProducer::getBeamSpotFromRecord(const TokenType& token, | |
const BeamSpotOnlineObjects& BeamSpotOnlineProducer::getBeamSpotFromRecord(const TokenType& token, |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will add this in the next commit. It also requires modifications in the function body
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
const auto& bs = setup.getData(token); | ||
if (bs.sigmaZ() < sigmaZThreshold_ || bs.beamWidthX() < sigmaXYThreshold_ || bs.beamWidthY() < sigmaXYThreshold_ || | ||
bs.beamType() != reco::BeamSpot::Tracker) { | ||
return fakeBS_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the OnlineBeamSpotESProducer
we instrumented all the cases in which a fake BS is returned because of #45555, e.g. here:
cmssw/RecoVertex/BeamSpotProducer/plugins/OnlineBeamSpotESProducer.cc
Lines 166 to 168 in b8776f5
if (not legacyRec and not hltRec) { | |
edm::LogWarning("OnlineBeamSpotESProducer") | |
<< "None of the Beam Spots in ES are available! \n returning a fake one (fallback to PCL)."; |
or here
cmssw/RecoVertex/BeamSpotProducer/plugins/OnlineBeamSpotESProducer.cc
Lines 148 to 149 in b8776f5
edm::LogWarning("OnlineBeamSpotESProducer") << "Defaulting to fake (fallback to PCL) because the only payload " | |
"is either too old or does not pass the fit sanity checks"; |
please do the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added back the warnings when the record does not pass the sanity check or the time threshold, I do not know however how to replicate tryToGetRecord
if (spotDB.beamType() != 2) { | ||
if (shoutMODE && beamTransientRcdESWatcher_.check(iSetup)) { | ||
if (spotDB.beamType() != reco::BeamSpot::Tracker) { | ||
if (shoutMODE && (beamLegacyRcdESWatcher_.check(iSetup) || beamHLTRcdESWatcher_.check(iSetup))) { | ||
edm::LogWarning("BeamSpotOnlineProducer") | ||
<< "Online Beam Spot producer falls back to DB value due to fake beamspot in transient record."; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this warning now is outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
fakeBS_.setCovariance(3, 3, 0.002); | ||
fakeBS_.setCovariance(4, 4, 5e-11); | ||
fakeBS_.setCovariance(5, 5, 5e-11); | ||
fakeBS_.setCovariance(6, 6, 1e-09); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does setting all the data members really matter? IIUC the logic we never actually return a fake beamspot, so the only important point is to set the type, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
Alignment/CommonAlignmentProducer/python/ALCARECOPromptCalibProdSiPixelAliHLT_cff.py
Outdated
Show resolved
Hide resolved
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-47378/43764
|
Pull request #47378 was updated. @antoniovagnerini, @antoniovilela, @atpathak, @cmsbuild, @consuegs, @davidlange6, @fabiocos, @jfernan2, @mandrenguyen, @perrotta, @rappoccio, @rseidita can you please check and sign again. |
@cmsbuild, please test |
+1 Size: This PR adds an extra 24KB to repository Comparison SummarySummary:
|
+alca |
@cms-sw/dqm-l2 @cms-sw/reconstruction-l2 a kind reminder to please review/sign this PR. |
+1 |
+dqm
|
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. @mandrenguyen, @antoniovilela, @rappoccio, @sextonkennedy (and backports should be raised in the release meeting by the corresponding L2) |
+1 |
PR description:
This PR moves the online beam spot arbitration between the two DQM clients (legacy and hlt) to the EDProducer (RecoVertex/plugin/BeamSpotOnlineProducer.cc), removing the need for the ESProducer (RecoVertex/plugin/OnlineBeamSpotESProducer.cc). These modifications were asked in #39840 to allow selecting the proper event timestamp instead of the wall-clock time during the record selection.
The main modification is in RecoVertex/plugin/BeamSpotOnlineProducer.cc:
BeamSpotOnlineLegacyObjectsRcd
andBeamSpotOnlineHLTObjectsRcd
) instead of the transient record.useTransientRecord
argument is renameduseBSOnlineRecords
.sigmaZThreshold
(default 2 cm) is used to accept or reject a single record based on the beam spot sigmaZ (must be higher than threshold to be accepted). This selection was done before in the ESProducer.sigmaXYThreshold
(default 4 mum) is used to accept or reject a single record based on the beam spot sigmaX and sigmaY (must be higher than threshold to be accepted). This selection was done before in the ESProducer.timeThreshold
(default 48 h) is is used to accept or reject a single record based on the elapsed time between the event and the record creation. This selection was done similarly in the ESProducer but is now using the event proper timestamp instead of the job wall-clock time.The logic for the record arbitration is unchanged.
The ESProducer is also removed from the phase2 simplified HLT menu and the EDProducer is set accordingly.
This only affects online operations (running with
useBSOnlineRecords=cms.bool(True)
).The OnlineBeamMonitor.cc has also been updated to fetch the information saved in the HLT collection instead of the transient record. This is done in the first event of each lumisection.
PR validation:
I validated this PR using the suggested recipe:
gives no failures.
fails on 4 workflows for unrelated problems (input files not available on any site) [*].gives no failures.fails 14 times due to unavailable files [**].gives no failures.I also checked that re-running the HLT writes in the hltOnlineBeamSpot collection the same information as before (running on /HLTMonitor/Run2024I-Express-v2/FEVTHLTALL run=386852, see here).
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:
need a backport to 15_0_X
[*] https://lguzzi.web.cern.ch/lguzzi/BeamSpot/EDP_migration/test_runthematrix/
[**] https://lguzzi.web.cern.ch/lguzzi/BeamSpot/EDP_migration/addOnTests/
FYI @missirol @mtosi @rovere @VourMa @gennai @francescobrivio