Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1535 from dmitrijus/conditions-objects
Alca updates -- Define condition objects for Ecal time bias corrections (reco).
- Loading branch information
Showing
11 changed files
with
252 additions
and
1 deletion.
There are no files selected for viewing
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/DataRecord/interface/EcalTimeBiasCorrectionsRcd.h
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 @@ | ||
#ifndef CondFormats_EcalObjects_EcalTimeBiasCorrectionsRcd_HH | ||
#define CondFormats_EcalObjects_EcalTimeBiasCorrectionsRcd_HH | ||
|
||
// -*- C++ -*- | ||
// | ||
// Author: Dmitrijus Bugelskis | ||
// Created: Thu, 14 Nov 2013 17:12:16 GMT | ||
// | ||
|
||
#include "FWCore/Framework/interface/EventSetupRecordImplementation.h" | ||
|
||
class EcalTimeBiasCorrectionsRcd | ||
: public edm::eventsetup::EventSetupRecordImplementation< | ||
EcalTimeBiasCorrectionsRcd> { | ||
}; | ||
|
||
#endif |
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,9 @@ | ||
// -*- C++ -*- | ||
|
||
// Author: Dmitrijus Bugelskis | ||
// Created: Thu, 14 Nov 2013 17:12:16 GMT | ||
|
||
#include "CondFormats/DataRecord/interface/EcalTimeBiasCorrectionsRcd.h" | ||
#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h" | ||
|
||
EVENTSETUP_RECORD_REG(EcalTimeBiasCorrectionsRcd); |
30 changes: 30 additions & 0 deletions
30
CondFormats/EcalObjects/interface/EcalTimeBiasCorrections.h
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,30 @@ | ||
#ifndef CondFormats_EcalObjects_EcalTimeBiasCorrections_HH | ||
#define CondFormats_EcalObjects_EcalTimeBiasCorrections_HH | ||
|
||
// -*- C++ -*- | ||
// | ||
// Author: Dmitrijus Bugelskis | ||
// Created: Thu, 14 Nov 2013 17:12:16 GMT | ||
// | ||
|
||
#include "DataFormats/Math/interface/Matrix.h" | ||
#include <iostream> | ||
#include <vector> | ||
|
||
class EcalTimeBiasCorrections { | ||
public: | ||
EcalTimeBiasCorrections(); | ||
EcalTimeBiasCorrections(const EcalTimeBiasCorrections& aset); | ||
~EcalTimeBiasCorrections(); | ||
|
||
// there is no need to getters/setters, just access data directly | ||
std::vector<float> EBTimeCorrAmplitudeBins; | ||
std::vector<float> EBTimeCorrShiftBins; | ||
|
||
std::vector<float> EETimeCorrAmplitudeBins; | ||
std::vector<float> EETimeCorrShiftBins; | ||
|
||
void print(std::ostream& o) const; | ||
}; | ||
|
||
#endif |
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,34 @@ | ||
#include "CondFormats/EcalObjects/interface/EcalTimeBiasCorrections.h" | ||
|
||
EcalTimeBiasCorrections::EcalTimeBiasCorrections() {} | ||
EcalTimeBiasCorrections::~EcalTimeBiasCorrections() {} | ||
|
||
EcalTimeBiasCorrections::EcalTimeBiasCorrections( | ||
const EcalTimeBiasCorrections& aset) {} | ||
|
||
template <typename T> | ||
static inline void print_vector(std::ostream& o, const std::vector<T>& vect) { | ||
o << "["; | ||
for (std::vector<float>::const_iterator i = vect.begin(); i != vect.end(); | ||
++i) { | ||
|
||
std::cout << *i << ", "; | ||
} | ||
o << "]"; | ||
} | ||
|
||
void EcalTimeBiasCorrections::print(std::ostream& o) const { | ||
o << "EB Amplitude bins:"; | ||
print_vector<float>(o, this->EBTimeCorrAmplitudeBins); | ||
o << std::endl; | ||
o << "EE Amplitude bins:"; | ||
print_vector<float>(o, this->EETimeCorrAmplitudeBins); | ||
o << std::endl; | ||
|
||
o << "EB Shift bins:"; | ||
print_vector<float>(o, this->EBTimeCorrShiftBins); | ||
o << std::endl; | ||
o << "EE Shift bins:"; | ||
print_vector<float>(o, this->EETimeCorrShiftBins); | ||
o << std::endl; | ||
} |
4 changes: 4 additions & 0 deletions
4
CondFormats/EcalObjects/src/T_EventSetup_EcalTimeBiasCorrections.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,4 @@ | ||
#include "CondFormats/EcalObjects/interface/EcalTimeBiasCorrections.h" | ||
#include "FWCore/Utilities/interface/typelookup.h" | ||
|
||
TYPELOOKUP_DATA_REG(EcalTimeBiasCorrections); |
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
50 changes: 50 additions & 0 deletions
50
CondFormats/EcalObjects/test/fillEcalTimeCorrections_cfg.py
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,50 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
process = cms.Process("InitialData") | ||
process.load("CondCore.DBCommon.CondDBCommon_cfi") | ||
process.CondDBCommon.connect = 'sqlite_file:/tmp/ecal_timebias_corrections.db' | ||
|
||
process.source = cms.Source("EmptyIOVSource", | ||
lastValue = cms.uint64(1), | ||
timetype = cms.string('runnumber'), | ||
firstValue = cms.uint64(1), | ||
interval = cms.uint64(1) | ||
) | ||
|
||
process.PoolDBOutputService = cms.Service("PoolDBOutputService", | ||
process.CondDBCommon, | ||
timetype = cms.untracked.string('runnumber'), | ||
toPut = cms.VPSet(cms.PSet( | ||
record = cms.string('EcalTimeBiasCorrectionsRcd'), | ||
tag = cms.string('initial') | ||
)) | ||
) | ||
|
||
process.timebias = cms.EDAnalyzer("EcalTimeBiasCorrectionsFillInitial", | ||
EBtimeCorrAmplitudeBins = cms.vdouble( | ||
7.9, 8.9, 10, 11.2, 12.5, 14.1, 15.8, 17.7, 19.9, 22.3, 25, 28.1, 31.5, 35.3, 39.7, | ||
44.5, 49.9, 56, 62.8, 70.5, 79.1, 88.8, 99.6, 111.7, 125.4, 140.7, 157.9, 177.1, 198.7, 223, | ||
250.2, 280.7, 315, 353.4, 396.5, 444.9, 499.2, 560.1, 628.4, 705.1, 791.1, 887.7, 996, 1117.5, 1253.9, | ||
1406.8, 1578.5, 1771.1, 1987.2, 2229.7, 2501.8, 2807, 3149.5, 3533.8, 3895.9, 3896, 4311.8, 4837.9, 5428.2, 6090.6, | ||
6833.7, 7667.5, 8603.1, 9652.9, 10830, 12152, 13635, 15298, 17165, 19260, 21610), | ||
|
||
EBtimeCorrShiftBins = cms.vdouble( | ||
-1.770, -1.770, -1.770, -1.770, -1.666, -1.430, -1.233, -1.012, -0.866, -0.736, -0.640, -0.561, -0.505, -0.452, -0.405, | ||
-0.363, -0.335, -0.305, -0.279, -0.260, -0.239, -0.220, -0.204, -0.191, -0.186, -0.177, -0.158, -0.137, -0.126, -0.115, | ||
-0.104, -0.096, -0.085, -0.064, -0.056, -0.036, -0.020, -0.006, -0.020, -0.009, -0.020, 0.005, 0.053, 0.076, 0.093, | ||
0.137, 0.143, 0.171, 0.222, 0.229, 0.271, 0.298, 0.312, 0.307, 0.254 , -0.997 ,-0.859 , -0.819, -0.775, -0.589, | ||
-0.428, -0.288, -0.434, -0.277, -0.210, -0.179, -0.134, 0.362, 0.152, -0.282, -0.382), | ||
|
||
EEtimeCorrAmplitudeBins = cms.vdouble( | ||
15.7, 17.6, 19.7, 22.1, 24.8, 27.9, 31.3, 35.1, 39.4, 44.2, 49.6, 55.6, 62.4, 70, 78.6, | ||
88.1, 98.9, 111, 124.5, 139.7, 156.7, 175.9, 197.3, 221.4, 248.4, 278.7, 312.7, 350.9, 393.7, 441.7, | ||
495.6, 556.1, 624, 700.1, 785.5, 881.4, 988.9, 1109.6, 1245, 1396.9, 1567.3, 1758.6, 1973.1, 2213.9, 2484, | ||
2787.1, 3127.2, 3508.8, 3936.9, 4417.3, 4956.3, 5561.1, 6239.6, 7001, 7522.8, 8440.7, 9470.6, 10626), | ||
|
||
EEtimeCorrShiftBins = cms.vdouble( | ||
-0.896, -0.896, -0.896, -0.896, -0.563, -0.392, -0.287, -0.203, -0.135, -0.100, -0.068, -0.050, -0.060, -0.052, -0.055, | ||
-0.050, -0.052, -0.056, -0.055, -0.056, -0.048, -0.037, -0.038, -0.037, -0.025, -0.026, -0.024, -0.013, -0.003, 0.005, | ||
0.020, 0.026, 0.008, 0.007, -0.006, 0.024, 0.045, 0.062, 0.085, 0.088 , 0.111 , 0.139, 0.156, 0.176, 0.210, | ||
0.242, 0.267, 0.301, 0.318, 0.278, 0.287, 0.218, 0.305, 0.245, 0.184, -0.159, -0.095, 0.037), | ||
) | ||
process.p = cms.Path(process.timebias) |
94 changes: 94 additions & 0 deletions
94
CondFormats/EcalObjects/test/stubs/EcalTimeBiasCorrectionsFillInitial.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,94 @@ | ||
// -*- C++ -*- | ||
// | ||
// Description: Fill in time bias record from an old configuration file. | ||
// Original Author: Dmitrijus Bugelskis | ||
// Created: Thu, 14 Nov 2013 17:44:11 GMT | ||
// | ||
|
||
#include <memory> | ||
|
||
#include "FWCore/Framework/interface/Frameworkfwd.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
|
||
#include "FWCore/Framework/interface/ModuleFactory.h" | ||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
#include "FWCore/Framework/interface/EDAnalyzer.h" | ||
#include "FWCore/Framework/interface/ESProducts.h" | ||
|
||
#include "CondFormats/EcalObjects/interface/EcalTimeBiasCorrections.h" | ||
#include "CondFormats/DataRecord/interface/EcalTimeBiasCorrectionsRcd.h" | ||
|
||
#include "FWCore/ServiceRegistry/interface/Service.h" | ||
#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" | ||
|
||
class EcalTimeBiasCorrectionsFillInitial : public edm::EDAnalyzer { | ||
public: | ||
explicit EcalTimeBiasCorrectionsFillInitial(const edm::ParameterSet &); | ||
~EcalTimeBiasCorrectionsFillInitial(); | ||
|
||
void analyze(const edm::Event &, const edm::EventSetup &); | ||
void beginJob(const edm::EventSetup &); | ||
void endJob(); | ||
|
||
private: | ||
std::vector<double> EBtimeCorrAmplitudeBins_; | ||
std::vector<double> EBtimeCorrShiftBins_; | ||
std::vector<double> EEtimeCorrAmplitudeBins_; | ||
std::vector<double> EEtimeCorrShiftBins_; | ||
|
||
EcalTimeBiasCorrections *bias_; | ||
}; | ||
|
||
EcalTimeBiasCorrectionsFillInitial::EcalTimeBiasCorrectionsFillInitial( | ||
const edm::ParameterSet &ps) { | ||
|
||
EBtimeCorrAmplitudeBins_ = | ||
ps.getParameter<std::vector<double> >("EBtimeCorrAmplitudeBins"); | ||
EBtimeCorrShiftBins_ = | ||
ps.getParameter<std::vector<double> >("EBtimeCorrShiftBins"); | ||
EEtimeCorrAmplitudeBins_ = | ||
ps.getParameter<std::vector<double> >("EEtimeCorrAmplitudeBins"); | ||
EEtimeCorrShiftBins_ = | ||
ps.getParameter<std::vector<double> >("EEtimeCorrShiftBins"); | ||
|
||
if (EBtimeCorrAmplitudeBins_.size() != EBtimeCorrShiftBins_.size()) { | ||
edm::LogError("EcalRecHitError") << "Size of EBtimeCorrAmplitudeBins " | ||
"different from EBtimeCorrShiftBins."; | ||
} | ||
|
||
if (EEtimeCorrAmplitudeBins_.size() != EEtimeCorrShiftBins_.size()) { | ||
edm::LogError("EcalRecHitError") << "Size of EEtimeCorrAmplitudeBins " | ||
"different from EEtimeCorrShiftBins."; | ||
} | ||
|
||
bias_ = new EcalTimeBiasCorrections(); | ||
|
||
copy(EBtimeCorrAmplitudeBins_.begin(), EBtimeCorrAmplitudeBins_.end(), | ||
back_inserter(bias_->EBTimeCorrAmplitudeBins)); | ||
|
||
copy(EBtimeCorrShiftBins_.begin(), EBtimeCorrShiftBins_.end(), | ||
back_inserter(bias_->EBTimeCorrShiftBins)); | ||
|
||
copy(EEtimeCorrAmplitudeBins_.begin(), EEtimeCorrAmplitudeBins_.end(), | ||
back_inserter(bias_->EETimeCorrAmplitudeBins)); | ||
|
||
copy(EEtimeCorrShiftBins_.begin(), EEtimeCorrShiftBins_.end(), | ||
back_inserter(bias_->EETimeCorrShiftBins)); | ||
} | ||
|
||
EcalTimeBiasCorrectionsFillInitial::~EcalTimeBiasCorrectionsFillInitial() {} | ||
|
||
void EcalTimeBiasCorrectionsFillInitial::beginJob( | ||
const edm::EventSetup &iSetup) {} | ||
void EcalTimeBiasCorrectionsFillInitial::analyze( | ||
const edm::Event &iEvent, const edm::EventSetup &iSetup) {} | ||
void EcalTimeBiasCorrectionsFillInitial::endJob() { | ||
edm::Service<cond::service::PoolDBOutputService> poolDbService; | ||
if (poolDbService.isAvailable()) { | ||
poolDbService->writeOne(this->bias_, poolDbService->beginOfTime(), | ||
"EcalTimeBiasCorrectionsRcd"); | ||
} | ||
} | ||
|
||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
DEFINE_FWK_MODULE(EcalTimeBiasCorrectionsFillInitial); |