Skip to content

Commit

Permalink
Revert "Deleted obsolete files and lines of code."
Browse files Browse the repository at this point in the history
This reverts commit 772b3e4.
  • Loading branch information
MatiXOfficial committed Sep 14, 2021
1 parent b0a572a commit 710a04f
Show file tree
Hide file tree
Showing 11 changed files with 948 additions and 0 deletions.
690 changes: 690 additions & 0 deletions CalibPPS/ESProducers/plugins/PPSAlignmentConfigESSource.cc

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions CondCore/Utilities/plugins/Module_2XML.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ PAYLOAD_2XML_MODULE(pluginUtilities_payload2xml) {
PAYLOAD_2XML_CLASS(CTPPSPixelAnalysisMask);
PAYLOAD_2XML_CLASS(CTPPSPixelDAQMapping);
PAYLOAD_2XML_CLASS(CTPPSPixelGainCalibrations);
PAYLOAD_2XML_CLASS(PPSAlignmentConfig)
PAYLOAD_2XML_CLASS(PPSAlignmentConfiguration)
PAYLOAD_2XML_CLASS(CastorChannelQuality);
PAYLOAD_2XML_CLASS(CastorElectronicsMap);
Expand Down
1 change: 1 addition & 0 deletions CondCore/Utilities/src/CondDBFetch.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ namespace cond {
FETCH_PAYLOAD_CASE(CTPPSPixelAnalysisMask)
FETCH_PAYLOAD_CASE(CTPPSPixelGainCalibrations)
FETCH_PAYLOAD_CASE(CTPPSRPAlignmentCorrectionsData)
FETCH_PAYLOAD_CASE(PPSAlignmentConfig)
FETCH_PAYLOAD_CASE(PPSAlignmentConfiguration)
FETCH_PAYLOAD_CASE(LHCOpticalFunctionsSetCollection)
FETCH_PAYLOAD_CASE(CastorChannelQuality)
Expand Down
1 change: 1 addition & 0 deletions CondCore/Utilities/src/CondDBImport.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ namespace cond {
IMPORT_PAYLOAD_CASE(CTPPSPixelAnalysisMask)
IMPORT_PAYLOAD_CASE(CTPPSPixelGainCalibrations)
IMPORT_PAYLOAD_CASE(CTPPSRPAlignmentCorrectionsData)
IMPORT_PAYLOAD_CASE(PPSAlignmentConfig)
IMPORT_PAYLOAD_CASE(PPSAlignmentConfiguration)
IMPORT_PAYLOAD_CASE(LHCOpticalFunctionsSetCollection)
IMPORT_PAYLOAD_CASE(CastorChannelQuality)
Expand Down
1 change: 1 addition & 0 deletions CondCore/Utilities/src/CondFormats.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "CondFormats/PPSObjects/interface/PPSTimingCalibration.h"
#include "CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.h"
#include "CondFormats/PPSObjects/interface/LHCOpticalFunctionsSetCollection.h"
#include "CondFormats/PPSObjects/interface/PPSAlignmentConfig.h"
#include "CondFormats/DTObjects/interface/DTCCBConfig.h"
#include "CondFormats/DTObjects/interface/DTDeadFlag.h"
#include "CondFormats/DTObjects/interface/DTHVStatus.h"
Expand Down
4 changes: 4 additions & 0 deletions CondFormats/PPSObjects/test/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
<use name="CondFormats/PPSObjects"/>
</bin>

<bin file="testSerializationPPSAlignmentConfig.cc">
<use name="CondFormats/PPSObjects"/>
</bin>

<bin file="testSerializationPPSAlignmentConfiguration.cc">
<use name="CondFormats/PPSObjects"/>
</bin>
17 changes: 17 additions & 0 deletions CondFormats/PPSObjects/test/testSerializationPPSAlignmentConfig.cc
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>();
}
42 changes: 42 additions & 0 deletions CondTools/CTPPS/plugins/RetrievePPSAlignmentConfig.cc
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);
51 changes: 51 additions & 0 deletions CondTools/CTPPS/plugins/WritePPSAlignmentConfig.cc
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);
52 changes: 52 additions & 0 deletions CondTools/CTPPS/test/retrieve_PPSAlignmentConfig_cfg.py
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)
88 changes: 88 additions & 0 deletions CondTools/CTPPS/test/write_PPSAlignmentConfig_cfg.py
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)

0 comments on commit 710a04f

Please sign in to comment.