ATLAS Offline Software
Classes | Functions
JetMonitoringConfig Namespace Reference

Classes

class  ConfigDict
 
class  EventHistoSpec
 
class  HistoSpec
 
class  JetMonAlgSpec
 
class  JetMonSpecException
 
class  SelectSpec
 
class  ToolSpec
 
class  VarSpec
 

Functions

def interpretManySelStr (selStr)
 
def interpretSelStr (selStr)
 
def findSelectIndex (name)
 
def retrieveVarToolConf (alias)
 
def retrieveEventVarToolConf (alias)
 
def retrieveHistoToolConf (alias)
 

Function Documentation

◆ findSelectIndex()

def JetMonitoringConfig.findSelectIndex (   name)
interprets 'varName[X]' into ('varName',x) 

Definition at line 144 of file JetMonitoringConfig.py.

144 def findSelectIndex( name):
145  """ interprets 'varName[X]' into ('varName',x) """
146  try:
147  name, index = name.split('[')
148  except ValueError:
149  name, index = name, ''
150  if not index.endswith(']'):
151  return name, -1
152  index = int(index[:-1])
153  return name, index
154 
155 # **********************************************************
156 
157 

◆ interpretManySelStr()

def JetMonitoringConfig.interpretManySelStr (   selStr)

Definition at line 105 of file JetMonitoringConfig.py.

105 def interpretManySelStr(selStr):
106  selL = selStr.split('&')
107  interpL = [interpretSelStr( s ) for s in selL]
108  # interpL is in the form [ (min1,v1,max1), (min2,v2,max2),..]
109  # unpack it into 3 lists :
110  minL, varL, maxL = zip(*interpL)
111  return minL, varL, maxL
112 

◆ interpretSelStr()

def JetMonitoringConfig.interpretSelStr (   selStr)
Interpret a selection string in the form '12.3<var<42.0'
and returns a tuple.
 '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)

Definition at line 113 of file JetMonitoringConfig.py.

113 def interpretSelStr(selStr):
114  """Interpret a selection string in the form '12.3<var<42.0'
115  and returns a tuple.
116  '12.3<var<42.0' -> returns (12.3, 'var', 42.)
117  'var<42.0' -> returns (None, 'var', 42.)
118  '12.3<var' -> returns (12.3, 'var', None)
119  """
120 
121  if '>' in selStr:
122  print("JetMonitoring ERROR interpreting selection string ", selStr)
123  print("JetMonitoring ERROR can not interpret '>', please use only '<' ")
124 
125  parts = selStr.split('<')
126  cmin, cmax = -3.4e38, 3.4e38 #we declare std::vector<float> for both on the c++ side, but will not necessarily pass actual values for them, so we use min/max float values in python as default (hardcoded numbers, because not easily accessible)
127  var = selStr
128  if len(parts)==2:
129  ismin = False
130  try :
131  var, cut = parts[0] , float(parts[1])
132  except ValueError:
133  cut, var = float(parts[0]) ,parts[1]
134  ismin=True
135  if ismin : cmin = cut
136  else: cmax = cut
137  elif len(parts)==3:
138  cmin, var, cmax = parts
139  cmin = float(cmin)
140  cmax = float(cmax)
141 
142  return cmin, var, cmax
143 

◆ retrieveEventVarToolConf()

def JetMonitoringConfig.retrieveEventVarToolConf (   alias)
Return a ToolSpec from alias : (now with EventInfo or JetContainer variables) 
    * if alias is a string build a ToolSpec, assuming alias is an attribute of type float.
    * if alias is a ToolSpec, returns it directly

Definition at line 600 of file JetMonitoringConfig.py.

600 def retrieveEventVarToolConf(alias):
601  """Return a ToolSpec from alias : (now with EventInfo or JetContainer variables)
602  * if alias is a string build a ToolSpec, assuming alias is an attribute of type float.
603  * if alias is a ToolSpec, returns it directly
604  """
605  from JetMonitoring.JetStandardHistoSpecs import knownEventVar
606  if isinstance(alias, str): #check for existing event or jetcontainer specs
607  conf = knownEventVar.get(alias,None)
608  if conf is None: #assume it's an eventInfo variable
609  conf = ToolSpec('EventHistoVarTool', alias, Attribute=alias)
610  else: # assume it's a config dict
611  conf = alias
612  return conf
613 
614 

◆ retrieveHistoToolConf()

