5 name_(conf.getParameter<
std::
string>(
"mvaName")),
6 tag_(conf.getParameter<
std::
string>(
"mvaTag")),
7 nCategories_ (conf.getParameter<
int>(
"nCategories")),
8 methodName_ (
"BDTG method"),
9 mvaVarMngr_(conf.getParameter<
std::
string>(
"variableDefinition")),
10 debug_(conf.getUntrackedParameter<
bool>(
"debug",
false))
14 = conf.
getParameter<std::vector<std::string> >(
"weightFileNames");
16 const std::vector <std::string> categoryCutStrings
17 = conf.
getParameter<std::vector<std::string> >(
"categoryCuts");
21 <<
"wrong number of category cuts in " <<
name_ <<
tag_ << std::endl;
29 init(weightFileNames);
51 <<
"wrong number of weightfiles in " <<
name_ <<
tag_ << std::endl;
57 std::vector<std::string> variableNamesInCategory;
58 std::vector<int> variablesInCategory;
65 nVariables_.push_back(variableNamesInCategory.size());
78 <<
"Concerning " <<
name_ <<
tag_ << std::endl
79 <<
"Variable " << variableNamesInCategory[j]
80 <<
" not found in variable definition file!" << std::endl;
99 cc.consumes<
double>(
tag);
108 if (iCategory < 0)
return -999;
110 std::vector<float> vars;
114 if( gsfPtr.get() ==
nullptr ) {
116 <<
" given particle is expected to be reco::GsfElectron or pat::Electron," << std::endl
117 <<
" but appears to be neither" << std::endl;
126 std::cout <<
" category " << iCategory << std::endl;
127 for (
int i = 0;
i < nVariables_[iCategory]; ++
i) {
131 const float response =
gbrForests_.at(iCategory)->GetResponse(vars.data());
134 std::cout <<
" ### MVA " << response << std::endl << std::endl;
144 if( gsfEle ==
nullptr ) {
146 <<
" given particle is expected to be reco::GsfElectron or pat::Electron," << std::endl
147 <<
" but appears to be neither" << std::endl;
155 "category not defined for particle with pt " << gsfEle->pt() <<
" GeV, eta " <<
156 gsfEle->superCluster()->eta() <<
" in " <<
name_ <<
tag_;
const std::string getName(int index) const
T getParameter(std::string const &) const
int findCategory(const edm::Ptr< reco::Candidate > &candPtr) const override
T const * get() const
Returns C++ pointer to the item.
MVAVariableManager< reco::GsfElectron > mvaVarMngr_
const std::string methodName_
std::vector< int > nVariables_
std::vector< edm::InputTag > getHelperInputTags() const
void setConsumes(edm::ConsumesCollector &&) const final
~ElectronMVAEstimatorRun2() override
std::vector< StringCutObjectSelector< reco::GsfElectron > > categoryFunctions_
ElectronMVAEstimatorRun2(const edm::ParameterSet &conf)
void init(const std::vector< std::string > &weightFileNames)
int getVarIndex(std::string &name)
std::vector< std::vector< int > > variables_
std::vector< std::unique_ptr< const GBRForest > > gbrForests_
float getValue(int index, const edm::Ptr< ParticleType > &ptclPtr, const edm::EventBase &iEvent) const
float mvaValue(const edm::Ptr< reco::Candidate > &candPtr, const edm::EventBase &iEvent) const override
std::vector< edm::InputTag > getGlobalInputTags() const