ATLAS Offline Software
Loading...
Searching...
No Matches
python.RPyEvent.RPyEvent Class Reference

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

Inheritance diagram for python.RPyEvent.RPyEvent:
Collaboration diagram for python.RPyEvent.RPyEvent:

Public Member Functions

 __init__ (self)
 Constructor for the class.
 __getitem__ (self, key)
 Convenient shorthand for retrieving an object.
 contains (self, key, type)
 Convenient version of the base class's contains function.
 transientContains (self, key, type)
 Convenient version of the base class's transientContains function.

Detailed Description

A Python wrapper around xAOD::RPyEvent.

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

Definition at line 15 of file RPyEvent.py.

Constructor & Destructor Documentation

◆ __init__()

python.RPyEvent.RPyEvent.__init__ ( self)

Constructor for the class.

Definition at line 18 of file RPyEvent.py.

18 def __init__( self ):
19
20 # Forward the call to the base class's constructor:
21 ROOT.xAOD.Experimental.RPyEvent.__init__( self )
22 return
23

Member Function Documentation

◆ __getitem__()

python.RPyEvent.RPyEvent.__getitem__ ( self,
key )

Convenient shorthand for retrieving an object.

Definition at line 25 of file RPyEvent.py.

25 def __getitem__( self, key ):
26 return self.pyRetrieve( key )
27

◆ contains()

python.RPyEvent.RPyEvent.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 42 of file RPyEvent.py.

42 def contains( self, key, type ):
43 # Determine the class name:
44 clname = type.__name__
45 if hasattr( type, "__cpp_name__" ):
46 clname = type.__cpp_name__
47 pass
48 # Call the parent class's function:
49 return super( RPyEvent, self ).pyContains( key, clname )
50
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition hcg.cxx:114

◆ transientContains()

python.RPyEvent.RPyEvent.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 modifiable form, False if it's not

Definition at line 66 of file RPyEvent.py.

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

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