ATLAS Offline Software
Classes | Functions | Variables
python.JetAnalysisCommon Namespace Reference

Classes

class  ComponentAccumulatorMockUp
 
class  ConfArray
 
class  Configured
 
class  ConfNameSpace
 

Functions

def stringPropValue (value)
 
def generateConfigured (classname, cppclass, prefix="")
 
def propertyType (p)
 
def parOR (name)
 
def addManyAlgs (job, algList)
 
def mock_JetRecTools ()
 
def JetRecCfg_reorder (jetdef, flags, returnFinalJetDef=False)
 

Variables

 CompFactory = ConfNameSpace()
 
 ComponentFactory = ModuleType("ComponentFactory")
 
 isComponentAccumulatorCfg
 
 CFElements = ModuleType("CFElements")
 
 parOR
 
 ComponentAccumulator = ModuleType("ComponentAccumulator")
 
 JetAnalysisCommon = sys.modules[__name__]
 
 JetRecCfg_original
 

Function Documentation

◆ addManyAlgs()

def python.JetAnalysisCommon.addManyAlgs (   job,
  algList 
)
a little configuration function added from the python module JetAnalysisCommon.py to easily schedule
# a list of Configured algs as defined by this module.

Definition at line 350 of file JetAnalysisCommon.py.

350 def addManyAlgs(job, algList):
351  """a little configuration function added from the python module JetAnalysisCommon.py to easily schedule
352  # a list of Configured algs as defined by this module."""
353  for alg in algList:
354  job.algsAdd( alg.asAnaAlg() )
355 
356 ROOT.EL.Job.addManyAlgs = addManyAlgs
357 
358 
359 #*******************************************************************
360 # hack the list of modules in sys so that the Athena config modules are found and redirected
361 # to what we have defined in this module

◆ generateConfigured()

def python.JetAnalysisCommon.generateConfigured (   classname,
  cppclass,
  prefix = "" 
)

Definition at line 212 of file JetAnalysisCommon.py.

212 def generateConfigured(classname, cppclass, prefix=""):
213  import cppyy
214 
215  # get an instance of the class :
216  if issubclass(cppclass, cppyy.gbl.asg.IAsgTool):
217  dummy = cppclass('dummy')
218  else: # then it's an Algorithm
219  dummy = cppclass('dummy', 0)
220 
221  # find all the properties of the Tool/Algorithm
222  pm = dummy.getPropertyMgr()
223  propkeys = [str(k) for k,p in pm.getProperties() ]
224  propTypes = dict( (k,propertyType(pm.getProperty(k)) ) for k in propkeys)
225  allowedProp = Configured._allowed + [k for k in propkeys]
226  # generate the class derived from Configured for this Tool/Alg
227  klass=type(classname+'Conf', (Configured,), dict(_allowed=allowedProp, _propTypes=propTypes,
228  type=prefix+classname,_cppclass=cppclass) )
229 
230  return klass
231 

◆ JetRecCfg_reorder()

def python.JetAnalysisCommon.JetRecCfg_reorder (   jetdef,
  flags,
  returnFinalJetDef = False 
)
Builds the algs with JetRecConfig.JetRecCfg and then make sure
they are in proper order.
Re-ordering is done manually, according to various input alg type.

Definition at line 391 of file JetAnalysisCommon.py.

391 def JetRecCfg_reorder(jetdef, flags, returnFinalJetDef=False):
392  """Builds the algs with JetRecConfig.JetRecCfg and then make sure
393  they are in proper order.
394  Re-ordering is done manually, according to various input alg type.
395  """
396  res = JetRecConfig.JetRecCfg_original(flags, jetdef , returnFinalJetDef)
397 
398  acc , _ = res if returnFinalJetDef else (res,None)
399  algs = acc.algs
400 
401  # ************
402  # reorder EventDensity and PseudoJetAlg
403  if not hasattr(ROOT, 'EventDensityAthAlg'):
404  return res
405  evtDensityAlgs = [ (i,alg) for (i,alg) in enumerate(algs) if alg._cppclass == ROOT.EventDensityAthAlg ]
406  pjAlgs = [ (i,alg) for (i,alg) in enumerate(algs) if alg._cppclass == ROOT.PseudoJetAlgorithm ]
407  pairsToswap = []
408  for i,edalg in evtDensityAlgs:
409  edInput = edalg.EventDensityTool.InputContainer
410  for j,pjalg in pjAlgs:
411  if j<i: continue
412  if edInput == pjalg.OutputContainer:
413  pairsToswap.append( (i,j) )
414  for (i,j) in pairsToswap:
415  algs[i], algs[j] = algs[j], algs[i]
416 
417  # ************
418  # if there were other types of alg which need re-rordering
419  # we could add the specific re-ordering code below ...
420 
421  return res
422 
423 JetRecConfig.JetRecCfg = JetRecCfg_reorder

