Skip to content
Snippets Groups Projects
Commit 26494241 authored by Jannik Geisen's avatar Jannik Geisen
Browse files

fixing name expression of SelectSpec and size of cut vectors

parent bc797d35
No related branches found
No related tags found
6 merge requests!58791DataQualityConfigurations: Modify L1Calo config for web display,!46784MuonCondInterface: Enable thread-safety checking.,!46776Updated LArMonitoring config file for WD to match new files produced using MT,!45405updated ART test cron job,!42417Draft: DIRE and VINCIA Base Fragments for Pythia 8.3,!39284Multiple Selections in Run3 Offline JetMon
......@@ -11,8 +11,8 @@ JetSelectorAttribute::JetSelectorAttribute(const std::string &t)
: asg::AsgTool(t)
//, m_min(-std::numeric_limits<float>::max())
//, m_max(std::numeric_limits<float>::max())
, m_min(-999999.)
, m_max(999999.)
, m_min(10)
, m_max(10)
, m_var(this)
{
declareProperty("CutMin", m_min );
......@@ -35,12 +35,11 @@ StatusCode JetSelectorAttribute::initialize() {
}
int JetSelectorAttribute::keep(const xAOD::Jet& jet) const {
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;
if ((m_min.at(it) > v) || (m_max.at(it) < v)) return false;
it++;
}
return pass;
return true;
}
......@@ -110,6 +110,7 @@ def interpretSelStr(selStr):
'12.3<var<42.0' -> returns (12.3, 'var', 42.)
'var<42.0' -> returns (None, 'var', 42.)
'12.3<var' -> returns (12.3, 'var', None)
Now adjusted to read multiple selection strings connected via ','
"""
if '>' in selStr:
......@@ -126,8 +127,12 @@ def interpretSelStr(selStr):
except ValueError:
cut, v = float(parts[0]) , parts[1]
ismin=True
if ismin : cmin.append(cut)
else: cmax.append(cut)
if ismin :
cmin.append(cut)
cmax.append(None)
else:
cmax.append(cut)
cmin.append(None)
var.append(v)
elif len(parts)==3:
cutmin, v, cutmax = parts
......@@ -429,17 +434,17 @@ class SelectSpec(ToolSpec):
# interpret it as min<v<max
cmin, v , cmax = interpretSelStr(selexpr)
VarList = []
specname = '_'.join(v)
if args.setdefault('isEventVariable', False) :
selProp = 'EventSelector'
for variable in v:
VarList.append(retrieveEventVarToolConf(v))
selSpec = ToolSpec('JetEventSelector', v+'sel', Var = VarList, )
selSpec = ToolSpec('JetEventSelector', specname+'_sel', Var = VarList, )
else:
selProp = 'Selector'
for variable in v:
VarList.append(retrieveVarToolConf(v))
selSpec = ToolSpec('JetSelectorAttribute', v+'sel', Var = VarList, )
#from numpy import array
selSpec = ToolSpec('JetSelectorAttribute', specname+'_sel', Var = VarList, )
if cmin is not []: selSpec['CutMin'] = cmin
if cmax is not []: selSpec['CutMax'] = cmax
args[selProp] = selSpec
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment