74 template <
typename HandleType,
typename ValType>
77 const std::vector<ValType>& vals,
79 auto valMap = std::make_unique<edm::ValueMap<ValType>>();
81 filler.insert(objHandle, vals.begin(), vals.end());
89 : electronToken_(consumes(conf.getParameter<
edm::
InputTag>(
"src"))),
90 epCombinationTool_{conf.
getParameterSet(
"epCombConfig"), consumesCollector()},
91 energyCorrector_(epCombinationTool_, conf.getParameter<
std::string>(
"correctionFile")),
92 recHitCollectionEBToken_(consumes(conf.getParameter<
edm::InputTag>(
"recHitCollectionEB"))),
93 recHitCollectionEEToken_(consumes(conf.getParameter<
edm::InputTag>(
"recHitCollectionEE"))),
94 produceCalibratedObjs_(conf.getParameter<
bool>(
"produceCalibratedObjs")) {
95 energyCorrector_.setMinEt(conf.getParameter<
double>(
"minEtToCalibrate"));
97 if (conf.getParameter<
bool>(
"semiDeterministic")) {
98 semiDeterministicRng_ = std::make_unique<TRandom2>();
99 energyCorrector_.initPrivateRng(semiDeterministicRng_.get());
102 if (produceCalibratedObjs_)
103 produces<std::vector<T>>();
105 for (
const auto& toStore : valMapsToStore_) {
110 template <
typename T>
118 desc.add<
double>(
"minEtToCalibrate", 5.0);
119 desc.add<
bool>(
"produceCalibratedObjs",
true);
120 desc.add<
bool>(
"semiDeterministic",
true);
121 std::vector<std::string> valMapsProduced;
122 valMapsProduced.reserve(valMapsToStore_.size());
123 for (
auto varToStore : valMapsToStore_)
125 desc.add<std::vector<std::string>>(
"valueMapsStored", valMapsProduced)
127 "provides to python configs the list of valuemaps stored, can not be overriden in the python config");
131 template <
typename T>
133 epCombinationTool_.setEventContent(iSetup);
135 auto inHandle =
iEvent.getHandle(electronToken_);
137 auto recHitCollectionEBHandle =
iEvent.getHandle(recHitCollectionEBToken_);
138 auto recHitCollectionEEHandle =
iEvent.getHandle(recHitCollectionEEToken_);
140 std::unique_ptr<std::vector<T>>
out = std::make_unique<std::vector<T>>();
142 size_t nrObj = inHandle->size();
150 for (
const auto& ele : *inHandle) {
153 if (semiDeterministicRng_)
154 setSemiDetRandomSeed(
iEvent, ele, nrObj,
out->size());
157 (ele.isEB()) ? recHitCollectionEBHandle.product() : recHitCollectionEEHandle.product();
158 std::array<float, EGEnergySysIndex::kNrSysErrs> uncertainties =
166 auto fillAndStore = [&](
auto handle) {
167 for (
const auto& mapToStore : valMapsToStore_) {
172 if (produceCalibratedObjs_) {
175 fillAndStore(inHandle);
179 template <
typename T>
184 if (
obj.superCluster().isNonnull()) {