ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
readDataHeader.ReadDataHeaderAlg Class Reference
Inheritance diagram for readDataHeader.ReadDataHeaderAlg:
Collaboration diagram for readDataHeader.ReadDataHeaderAlg:

Public Member Functions

def __init__ (self, name='ReadDataHeaderAlg', totalEvents=0)
 
def initialize (self)
 
def execute (self)
 
def finalize (self)
 

Public Attributes

 totalEvents
 
 nevt
 
 sg
 

Detailed Description

Definition at line 9 of file readDataHeader.py.

Constructor & Destructor Documentation

◆ __init__()

def readDataHeader.ReadDataHeaderAlg.__init__ (   self,
  name = 'ReadDataHeaderAlg',
  totalEvents = 0 
)

Definition at line 11 of file readDataHeader.py.

11  def __init__(self,name='ReadDataHeaderAlg', totalEvents=0):
12  super(ReadDataHeaderAlg,self).__init__(name=name)
13  self.totalEvents = totalEvents
14  self.nevt = 0
15  return
16 

Member Function Documentation

◆ execute()

def readDataHeader.ReadDataHeaderAlg.execute (   self)

Definition at line 21 of file readDataHeader.py.

21  def execute(self):
22  if self.sg.contains('DataHeader', 'EventSelector'):
23  dh = self.sg.retrieve('DataHeader', 'EventSelector')
24  sz = dh.size()
25  self.nevt += 1
26  if self.nevt % 100 == 0:
27  logging.info(f'DataHeader Size {sz} in event #{self.nevt}')
28  if sz > 0:
29  it = dh.begin()
30  for idx in range(sz):
31  logging.debug(f' >> Key {it.getKey()} : Token {it.getToken().toString()}')
32  it+=1
33  else:
34  logging.debug(' >> Successfully read through the DataHeader')
35  else:
36  logging.error(f' >> Negative DataHeader size ({sz})!')
37  return StatusCode.Failure
38  else:
39  logging.error('Could NOT find the DataHeader!')
40  return StatusCode.Failure
41 
42  return StatusCode.Success
43 

◆ finalize()

def readDataHeader.ReadDataHeaderAlg.finalize (   self)

Definition at line 44 of file readDataHeader.py.

44  def finalize(self):
45  # Now this hack is needed because some errors, e.g. those in loading proxies,
46  # don't cause a job failure because most loop managers seem to ignore them.
47  # The problem is that even though we fail here, the job still "succeeds"
48  if self.nevt != self.totalEvents:
49  logging.error(f'Expected {self.totalEvents} events but processed {self.nevt}!')
50  logging.error('This most likely means we could not process some events successfully!')
51  return StatusCode.Failure
52 
53  return StatusCode.Success
54 
55 # A minimal job that reads the DataHeader

◆ initialize()

def readDataHeader.ReadDataHeaderAlg.initialize (   self)

Definition at line 17 of file readDataHeader.py.

17  def initialize(self):
18  self.sg = py_svc('StoreGateSvc')
19  return StatusCode.Success
20 

Member Data Documentation

◆ nevt

readDataHeader.ReadDataHeaderAlg.nevt

Definition at line 14 of file readDataHeader.py.

◆ sg

readDataHeader.ReadDataHeaderAlg.sg

Definition at line 18 of file readDataHeader.py.

◆ totalEvents

readDataHeader.ReadDataHeaderAlg.totalEvents

Definition at line 13 of file readDataHeader.py.


The documentation for this class was generated from the following file:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
python.tests.PyTestsLib.finalize
def finalize(self)
_info( "content of StoreGate..." ) self.sg.dump()
Definition: PyTestsLib.py:50
initialize
void initialize()
Definition: run_EoverP.cxx:894
LArG4FSStartPointFilterLegacy.execute
execute
Definition: LArG4FSStartPointFilterLegacy.py:20
python.Bindings.py_svc
def py_svc(svcName, createIf=True, iface=None)
Definition: Control/AthenaPython/python/Bindings.py:98
contains
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition: hcg.cxx:111
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18