ATLAS Offline Software
Public Member Functions | List of all members
python.TPyEvent.TPyEvent Class Reference

A Python wrapper around xAOD::TPyEvent. More...

Inheritance diagram for python.TPyEvent.TPyEvent:
Collaboration diagram for python.TPyEvent.TPyEvent:

Public Member Functions

def __init__ (self, mode=ROOT.xAOD.TEvent.kClassAccess)
 Constructor for the class. More...
 
def __getitem__ (self, key)
 Convenient shorthand for retrieving an object. More...
 
def contains (self, key, type)
 Convenient version of the base class's contains function. More...
 
def transientContains (self, key, type)
 Convenient version of the base class's transientContains function. More...
 
def record (self, obj, key)
 Convenient version of the base class's record function. More...
 

Detailed Description

A Python wrapper around xAOD::TPyEvent.

In order to make the semi-templated functions of xAOD::TPyEvent more convenient to use from PyROOT, the user is supposed to use an instance of this class, and not ROOT.xAOD.TPyEvent directly.

Author
Attila Krasznahorkay Attil.nosp@m.a.Kr.nosp@m.aszna.nosp@m.hork.nosp@m.ay@ce.nosp@m.rn.c.nosp@m.h

Definition at line 17 of file TPyEvent.py.

Constructor & Destructor Documentation

◆ __init__()

def python.TPyEvent.TPyEvent.__init__ (   self,
  mode = ROOT.xAOD.TEvent.kClassAccess 
)

Constructor for the class.

Definition at line 20 of file TPyEvent.py.

20  def __init__( self, mode = ROOT.xAOD.TEvent.kClassAccess ):
21 
22  # Forward the call to the base class's constructor:
23  ROOT.xAOD.TPyEvent.__init__( self, mode )
24  return
25 

Member Function Documentation

◆ __getitem__()

def python.TPyEvent.TPyEvent.__getitem__ (   self,
  key 
)

Convenient shorthand for retrieving an object.

Definition at line 27 of file TPyEvent.py.

27  def __getitem__( self, key ):
28  return self.pyRetrieve( key )
29 

◆ contains()

def python.TPyEvent.TPyEvent.contains (   self,
  key,
  type 
)

Convenient version of the base class's contains function.

This function allows the user to, instead of figuring out the exact type name of some C++ type, to rather write code like:

if event.contains( "Electrons", ROOT.xAOD.ElectronContainer ):

Parameters
keyThe string key of the object to check for
typeThe type of the object we are looking for
Returns
True if the object is available in the event, False if it's not

Definition at line 44 of file TPyEvent.py.

44  def contains( self, key, type ):
45  # Determine the class name:
46  clname = type.__name__
47  if hasattr( type, "__cpp_name__" ):
48  clname = type.__cpp_name__
49  pass
50  # Call the parent class's function:
51  return super( TPyEvent, self ).pyContains( key, clname )
52 

◆ record()

def python.TPyEvent.TPyEvent.record (   self,
  obj,
  key 
)

Convenient version of the base class's record function.

This is the main function of this wrapper class. It allows the user to record objects into an output file like:

el = ROOT.xAOD.ElectronContainer() event.record( el, "MyElectrons" )

Parameters
objThe object to be recorded into the output file
keyThe key (branch name) for the object
Returns
StatusCode::SUCCESS if all was successful, or StatusCode::FAILURE if not

Definition at line 93 of file TPyEvent.py.

93  def record( self, obj, key ):
94  # Determine the class name:
95  clname = obj.__class__.__name__
96  if hasattr( obj.__class__, "__cpp_name__" ):
97  clname = obj.__class__.__cpp_name__
98  pass
99  # Call the parent class's function:
100  return super( TPyEvent, self ).pyRecord( obj, key, clname )

◆ transientContains()

def python.TPyEvent.TPyEvent.transientContains (   self,
  key,
  type 
)

Convenient version of the base class's transientContains function.

This function allows the used to, instead of figuring out the exact type name of some C++ type, to rather write code like:

if event.transientContains( "MyElectrons",
ROOT.xAOD.ElectronContainer ):

Parameters
keyThe string key of the object to check for
typeThe type of the object we are looking for
Returns
True if the object is available in the event in a modifyable form, False if it's not

Definition at line 68 of file TPyEvent.py.

68  def transientContains( self, key, type ):
69  # Determine the class name:
70  clname = type.__name__
71  if hasattr( type, "__cpp_name__" ):
72  clname = type.__cpp_name__
73  pass
74  # Call the parent class's function:
75  return super( TPyEvent,
76  self ).pyTransientContains( key, clname )
77 

The documentation for this class was generated from the following file:
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
contains
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition: hcg.cxx:111
python.Bindings.__getitem__
__getitem__
Definition: Control/AthenaPython/python/Bindings.py:782