1 #ifndef RecoEgamma_EgammaTools_MVAVariableManager_H 2 #define RecoEgamma_EgammaTools_MVAVariableManager_H 13 template <
class ParticleType>
22 std::ifstream
file(variableDefinitionFileEdm.
fullPath());
30 if (name.find(
"#") != std::string::npos) {
44 std::map<std::string,int>::iterator it =
indexMap_.find(name);
65 if (varInfo.auxIndex >= 0) value = auxVariables[varInfo.auxIndex];
68 if (varInfo.hasLowerClip && value < varInfo.lowerClipValue) {
69 value = varInfo.lowerClipValue;
71 if (varInfo.hasUpperClip && value > varInfo.upperClipValue) {
72 value = varInfo.upperClipValue;
90 bool hasLowerClip = lowerClip.find(
"None") == std::string::npos;
91 bool hasUpperClip = upperClip.find(
"None") == std::string::npos;
92 bool isAuxiliary = formula.find(
"MVAVariableHelper") != std::string::npos ||
93 formula.find(
"IDValueMapProducer") != std::string::npos ||
94 formula.find(
"egmPhotonIsolation") != std::string::npos ||
95 formula.find(
"Rho") != std::string::npos;
100 if ( !isAuxiliary )
functions_.emplace_back(formula);
109 MVAVariableInfo varInfo {
const std::string & getName(int index) const
MVAVariableManager(const std::string &variableDefinitionFileName)
std::vector< std::string > names_
std::map< std::string, int > indexMap_
std::vector< std::string > formulas_
float getValue(int index, const ParticleType &particle, const std::vector< float > &auxVariables) const
std::vector< ThreadSafeStringCut< StringObjectFunction< ParticleType >, ParticleType > > functions_
void addVariable(const std::string &name, const std::string &formula, const std::string &lowerClip, const std::string &upperClip)
const MVAVariableIndexMap< ParticleType > indexMap
int getVarIndex(const std::string &name)
std::string fullPath() const
std::vector< MVAVariableInfo > variableInfos_
ParticleType
Definition of particle types.