ATLAS Offline Software
Loading...
Searching...
No Matches
EventGUIDLookup_Skeleton Namespace Reference

Functions

 _getRunArg (runArgs, base)
 _unwrap (a)
 _loadEventList (path)
 fromRunArgs (runArgs)

Variables

 msglog = logging.getLogger('EventGUIDLookup_Skeleton')

Detailed Description

EventGUIDLookup_Skeleton.py

Function Documentation

◆ _getRunArg()

_getRunArg ( runArgs,
base )
protected

Definition at line 13 of file EventGUIDLookup_Skeleton.py.

13def _getRunArg(runArgs, base):
14 attrs = vars(runArgs)
15 candidates = [a for a in attrs if a == base or a.startswith(base)]
16 if not candidates:
17 raise AttributeError('No runArgs attribute starting with %r (have: %s)'
18 % (base, sorted(attrs.keys())))
19 candidates.sort(key=lambda a: (a != base, len(a)))
20 return getattr(runArgs, candidates[0])
21
22

◆ _loadEventList()

_loadEventList ( path)
protected

Definition at line 29 of file EventGUIDLookup_Skeleton.py.

29def _loadEventList(path):
30 requested = set()
31 with open(path) as fh:
32 for lineNo, line in enumerate(fh, 1):
33 line = line.strip()
34 if not line or line.startswith('#'):
35 continue
36 fields = line.split()
37 if len(fields) < 2:
38 msglog.warning('Ignoring malformed line %d in %s: %r',
39 lineNo, path, line)
40 continue
41 requested.add((int(fields[0]), int(fields[1])))
42 return requested
43
44
STL class.

◆ _unwrap()

_unwrap ( a)
protected

Definition at line 23 of file EventGUIDLookup_Skeleton.py.

23def _unwrap(a):
24 if hasattr(a, 'value'):
25 a = a.value
26 return a if isinstance(a, list) else [a]
27
28

◆ fromRunArgs()

fromRunArgs ( runArgs)

Definition at line 45 of file EventGUIDLookup_Skeleton.py.

45def fromRunArgs(runArgs):
46 msglog.info('***************** STARTING EventGUIDLookup *****************')
47
48 dataType = runArgs.dataType
49 inputDataType = runArgs.inputDataType
50 eventListPath = runArgs.eventList
51 inputFiles = [str(f) for f in _unwrap(_getRunArg(runArgs, 'inputFile'))]
52 outputPath = _unwrap(_getRunArg(runArgs, 'outputTXTFile'))[0]
53
54 requested = _loadEventList(eventListPath)
55 msglog.info('Loaded %d requested (run,event) pairs', len(requested))
56
57 flags = initConfigFlags()
58 flags.Input.Files = inputFiles
59 flags.Exec.MaxEvents = -1
60 flags.Concurrency.NumThreads = 1
61 flags.lock()
62
63 cfg = MainServicesCfg(flags)
64
65 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
66 cfg.merge(PoolReadCfg(flags))
67 # (xAODEventInfoCnvAlgDefault import removed -- not needed, and not
68 # verified to exist at that path anyway)
69
70 from EventGUIDLookup.EventGUIDLookupAlgConfig import EventGUIDLookupAlgCfg
71 cfg.merge(EventGUIDLookupAlgCfg(flags, dataType=dataType,
72 inputDataType=inputDataType,
73 requestedEvents=requested,
74 outputFile=outputPath))
75
76 sc = cfg.run()
77 sys.exit(0 if sc.isSuccess() else 1)

Variable Documentation

◆ msglog

EventGUIDLookup_Skeleton.msglog = logging.getLogger('EventGUIDLookup_Skeleton')

Definition at line 10 of file EventGUIDLookup_Skeleton.py.