Belle II Software light-2406-ragdoll
PyObjROOTUtils.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10#include <boost/python/object.hpp>
11#include <TPython.h>
12
13namespace Belle2 {
25 template<class T>
26 boost::python::object createROOTObjectPyCopy(const T& instance)
27 {
28 const char* classname = instance.IsA()->GetName();
29 void* addr = new T(instance);
30 PyObject* obj = TPython::CPPInstance_FromVoidPtr(addr, classname, true);
31 return boost::python::object(boost::python::handle<>(obj));
32 }
34}
boost::python::object createROOTObjectPyCopy(const T &instance)
Create a python wrapped copy from a class instance which has a ROOT dictionary.
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:24