Skip to content

Commit

Permalink
Moving clients holding the payload pointer ownership to the new DBOup…
Browse files Browse the repository at this point in the history
…utService interface
  • Loading branch information
ggovi committed Aug 27, 2021
1 parent beace2e commit 40f6c27
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 43 deletions.
Expand Up @@ -69,12 +69,12 @@ void WriteEcalMiscalibConstants::analyze(const edm::Event& iEvent, const edm::Ev
if (poolDbService.isAvailable()) {
if (poolDbService->isNewTagRequest(newTagRequest_)) {
std::cout << " Creating a new one " << std::endl;
poolDbService->createNewIOV<const EcalIntercalibConstants>(
Mcal, poolDbService->beginOfTime(), poolDbService->endOfTime(), newTagRequest_);
poolDbService->createNewIOV<const EcalIntercalibConstants>(*Mcal, poolDbService->beginOfTime(), newTagRequest_);
std::cout << "Done" << std::endl;
} else {
std::cout << "Old One " << std::endl;
poolDbService->appendSinceTime<const EcalIntercalibConstants>(Mcal, poolDbService->currentTime(), newTagRequest_);
poolDbService->appendSinceTime<const EcalIntercalibConstants>(
*Mcal, poolDbService->currentTime(), newTagRequest_);
}
}
}
Expand Down
Expand Up @@ -69,13 +69,12 @@ void WriteEcalMiscalibConstantsMC::analyze(const edm::Event& iEvent, const edm::
if (poolDbService.isAvailable()) {
if (poolDbService->isNewTagRequest(newTagRequest_)) {
std::cout << " Creating a new one " << std::endl;
poolDbService->createNewIOV<const EcalIntercalibConstantsMC>(
Mcal, poolDbService->beginOfTime(), poolDbService->endOfTime(), newTagRequest_);
poolDbService->createNewIOV<const EcalIntercalibConstantsMC>(*Mcal, poolDbService->beginOfTime(), newTagRequest_);
std::cout << "Done" << std::endl;
} else {
std::cout << "Old One " << std::endl;
poolDbService->appendSinceTime<const EcalIntercalibConstantsMC>(
Mcal, poolDbService->currentTime(), newTagRequest_);
*Mcal, poolDbService->currentTime(), newTagRequest_);
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.cc
Expand Up @@ -194,7 +194,7 @@ void SiPixelStatusHarvester::dqmEndRun(const edm::Run& iRun, const edm::EventSet
}
if (debug_ == true) { // only produced for debugging reason
cond::Time_t thisIOV = (cond::Time_t)iRun.id().run();
poolDbService->writeOne<SiPixelQuality>(siPixelQualityPermBad, thisIOV, recordName_ + "_permanentBad");
poolDbService->writeOne<SiPixelQuality>(*siPixelQualityPermBad, thisIOV, recordName_ + "_permanentBad");
}

// IOV for final payloads. FEDerror25 and pcl
Expand Down Expand Up @@ -298,7 +298,7 @@ void SiPixelStatusHarvester::dqmEndRun(const edm::Run& iRun, const edm::EventSet
fedError25IOV[it->first] = it->first;

if (debug_ == true) // only produced for debugging reason
poolDbService->writeOne<SiPixelQuality>(siPixelQuality_FEDerror25, thisIOV, recordName_ + "_FEDerror25");
poolDbService->writeOne<SiPixelQuality>(*siPixelQuality_FEDerror25, thisIOV, recordName_ + "_FEDerror25");

delete siPixelQuality_FEDerror25;
}
Expand Down Expand Up @@ -556,12 +556,12 @@ void SiPixelStatusHarvester::dqmEndRun(const edm::Run& iRun, const edm::EventSet
edm::LuminosityBlockID lu(iRun.id().run(), endLumiBlock_ + 1);
cond::Time_t thisIOV = (cond::Time_t)(lu.value());
if (!SiPixelStatusHarvester::equal(lastPrompt, siPixelQualityPermBad))
poolDbService->writeOne<SiPixelQuality>(siPixelQualityPermBad, thisIOV, recordName_ + "_prompt");
poolDbService->writeOne<SiPixelQuality>(*siPixelQualityPermBad, thisIOV, recordName_ + "_prompt");

// add empty bad components to last lumi+1 IF AND ONLY IF the last payload of other is not equal to empty
SiPixelQuality* siPixelQualityDummy = new SiPixelQuality();
if (!SiPixelStatusHarvester::equal(lastOther, siPixelQualityDummy))
poolDbService->writeOne<SiPixelQuality>(siPixelQualityDummy, thisIOV, recordName_ + "_other");
poolDbService->writeOne<SiPixelQuality>(*siPixelQualityDummy, thisIOV, recordName_ + "_other");

delete siPixelQualityDummy;
}
Expand Down Expand Up @@ -657,12 +657,12 @@ void SiPixelStatusHarvester::constructTag(std::map<int, SiPixelQuality*> siPixel

SiPixelQuality* thisPayload = qIt->second;
if (qIt == siPixelQualityTag.begin())
poolDbService->writeOne<SiPixelQuality>(thisPayload, thisIOV, recordName_ + "_" + tagName);
poolDbService->writeOne<SiPixelQuality>(*thisPayload, thisIOV, recordName_ + "_" + tagName);
else {
SiPixelQuality* prevPayload = (std::prev(qIt))->second;
if (!SiPixelStatusHarvester::equal(thisPayload,
prevPayload)) // only append newIOV if this payload differs wrt last
poolDbService->writeOne<SiPixelQuality>(thisPayload, thisIOV, recordName_ + "_" + tagName);
poolDbService->writeOne<SiPixelQuality>(*thisPayload, thisIOV, recordName_ + "_" + tagName);
}
}
}
Expand Down
Expand Up @@ -68,7 +68,7 @@ void DummyCondDBWriter<TObject, TObjectO, TRecord>::endRun(const edm::Run& run,
else
Time_ = iConfig_.getUntrackedParameter<uint32_t>("OpenIovAtTime", 1);

dbservice->writeOne(obj.release(), Time_, rcdName);
dbservice->writeOne(*obj, Time_, rcdName);
} else {
edm::LogError("SiStripFedCablingBuilder") << "Service is unavailable" << std::endl;
}
Expand Down
Expand Up @@ -41,12 +41,12 @@ void SiStripFedCablingManipulator::endRun(const edm::Run& run, const edm::EventS
edm::LogInfo("SiStripFedCablingManipulator") << "first request for storing objects with Record "
<< "SiStripFedCablingRcd"
<< " at time " << Time_ << std::endl;
dbservice->createNewIOV<SiStripFedCabling>(obj.release(), Time_, dbservice->endOfTime(), "SiStripFedCablingRcd");
dbservice->createNewIOV<SiStripFedCabling>(*obj, Time_, "SiStripFedCablingRcd");
} else {
edm::LogInfo("SiStripFedCablingManipulator") << "appending a new object to existing tag "
<< "SiStripFedCablingRcd"
<< " in since mode " << std::endl;
dbservice->appendSinceTime<SiStripFedCabling>(obj.release(), Time_, "SiStripFedCablingRcd");
dbservice->appendSinceTime<SiStripFedCabling>(*obj, Time_, "SiStripFedCablingRcd");
}
} else {
edm::LogError("SiStripFedCablingManipulator") << "Service is unavailable" << std::endl;
Expand Down
2 changes: 0 additions & 2 deletions Calibration/LumiAlCaRecoProducers/plugins/CorrPCCProducer.cc
Expand Up @@ -580,8 +580,6 @@ void CorrPCCProducer::dqmEndRunProduce(edm::Run const& runSeg, const edm::EventS
throw std::runtime_error("PoolDBService required.");
}

delete pccCorrections;

histoFile->cd();
corrlumiAvg_h->Write();
scaleFactorAvg_h->Write();
Expand Down
Expand Up @@ -333,7 +333,7 @@ class ConditionDBWriter : public edm::EDAnalyzer {
edm::LogInfo("ConditionDBWriter") << "appending a new object to tag " << Record_ << " in since mode " << std::endl;

// The Framework will take control over the DB object now, therefore the release.
mydbservice->writeOne<T>(objPointer.release(), since, Record_);
mydbservice->writeOne<T>(*objPointer, since, Record_);
}

void setTime() {
Expand Down
4 changes: 2 additions & 2 deletions CondFormats/MFObjects/test/MagFieldConfigDBWriter.cc
Expand Up @@ -45,10 +45,10 @@ void MagFieldConfigDBWriter::endJob() {
try {
if (dbOutputSvc->isNewTagRequest(record)) {
//create mode
dbOutputSvc->writeOne<MagFieldConfig>(conf, dbOutputSvc->beginOfTime(), record);
dbOutputSvc->writeOne<MagFieldConfig>(*conf, dbOutputSvc->beginOfTime(), record);
} else {
//append mode. Note: correct PoolDBESSource must be loaded
dbOutputSvc->writeOne<MagFieldConfig>(conf, dbOutputSvc->currentTime(), record);
dbOutputSvc->writeOne<MagFieldConfig>(*conf, dbOutputSvc->currentTime(), record);
}
} catch (const cond::Exception& er) {
std::cout << er.what() << std::endl;
Expand Down
16 changes: 6 additions & 10 deletions CondTools/SiPixel/test/SiPixelGainCalibrationReadDQMFile.cc
Expand Up @@ -459,24 +459,20 @@ void SiPixelGainCalibrationReadDQMFile::fillDatabase(const edm::EventSetup &iSet
if (record_ == "SiPixelGainCalibrationForHLTRcd") {
std::cout << "now doing SiPixelGainCalibrationForHLTRcd payload..." << std::endl;
if (mydbservice->isNewTagRequest(record_)) {
mydbservice->createNewIOV<SiPixelGainCalibrationForHLT>(theGainCalibrationDbInputHLT.release(),
mydbservice->beginOfTime(),
mydbservice->endOfTime(),
"SiPixelGainCalibrationForHLTRcd");
mydbservice->createNewIOV<SiPixelGainCalibrationForHLT>(
*theGainCalibrationDbInputHLT, mydbservice->beginOfTime(), "SiPixelGainCalibrationForHLTRcd");
} else {
mydbservice->appendSinceTime<SiPixelGainCalibrationForHLT>(
theGainCalibrationDbInputHLT.release(), mydbservice->currentTime(), "SiPixelGainCalibrationForHLTRcd");
*theGainCalibrationDbInputHLT, mydbservice->currentTime(), "SiPixelGainCalibrationForHLTRcd");
}
} else if (record_ == "SiPixelGainCalibrationOfflineRcd") {
std::cout << "now doing SiPixelGainCalibrationOfflineRcd payload..." << std::endl;
if (mydbservice->isNewTagRequest(record_)) {
mydbservice->createNewIOV<SiPixelGainCalibrationOffline>(theGainCalibrationDbInputOffline.release(),
mydbservice->beginOfTime(),
mydbservice->endOfTime(),
"SiPixelGainCalibrationOfflineRcd");
mydbservice->createNewIOV<SiPixelGainCalibrationOffline>(
*theGainCalibrationDbInputOffline, mydbservice->beginOfTime(), "SiPixelGainCalibrationOfflineRcd");
} else {
mydbservice->appendSinceTime<SiPixelGainCalibrationOffline>(
theGainCalibrationDbInputOffline.release(), mydbservice->currentTime(), "SiPixelGainCalibrationOfflineRcd");
*theGainCalibrationDbInputOffline, mydbservice->currentTime(), "SiPixelGainCalibrationOfflineRcd");
}
}
edm::LogInfo(" --- all OK");
Expand Down
Expand Up @@ -23,10 +23,10 @@ void SiStripApvSimulationParametersBuilder::analyze(const edm::Event&, const edm
if (mydbservice.isAvailable()) {
if (mydbservice->isNewTagRequest("SiStripApvSimulationParametersRcd")) {
mydbservice->createNewIOV<SiStripApvSimulationParameters>(
obj.get(), mydbservice->beginOfTime(), mydbservice->endOfTime(), "SiStripApvSimulationParametersRcd");
*obj, mydbservice->beginOfTime(), "SiStripApvSimulationParametersRcd");
} else {
mydbservice->appendSinceTime<SiStripApvSimulationParameters>(
obj.get(), mydbservice->currentTime(), "SiStripApvSimulationParametersRcd");
*obj, mydbservice->currentTime(), "SiStripApvSimulationParametersRcd");
}
} else {
edm::LogError("SiStripApvSimulationParametersBuilder") << "Service is unavailable";
Expand Down
7 changes: 3 additions & 4 deletions CondTools/SiStrip/plugins/SiStripBadChannelBuilder.cc
Expand Up @@ -79,11 +79,10 @@ std::unique_ptr<SiStripBadStrip> SiStripBadChannelBuilder::getNewObject() {

if (mydbservice.isAvailable()) {
if (mydbservice->isNewTagRequest("SiStripBadStripRcd")) {
mydbservice->createNewIOV<SiStripBadStrip>(
obj.get(), mydbservice->beginOfTime(), mydbservice->endOfTime(), "SiStripBadStripRcd");
mydbservice->createNewIOV<SiStripBadStrip>(*obj, mydbservice->beginOfTime(), "SiStripBadStripRcd");
} else {
//mydbservice->createNewIOV<SiStripBadStrip>(obj.get(),mydbservice->currentTime(),"SiStripBadStripRcd");
mydbservice->appendSinceTime<SiStripBadStrip>(obj.get(), mydbservice->currentTime(), "SiStripBadStripRcd");
//mydbservice->createNewIOV<SiStripBadStrip>(*obj, mydbservice->currentTime(),"SiStripBadStripRcd");
mydbservice->appendSinceTime<SiStripBadStrip>(*obj, mydbservice->currentTime(), "SiStripBadStripRcd");
}
} else {
edm::LogError("SiStripBadStripBuilder") << "Service is unavailable" << std::endl;
Expand Down
3 changes: 1 addition & 2 deletions IOMC/EventVertexGenerators/src/BeamProfile2DB.cc
Expand Up @@ -103,8 +103,7 @@ void BeamProfile2DB::beginJob() {}
// ------------ method called once each job just after ending the event loop ------------
void BeamProfile2DB::endJob() {
edm::Service<cond::service::PoolDBOutputService> poolDbService;
poolDbService->createNewIOV<SimBeamSpotObjects>(
&beamSpot_, poolDbService->beginOfTime(), poolDbService->endOfTime(), "SimBeamSpotObjectsRcd");
poolDbService->createNewIOV<SimBeamSpotObjects>(beamSpot_, poolDbService->beginOfTime(), "SimBeamSpotObjectsRcd");
}

// ------------ method fills 'descriptions' with the allowed parameters for the module ------------
Expand Down
9 changes: 4 additions & 5 deletions RecoHI/HiJetAlgos/plugins/UETableProducer.cc
Expand Up @@ -202,19 +202,18 @@ void UETableProducer::endJob() {
jme_payload->push_back(JetCorrectorParametersCollection::L1Offset, parameter);

if (pool->isNewTagRequest("JetCorrectionsRecord")) {
pool->createNewIOV<JetCorrectorParametersCollection>(
jme_payload.get(), pool->beginOfTime(), pool->endOfTime(), "JetCorrectionsRecord");
pool->createNewIOV<JetCorrectorParametersCollection>(*jme_payload, pool->beginOfTime(), "JetCorrectionsRecord");
} else {
pool->appendSinceTime<JetCorrectorParametersCollection>(
jme_payload.get(), pool->currentTime(), "JetCorrectionsRecord");
*jme_payload, pool->currentTime(), "JetCorrectionsRecord");
}
} else {
ue_predictor_pf->values = ue_vec;

if (pool->isNewTagRequest("HeavyIonUERcd")) {
pool->createNewIOV<UETable>(ue_predictor_pf.get(), pool->beginOfTime(), pool->endOfTime(), "HeavyIonUERcd");
pool->createNewIOV<UETable>(*ue_predictor_pf, pool->beginOfTime(), "HeavyIonUERcd");
} else {
pool->appendSinceTime<UETable>(ue_predictor_pf.get(), pool->currentTime(), "HeavyIonUERcd");
pool->appendSinceTime<UETable>(*ue_predictor_pf, pool->currentTime(), "HeavyIonUERcd");
}
}
}
Expand Down

0 comments on commit 40f6c27

Please sign in to comment.