1 #ifndef __RecoEgamma_EgammaTools_MVAValueMapProducer_H__ 2 #define __RecoEgamma_EgammaTools_MVAValueMapProducer_H__ 24 template <
class ParticleType>
51 template <
class ParticleType>
53 :
src_(consumesCollector(), iConfig,
"src",
"srcMiniAOD")
58 const std::vector<edm::ParameterSet>& mvaEstimatorConfigs
61 for(
auto &imva : mvaEstimatorConfigs ){
72 <<
" failed to find proper configuration for one of the MVAs in the main python script " << std::endl;
83 const std::string thisValueMapName = fullName +
"Values";
84 const std::string thisRawValueMapName = fullName +
"RawValues";
85 const std::string thisCategoriesMapName = fullName +
"Categories";
92 produces<edm::ValueMap<float>>(thisValueMapName );
93 produces<edm::ValueMap<float>>(thisRawValueMapName );
94 produces<edm::ValueMap<int>> (thisCategoriesMapName);
100 template <
class ParticleType>
104 template <
class ParticleType>
110 for(
unsigned iEstimator = 0; iEstimator <
mvaEstimators_.size(); iEstimator++ ){
112 std::vector<float> mvaValues;
113 std::vector<float> mvaRawValues;
114 std::vector<int> mvaCategories;
117 for (
size_t i = 0;
i < src->size(); ++
i){
118 auto iCand = src->ptrAt(
i);
120 const float response =
mvaEstimators_[iEstimator]->mvaValue( iCand, iEvent, cat );
121 mvaRawValues.push_back( response );
122 mvaValues.push_back( 2.0/(1.0+
exp(-2.0*response))-1 );
123 mvaCategories.push_back( cat );
134 template <
class ParticleType>
VParameterSet const & getParameterSetVector(std::string const &name) const
def create(alignables, pedeDump, additionalData, outputFile, config)
std::vector< std::string > mvaValueMapNames_
std::vector< std::string > mvaRawValueMapNames_
std::vector< std::unique_ptr< AnyMVAEstimatorRun2Base > > mvaEstimators_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void addDefault(ParameterSetDescription const &psetDescription)
void produce(edm::Event &, const edm::EventSetup &) override
edm::Handle< T > getValidHandle(const edm::Event &iEvent)
std::vector< std::string > mvaCategoriesMapNames_
~MVAValueMapProducer() override
MVAValueMapProducer(const edm::ParameterSet &)
MultiTokenT< edm::View< ParticleType > > src_
T get(const Candidate &c)