CMS 3D CMS Logo

EventContentDataAccessor.py
Go to the documentation of this file.
1 import sys
2 import logging
3 import os.path
4 
5 from Vispa.Share.BasicDataAccessor import BasicDataAccessor
6 from Vispa.Plugins.EdmBrowser.EdmDataAccessor import EdmDataAccessor
7 
9  def __init__(self):
10  self._eventContents = []
11  self._configAccessors = {}
12 
13  def children(self, object):
14  return []
15 
16  def isContainer(self, object):
17  return False
18 
19  def label(self, object):
20  return "_".join(object)
21 
22  def eventContentsList(self):
23  """ return top level objects from file, e.g. the event.
24  """
25  return self._eventContents
26 
27  def topLevelObjects(self):
28  objects = []
29  for name, content, input, comment in self._eventContents:
30  objects += list(content)
31  return objects
32 
33  def addContents(self,content,content2):
34  for object in content2:
35  if not self.inContent(object,content):
36  content+=[object]
37 
38  def properties(self, object):
39  """ Make list of all properties """
40  properties = []
41  properties += [("Category", "Object info", "")]
42  properties += [("String", "Label", object)]
43  return properties
44 
45  def addConfig(self, accessor):
46  if not accessor:
47  return
48  configName=os.path.splitext(os.path.basename(accessor.configFile()))[0]
49  name = "Input: " + configName
50  inputContent=accessor.inputEventContent()
51  self._eventContents += [(name, inputContent[0], True, inputContent[1])]
52  output_content=[]
53  if len(self._eventContents)>1:
54  self.addContents(output_content,self._eventContents[-2][1])
55  output_content=self.applyCommands(output_content,accessor.inputCommands())
56  self.addContents(output_content,accessor.outputEventContent())
57  output_content=self.applyCommands(output_content,accessor.outputCommands())
58  name = "Output: " + configName
59  self._eventContents += [(name, output_content, False, {})]
60 
61  def addContentFile(self, filename):
62  accessor=EdmDataAccessor()
63  accessor.open(filename)
64  branches=[branch[0].split("_") for branch in accessor.filteredBranches()]
65  name = os.path.splitext(os.path.basename(filename))[0]
66  self.addBranches(name,branches)
67 
68  def addBranches(self,name,branches):
69  content = []
70  for branch in branches:
71  type = branch[0]
72  label = branch[1]
73  product = branch[2]
74  process = branch[3]
75  content += [(type,label,product,process)]
76  self._eventContents += [(name, content, False, {})]
77 
78  def compareEntry(self, entry1, entry2):
79  result=True
80  for i in range(4):
81  result=result and (entry1[i]==entry2[i] or entry1[i]=="*" or entry2[i]=="*")
82  return result
83 
84  def inContent(self, entry, content):
85  return True in [self.compareEntry(entry,c) for c in content]
86 
87  def applyCommands(self, content, outputCommands):
88  keep = {}
89  if len(outputCommands)>0 and outputCommands[0]!="keep *":
90  for object in content:
91  keep[object] = False
92  else:
93  for object in content:
94  keep[object] = True
95  for o in outputCommands:
96  command, filter = o.split(" ")
97  if len(filter.split("_")) > 1:
98  module = filter.split("_")[1]
99  product = filter.split("_")[2]
100  process = filter.split("_")[3]
101  else:
102  module = filter
103  product = "*"
104  process = "*"
105  for object in content:
106  if "*" in module:
107  match = module.strip("*") in object[1]
108  else:
109  match = module == object[1]
110  if "*" in product:
111  match = match and product.strip("*") in object[2]
112  else:
113  match = match and product == object[2]
114  if "*" in process:
115  match = match and process.strip("*") in object[3]
116  else:
117  match = match and process == object[3]
118  if match:
119  keep[object] = command == "keep"
120  return [object for object in content if keep[object]]
121 
122  def clear(self):
123  self._eventContents=[]
124 
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
double split
Definition: MVATrainer.cc:139
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