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

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

Inheritance diagram for python.TPyStore.TPyStore:
Collaboration diagram for python.TPyStore.TPyStore:

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 isConst (self, key, type)
 Convenient version of the base class's isConst function. More...
 
def record (self, obj, key)
 Convenient version of the base class's record function. More...
 

Detailed Description

A Python wrapper around xAOD::TPyStore.

In order to make the semi-templated functions of xAOD::TPyStore more convenient to use from PyROOT, the user is supposed to use an instance of this class, and not ROOT.xAOD.TPyStore 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 TPyStore.py.

Constructor & Destructor Documentation

◆ __init__()

def python.TPyStore.TPyStore.__init__ (   self)

Constructor for the class.

Definition at line 20 of file TPyStore.py.

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

Member Function Documentation

◆ contains()

def python.TPyStore.TPyStore.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 store.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 store, False if it's not

Definition at line 40 of file TPyStore.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( TPyStore, self ).contains( key, clname )
48 

◆ isConst()

def python.TPyStore.TPyStore.isConst (   self,
  key,
  type 
)

Convenient version of the base class's isConst 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 store.isConst( "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 only available as a constant, False if it's not

Definition at line 63 of file TPyStore.py.

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

◆ record()

def python.TPyStore.TPyStore.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 the transient store like:

el = ROOT.xAOD.ElectronContainer_v1() store.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 87 of file TPyStore.py.

87  def record( self, obj, key ):
88  # Determine the class name:
89  clname = obj.__class__.__name__
90  if hasattr( obj.__class__, "__cpp_name__" ):
91  clname = obj.__class__.__cpp_name__
92  pass
93  # Call the parent class's function:
94  print("Recording",key,clname)
95  return super( TPyStore, self ).record( obj, key, clname )

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
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition: SGImplSvc.cxx:70