From: emitc2h <mt...@sf...> - 2011-06-27 17:25:26
|
Hi David, It turns out there is a much easier way to invoke a C++ class in python using the ROOT infrastructure. It basically can generate its own python modules from C++ classes. This is the solution I adopted. Thanks again for your help. Cheers, Michel. emitc2h wrote: > > Hi David, > > Thanks, that was definitely worth exploring, however, it didn't solve the > problem. I get the exact same segmentation fault, so I guess it is not an > ownership problem. Still, the link you sent me is very helpful. > > Cheers, > Michel. > > > david.froger wrote: >> >> Hi Michel, >> >> The solution may be: http://swig.org/Doc2.0/Python.html#Python_nn30 >> >> Could you try something like this, depending on what does the >> underlying C++ code : >> >> from ROOT import TLorentzVector >> from Pi0Reco import Pi0Reco >> >> track1 = TLorentzVector(15000, 1.5, 2.3, 140) >> track2 = TLorentzVector(6000, 1.41, 2.25, 140) >> >> track1.thisown = 0 >> track2.thisown = 0 >> >> tracks = [track1, track2] >> >> cluster1 = TLorentzVector(8000, 1.55, 2.19, 0) >> cluster2 = TLorentzVector(7500, 1.46, 2.37, 0) >> cluster3 = TLorentzVector(6000, 1.41, 2.25, 0) >> >> cluster1.thisown = 0 >> cluster2.thisown = 0 >> cluster3.thisown = 0 >> >> clusters = [cluster1, cluster2, cluster3] >> >> algo = Pi0Reco(tracks, clusters) >> >> Pi0s = algo.get_Pi0s() >> >> print len(Pi0s) >> >> Best, >> >> David >> >> ------------------------------------------------------------------------------ >> All of the data generated in your IT infrastructure is seriously >> valuable. >> Why? It contains a definitive record of application performance, security >> threats, fraudulent activity, and more. Splunk takes this data and makes >> sense of it. IT sense. And common sense. >> http://p.sf.net/sfu/splunk-d2d-c2 >> _______________________________________________ >> Swig-user mailing list >> Swi...@li... >> https://lists.sourceforge.net/lists/listinfo/swig-user >> >> > > -- View this message in context: http://old.nabble.com/Using-std%3A%3Avector%3C%3E-with-objects-from-an-external-module-tp31933116p31939757.html Sent from the swig-user mailing list archive at Nabble.com. |