10 #include <tracking/trackFindingCDC/testFixtures/TrackFindingCDCTestWithTopology.h>
12 #include <tracking/trackFindingCDC/eventdata/tracks/CDCTrack.h>
13 #include <tracking/trackFindingCDC/eventdata/segments/CDCSegment2D.h>
14 #include <tracking/trackFindingCDC/eventdata/hits/CDCWireHit.h>
16 #include <tracking/trackFindingCDC/utilities/WeightedRelation.h>
18 #include <tracking/trackFindingCDC/rootification/StoreWrapper.h>
19 #include <tracking/trackFindingCDC/rootification/StoreWrappedObjPtr.h>
21 #include <framework/datastore/StoreObjPtr.h>
22 #include <framework/datastore/DataStore.h>
24 #include <boost/python.hpp>
25 #include <gtest/gtest.h>
28 using namespace TrackFindingCDC;
31 TEST(TrackFindingCDCTest, cpp_storeWrapper)
36 TEST(TrackFindingCDCTest, cpp_storeWrappedObjPtr)
45 using RootifiedTypes =
46 ::testing::Types<std::vector<CDCWireHit>,
47 std::vector<CDCSegment2D>,
48 std::vector<CDCTrack>,
49 std::vector<WeightedRelation<const CDCTrack> > >;
66 const std::string& objectName = storeObj.getName();
73 ASSERT_NE(-1, PyRun_SimpleString(
"import basf2"));
74 ASSERT_NE(-1, PyRun_SimpleString(
"from ROOT import Belle2"));
77 std::string pyCmd_transferName_prototype =
"objectName = 'X'";
78 std::string pyCmd_transferName = pyCmd_transferName_prototype.replace(pyCmd_transferName_prototype.find(
"X"), 1, objectName);
79 ASSERT_NE(-1, PyRun_SimpleString(pyCmd_transferName.c_str()));
82 ASSERT_NE(-1, PyRun_SimpleString(
"pyStoreObj = Belle2.PyStoreObj(objectName)"));
83 ASSERT_NE(-1, PyRun_SimpleString(
"if not pyStoreObj: raise ValueError('PyStoreObj does not point to a "
84 "valid object on the DataStore')"));
85 ASSERT_NE(-1, PyRun_SimpleString(
"print('pyStoreObj.obj() is', pyStoreObj.obj())"));
86 ASSERT_NE(-1, PyRun_SimpleString(
"print('pyStoreObj.obj().unwrap() is', pyStoreObj.obj().unwrap())"));