CMS 3D CMS Logo

EventContentDataAccessor.py
Go to the documentation of this file.
1 from builtins import range
2 import sys
3 import logging
4 import os.path
5 
6 from Vispa.Share.BasicDataAccessor import BasicDataAccessor
7 from Vispa.Plugins.EdmBrowser.EdmDataAccessor import EdmDataAccessor
8 
10  def __init__(self):
11  self._eventContents = []
12  self._configAccessors = {}
13 
14  def children(self, object):
15  return []
16 
17  def isContainer(self, object):
18  return False
19 
20  def label(self, object):
21  return "_".join(object)
22 
23  def eventContentsList(self):
24  """ return top level objects from file, e.g. the event.
25  """
26  return self._eventContents
27 
28  def topLevelObjects(self):
29  objects = []
30  for name, content, input, comment in self._eventContents:
31  objects += list(content)
32  return objects
33 
34  def addContents(self,content,content2):
35  for object in content2:
36  if not self.inContent(object,content):
37  content+=[object]
38 
39  def properties(self, object):
40  """ Make list of all properties """
41  properties = []
42  properties += [("Category", "Object info", "")]
43  properties += [("String", "Label", object)]
44  return properties
45 
46  def addConfig(self, accessor):
47  if not accessor:
48  return
49  configName=os.path.splitext(os.path.basename(accessor.configFile()))[0]
50  name = "Input: " + configName
51  inputContent=accessor.inputEventContent()
52  self._eventContents += [(name, inputContent[0], True, inputContent[1])]
53  output_content=[]
54  if len(self._eventContents)>1:
55  self.addContents(output_content,self._eventContents[-2][1])
56  output_content=self.applyCommands(output_content,accessor.inputCommands())
57  self.addContents(output_content,accessor.outputEventContent())
58  output_content=self.applyCommands(output_content,accessor.outputCommands())
59  name = "Output: " + configName
60  self._eventContents += [(name, output_content, False, {})]
61 
62  def addContentFile(self, filename):
63  accessor=EdmDataAccessor()
64  accessor.open(filename)
65  branches=[branch[0].split("_") for branch in accessor.filteredBranches()]
66  name = os.path.splitext(os.path.basename(filename))[0]
67  self.addBranches(name,branches)
68 
69  def addBranches(self,name,branches):
70  content = []
71  for branch in branches:
72  type = branch[0]
73  label = branch[1]
74  product = branch[2]
75  process = branch[3]
76  content += [(type,label,product,process)]
77  self._eventContents += [(name, content, False, {})]
78 
79  def compareEntry(self, entry1, entry2):
80  result=True
81  for i in range(4):
82  result=result and (entry1[i]==entry2[i] or entry1[i]=="*" or entry2[i]=="*")
83  return result
84 
85  def inContent(self, entry, content):
86  return True in [self.compareEntry(entry,c) for c in content]
87 
88  def applyCommands(self, content, outputCommands):
89  keep = {}
90  if len(outputCommands)>0 and outputCommands[0]!="keep *":
91  for object in content:
92  keep[object] = False
93  else:
94  for object in content:
95  keep[object] = True
96  for o in outputCommands:
97  command, filter = o.split(" ")
98  if len(filter.split("_")) > 1:
99  module = filter.split("_")[1]
100  product = filter.split("_")[2]
101  process = filter.split("_")[3]
102  else:
103  module = filter
104  product = "*"
105  process = "*"
106  for object in content:
107  if "*" in module:
108  match = module.strip("*") in object[1]
109  else:
110  match = module == object[1]
111  if "*" in product:
112  match = match and product.strip("*") in object[2]
113  else:
114  match = match and product == object[2]
115  if "*" in process:
116  match = match and process.strip("*") in object[3]
117  else:
118  match = match and process == object[3]
119  if match:
120  keep[object] = command == "keep"
121  return [object for object in content if keep[object]]
122 
123  def clear(self):
124  self._eventContents=[]
125 
std::vector< std::string_view > split(std::string_view, const char *)
static std::string join(char **cmd)
Definition: RemoteFile.cc:17
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run