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

Public Member Functions

def __init__ (self, name='PyEventInfo', **kwargs)
 
def initialize (self)
 
def finalize (self)
 
def execute (self)
 

Public Attributes

 isMC
 
 output
 
 prefix
 
 sg
 
 info
 

Detailed Description

Definition at line 14 of file EventInfo.py.

Constructor & Destructor Documentation

◆ __init__()

def EventInfo.PyEventInfo.__init__ (   self,
  name = 'PyEventInfo',
**  kwargs 
)

Definition at line 17 of file EventInfo.py.

17  def __init__(self, name='PyEventInfo', **kwargs):
18  kwargs['name'] = name
19  super().__init__(**kwargs)
20  self.isMC = kwargs.get('isMC', False)
21  self.output = kwargs.get('output')
22  self.prefix = kwargs.get('prefix')
23 

Member Function Documentation

◆ execute()

def EventInfo.PyEventInfo.execute (   self)

Definition at line 44 of file EventInfo.py.

44  def execute(self):
45 
46  # Read the run/event number from xAOD::EventInfo
47  if self.sg.contains('xAOD::EventInfo', 'EventInfo'):
48  ei = self.sg.retrieve('xAOD::EventInfo', 'EventInfo')
49  runNumber = ei.runNumber()
50  eventNumber = ei.eventNumber()
51  mcChannelNumber = ei.mcChannelNumber()
52 
53  self.info['run_number'].append(runNumber)
54  self.info['mc_channel_number'].append(mcChannelNumber)
55  self.info['event_number'].append(eventNumber)
56 
57  # Let's happily move to the next event
58  return StatusCode.Success
59 
60  # If we made it thus far something went wrong
61  return StatusCode.Failure
62 
63 # Main executable

◆ finalize()

def EventInfo.PyEventInfo.finalize (   self)

Definition at line 32 of file EventInfo.py.

32  def finalize(self):
33  if not self.isMC:
34  key_name = 'run_number'
35  else:
36  key_name = 'mc_channel_number'
37  for run, event in zip(self.info[key_name], self.info['event_number'], strict=True):
38  # Changed in version 3.10: Added the strict argument.
39  print(f"{'' if self.prefix is None else self.prefix}{run:d} {event:d}",
40  file=self.output)
41  return StatusCode.Success
42 

◆ initialize()

def EventInfo.PyEventInfo.initialize (   self)

Definition at line 25 of file EventInfo.py.

25  def initialize(self):
26  self.sg = py_svc('StoreGateSvc')
27  from collections import defaultdict
28  self.info = defaultdict(list)
29  return StatusCode.Success
30 

Member Data Documentation

◆ info

EventInfo.PyEventInfo.info

Definition at line 28 of file EventInfo.py.

◆ isMC

EventInfo.PyEventInfo.isMC

Definition at line 20 of file EventInfo.py.

◆ output

EventInfo.PyEventInfo.output

Definition at line 21 of file EventInfo.py.

◆ prefix

EventInfo.PyEventInfo.prefix

Definition at line 22 of file EventInfo.py.

◆ sg

EventInfo.PyEventInfo.sg

Definition at line 26 of file EventInfo.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
python.processes.powheg.ZZj_MiNNLO.ZZj_MiNNLO.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZj_MiNNLO.py:18
dumpHVPathFromNtuple.append
bool append
Definition: dumpHVPathFromNtuple.py:91
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:114
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:26