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)
 Constructor for the class. 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, basketSize=32000, splitLevel=0)
 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)

Constructor for the class.

Definition at line 20 of file TPyEvent.py.

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

Member Function Documentation

◆ 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_v1 ):

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 40 of file TPyEvent.py.

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

◆ record()

def python.TPyEvent.TPyEvent.record (   self,
  obj,
  key,
  basketSize = 32000,
  splitLevel = 0 
)

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_v1() event.record( el, "MyElectrons" )

Parameters
objThe object to be recorded into the output file
keyThe key (branch name) for the object
basketSizeThe (optional) size of the basket for the output branch
splitLevelThe (optional) split level for the output branch
Returns
StatusCode::SUCCESS if all was successful, or StatusCode::FAILURE if not

Definition at line 91 of file TPyEvent.py.

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

◆ 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_v1 ):

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 64 of file TPyEvent.py.

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

The documentation for this class was generated from the following file:
contains
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition: hcg.cxx:111
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18