-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Deleted obsolete files and lines of code."
This reverts commit 772b3e4.
- Loading branch information
1 parent
b0a572a
commit 710a04f
Showing
11 changed files
with
948 additions
and
0 deletions.
There are no files selected for viewing
690 changes: 690 additions & 0 deletions
690
CalibPPS/ESProducers/plugins/PPSAlignmentConfigESSource.cc
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
CondFormats/PPSObjects/test/testSerializationPPSAlignmentConfig.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include "CondFormats/Serialization/interface/Test.h" | ||
|
||
#include "../src/headers.h" | ||
|
||
int main() { | ||
testSerialization<PointErrors>(); | ||
testSerialization<SelectionRange>(); | ||
testSerialization<RPConfig>(); | ||
testSerialization<SectorConfig>(); | ||
testSerialization<Binning>(); | ||
|
||
testSerialization<std::vector<PointErrors>>(); | ||
testSerialization<std::map<unsigned int, std::vector<PointErrors>>>(); | ||
testSerialization<std::map<unsigned int, SelectionRange>>(); | ||
|
||
testSerialization<PPSAlignmentConfig>(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/**************************************************************************** | ||
* Author: | ||
* Mateusz Kocot (mateuszkocot99@gmail.com) | ||
****************************************************************************/ | ||
|
||
#include "FWCore/Framework/interface/Frameworkfwd.h" | ||
#include "FWCore/Framework/interface/one/EDAnalyzer.h" | ||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/Framework/interface/EventSetup.h" | ||
#include "FWCore/Framework/interface/ESHandle.h" | ||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
|
||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "FWCore/ServiceRegistry/interface/Service.h" | ||
|
||
#include "CondFormats/PPSObjects/interface/PPSAlignmentConfig.h" | ||
#include "CondFormats/DataRecord/interface/PPSAlignmentConfigRcd.h" | ||
|
||
#include <memory> | ||
|
||
class RetrievePPSAlignmentConfig : public edm::one::EDAnalyzer<> { | ||
public: | ||
explicit RetrievePPSAlignmentConfig(const edm::ParameterSet &); | ||
|
||
private: | ||
void analyze(const edm::Event &, const edm::EventSetup &) override; | ||
|
||
edm::ESGetToken<PPSAlignmentConfig, PPSAlignmentConfigRcd> esToken_; | ||
}; | ||
|
||
RetrievePPSAlignmentConfig::RetrievePPSAlignmentConfig(const edm::ParameterSet &iConfig) : esToken_(esConsumes()) {} | ||
|
||
void RetrievePPSAlignmentConfig::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { | ||
// get the data | ||
const auto &ppsAlignmentConfig = iSetup.getData(esToken_); | ||
|
||
edm::LogInfo("PPS") << ppsAlignmentConfig; | ||
} | ||
|
||
//define this as a plug-in | ||
DEFINE_FWK_MODULE(RetrievePPSAlignmentConfig); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/**************************************************************************** | ||
* Author: | ||
* Mateusz Kocot (mateuszkocot99@gmail.com) | ||
****************************************************************************/ | ||
|
||
#include "FWCore/Framework/interface/Frameworkfwd.h" | ||
#include "FWCore/Framework/interface/one/EDAnalyzer.h" | ||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/Framework/interface/EventSetup.h" | ||
#include "FWCore/Framework/interface/ESHandle.h" | ||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
|
||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "FWCore/ServiceRegistry/interface/Service.h" | ||
|
||
#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" | ||
|
||
#include "CondFormats/PPSObjects/interface/PPSAlignmentConfig.h" | ||
#include "CondFormats/DataRecord/interface/PPSAlignmentConfigRcd.h" | ||
|
||
#include <memory> | ||
|
||
class WritePPSAlignmentConfig : public edm::one::EDAnalyzer<> { | ||
public: | ||
explicit WritePPSAlignmentConfig(const edm::ParameterSet&); | ||
|
||
private: | ||
void analyze(const edm::Event&, const edm::EventSetup&) override; | ||
|
||
edm::ESGetToken<PPSAlignmentConfig, PPSAlignmentConfigRcd> esToken_; | ||
}; | ||
|
||
WritePPSAlignmentConfig::WritePPSAlignmentConfig(const edm::ParameterSet& iConfig) | ||
: esToken_(esConsumes<PPSAlignmentConfig, PPSAlignmentConfigRcd>( | ||
edm::ESInputTag("", iConfig.getParameter<std::string>("label")))) {} | ||
|
||
void WritePPSAlignmentConfig::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { | ||
// get the data | ||
const auto& ppsAlignmentConfig = iSetup.getData(esToken_); | ||
|
||
// store the data in a DB object | ||
edm::Service<cond::service::PoolDBOutputService> poolDbService; | ||
if (poolDbService.isAvailable()) { | ||
poolDbService->writeOne(&ppsAlignmentConfig, poolDbService->currentTime(), "PPSAlignmentConfigRcd"); | ||
} else { | ||
throw cms::Exception("WritePPSAlignmentConfig") << "PoolDBService required."; | ||
} | ||
} | ||
|
||
//define this as a plug-in | ||
DEFINE_FWK_MODULE(WritePPSAlignmentConfig); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
##### configuration ##### | ||
input_conditions = 'sqlite_file:alignment_config.db' # input database | ||
run_number = 1 # used to select the IOV | ||
db_tag = 'PPSAlignmentConfig_test_v1_prompt' # database tag | ||
######################### | ||
|
||
import FWCore.ParameterSet.Config as cms | ||
|
||
process = cms.Process("retrievePPSAlignmentConfig") | ||
|
||
# Message Logger | ||
process.MessageLogger = cms.Service("MessageLogger", | ||
destinations = cms.untracked.vstring('retrieve_PPSAlignmentConfig'), | ||
retrieve_PPSAlignmentConfig = cms.untracked.PSet( | ||
threshold = cms.untracked.string('INFO') | ||
) | ||
) | ||
|
||
# Load CondDB service | ||
process.load("CondCore.CondDB.CondDB_cfi") | ||
|
||
# input database (in this case the local sqlite file) | ||
process.CondDB.connect = input_conditions | ||
|
||
# A data source must always be defined. We don't need it, so here's a dummy one. | ||
process.source = cms.Source("EmptyIOVSource", | ||
timetype = cms.string('runnumber'), | ||
firstValue = cms.uint64(run_number), | ||
lastValue = cms.uint64(run_number), | ||
interval = cms.uint64(1) | ||
) | ||
|
||
# input service | ||
process.PoolDBESSource = cms.ESSource("PoolDBESSource", | ||
process.CondDB, | ||
DumbStat = cms.untracked.bool(True), | ||
toGet = cms.VPSet(cms.PSet( | ||
record = cms.string('PPSAlignmentConfigRcd'), | ||
tag = cms.string(db_tag) | ||
)) | ||
) | ||
|
||
# DB object retrieve module | ||
process.retrieve_config = cms.EDAnalyzer("RetrievePPSAlignmentConfig", | ||
toGet = cms.VPSet(cms.PSet( | ||
record = cms.string('PPSAlignmentConfigRcd'), | ||
data = cms.vstring('PPSAlignmentConfig') | ||
)), | ||
verbose = cms.untracked.bool(True) | ||
) | ||
|
||
process.path = cms.Path(process.retrieve_config) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
##### configuration ##### | ||
output_conditions = 'sqlite_file:alignment_config.db' # output database | ||
run_number = 1 # beginning of the IOV | ||
db_tag = 'PPSAlignmentConfig_test_v1_prompt' # database tag | ||
produce_logs = True # if set to True, a file with logs will be produced. | ||
product_instance_label = 'db_test' # ES product label | ||
######################### | ||
|
||
import FWCore.ParameterSet.Config as cms | ||
|
||
process = cms.Process("writePPSAlignmentConfig") | ||
|
||
# Message Logger | ||
if produce_logs: | ||
process.MessageLogger = cms.Service("MessageLogger", | ||
destinations = cms.untracked.vstring('write_PPSAlignmentConfig', | ||
'cout' | ||
), | ||
write_PPSAlignmentConfig = cms.untracked.PSet( | ||
threshold = cms.untracked.string('INFO') | ||
), | ||
cout = cms.untracked.PSet( | ||
threshold = cms.untracked.string('WARNING') | ||
) | ||
) | ||
else: | ||
process.MessageLogger = cms.Service("MessageLogger", | ||
destinations = cms.untracked.vstring('cout'), | ||
cout = cms.untracked.PSet( | ||
threshold = cms.untracked.string('WARNING') | ||
) | ||
) | ||
|
||
# Load CondDB service | ||
process.load("CondCore.CondDB.CondDB_cfi") | ||
|
||
# output database | ||
process.CondDB.connect = output_conditions | ||
|
||
# A data source must always be defined. We don't need it, so here's a dummy one. | ||
process.source = cms.Source("EmptyIOVSource", | ||
timetype = cms.string('runnumber'), | ||
firstValue = cms.uint64(run_number), | ||
lastValue = cms.uint64(run_number), | ||
interval = cms.uint64(1) | ||
) | ||
|
||
# output service | ||
process.PoolDBOutputService = cms.Service("PoolDBOutputService", | ||
process.CondDB, | ||
timetype = cms.untracked.string('runnumber'), | ||
toPut = cms.VPSet(cms.PSet( | ||
record = cms.string('PPSAlignmentConfigRcd'), | ||
tag = cms.string(db_tag) | ||
)) | ||
) | ||
|
||
# ESSource | ||
process.ppsAlignmentConfigESSource = cms.ESSource("PPSAlignmentConfigESSource", | ||
# PPSAlignmentConfigESSource parameters, defaults will be taken from fillDescriptions | ||
label = cms.string(product_instance_label), | ||
sector_45 = cms.PSet( | ||
rp_N = cms.PSet( | ||
name = cms.string('db_test_RP'), | ||
id = cms.int32(44), | ||
y_max_fit_mode = cms.double(66.6) | ||
) | ||
), | ||
y_alignment = cms.PSet( | ||
rp_L_F = cms.PSet( | ||
x_min = cms.double(102), | ||
x_max = cms.double(210.0) | ||
) | ||
) | ||
) | ||
|
||
# DB object maker | ||
process.config_writer = cms.EDAnalyzer("WritePPSAlignmentConfig", | ||
record = cms.string('PPSAlignmentConfigRcd'), | ||
loggingOn = cms.untracked.bool(True), | ||
SinceAppendMode = cms.bool(True), | ||
Source = cms.PSet( | ||
IOVRun = cms.untracked.uint32(1) | ||
), | ||
label = cms.string(product_instance_label) | ||
) | ||
|
||
process.path = cms.Path(process.config_writer) |