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
fix for Beam Spot txt file mess-up #20102
Conversation
A new Pull Request was created by @rmanzoni (Riccardo Manzoni) for CMSSW_9_2_X. It involves the following packages: Calibration/TkAlCaRecoProducers @perrotta, @ghellwig, @arunhep, @cerminar, @cmsbuild, @franzoni, @slava77, @lpernie can you please review it and eventually sign? Thanks. cms-bot commands are listed here
|
please test |
The tests are being triggered in jenkins. |
+1 The following merge commits were also included on top of IB + this PR after doing git cms-merge-topic: |
Comparison job queued. |
Comparison is ready Comparison Summary:
|
please see the comment #20103 (comment) @davidlange6 we should have this PR integrated in next 92X release or patch (whatever is coming earlier) |
+1 |
backport of #20103 |
@@ -155,7 +157,7 @@ void AlcaBeamSpotHarvester::endRun(const edm::Run& iRun, const edm::EventSetup&) | |||
//poolDbService->appendSinceTime<BeamSpotObjects>(aBeamSpot, poolDbService->currentTime(),"BeamSpotObjectsRcd"); | |||
poolDbService->writeOne<BeamSpotObjects>(aBeamSpot, thisIOV, outputrecordName_); | |||
if (dumpTxt_ && beamSpotOutputBase_ == "lumibased"){ | |||
beamspot::dumpBeamSpotTxt(outTxt, true, currentBS); | |||
beamspot::dumpBeamSpotTxt(outFile, currentBS); |
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'm lost a bit in which set of changes provides a fix.
The PR description mentions a problem of overwriting a file.
This change, if the outTxt existed already will overwrite now, while it was going to append in the previous version.
this seems to contradict the PR description
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 origin of the problem comes from duplicating the file handling in the printer function, here
https://github.com/cms-sw/cmssw/blob/master/RecoVertex/BeamSpotProducer/interface/BeamSpotWrite2Txt.h#L22-L27
while this is already done here
https://github.com/cms-sw/cmssw/blob/master/RecoVertex/BeamSpotProducer/src/BeamFitter.cc#L636-L639
==============
As long as the outfile is used in append mode, everything is normal.
The problem showed up because, when the append option is not enabled, and this only happens for DIP, the outfile is first open here
https://github.com/cms-sw/cmssw/blob/master/RecoVertex/BeamSpotProducer/src/BeamFitter.cc#L636-L639
then reopened by the printer function here
https://github.com/cms-sw/cmssw/blob/master/RecoVertex/BeamSpotProducer/interface/BeamSpotWrite2Txt.h#L22-L27
the beam spot fit results are written, and then the file is closed here
https://github.com/cms-sw/cmssw/blob/master/RecoVertex/BeamSpotProducer/interface/BeamSpotWrite2Txt.h#L55
but then, back in the main BeamFitter.cc file, there's a concurrent attempt writing into the same file here
https://github.com/cms-sw/cmssw/blob/master/RecoVertex/BeamSpotProducer/src/BeamFitter.cc#L690-L701
Now, the idea is that the printer function does not need to handle the creation/closure and write mode of the outfile and let the code that calls it do it.
In this PRs the printer function receives a reference to the outfile
https://github.com/rmanzoni/cmssw/blob/a5b3d276baeaf1960a577b893410cb9f09842025/RecoVertex/BeamSpotProducer/interface/BeamSpotWrite2Txt.h#L20
and all it does is it writes.
The open/close file handling is delegated to the code that calls this function
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, this is clear now.
please test |
The tests are being triggered in jenkins. |
+1 The following merge commits were also included on top of IB + this PR after doing git cms-merge-topic: |
Comparison job queued. |
Comparison is ready Comparison Summary:
|
+1
|
+1 |
This pull request is fully signed and it will be integrated in one of the next CMSSW_9_2_X IBs (tests are also fine) and once validation in the development release cycle CMSSW_9_3_X is complete. This pull request will now be reviewed by the release team before it's merged. @davidlange6, @smuzaffar (and backports should be raised in the release meeting by the corresponding L2) |
+1 |
Fix needed to restore the appropriate txt format needed by, in cascade, if I understand correctly: DIP, WBM, scalers, HLT.
It heals a simultaneous attempt to write in the same
/nfshome0/dqmpro/BeamMonitorDQM/BeamFitResults.txt
file.
@vanbesien @arunhep @sarafiorendi @sikler