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

added the possibility to lock a record #33659

Merged
merged 2 commits into from
May 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion DQM/BeamMonitor/plugins/BeamMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ BeamMonitor::BeamMonitor(const ParameterSet& ps)
minNrVertices_ = ps.getParameter<ParameterSet>("PVFitter").getUntrackedParameter<unsigned int>("minNrVerticesForFit");
minVtxNdf_ = ps.getParameter<ParameterSet>("PVFitter").getUntrackedParameter<double>("minVertexNdf");
minVtxWgt_ = ps.getParameter<ParameterSet>("PVFitter").getUntrackedParameter<double>("minVertexMeanWeight");
useLockRecords_ = ps.getUntrackedParameter<bool>("useLockRecords");
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't better to have it as a tracked parameter? (same comment for other parameters above, not related to this PR)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @silviodonato , thanks for the tips. Regarding the clone comment if you wish I can change it and commit. Let me know if I should do it or not.
For the untracked vs tracked parameters I have simply followed what was already there for the others, I have no strong feeling about it.


if (!monitorName_.empty())
monitorName_ = monitorName_ + "/";
Expand Down Expand Up @@ -203,6 +204,12 @@ namespace {
};
} // namespace

void BeamMonitor::dqmBeginRun(edm::Run const&, edm::EventSetup const&) {
if (useLockRecords_ && onlineDbService_.isAvailable()) {
onlineDbService_->lockRecords();
}
}

