1 #ifndef __RecoEgamma_EgammaTools_MVAValueMapProducer_H__ 2 #define __RecoEgamma_EgammaTools_MVAValueMapProducer_H__ 23 template <
class ParticleType>
50 template <
typename ValueType,
class HandleType>
53 const std::vector<ValueType>&
values,
55 auto valMap = std::make_unique<edm::ValueMap<ValueType>>();
57 filler.insert(handle, values.begin(), values.end());
63 std::vector<std::unique_ptr<AnyMVAEstimatorRun2Base>> mvaEstimators;
67 for (
auto& imva : vConfig) {
71 mvaEstimators.emplace_back(
76 <<
" failed to find proper configuration for one of the MVAs in the main python script " << std::endl;
83 std::vector<std::string>
names;
84 for (
auto& imva : vConfig) {
92 template <
class ParticleType>
95 mvaEstimators_(getMVAEstimators(iConfig.getParameterSetVector(
"mvaConfigurations"))),
96 mvaValueMapNames_(getValueMapNames(iConfig.getParameterSetVector(
"mvaConfigurations"),
"Values")),
97 mvaRawValueMapNames_(getValueMapNames(iConfig.getParameterSetVector(
"mvaConfigurations"),
"RawValues")),
98 mvaCategoriesMapNames_(getValueMapNames(iConfig.getParameterSetVector(
"mvaConfigurations"),
"Categories")),
101 produces<edm::ValueMap<float>>(
name);
103 produces<edm::ValueMap<float>>(
name);
105 produces<edm::ValueMap<int>>(
name);
108 template <
class ParticleType>
117 for (
unsigned iEstimator = 0; iEstimator <
mvaEstimators_.size(); iEstimator++) {
118 std::vector<float> mvaValues;
119 std::vector<float> mvaRawValues;
120 std::vector<int> mvaCategories;
123 for (
auto const&
cand :
src->ptrs()) {
126 mvaRawValues.push_back(response);
127 mvaValues.push_back(2.0 / (1.0 +
exp(-2.0 * response)) - 1);
128 mvaCategories.push_back(cat);
138 template <
class ParticleType>
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
const std::vector< std::string > mvaRawValueMapNames_
def create(alignables, pedeDump, additionalData, outputFile, config)
std::vector< ParameterSet > VParameterSet
const MVAVariableHelper variableHelper_
const std::vector< std::unique_ptr< AnyMVAEstimatorRun2Base > > mvaEstimators_
const std::string names[nVars_]
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void addDefault(ParameterSetDescription const &psetDescription)
const std::vector< std::string > mvaCategoriesMapNames_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
const std::vector< std::string > mvaValueMapNames_
const edm::EDGetTokenT< edm::View< ParticleType > > src_
MVAValueMapProducer(const edm::ParameterSet &)
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
const std::vector< float > getAuxVariables(const edm::Event &iEvent) const
ParticleType
Definition of particle types.