ATLAS Offline Software
Loading...
Searching...
No Matches
PhysicsAnalysis
DerivationFramework
DerivationFrameworkCore
python
ContentHandler.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2
3
import
PyUtils.Logging
as
L
4
msg = L.logging.getLogger(
'DerivationFramework__ContentHandler'
)
5
msg.setLevel(L.logging.INFO)
6
7
class
ContentHandler
:
8
def
__init__
(self,inputName,namesAndTypes):
9
self.
name
= inputName
10
self.
AppendToDictionary
= {}
11
self.
NamesAndTypes
= namesAndTypes
12
13
def
mainContainerLine
(self,containerName):
14
theDictionary = self.
NamesAndTypes
.copy()
15
theDictionary.update (self.
AppendToDictionary
)
16
line =
''
17
if
containerName
in
theDictionary.keys():
18
line = theDictionary[containerName]+
"#"
+containerName
19
else
:
20
msg.warning(
'Collection with name %s not found in input file or in definitions from user. No action will be taken for this collection.'
, containerName)
21
return
line
22
23
24
def
GetContent
(self,contentList,wholeContentList):
25
mainOutput = []
26
auxOutput = {}
27
for
item
in
contentList:
28
components = item.split(
"."
)
29
if
len(components)==0:
30
continue
31
mainItem = self.
mainContainerLine
(components[0])
32
if
mainItem==
''
:
33
continue
34
if
len(components)==1:
35
# deal with main containers
36
if
(mainItem
not
in
mainOutput):
37
mainOutput.append(mainItem)
38
if
len(components)>1:
39
# All variables needed
40
if
(components[0]+
"."
in
wholeContentList):
41
if
(components[0]
not
in
auxOutput.keys()):
42
auxOutput[components[0]] =
""
43
continue
44
# All variables needed but user did it via smart slimming list with ContainerAux.
45
if
(len(components)==2):
46
if
(components[1] ==
""
):
47
wholeContentList.append(components[0]+
"."
)
48
auxOutput[components[0]] =
""
49
continue
50
if
(components[0]
not
in
auxOutput.keys()):
51
auxOutput[components[0]] = components[1:]
52
if
(components[0]
in
auxOutput.keys()):
53
auxOutput[components[0]] = list(
set
(auxOutput[components[0]]) |
set
(components[1:]))
54
return
mainOutput,auxOutput
ContentHandler.ContentHandler
Definition
ContentHandler.py:7
ContentHandler.ContentHandler.GetContent
GetContent(self, contentList, wholeContentList)
Definition
ContentHandler.py:24
ContentHandler.ContentHandler.mainContainerLine
mainContainerLine(self, containerName)
Definition
ContentHandler.py:13
ContentHandler.ContentHandler.name
name
Definition
ContentHandler.py:9
ContentHandler.ContentHandler.NamesAndTypes
NamesAndTypes
Definition
ContentHandler.py:11
ContentHandler.ContentHandler.AppendToDictionary
dict AppendToDictionary
Definition
ContentHandler.py:10
ContentHandler.ContentHandler.__init__
__init__(self, inputName, namesAndTypes)
Definition
ContentHandler.py:8
set
STL class.
Generated on
for ATLAS Offline Software by
1.14.0