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

Fix EcalDQMStatusWriter to watch runs and load the input file #35466

Merged
merged 2 commits into from
Sep 30, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
43 changes: 0 additions & 43 deletions DQM/EcalCommon/data/readEcalDQMStatus.py

This file was deleted.

30 changes: 10 additions & 20 deletions DQM/EcalCommon/data/writeEcalDQMStatus.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
process.EcalTrivialConditionRetriever.producedEcalDQMChannelStatus = False
process.EcalTrivialConditionRetriever.producedEcalDQMTowerStatus = False

process.load("CondCore.DBCommon.CondDBCommon_cfi")
process.CondDBCommon.DBParameters.authenticationPath = '/nfshome0/popcondev/conddb'
#process.CondDBCommon.connect = 'sqlite_file:mask-ECAL.db'
#process.CondDBCommon.connect = 'oracle://cms_orcon_prod/CMS_COND_34X_ECAL'
process.load("CondCore.CondDB.CondDB_cfi")
process.CondDB.DBParameters.authenticationPath = '/nfshome0/popcondev/conddb'
process.CondDB.connect = 'sqlite_file:mask-ECAL.db'
Copy link
Contributor

Choose a reason for hiding this comment

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

@thomreis This is the change producing a valid sqlite... nothing to do with conddb dump

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Without changing the writeOne() functions in DQM/EcalMonitorDbModule/plugins/EcalDQMStatusWriter.cc from pointer based to reference based the produced sqlite file was not valid. Or at least the payload in it could not be printed.

#process.CondDB.connect = 'oracle://cms_orcon_prod/CMS_COND_34X_ECAL'

process.source = cms.Source("EmptyIOVSource",
firstValue = cms.uint64(1),
Expand All @@ -28,37 +28,27 @@
)

process.PoolDBOutputService = cms.Service("PoolDBOutputService",
process.CondDBCommon,
process.CondDB,
toPut = cms.VPSet(
cms.PSet(
record = cms.string('EcalDQMChannelStatusRcd'),
# tag = cms.string('EcalDQMChannelStatus_v1_hlt')
tag = cms.string('EcalDQMChannelStatus_v1_hlt')
# tag = cms.string('EcalDQMChannelStatus_v1_express')
# tag = cms.string('EcalDQMChannelStatus_v1_offline')
),
cms.PSet(
record = cms.string('EcalDQMTowerStatusRcd'),
# tag = cms.string('EcalDQMTowerStatus_v1_hlt')
tag = cms.string('EcalDQMTowerStatus_v1_hlt')
# tag = cms.string('EcalDQMTowerStatus_v1_express')
# tag = cms.string('EcalDQMTowerStatus_v1_offline')
)
)
)

process.write = cms.EDAnalyzer("EcalDQMStatusWriter",
verbose = cms.untracked.bool(False),
toPut = cms.VPSet(
cms.PSet(
conditionType = cms.untracked.string('EcalDQMChannelStatus'),
since = cms.untracked.uint32(1),
inputFile = cms.untracked.string('mask-ECAL.txt')
),
cms.PSet(
conditionType = cms.untracked.string('EcalDQMTowerStatus'),
since = cms.untracked.uint32(1),
inputFile = cms.untracked.string('mask-ECAL.txt')
)
)
firstRun = cms.untracked.uint32(350000),
inputFile = cms.untracked.string('mask-EB.txt')
#inputFile = cms.untracked.string('mask-EE.txt')
)

process.p = cms.Path(process.write)
Expand Down
13 changes: 7 additions & 6 deletions DQM/EcalMonitorDbModule/interface/EcalDQMStatusWriter.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef EcalDQMStatusWriter_H
#define EcalDQMStatusWriter_H
#ifndef DQM_EcalMonitorDbModule_EcalDQMStatusWriter_h
#define DQM_EcalMonitorDbModule_EcalDQMStatusWriter_h

#include "FWCore/Framework/interface/one/EDAnalyzer.h"

Expand All @@ -11,24 +11,25 @@

#include <fstream>

