diff --git a/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetSelectorAttribute.h b/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetSelectorAttribute.h index e4db59d70a32f9fb8e6e69e94f45d21b732e5049..ce2d42246504fc2f83e53f1f65f9998f5fdd6f33 100644 --- a/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetSelectorAttribute.h +++ b/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetSelectorAttribute.h @@ -30,10 +30,10 @@ class JetSelectorAttribute : public asg::AsgTool , virtual public IJetSelector protected: - float m_min; - float m_max; + std::vector<float> m_min; + std::vector<float> m_max; - ToolHandle<IJetHistoVarTool> m_var; + std::vector<ToolHandle<IJetHistoVarTool>> m_var; }; diff --git a/Reconstruction/Jet/JetMonitoring/Root/JetSelectorAttribute.cxx b/Reconstruction/Jet/JetMonitoring/Root/JetSelectorAttribute.cxx index 14a3017d0c7590dc47822dd44032558243deead8..6c597688cda3c52c1ce2d2bd3f25376e3c8f7898 100644 --- a/Reconstruction/Jet/JetMonitoring/Root/JetSelectorAttribute.cxx +++ b/Reconstruction/Jet/JetMonitoring/Root/JetSelectorAttribute.cxx @@ -10,10 +10,9 @@ JetSelectorAttribute::JetSelectorAttribute(const std::string &t) : asg::AsgTool(t) , m_min(-std::numeric_limits<float>::max()) - , m_max( std::numeric_limits<float>::max()) - , m_var(this) + , m_max(std::numeric_limits<float>::max()) + , m_var(0) { - declareProperty("CutMin", m_min ); declareProperty("CutMax", m_max ); declareProperty("Var", m_var); @@ -24,13 +23,22 @@ JetSelectorAttribute:: ~JetSelectorAttribute(){ StatusCode JetSelectorAttribute::initialize() { - ATH_CHECK(m_var.retrieve() ); - ATH_MSG_INFO( "Selecting on var ("<< m_var->describe() << ") in ["<< m_min << " , "<< m_max<< "]"); - + unsigned int it=0; + for (auto var : m_var) { + ATH_CHECK(var.retrieve() ); + ATH_MSG_INFO( "Selecting on var ("<< var->describe() << ") in ["<< m_min.at(it) << " , "<< m_max.at(it)<< "]"); + it++; + } return StatusCode::SUCCESS; } int JetSelectorAttribute::keep(const xAOD::Jet& jet) const { - float v = m_var->value(jet); - return (m_min < v ) && (v<m_max); + bool pass=true; + unsigned int it=0; + for (auto var : m_var) { + float v = var->value(jet); + if ((m_min.at(it) > v) || (m_max.at(it) < v)) pass=false; + it++; + } + return pass; } diff --git a/Reconstruction/Jet/JetMonitoring/python/JetMonitoringConfig.py b/Reconstruction/Jet/JetMonitoring/python/JetMonitoringConfig.py index df7a618cb4f3fd57c57342cf309a139359aa2cbb..20e5088712b75216e0091a3f6f730c0f31a0aac8 100644 --- a/Reconstruction/Jet/JetMonitoring/python/JetMonitoringConfig.py +++ b/Reconstruction/Jet/JetMonitoring/python/JetMonitoringConfig.py @@ -115,22 +115,25 @@ def interpretSelStr(selStr): if '>' in selStr: print("JetMonitoring ERROR interpreting selection string ", selStr) print("JetMonitoring ERROR can not interpret '>', please use only '<' ") - parts = selStr.split('<') - cmin, cmax = None, None - var = selStr - if len(parts)==2: + selstrings = selStr.split(',') + cmin, cmax, var = [], [], [] + for substring in selstrings: + parts = substring.split('<') + if len(parts)==2: ismin = False try : - var, cut = parts[0] , float(parts[1]) + v, cut = parts[0] , float(parts[1]) #would fail except ValueError: - cut, var = float(parts[0]) ,parts[1] - ismin=True - if ismin : cmin = cut - else: cmax = cut - elif len(parts)==3: - cmin, var, cmax = parts - cmin = float(cmin) - cmax = float(cmax) + cut, v = float(parts[0]) , parts[1] + ismin=True + if ismin : cmin.append(cut) + else: cmax.append(cut) + var.append(v) + elif len(parts)==3: + cutmin, v, cutmax = parts + var.append(v) + cmin.append(float(cutmin)) + cmax.append(float(cutmax)) return cmin, var, cmax @@ -425,14 +428,20 @@ class SelectSpec(ToolSpec): if '<' in selexpr: # interpret it as min<v<max cmin, v , cmax = interpretSelStr(selexpr) + VarList = [] if args.setdefault('isEventVariable', False) : selProp = 'EventSelector' - selSpec = ToolSpec('JetEventSelector', v+'sel', Var = retrieveEventVarToolConf(v), ) + for variable in v: + VarList.append(retrieveEventVarToolConf(v)) + selSpec = ToolSpec('JetEventSelector', v+'sel', Var = VarList, ) else: selProp = 'Selector' - selSpec = ToolSpec('JetSelectorAttribute', v+'sel', Var = retrieveVarToolConf(v), ) - if cmin is not None: selSpec['CutMin'] = cmin - if cmax is not None: selSpec['CutMax'] = cmax + for variable in v: + VarList.append(retrieveVarToolConf(v)) + selSpec = ToolSpec('JetSelectorAttribute', v+'sel', Var = VarList, ) + #from numpy import array + if cmin is not []: selSpec['CutMin'] = cmin + if cmax is not []: selSpec['CutMax'] = cmax args[selProp] = selSpec elif selexpr != '': from JetMonitoring.JetStandardHistoSpecs import knownSelector