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

Classes

class  ConfArray
class  Configured
class  ConfNameSpace
class  ComponentAccumulatorMockUp

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

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

◆ generateConfigured()

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

Definition at line 218 of file JetAnalysisCommon.py.

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

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

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

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

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

◆ parOR()

python.JetAnalysisCommon.parOR ( name)

Definition at line 314 of file JetAnalysisCommon.py.

314def parOR(name):
315 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 238 of file JetAnalysisCommon.py.

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

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

◆ CFElements

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

Definition at line 316 of file JetAnalysisCommon.py.

◆ CompFactory

python.JetAnalysisCommon.CompFactory = ConfNameSpace()

Definition at line 301 of file JetAnalysisCommon.py.

◆ ComponentAccumulator

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

Definition at line 348 of file JetAnalysisCommon.py.

◆ ComponentFactory

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

Definition at line 306 of file JetAnalysisCommon.py.

◆ isComponentAccumulatorCfg

python.JetAnalysisCommon.isComponentAccumulatorCfg

Definition at line 309 of file JetAnalysisCommon.py.

◆ JetAnalysisCommon

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

Definition at line 369 of file JetAnalysisCommon.py.

◆ JetRecCfg

python.JetAnalysisCommon.JetRecCfg

Definition at line 429 of file JetAnalysisCommon.py.

◆ JetRecCfg_original

python.JetAnalysisCommon.JetRecCfg_original

Definition at line 396 of file JetAnalysisCommon.py.

◆ parOR

python.JetAnalysisCommon.parOR

Definition at line 317 of file JetAnalysisCommon.py.