ATLAS Offline Software
Functions | Variables
python.selection Namespace Reference

Functions

def convertNumber (t)
 
def make_parser (payload_specification)
 
def make_browse_objects_selection (folder, selection)
 

Variables

 sign = oneOf('+ -')
 
 integer = Word(nums)
 
 number
 
tuple boolValue
 
 stringValue = QuotedString("'") | QuotedString('"')
 
tuple value = boolValue | number | stringValue
 
 variable = Word(alphanums, min=1)
 

Function Documentation

◆ convertNumber()

def python.selection.convertNumber (   t)

Definition at line 10 of file selection.py.

10 def convertNumber(t):
11  if t.is_float:
12  return float(t[0])
13  else:
14  return int(t[0])
15 
16 # Number defintion

◆ make_browse_objects_selection()

def python.selection.make_browse_objects_selection (   folder,
  selection 
)

Definition at line 82 of file selection.py.

82 def make_browse_objects_selection(folder, selection):
83  parser = make_parser(folder.folderSpecification().payloadSpecification())
84  return parser(selection)

◆ make_parser()

def python.selection.make_parser (   payload_specification)
The parser has to be payload_specification specific because it needs to know
the types of the records to build a FieldSelection.

Definition at line 35 of file selection.py.

35 def make_parser(payload_specification):
36  """
37  The parser has to be payload_specification specific because it needs to know
38  the types of the records to build a FieldSelection.
39  """
40 
41  def make_selection(string, location, tokens):
42  variable, comparator, value = tokens
43  if payload_specification and variable not in payload_specification:
44  raise RuntimeError("%s is not a value in the folder payload "
45  "specification")
46  elif not payload_specification:
47  return (variable, comparator, value)
48  typeid = payload_specification[variable].storageType().id()
49  return make_fieldselection(variable, typeid, comparator, value)
50 
51  from PyCool import cool
52  EQ = Literal("==").setParseAction(lambda t: cool.FieldSelection.EQ)
53  NE = Literal("!=").setParseAction(lambda t: cool.FieldSelection.NE)
54  GE = Literal(">=").setParseAction(lambda t: cool.FieldSelection.GE)
55  LE = Literal("<=").setParseAction(lambda t: cool.FieldSelection.LE)
56  GT = Literal(">") .setParseAction(lambda t: cool.FieldSelection.GT)
57  LT = Literal("<") .setParseAction(lambda t: cool.FieldSelection.LT)
58  comparator = EQ | NE | GE | LE | GT | LT
59  operand = (variable + comparator + value).setParseAction(make_selection)
60 
61  orop = Literal("or").suppress()
62  andop = Literal("and").suppress()
63 
64  def logic_builder(connective):
65  def thunk(string, location, tokens):
66  vec = make_selection_vector()
67  for token in tokens[0]:
68  vec.push_back(token)
69 
70  return cool.CompositeSelection(connective, vec)
71  return thunk
72 
73  expr = StringStart() + operatorPrecedence( operand,
74  [(andop, 2, opAssoc.LEFT, logic_builder(cool.CompositeSelection.AND)),
75  (orop, 2, opAssoc.LEFT, logic_builder(cool.CompositeSelection.OR)),]
76  ) + StringEnd()
77 
78  def go(selection):
79  return expr.parseString(selection)[0]
80  return go
81 

Variable Documentation

◆ boolValue

tuple python.selection.boolValue
Initial value:
1 = (Literal("True") .setParseAction(lambda t: True) |
2  Literal("False").setParseAction(lambda t: False))

Definition at line 28 of file selection.py.

◆ integer

python.selection.integer = Word(nums)

Definition at line 18 of file selection.py.

◆ number

python.selection.number
Initial value:
1 = Combine(
2  Optional(sign)
3  + ( ( integer + Optional('.')('is_float') + Optional(integer))
4  | ( Literal('.')('is_float') + Optional(integer))
5  )
6  + Optional( CaselessLiteral('E') + Optional(sign) + integer)('is_float')
7  ).setParseAction(convertNumber)

Definition at line 20 of file selection.py.

◆ sign

python.selection.sign = oneOf('+ -')

Definition at line 17 of file selection.py.

◆ stringValue

python.selection.stringValue = QuotedString("'") | QuotedString('"')

Definition at line 30 of file selection.py.

◆ value

tuple python.selection.value = boolValue | number | stringValue

Definition at line 31 of file selection.py.

◆ variable

python.selection.variable = Word(alphanums, min=1)

Definition at line 33 of file selection.py.

python.CaloScaleNoiseConfig.parser
parser
Definition: CaloScaleNoiseConfig.py:75
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
python.quick_retrieve.make_selection_vector
make_selection_vector
Definition: quick_retrieve.py:20
python.selection.convertNumber
def convertNumber(t)
Definition: selection.py:10
python.doZLumi.go
def go(fname)
Definition: doZLumi.py:78
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:220
python.selection.make_browse_objects_selection
def make_browse_objects_selection(folder, selection)
Definition: selection.py:82
python.selection.make_parser
def make_parser(payload_specification)
Definition: selection.py:35
python.quick_retrieve.make_fieldselection
make_fieldselection
Definition: quick_retrieve.py:19
readCCLHist.float
float
Definition: readCCLHist.py:83