◆ mock_JetRecTools()

def python.JetAnalysisCommon.mock_JetRecTools ( )
Allows to ignore JetRecTools in case this package is not checked out on top of AnalysisBase

Definition at line 371 of file JetAnalysisCommon.py.

371 def mock_JetRecTools():
372  """Allows to ignore JetRecTools in case this package is not checked out on top of AnalysisBase"""
373  sys.modules['JetRecTools'] = ModuleType('JetRecTools')
374  sys.modules['JetRecTools.JetRecToolsConfig'] = ModuleType('JetRecToolsConfig')
375 
376 
377 
378 #*******************************************************************
379 # hacks specific to jets
380 

◆ parOR()

def python.JetAnalysisCommon.parOR (   name)

Definition at line 308 of file JetAnalysisCommon.py.

308 def parOR(name):
309  pass

◆ propertyType()

def python.JetAnalysisCommon.propertyType (   p)
Guess the type of the TProperty p.
p is a C++ instance of a TProperty.

This simply interpret the cpp name as set by cppyy...

Definition at line 232 of file JetAnalysisCommon.py.

232 def propertyType(p):
233  """Guess the type of the TProperty p.
234  p is a C++ instance of a TProperty.
235 
236  This simply interpret the cpp name as set by cppyy...
237  """
238  clsname = p.__class__.__cpp_name__
239  # clsname is in the form : 'TProperty<vector<double> >'
240  typ = clsname[10:-1].strip()
241  if 'Handle' in typ:
242  typ='string'
243  return typ
244 
245 

◆ stringPropValue()

def python.JetAnalysisCommon.stringPropValue (   value)
Helper function producing a string property value

Definition at line 48 of file JetAnalysisCommon.py.

48 def stringPropValue( value ):
49  """Helper function producing a string property value"""
50 
51  stringValue = str( value )
52  if isinstance( value, bool ):
53  stringValue = str( int( value ) )
54  pass
55  return stringValue
56 
57 

Variable Documentation

◆ CFElements

python.JetAnalysisCommon.CFElements = ModuleType("CFElements")

Definition at line 310 of file JetAnalysisCommon.py.

◆ CompFactory

python.JetAnalysisCommon.CompFactory = ConfNameSpace()

Definition at line 295 of file JetAnalysisCommon.py.

◆ ComponentAccumulator

python.JetAnalysisCommon.ComponentAccumulator = ModuleType("ComponentAccumulator")

Definition at line 342 of file JetAnalysisCommon.py.

◆ ComponentFactory

python.JetAnalysisCommon.ComponentFactory = ModuleType("ComponentFactory")

Definition at line 300 of file JetAnalysisCommon.py.

◆ isComponentAccumulatorCfg

python.JetAnalysisCommon.isComponentAccumulatorCfg

Definition at line 303 of file JetAnalysisCommon.py.

◆ JetAnalysisCommon

python.JetAnalysisCommon.JetAnalysisCommon = sys.modules[__name__]

Definition at line 363 of file JetAnalysisCommon.py.

◆ JetRecCfg_original

python.JetAnalysisCommon.JetRecCfg_original

Definition at line 390 of file JetAnalysisCommon.py.

◆ parOR

python.JetAnalysisCommon.parOR

Definition at line 311 of file JetAnalysisCommon.py.

SCT_Parameters::ModuleType
ModuleType
Enums for module and chip type.
Definition: SCT_ReadoutData.h:33
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
python.JetAnalysisCommon.stringPropValue
def stringPropValue(value)
Definition: JetAnalysisCommon.py:48
python.JetAnalysisCommon.mock_JetRecTools
def mock_JetRecTools()
Definition: JetAnalysisCommon.py:371
python.JetAnalysisCommon.parOR
def parOR(name)
Definition: JetAnalysisCommon.py:308
python.JetAnalysisCommon.JetRecCfg_reorder
def JetRecCfg_reorder(jetdef, flags, returnFinalJetDef=False)
Definition: JetAnalysisCommon.py:391
python.CaloAddPedShiftConfig.int
int
Definition: CaloAddPedShiftConfig.py:45
python.JetAnalysisCommon.generateConfigured
def generateConfigured(classname, cppclass, prefix="")
Definition: JetAnalysisCommon.py:212
python.JetAnalysisCommon.propertyType
def propertyType(p)
Definition: JetAnalysisCommon.py:232
str
Definition: BTagTrackIpAccessor.cxx:11
python.JetAnalysisCommon.addManyAlgs
def addManyAlgs(job, algList)
Definition: JetAnalysisCommon.py:350