def JetMonitoringConfig.retrieveHistoToolConf (   alias)
Return a HistoSpec from alias : 
    * if alias is a string look up in JetStandardHistoSpecs.knownHistos
      --> if found, return a full clone (so client can modify it safely)
      --> if not found and contain a ';' build a HistoSpec for a 2D histograms
    * if alias is a ToolSpec, returns it directly

Definition at line 615 of file JetMonitoringConfig.py.

615 def retrieveHistoToolConf(alias):
616  """Return a HistoSpec from alias :
617  * if alias is a string look up in JetStandardHistoSpecs.knownHistos
618  --> if found, return a full clone (so client can modify it safely)
619  --> if not found and contain a ';' build a HistoSpec for a 2D histograms
620  * if alias is a ToolSpec, returns it directly
621  """
622  if isinstance(alias, ToolSpec):
623  return alias
624  elif isinstance(alias,str):
625  from JetMonitoring.JetStandardHistoSpecs import knownHistos
626  # get it from knownHistos
627  c = knownHistos.get(alias,None)
628  if c :
629  # found a knownHistos.
630  # we return a *clone* so that it can be modified without changing the standard spec.
631  return c.clone(c.name)
632  if ';' not in alias:
633  raise JetMonSpecException(" Unknown Histo specification : '{}' ".format(alias))
634  # print 'ERROR unknown Histo Filler specification ', alias
635  # return None
636  # we have a ';' : try to generate a 2D histo
637  aliases = alias.split(';')
638  aliasX, aliasY = aliases[0], aliases[1]
639  cX = knownHistos.get(aliasX,None)
640  cY = knownHistos.get(aliasY,None)
641  if len(aliases) == 2:
642  if None in (cX,cY):
643  print("ERROR unknown Histo Filler specification ", cX if cX is None else cY)
644  return None
645  # merge the spec
646  return cX.to2DSpec(cY)
647  else: # must be 3
648  aliasZ = aliases[2]
649  cZ = knownHistos.get(aliasZ,None)
650  if cZ is None:
651  # then we can try to build a dummy HistoSpec from a variable
652  # this is ok, since we're building a TProfile2D and we don't need
653  # binning info on the xAxis
654  vZ = retrieveVarToolConf(aliasZ)
655  cZ = HistoSpec(vZ.Name, (10,0,1) , title=vZ.Name+';'+vZ.Name+';', xvar=vZ )
656  return cX.to2DSpec(cY, zspec=cZ)
657 
658  else:
659  # What is this :
660  print('ERROR can not instantiate a tool from ', alias)
661  return None
662 
663 

◆ retrieveVarToolConf()

def JetMonitoringConfig.retrieveVarToolConf (   alias)
Return a VarSpec from alias : 
    * if alias is a string look up in JetStandardHistoSpecs.knownVar
      --> if not found build a VarSpec, assuming alias is an attribute of type float.
    * if alias is a VarSpec, returns it directly

Definition at line 584 of file JetMonitoringConfig.py.

584 def retrieveVarToolConf(alias):
585  """Return a VarSpec from alias :
586  * if alias is a string look up in JetStandardHistoSpecs.knownVar
587  --> if not found build a VarSpec, assuming alias is an attribute of type float.
588  * if alias is a VarSpec, returns it directly
589  """
590  from JetMonitoring.JetStandardHistoSpecs import knownVar
591  if isinstance(alias, str):
592  conf = knownVar.get(alias,None)
593  if conf is None:
594  conf=VarSpec( Name=alias, Type='float')
595  else: # assume it's a config dict
596  conf = alias
597  return conf
598 
599 
JetMonitoringConfig.retrieveEventVarToolConf
def retrieveEventVarToolConf(alias)
Definition: JetMonitoringConfig.py:600
vtune_athena.format
format
Definition: vtune_athena.py:14
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
JetMonitoringConfig.interpretManySelStr
def interpretManySelStr(selStr)
Definition: JetMonitoringConfig.py:105
JetMonitoringConfig.interpretSelStr
def interpretSelStr(selStr)
Definition: JetMonitoringConfig.py:113
JetMonitoringConfig.retrieveVarToolConf
def retrieveVarToolConf(alias)
Definition: JetMonitoringConfig.py:584
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
JetMonitoringConfig.retrieveHistoToolConf
def retrieveHistoToolConf(alias)
Definition: JetMonitoringConfig.py:615
readCCLHist.float
float
Definition: readCCLHist.py:83
JetMonitoringConfig.findSelectIndex
def findSelectIndex(name)
Definition: JetMonitoringConfig.py:144