1 #ifndef RecoEgamma_EgammaTools_MVAVariableManager_H 2 #define RecoEgamma_EgammaTools_MVAVariableManager_H 18 template <
class ParticleType>
27 init(variableDefinitionFileName);
41 std::ifstream
file(variableDefinitionFileEdm.
fullPath());
46 if (name.find(
"#") != std::string::npos) {
60 std::map<std::string,int>::iterator it =
indexMap_.find(name);
87 if (varInfo.fromVariableHelper) {
90 value = (*vMap)[ptclPtr];
91 }
else if (varInfo.isGlobalVariable) {
98 if (varInfo.hasLowerClip && value < varInfo.lowerClipValue) {
99 value = varInfo.lowerClipValue;
101 if (varInfo.hasUpperClip && value > varInfo.upperClipValue) {
102 value = varInfo.upperClipValue;
119 bool hasLowerClip = lowerClip.find(
"None") == std::string::npos;
120 bool hasUpperClip = upperClip.find(
"None") == std::string::npos;
122 formula.find(
"IDValueMapProducer") != std::string::npos ||
123 formula.find(
"egmPhotonIsolation") != std::string::npos;
130 if ( !(fromVariableHelper || isGlobalVariable) ) {
140 if (fromVariableHelper) {
143 if (isGlobalVariable) {
146 MVAVariableInfo varInfo = {
152 .isGlobalVariable = isGlobalVariable
const std::string getName(int index) const
void addVariable(std::string &name, std::string &formula, std::string &lowerClip, std::string &upperClip)
MVAVariableManager(const std::string &variableDefinitionFileName)
std::vector< std::string > names_
std::map< std::string, int > indexMap_
std::vector< edm::InputTag > getHelperInputTags() const
std::vector< std::string > formulas_
const int getNVars() const
int getVarIndex(std::string &name)
std::vector< edm::InputTag > helperInputTags_
float getValue(int index, const edm::Ptr< ParticleType > &ptclPtr, const edm::EventBase &iEvent) const
std::vector< edm::InputTag > globalInputTags_
std::vector< StringObjectFunction< ParticleType > > functions_
bool getByLabel(InputTag const &, Handle< T > &) const
std::string fullPath() const
std::vector< MVAVariableInfo > variableInfos_
int init(const std::string &variableDefinitionFileName)
std::vector< edm::InputTag > getGlobalInputTags() const