ATLAS Offline Software
Loading...
Searching...
No Matches
python.JetAnalysisCommon Namespace Reference

Classes

class  ComponentAccumulatorMockUp
class  ConfArray
class  Configured
class  ConfNameSpace

Functions

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

Variables

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

Function Documentation

◆ addManyAlgs()

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 355 of file JetAnalysisCommon.py.

355def addManyAlgs(job, algList):
356 """a little configuration function added from the python module JetAnalysisCommon.py to easily schedule
357 # a list of Configured algs as defined by this module."""
358 for alg in algList:
359 job.algsAdd( alg.asAnaAlg() )
360

◆ generateConfigured()

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

Definition at line 217 of file JetAnalysisCommon.py.

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

◆ JetRecCfg_reorder()

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 396 of file JetAnalysisCommon.py.

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

◆ mock_JetRecTools()

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

Definition at line 376 of file JetAnalysisCommon.py.

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

◆ parOR()

python.JetAnalysisCommon.parOR ( name)

Definition at line 313 of file JetAnalysisCommon.py.

313def parOR(name):
314 pass

◆ propertyType()

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 237 of file JetAnalysisCommon.py.

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

◆ stringPropValue()

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

Definition at line 49 of file JetAnalysisCommon.py.

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

Variable Documentation

◆ addManyAlgs

python.JetAnalysisCommon.addManyAlgs

Definition at line 361 of file JetAnalysisCommon.py.

◆ CFElements

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

Definition at line 315 of file JetAnalysisCommon.py.

◆ CompFactory

python.JetAnalysisCommon.CompFactory = ConfNameSpace()

Definition at line 300 of file JetAnalysisCommon.py.

◆ ComponentAccumulator

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

Definition at line 347 of file JetAnalysisCommon.py.

◆ ComponentFactory

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

Definition at line 305 of file JetAnalysisCommon.py.

◆ isComponentAccumulatorCfg

python.JetAnalysisCommon.isComponentAccumulatorCfg

Definition at line 308 of file JetAnalysisCommon.py.

◆ JetAnalysisCommon

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

Definition at line 368 of file JetAnalysisCommon.py.

◆ JetRecCfg

python.JetAnalysisCommon.JetRecCfg

Definition at line 428 of file JetAnalysisCommon.py.

◆ JetRecCfg_original

python.JetAnalysisCommon.JetRecCfg_original

Definition at line 395 of file JetAnalysisCommon.py.

◆ parOR

python.JetAnalysisCommon.parOR

Definition at line 316 of file JetAnalysisCommon.py.