ATLAS Offline Software
Loading...
Searching...
No Matches
EventInfo.PyEventInfo Class Reference
Inheritance diagram for EventInfo.PyEventInfo:
Collaboration diagram for EventInfo.PyEventInfo:

Public Member Functions

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

Public Attributes

 isMC = kwargs.get('isMC', False)
 output = kwargs.get('output')
 prefix = kwargs.get('prefix')
 sg = py_svc('StoreGateSvc')
 info = defaultdict(list)

Detailed Description

Definition at line 14 of file EventInfo.py.

Constructor & Destructor Documentation

◆ __init__()

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()

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
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition hcg.cxx:114

◆ finalize()

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
void print(char *figname, TCanvas *c1)

◆ initialize()

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
void initialize()

Member Data Documentation

◆ info

EventInfo.PyEventInfo.info = defaultdict(list)

Definition at line 28 of file EventInfo.py.

◆ isMC

EventInfo.PyEventInfo.isMC = kwargs.get('isMC', False)

Definition at line 20 of file EventInfo.py.

◆ output

EventInfo.PyEventInfo.output = kwargs.get('output')

Definition at line 21 of file EventInfo.py.

◆ prefix

EventInfo.PyEventInfo.prefix = kwargs.get('prefix')

Definition at line 22 of file EventInfo.py.

◆ sg

EventInfo.PyEventInfo.sg = py_svc('StoreGateSvc')

Definition at line 26 of file EventInfo.py.


The documentation for this class was generated from the following file: