1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
// -*- C++ -*-
//
// Package: SiStripBackPlaneCorrectionDepESProducer
// Class: SiStripBackPlaneCorrectionDepESProducer
//
/**\class SiStripBackPlaneCorrectionDepESProducer SiStripBackPlaneCorrectionDepESProducer.h CalibTracker/SiStripESProducers/plugins/real/SiStripBackPlaneCorrectionDepESProducer.cc
Description: <one line class summary>
Implementation:
<Notes on implementation>
*/
//
// Original Author: Loic Quertenmont inspired from the SiStripLorentzAngleDepESProducer
// Created: 07/03/2013
//
//
// system include files
#include <memory>
// user include files
#include "FWCore/Framework/interface/ModuleFactory.h"
#include "FWCore/Framework/interface/ESProducer.h"
#include "FWCore/Framework/interface/ModuleFactory.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "DataFormats/SiStripCommon/interface/SiStripConstants.h"
#include "CondFormats/SiStripObjects/interface/SiStripBackPlaneCorrection.h"
#include "CondFormats/SiStripObjects/interface/SiStripLatency.h"
#include "CalibTracker/Records/interface/SiStripDependentRecords.h"
#include "FWCore/Utilities/interface/ESProductTag.h"
class SiStripBackPlaneCorrectionDepESProducer : public edm::ESProducer {
public:
SiStripBackPlaneCorrectionDepESProducer(const edm::ParameterSet&);
std::shared_ptr<SiStripBackPlaneCorrection const> produce(const SiStripBackPlaneCorrectionDepRcd&);
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
private:
edm::ESGetToken<SiStripBackPlaneCorrection, SiStripBackPlaneCorrectionRcd> backPlaneCorrectionToken_;
};
SiStripBackPlaneCorrectionDepESProducer::SiStripBackPlaneCorrectionDepESProducer(const edm::ParameterSet& iConfig) {
edm::LogInfo("SiStripBackPlaneCorrectionDepESProducer") << "ctor" << std::endl;
auto getLatency = iConfig.getParameter<edm::ParameterSet>("LatencyRecord");
// How useful the "record" parameter really is?
if (getLatency.getParameter<std::string>("record") != "SiStripLatencyRcd") {
throw edm::Exception(edm::errors::Configuration,
"[SiStripBackPlaneCorrectionDepESProducer::ctor] No Latency Record found ");
}
auto getPeak = iConfig.getParameter<edm::ParameterSet>("BackPlaneCorrectionPeakMode");
if (getPeak.getParameter<std::string>("record") != "SiStripBackPlaneCorrectionRcd") {
throw edm::Exception(edm::errors::Configuration,
"[SiStripBackPlaneCorrectionDepESProducer::ctor] No Lorentz Angle Record found ");
}
auto getDeconv = iConfig.getParameter<edm::ParameterSet>("BackPlaneCorrectionDeconvMode");
// How useful the "record" parameter really is?
if (getDeconv.getParameter<std::string>("record") != "SiStripBackPlaneCorrectionRcd") {
throw edm::Exception(edm::errors::Configuration,
"[SiStripBackPlaneCorrectionDepESProducer::ctor] No Lorentz Angle Record found ");
}
auto peakLabel{getPeak.getUntrackedParameter<std::string>("label")};
auto deconvLabel{getDeconv.getUntrackedParameter<std::string>("label")};
setWhatProduced(this).setMayConsume(
backPlaneCorrectionToken_,
[peakLabel, deconvLabel](auto const& get, edm::ESTransientHandle<SiStripLatency> iLatency) {
if (iLatency->singleReadOutMode() == 1) {
return get("", peakLabel);
}
return get("", deconvLabel);
},
edm::ESProductTag<SiStripLatency, SiStripLatencyRcd>("", getLatency.getUntrackedParameter<std::string>("label")));
}
std::shared_ptr<SiStripBackPlaneCorrection const> SiStripBackPlaneCorrectionDepESProducer::produce(
const SiStripBackPlaneCorrectionDepRcd& iRecord) {
edm::LogInfo("SiStripBackPlaneCorrectionDepESProducer") << "Producer called" << std::endl;
//tell shared_ptr not to delete the product since it is already owned by the record
return std::shared_ptr<SiStripBackPlaneCorrection const>(&iRecord.get(backPlaneCorrectionToken_), [](auto) {});
}
void SiStripBackPlaneCorrectionDepESProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
{
edm::ParameterSetDescription latency;
latency.add<std::string>("record", "SiStripLatencyRcd");
latency.addUntracked<std::string>("label", "");
desc.add<edm::ParameterSetDescription>("LatencyRecord", latency);
}
{
edm::ParameterSetDescription peak;
peak.add<std::string>("record", "SiStripBackPlaneCorrectionRcd");
peak.addUntracked<std::string>("label", "peak");
desc.add<edm::ParameterSetDescription>("BackPlaneCorrectionPeakMode", peak);
}
{
edm::ParameterSetDescription deconv;
deconv.add<std::string>("record", "SiStripBackPlaneCorrectionRcd");
deconv.addUntracked<std::string>("label", "deconvolution");
desc.add<edm::ParameterSetDescription>("BackPlaneCorrectionDeconvMode", deconv);
}
descriptions.addWithDefaultLabel(desc);
}
DEFINE_FWK_EVENTSETUP_MODULE(SiStripBackPlaneCorrectionDepESProducer);
|