12 const auto weightFileNames = conf.getParameter<std::vector<std::string> >(
"weightFileNames");
13 const auto categoryCutStrings = conf.getParameter<std::vector<std::string> >(
"categoryCuts");
15 if ((
int)(categoryCutStrings.size()) != getNCategories())
17 <<
"wrong number of category cuts in ElectronMVAEstimatorRun2" << getTag() << std::endl;
19 for (
int i = 0;
i < getNCategories(); ++
i) {
20 categoryFunctions_.emplace_back(categoryCutStrings[
i]);
31 const std::vector<std::string>& categoryCutStrings,
36 if ((
int)(categoryCutStrings.size()) != getNCategories())
38 <<
"wrong number of category cuts in " <<
getName() << getTag() << std::endl;
40 for (
auto const&
cut : categoryCutStrings)
41 categoryFunctions_.emplace_back(
cut);
47 std::cout <<
" *** Inside ElectronMVAEstimatorRun2" <<
getTag() << std::endl;
53 <<
"wrong number of weightfiles in ElectronMVAEstimatorRun2" <<
getTag() << std::endl;
57 std::vector<int> variablesInCategory;
62 std::vector<std::string> variableNamesInCategory;
65 nVariables_.push_back(variableNamesInCategory.size());
70 std::cout <<
" *** Inside ElectronMVAEstimatorRun2" <<
getTag() << std::endl;
78 <<
"Concerning ElectronMVAEstimatorRun2" <<
getTag() << std::endl
79 <<
"Variable " << variableNamesInCategory[
j] <<
" not found in variable definition file!" << std::endl;
87 const std::vector<float>& auxVariables,
88 int& iCategory)
const {
93 <<
" given particle is expected to be reco::GsfElectron or pat::Electron," << std::endl
94 <<
" but appears to be neither" << std::endl;
102 std::vector<float>
vars;
110 std::cout <<
" *** Inside ElectronMVAEstimatorRun2" <<
getTag() << std::endl;
111 std::cout <<
" category " << iCategory << std::endl;
116 const float response =
gbrForests_.at(iCategory)->GetResponse(
vars.data());
119 std::cout <<
" ### MVA " << response << std::endl << std::endl;
130 <<
" given particle is expected to be reco::GsfElectron or pat::Electron," << std::endl
131 <<
" but appears to be neither" << std::endl;
143 edm::LogWarning(
"MVA warning") <<
"category not defined for particle with pt " <<
electron.pt() <<
" GeV, eta " 144 <<
electron.superCluster()->eta() <<
" in ElectronMVAEstimatorRun2" <<
getTag();
T getParameter(std::string const &) const
MVAVariableManager< reco::GsfElectron > mvaVarMngr_
std::vector< int > nVariables_
static std::unordered_map< std::string, int > indexMap()
const std::string & getName(int index) const
std::vector< ThreadSafeFunctor< StringCutObjectSelector< reco::GsfElectron > > > categoryFunctions_
ElectronMVAEstimatorRun2(const edm::ParameterSet &conf)
void init(const std::vector< std::string > &weightFileNames)
std::vector< std::vector< int > > variables_
const std::string & getTag() const
TString getName(TString structure, int layer, TString geometry)
int getNCategories() const
float getValue(int index, const ParticleType &particle, const std::vector< float > &auxVariables) const
int getVarIndex(const std::string &name)
float mvaValue(const reco::Candidate *candidate, std::vector< float > const &auxVariables, int &iCategory) const override
std::vector< std::unique_ptr< const GBRForest > > gbrForests_
int findCategory(const reco::Candidate *candidate) const override
Log< level::Warning, false > LogWarning