class EcalDQMStatusWriter : public edm::one::EDAnalyzer<> {
class EcalDQMStatusWriter : public edm::one::EDAnalyzer<edm::one::WatchRuns> {
public:
EcalDQMStatusWriter(edm::ParameterSet const &);
~EcalDQMStatusWriter() override {}

private:
void analyze(edm::Event const &, edm::EventSetup const &) override;
void beginRun(edm::Run const &, edm::EventSetup const &);
void beginRun(edm::Run const &, edm::EventSetup const &) override;
void endRun(edm::Run const &, edm::EventSetup const &) override;

EcalDQMChannelStatus channelStatus_;
EcalDQMTowerStatus towerStatus_;
unsigned firstRun_;
std::ifstream inputFile_;

EcalElectronicsMapping const *electronicsMap;
EcalElectronicsMapping const *electronicsMap_;
edm::ESGetToken<EcalElectronicsMapping, EcalMappingRcd> elecMapHandle_;
void setElectronicsMap(edm::EventSetup const &);
EcalElectronicsMapping const *GetElectronicsMap();
edm::ESGetToken<EcalElectronicsMapping, EcalMappingRcd> elecMapHandle;
};

#endif
17 changes: 9 additions & 8 deletions DQM/EcalMonitorDbModule/plugins/EcalDQMStatusWriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@

#include "FWCore/Framework/interface/MakerMacros.h"

#include <fstream>

EcalDQMStatusWriter::EcalDQMStatusWriter(edm::ParameterSet const &_ps)
: channelStatus_(),
towerStatus_(),
firstRun_(_ps.getUntrackedParameter<unsigned>("firstRun")),
inputFile_(_ps.getUntrackedParameter<std::string>("inputFile")),
elecMapHandle(esConsumes<edm::Transition::BeginRun>()) {
electronicsMap_(nullptr),
elecMapHandle_(esConsumes<edm::Transition::BeginRun>()) {
if (!inputFile_.is_open())
throw cms::Exception("Invalid input for EcalDQMStatusWriter");
}
Expand All @@ -30,25 +29,27 @@ void EcalDQMStatusWriter::beginRun(edm::Run const &_run, edm::EventSetup const &
statusManager.writeToObj(channelStatus_, towerStatus_);
}

void EcalDQMStatusWriter::endRun(edm::Run const &_run, edm::EventSetup const &_es) {}

void EcalDQMStatusWriter::analyze(edm::Event const &, edm::EventSetup const &_es) {
cond::service::PoolDBOutputService &dbOutput(*edm::Service<cond::service::PoolDBOutputService>());
if (firstRun_ == dbOutput.endOfTime())
return;

dbOutput.writeOne(&channelStatus_, firstRun_, "EcalDQMChannelStatusRcd");
dbOutput.writeOne(&towerStatus_, firstRun_, "EcalDQMTowerStatusRcd");
dbOutput.writeOne(channelStatus_, firstRun_, "EcalDQMChannelStatusRcd");
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 @ggovi
The changes that I needed to make in order to get conddb dump to work are these two lines.

Copy link
Contributor

Choose a reason for hiding this comment

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

@thomreis Can you please dump the error that you get with conddb dump?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. I have also sent it in an email to you last week already.

$ conddb --db mask-ECAL.db dump a68ed854e09eb04addd68ec350b820a4e171ca66
[2021-09-29 16:03:38,098] INFO: Connecting to mask-ECAL.db [sqlite:///mask-ECAL.db]
[2021-09-29 16:03:38,150] INFO: Found payload of type EcalCondTowerObjectContainer<EcalDQMStatusCode>*
[2021-09-29 16:03:39,303] WARNING: No XML converter for payload class EcalCondTowerObjectContainer<EcalDQMStatusCode>* found in the built-in library.

Copy link
Contributor

Choose a reason for hiding this comment

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

@thomreis thanks, i'll investigate.

dbOutput.writeOne(towerStatus_, firstRun_, "EcalDQMTowerStatusRcd");

firstRun_ = dbOutput.endOfTime(); // avoid accidentally re-writing the conditions
}

void EcalDQMStatusWriter::setElectronicsMap(edm::EventSetup const &_es) {
electronicsMap = &_es.getData(elecMapHandle);
electronicsMap_ = &_es.getData(elecMapHandle_);
}

EcalElectronicsMapping const *EcalDQMStatusWriter::GetElectronicsMap() {
if (!electronicsMap)
if (!electronicsMap_)
throw cms::Exception("InvalidCall") << "Electronics Mapping not initialized";
return electronicsMap;
return electronicsMap_;
}

DEFINE_FWK_MODULE(EcalDQMStatusWriter);