6 const auto categoryCutStrings = conf.
getParameter<std::vector<std::string> >(
"categoryCuts");
10 <<
"wrong number of category cuts in ElectronMVAEstimatorRun2" <<
getTag() << std::endl;
24 const std::vector<std::string>& categoryCutStrings,
30 <<
"wrong number of category cuts in " <<
getName() <<
getTag() << std::endl;
32 for (
auto const&
cut : categoryCutStrings)
34 init(weightFileNames);
39 std::cout <<
" *** Inside ElectronMVAEstimatorRun2" <<
getTag() << std::endl;
45 <<
"wrong number of weightfiles in ElectronMVAEstimatorRun2" <<
getTag() << std::endl;
50 std::vector<int> variablesInCategory;
55 std::vector<std::string> variableNamesInCategory;
58 nVariables_.push_back(variableNamesInCategory.size());
63 std::cout <<
" *** Inside ElectronMVAEstimatorRun2" <<
getTag() << std::endl;
71 <<
"Concerning ElectronMVAEstimatorRun2" <<
getTag() << std::endl
72 <<
"Variable " << variableNamesInCategory[
j] <<
" not found in variable definition file!" << std::endl;
80 const std::vector<float>& auxVariables,
81 int& iCategory)
const {
84 if (electron ==
nullptr) {
86 <<
" given particle is expected to be reco::GsfElectron or pat::Electron," << std::endl
87 <<
" but appears to be neither" << std::endl;
95 std::vector<float>
vars;
102 std::cout <<
" *** Inside ElectronMVAEstimatorRun2" <<
getTag() << std::endl;
103 std::cout <<
" category " << iCategory << std::endl;
104 for (
int i = 0;
i < nVariables_[iCategory]; ++
i) {
108 const float response =
gbrForests_.at(iCategory)->GetResponse(vars.data());
111 std::cout <<
" ### MVA " << response << std::endl << std::endl;
120 if (electron ==
nullptr) {
122 <<
" given particle is expected to be reco::GsfElectron or pat::Electron," << std::endl
123 <<
" but appears to be neither" << std::endl;
135 edm::LogWarning(
"MVA warning") <<
"category not defined for particle with pt " << electron.
pt() <<
" GeV, eta " T getParameter(std::string const &) const
const std::string & getName(int index) const
MVAVariableManager< reco::GsfElectron > mvaVarMngr_
std::vector< int > nVariables_
double pt() const final
transverse momentum
float getValue(int index, const ParticleType &particle, const std::vector< float > &auxVariables) const
const std::string & getName() const
const std::string & getTag() const
std::vector< ThreadSafeStringCut< StringCutObjectSelector< reco::GsfElectron >, reco::GsfElectron > > categoryFunctions_
float mvaValue(const reco::Candidate *candidate, std::vector< float > const &auxVariables, int &iCategory) const override
ElectronMVAEstimatorRun2(const edm::ParameterSet &conf)
void init(const std::vector< std::string > &weightFileNames)
std::vector< std::vector< int > > variables_
int getVarIndex(const std::string &name)
int findCategory(const reco::Candidate *candidate) const override
std::vector< std::unique_ptr< const GBRForest > > gbrForests_
SuperClusterRef superCluster() const override
reference to a SuperCluster
int getNCategories() const