1 #ifndef __RecoEgamma_EgammaTools_MVAValueMapProducer_H__ 2 #define __RecoEgamma_EgammaTools_MVAValueMapProducer_H__ 25 template <
class ParticleType>
61 std::vector<std::unique_ptr<AnyMVAEstimatorRun2Base>> mvaEstimators;
65 for(
auto &imva : vConfig )
77 <<
" failed to find proper configuration for one of the MVAs in the main python script " << std::endl;
85 std::vector<std::string>
names;
86 for(
auto &imva : vConfig )
94 template <
class ParticleType>
96 const bool tagGiven = !keysForValueMapsTag.
label().empty();
102 template <
class ParticleType>
107 ,
mvaEstimators_(getMVAEstimators(iConfig.getParameterSetVector(
"mvaConfigurations")))
108 ,
mvaValueMapNames_ (getValueMapNames(iConfig.getParameterSetVector(
"mvaConfigurations"),
"Values" ))
109 ,
mvaRawValueMapNames_ (getValueMapNames(iConfig.getParameterSetVector(
"mvaConfigurations"),
"RawValues" ))
110 ,
mvaCategoriesMapNames_(getValueMapNames(iConfig.getParameterSetVector(
"mvaConfigurations"),
"Categories"))
118 template <
class ParticleType>
123 auto keysForValueMapsHandle =
133 for(
unsigned iEstimator = 0; iEstimator <
mvaEstimators_.size(); iEstimator++ ){
135 std::vector<float> mvaValues;
136 std::vector<float> mvaRawValues;
137 std::vector<int> mvaCategories;
140 for (
auto const&
cand : srcHandle->ptrs())
146 mvaRawValues.push_back( response );
147 mvaValues.push_back( 2.0/(1.0+
exp(-2.0*response))-1 );
148 mvaCategories.push_back( cat );
159 template <
class ParticleType>
170 desc.
addVPSet(
"mvaConfigurations", mvaConfigurations);
const edm::EDGetTokenT< edm::View< ParticleType > > keysForValueMapsToken_
const std::vector< std::string > mvaRawValueMapNames_
ParameterDescriptionBase * addVPSet(U const &iLabel, ParameterSetDescription const &validator, std::vector< ParameterSet > const &defaults)
def create(alignables, pedeDump, additionalData, outputFile, config)
std::vector< ParameterSet > VParameterSet
const std::vector< std::unique_ptr< AnyMVAEstimatorRun2Base > > mvaEstimators_
const std::string names[nVars_]
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void addDefault(ParameterSetDescription const &psetDescription)
const MultiTokenT< edm::View< ParticleType > > src_
const std::vector< std::string > mvaCategoriesMapNames_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
const std::vector< std::string > mvaValueMapNames_
edm::Handle< T > getValidHandle(const edm::Event &iEvent) const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::atomic< bool > validated_
~MVAValueMapProducer() override
MVAValueMapProducer(const edm::ParameterSet &)
const MVAVariableHelper< ParticleType > variableHelper_
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
bool isUninitialized() const
T get(const Candidate &c)
ParticleType
Definition of particle types.