63 template <
typename HandleType,
typename ValType>
66 const std::vector<ValType>& vals,
68 auto valMap = std::make_unique<edm::ValueMap<ValType>>();
70 filler.insert(objHandle, vals.begin(), vals.end());
91 produces<std::vector<T>>();
105 desc.
add<
double>(
"minEtToCalibrate", 5.0);
106 desc.
add<
bool>(
"produceCalibratedObjs",
true);
107 desc.
add<
bool>(
"semiDeterministic",
true);
108 std::vector<std::string> valMapsProduced;
111 desc.
add<std::vector<std::string>>(
"valueMapsStored", valMapsProduced)
113 "provides to python configs the list of valuemaps stored, can not be overriden in the python config");
117 template <
typename T>
128 std::unique_ptr<std::vector<T>>
out = std::make_unique<std::vector<T>>();
130 size_t nrObj = inHandle->size();
132 for (
auto&
res : results)
138 for (
const auto& pho : *inHandle) {
139 out->emplace_back(pho);
145 (pho.isEB()) ? recHitCollectionEBHandle.
product() : recHitCollectionEEHandle.
product();
146 std::array<float, EGEnergySysIndex::kNrSysErrs> uncertainties =
150 results[
index].push_back(uncertainties[
index]);
154 auto fillAndStore = [&](
auto handle) {
163 fillAndStore(inHandle);
168 template <
typename T>
173 if (obj.superCluster().isNonnull()) {
T getParameter(std::string const &) const
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
std::unique_ptr< TRandom > semiDeterministicRng_
void initPrivateRng(TRandom *rnd)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
static const std::string & name(size_t index)
void produce(edm::Event &, const edm::EventSetup &) override
#define DEFINE_FWK_MODULE(type)
PhotonEnergyCalibrator energyCorrector_
void setSemiDetRandomSeed(const edm::Event &iEvent, const T &obj, size_t nrObjs, size_t objNr)
CalibratedPhotonProducerT(const edm::ParameterSet &)
edm::EDGetTokenT< EcalRecHitCollection > recHitCollectionEEToken_
static constexpr size_t kNrSysErrs
uint32_t getRandomSeedFromObj(const edm::Event &iEvent, const T &obj, size_t nrObjs, size_t objNr)
~CalibratedPhotonProducerT() override
edm::EDGetTokenT< EcalRecHitCollection > recHitCollectionEBToken_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
T const * product() const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::EDGetTokenT< edm::View< T > > photonToken_
uint32_t getRandomSeedFromSC(const edm::Event &iEvent, const reco::SuperClusterRef scRef)
StreamID streamID() const
static const std::vector< int > valMapsToStore_
bool produceCalibratedObjs_
std::array< float, EGEnergySysIndex::kNrSysErrs > calibrate(reco::Photon &photon, const unsigned int runNumber, const EcalRecHitCollection *recHits, edm::StreamID const &id, const EventType eventType) const