ATLAS Offline Software
Functions
VP1EvtFilter Namespace Reference

Functions

def readFileSimplified (filename)
 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration. More...
 
def filterEntry (parts)
 
def readFiltersFromFile (filename)
 
def parseFilterString (s)
 
def installEventFilter (filters)
 

Function Documentation

◆ filterEntry()

def VP1EvtFilter.filterEntry (   parts)

Definition at line 15 of file RunVP1Light/python/VP1EvtFilter.py.

15 def filterEntry(parts):
16  #parts is either [evt] or [run,evt]:
17  assert len(parts) in [1,2]
18  filter_run = int(parts[0]) if len(parts)==2 else None
19  filter_evt = int(parts[1]) if len(parts)==2 else int(parts[0])
20  assert (filter_run==None or filter_run>=0) and filter_evt>=0
21  return (filter_run,filter_evt)
22 

◆ installEventFilter()

def VP1EvtFilter.installEventFilter (   filters)

Definition at line 54 of file RunVP1Light/python/VP1EvtFilter.py.

54 def installEventFilter(filters):
55  def vp1filter(run,evt):
56  print "vp1filter(%i,%i) called" %(run,evt)
57  for filter in filters[1]:
58  if evt==filter[1] and (filter[0]==None or filter[0]==run): return not filters[0]
59  return filters[0]
60  from AthenaCommon.AlgSequence import AthSequencer
61  seq = AthSequencer('AthFilterSeq')
62  from GaudiSequencer.PyComps import PyEvtFilter
63  seq += PyEvtFilter ('vp1filteralg')
64  seq.vp1filteralg.filter_fct = vp1filter
65  seq.vp1filteralg.evt_info = ''#To trigger keyless retrieve of the EventInfo

◆ parseFilterString()

def VP1EvtFilter.parseFilterString (   s)

Definition at line 31 of file RunVP1Light/python/VP1EvtFilter.py.

31 def parseFilterString(s):
32  import os.path
33  excludemode=False
34  if s.startswith('%'):
35  excludemode=True
36  s=s[1:]
37  try:
38  filters=[]
39  tmp=s
40  for filt in tmp.split(','):
41  if os.path.exists(filt):
42  #This is a file...
43  for filefilt in readFiltersFromFile(filt):
44  filters += [filefilt]
45  continue
46  filters += [filterEntry(filt.split(':'))]
47  except:
48  filters=[]
49  def vp1CfgErr(s): print "VP1 CONFIGURATION ERROR: %s" % s#fixme: should go in common utils module
50  vp1CfgErr("Badly formatted filter string '%s'" % str(s))
51  raise
52  return (excludemode,filters)
53 

◆ readFileSimplified()

def VP1EvtFilter.readFileSimplified (   filename)

Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration.

Definition at line 5 of file RunVP1Light/python/VP1EvtFilter.py.

5 def readFileSimplified(filename):
6  import os.path
7  if not os.path.exists(filename): return None
8  lines = []
9  for l in open(filename):
10  if '#' in l: l = l[0:l.index('#')] #Remove comments
11  l=' '.join(l.split())#simplify whitespace
12  if l: lines += [l]
13  return lines
14 

◆ readFiltersFromFile()

def VP1EvtFilter.readFiltersFromFile (   filename)

Definition at line 23 of file RunVP1Light/python/VP1EvtFilter.py.

23 def readFiltersFromFile(filename):
24  lines = readFileSimplified(filename)
25  if lines==None: return None
26  filts=[]
27  for l in lines:
28  filts+=[filterEntry(l.replace(':',' ').split())]
29  return filts
30 
AthSequencer
ClassName: AthSequencer.
Definition: AthSequencer.h:40
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
VP1EvtFilter.readFiltersFromFile
def readFiltersFromFile(filename)
Definition: RunVP1Light/python/VP1EvtFilter.py:23
VP1EvtFilter.filterEntry
def filterEntry(parts)
Definition: RunVP1Light/python/VP1EvtFilter.py:15
VP1EvtFilter.parseFilterString
def parseFilterString(s)
Definition: RunVP1Light/python/VP1EvtFilter.py:31
VP1EvtFilter.readFileSimplified
def readFileSimplified(filename)
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration.
Definition: RunVP1Light/python/VP1EvtFilter.py:5
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
VP1EvtFilter.installEventFilter
def installEventFilter(filters)
Definition: RunVP1Light/python/VP1EvtFilter.py:54
Trk::open
@ open
Definition: BinningType.h:40
str
Definition: BTagTrackIpAccessor.cxx:11
Trk::split
@ split
Definition: LayerMaterialProperties.h:38