void BeamMonitor::bookHistograms(DQMStore::IBooker& iBooker, edm::Run const& iRun, edm::EventSetup const& iSetup) {
frun = iRun.run();
ftimestamp = iRun.beginTime().value();
Expand Down Expand Up @@ -1544,8 +1551,11 @@ void BeamMonitor::dqmEndRun(const Run& r, const EventSetup& context) {
mapLSBSTrkSize.clear();
mapLSPVStoreSize.clear();
mapLSCF.clear();
}

if (useLockRecords_ && onlineDbService_.isAvailable()) {
onlineDbService_->releaseLocks();
}
}
//--------------------------------------------------------
void BeamMonitor::scrollTH1(TH1* h, time_t ref) {
char offsetTime[64];
Expand Down
4 changes: 3 additions & 1 deletion DQM/BeamMonitor/plugins/BeamMonitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class BeamMonitor : public DQMOneEDAnalyzer<edm::one::WatchLuminosityBlocks> {

protected:
// BeginRun
void dqmBeginRun(edm::Run const&, edm::EventSetup const&) override;

void bookHistograms(DQMStore::IBooker& i, const edm::Run& r, const edm::EventSetup& c) override;

void analyze(const edm::Event& e, const edm::EventSetup& c) override;
Expand Down Expand Up @@ -114,7 +116,7 @@ class BeamMonitor : public DQMOneEDAnalyzer<edm::one::WatchLuminosityBlocks> {
int countGapLumi_;

bool processed_;

bool useLockRecords_;
// ----------member data ---------------------------

// std::vector<BSTrkParameters> fBSvector;
Expand Down
12 changes: 11 additions & 1 deletion DQM/BeamMonitor/plugins/FakeBeamMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ FakeBeamMonitor::FakeBeamMonitor(const ParameterSet& ps)
minNrVertices_ = ps.getParameter<ParameterSet>("PVFitter").getUntrackedParameter<unsigned int>("minNrVerticesForFit");
minVtxNdf_ = ps.getParameter<ParameterSet>("PVFitter").getUntrackedParameter<double>("minVertexNdf");
minVtxWgt_ = ps.getParameter<ParameterSet>("PVFitter").getUntrackedParameter<double>("minVertexMeanWeight");
useLockRecords_ = ps.getUntrackedParameter<bool>("useLockRecords");

if (!monitorName_.empty())
monitorName_ = monitorName_ + "/";
Expand Down Expand Up @@ -196,6 +197,12 @@ namespace {
};
} // namespace

void FakeBeamMonitor::dqmBeginRun(edm::Run const&, edm::EventSetup const&) {
if (useLockRecords_ && onlineDbService_.isAvailable()) {
onlineDbService_->lockRecords();
}
}

void FakeBeamMonitor::bookHistograms(DQMStore::IBooker& iBooker, edm::Run const& iRun, edm::EventSetup const& iSetup) {
frun = iRun.run();
ftimestamp = iRun.beginTime().value();
Expand Down Expand Up @@ -1499,7 +1506,7 @@ void FakeBeamMonitor::FitAndFill(const LuminosityBlock& lumiSeg, int& lastlumi,
}

//--------------------------------------------------------
void FakeBeamMonitor::RestartFitting() {
void FakeBeamMonitor::RestartFitting() { //
if (debug_)
edm::LogInfo("FakeBeamMonitor")
<< " RestartingFitting:: Restart Beami everything to a fresh start !!! because Gap is > 10 LS" << endl;
Expand Down Expand Up @@ -1552,6 +1559,9 @@ void FakeBeamMonitor::dqmEndRun(const Run& r, const EventSetup& context) {
mapLSBSTrkSize.clear();
mapLSPVStoreSize.clear();
mapLSCF.clear();
if (useLockRecords_ && onlineDbService_.isAvailable()) {
onlineDbService_->releaseLocks();
}
}

//--------------------------------------------------------
Expand Down
6 changes: 4 additions & 2 deletions DQM/BeamMonitor/plugins/FakeBeamMonitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ class FakeBeamMonitor : public DQMOneEDAnalyzer<edm::one::WatchLuminosityBlocks>
~FakeBeamMonitor() override;

protected:
// BeginRun
//BeginRun
void dqmBeginRun(edm::Run const&, edm::EventSetup const&) override;

void bookHistograms(DQMStore::IBooker& i, const edm::Run& r, const edm::EventSetup& c) override;

void analyze(const edm::Event& e, const edm::EventSetup& c) override;
Expand Down Expand Up @@ -109,7 +111,7 @@ class FakeBeamMonitor : public DQMOneEDAnalyzer<edm::one::WatchLuminosityBlocks>
int countGapLumi_;

bool processed_;

bool useLockRecords_;
// ----------member data ---------------------------

// std::vector<BSTrkParameters> fBSvector;
Expand Down
1 change: 1 addition & 0 deletions DQM/BeamMonitor/python/BeamMonitor_Cosmics_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
resetPVEveryNLumi = cms.untracked.int32(2),
Debug = cms.untracked.bool(False),
recordName = cms.untracked.string('BeamSpotOnlineHLTObjectsRcd'),
useLockRecords = cms.untracked.bool(False),
BeamFitter = cms.PSet(
Debug = cms.untracked.bool(False),
TrackCollection = cms.untracked.InputTag('ctfWithMaterialTracksP5'), ## ctfWithMaterialTracksP5 for CRAFT
Expand Down
1 change: 1 addition & 0 deletions DQM/BeamMonitor/python/BeamMonitor_MC_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
resetPVEveryNLumi = cms.untracked.int32(2),
Debug = cms.untracked.bool(False),
recordName = cms.untracked.string('BeamSpotOnlineHLTObjectsRcd'),
useLockRecords = cms.untracked.bool(False),
BeamFitter = cms.PSet(
Debug = cms.untracked.bool(False),
TrackCollection = cms.untracked.InputTag('generalTracks'), ## ctfWithMaterialTracksP5 for CRAFT
Expand Down
1 change: 1 addition & 0 deletions DQM/BeamMonitor/python/BeamMonitor_PixelLess_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
resetPVEveryNLumi = cms.untracked.int32(2),
Debug = cms.untracked.bool(False),
recordName = cms.untracked.string('BeamSpotOnlineHLTObjectsRcd'),
useLockRecords = cms.untracked.bool(False),
BeamFitter = cms.PSet(
Debug = cms.untracked.bool(False),
TrackCollection = cms.untracked.InputTag('ctfPixelLess'),
Expand Down
1 change: 1 addition & 0 deletions DQM/BeamMonitor/python/BeamMonitor_Pixel_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
Debug = cms.untracked.bool(False),
OnlineMode = cms.untracked.bool(True),
recordName = cms.untracked.string('BeamSpotOnlineHLTObjectsRcd'),
useLockRecords = cms.untracked.bool(False),
BeamFitter = cms.PSet(
Debug = cms.untracked.bool(False),
TrackCollection = cms.untracked.InputTag('pixelTracks'),
Expand Down
1 change: 1 addition & 0 deletions DQM/BeamMonitor/python/BeamMonitor_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
Debug = cms.untracked.bool(False),
OnlineMode = cms.untracked.bool(True),
recordName = cms.untracked.string('BeamSpotOnlineHLTObjectsRcd'),
useLockRecords = cms.untracked.bool(False),
BeamFitter = cms.PSet(
Debug = cms.untracked.bool(False),
TrackCollection = cms.untracked.InputTag('generalTracks'),
Expand Down
1 change: 1 addition & 0 deletions DQM/BeamMonitor/python/FakeBeamMonitor_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
Debug = cms.untracked.bool(False),
OnlineMode = cms.untracked.bool(True),
recordName = cms.untracked.string('BeamSpotOnlineHLTObjectsRcd'),
useLockRecords = cms.untracked.bool(False),
BeamFitter = cms.PSet(
Debug = cms.untracked.bool(False),
TrackCollection = cms.untracked.InputTag('pixelTracks'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
BSOnlineTag = 'BeamSpotOnlineTestLegacy'
BSOnlineJobName = 'BeamSpotOnlineTestLegacy'
BSOnlineOmsServiceUrl = 'http://cmsoms-services.cms:9949/urn:xdaq-application:lid=100/getRunAndLumiSection'
useLockRecords = True

#from Configuration.Eras.Era_Run2_2018_cff import Run2_2018
#process = cms.Process("BeamMonitor", Run2_2018) FIXME
Expand All @@ -19,7 +20,7 @@
BSOnlineTag = BSOnlineTag + 'Playback'
BSOnlineJobName = BSOnlineJobName + 'Playback'
BSOnlineOmsServiceUrl = ''

useLockRecords = False
#
process.MessageLogger = cms.Service("MessageLogger",
debugModules = cms.untracked.vstring('*'),
Expand All @@ -36,6 +37,7 @@
if 'unitTest=True' in sys.argv:
live=False
unitTest=True
useLockRecords = False

#---------------
# Input sources
Expand Down Expand Up @@ -303,6 +305,7 @@

process.dqmBeamMonitor.OnlineMode = True
process.dqmBeamMonitor.recordName = BSOnlineRecordName
process.dqmBeamMonitor.useLockRecords = cms.untracked.bool(useLockRecords)

process.dqmBeamMonitor.resetEveryNLumi = 5 # was 10 for HI
process.dqmBeamMonitor.resetPVEveryNLumi = 5 # was 10 for HI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
BSOnlineTag = 'BeamSpotOnlineTestLegacy'
BSOnlineJobName = 'BeamSpotOnlineTestLegacy'
BSOnlineOmsServiceUrl = 'http://cmsoms-services.cms:9949/urn:xdaq-application:lid=100/getRunAndLumiSection'

useLockRecords = True
import sys
from Configuration.Eras.Era_Run2_2018_cff import Run2_2018
process = cms.Process("FakeBeamMonitor", Run2_2018)
Expand All @@ -18,6 +18,7 @@
BSOnlineTag = BSOnlineTag + 'Playback'
BSOnlineJobName = BSOnlineJobName + 'Playback'
BSOnlineOmsServiceUrl = ''
useLockRecords = False

#
process.MessageLogger = cms.Service("MessageLogger",
Expand All @@ -35,9 +36,11 @@
if 'unitTest=True' in sys.argv:
live=False
unitTest=True
useLockRecords = False
else:
time.sleep(48.)


#---------------
# Input sources
if unitTest:
Expand Down Expand Up @@ -83,6 +86,7 @@
process.load("DQM.BeamMonitor.FakeBeamMonitor_cff")



#----------------
# Setup tracking
#process.load("Configuration.StandardSequences.GeometryRecoDB_cff")
Expand Down Expand Up @@ -132,7 +136,7 @@

process.dqmFakeBeamMonitor.resetEveryNLumi = 5 # was 10 for HI
process.dqmFakeBeamMonitor.resetPVEveryNLumi = 5 # was 10 for HI

process.dqmFakeBeamMonitor.useLockRecords = cms.untracked.bool(useLockRecords)


#---------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
BSOnlineTag = 'BeamSpotOnlineTestHLT'
BSOnlineJobName = 'BeamSpotOnlineTestHLT'
BSOnlineOmsServiceUrl = 'http://cmsoms-services.cms:9949/urn:xdaq-application:lid=100/getRunAndLumiSection'
useLockRecords = True

#from Configuration.Eras.Era_Run2_2018_cff import Run2_2018
#process = cms.Process("BeamMonitor", Run2_2018) # FIMXE
Expand All @@ -19,6 +20,7 @@
BSOnlineTag = BSOnlineTag + 'Playback'
BSOnlineJobName = BSOnlineJobName + 'Playback'
BSOnlineOmsServiceUrl = ''
useLockRecords = False

# Message logger
#process.load("FWCore.MessageLogger.MessageLogger_cfi")
Expand All @@ -41,6 +43,7 @@
if 'unitTest=True' in sys.argv:
live=False
unitTest=True
useLockRecords = False

# Common part for PP and H.I Running
#-----------------------------
Expand Down Expand Up @@ -95,6 +98,7 @@
#process.GlobalTag = gtCustomise(process.GlobalTag, 'auto:run2_data', '')

# Change Beam Monitor variables
process.dqmBeamMonitor.useLockRecords = cms.untracked.bool(useLockRecords)
if process.dqmRunConfig.type.value() is "production":
process.dqmBeamMonitor.BeamFitter.WriteAscii = True
process.dqmBeamMonitor.BeamFitter.AsciiFileName = '/nfshome0/yumiceva/BeamMonitorDQM/BeamFitResults.txt'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
BSOnlineTag = 'BeamSpotOnlineTestHLT'
BSOnlineJobName = 'BeamSpotOnlineTestHLT'
BSOnlineOmsServiceUrl = 'http://cmsoms-services.cms:9949/urn:xdaq-application:lid=100/getRunAndLumiSection'
useLockRecords = True

import sys
from Configuration.Eras.Era_Run2_2018_cff import Run2_2018
Expand All @@ -17,6 +18,7 @@
BSOnlineTag = BSOnlineTag + 'Playback'
BSOnlineJobName = BSOnlineJobName + 'Playback'
BSOnlineOmsServiceUrl = ''
useLockRecords = False

# switch
live = True # FIXME
Expand All @@ -25,7 +27,7 @@
if 'unitTest=True' in sys.argv:
live=False
unitTest=True

useLockRecords = False

# Common part for PP and H.I Running
#-----------------------------
Expand Down Expand Up @@ -81,7 +83,6 @@
#-----------------------------
process.load("DQM.BeamMonitor.FakeBeamMonitor_cff")
process.dqmBeamMonitor = process.dqmFakeBeamMonitor.clone()

#---------------
# Calibration
#---------------
Expand All @@ -106,7 +107,7 @@
process.dqmBeamMonitor.monitorName = 'FakeBeamMonitor'
process.dqmBeamMonitor.OnlineMode = True
process.dqmBeamMonitor.recordName = BSOnlineRecordName

process.dqmBeamMonitor.useLockRecords = cms.untracked.bool(useLockRecords)
process.dqmBeamMonitor.resetEveryNLumi = 5
process.dqmBeamMonitor.resetPVEveryNLumi = 5

Expand Down
1 change: 1 addition & 0 deletions DQM/Integration/python/clients/last_lumi.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0