Public Member Functions | Private Attributes | List of all members
cafana.PyCAFAna Class Reference

Public Member Functions

def __init__ (self, cppyy)
 
def convert_to_vector (self, elems, elemtype)
 
def CVar (self, body)
 
def SimpleVar (self, name)
 
def CCut (self, body)
 
def __getattr__ (self, name)
 

Private Attributes

 _cppyy
 

Detailed Description

Definition at line 53 of file cafana.py.

Constructor & Destructor Documentation

def cafana.PyCAFAna.__init__ (   self,
  cppyy 
)

Definition at line 54 of file cafana.py.

Referenced by PandAna.core.core.spectrum.fill().

54  def __init__(self, cppyy):
55  self._cppyy = cppyy
56 
57  # # Embed the osc namespace within cafana so it can be found
58  # self.osc = self._cppyy.gbl.osc
59  # self.caf = self._cppyy.gbl.caf
60 
61  # # Monkey-patch the constructor of Fitter to convert its vector args
62  # orig = self.MinuitFitter.__init__
63  # def monkey_init(fitself, expt, vs, systs = [], prec = self.MinuitFitter.kNormal):
64  # orig(fitself, expt,
65  # self.convert_to_vector(vs, 'const ana::IFitVar*'),
66  # self.convert_to_vector(systs, 'const ana::ISyst*'),
67  # prec)
68  # self.MinuitFitter.__init__ = monkey_init
69 
70 
def __init__(self, cppyy)
Definition: cafana.py:54

Member Function Documentation

def cafana.PyCAFAna.__getattr__ (   self,
  name 
)

Definition at line 100 of file cafana.py.

100  def __getattr__(self, name):
101  return getattr(self._cppyy.gbl.ana, name)
102 
103 
def __getattr__(self, name)
Definition: cafana.py:100
def cafana.PyCAFAna.CCut (   self,
  body 
)
Construct a new Cut given the C++ body as a string

Definition at line 91 of file cafana.py.

91  def CCut(self, body):
92  '''Construct a new Cut given the C++ body as a string'''
93  cut = 'pycut_'+self._cppyy.gbl.ana.UniqueName()
94  text = '#include "StandardRecord/Proxy/SRProxy.h"\nbool '+cut+'_func(const caf::SRProxy* srp){\nconst caf::SRProxy& sr = *srp;\n'+body+'\n}\nconst ana::Cut '+cut+'('+cut+'_func);'
95  self._cppyy.cppdef(text)
96  return getattr(self._cppyy.gbl, cut)
97 
98 
def CCut(self, body)
Definition: cafana.py:91
def cafana.PyCAFAna.convert_to_vector (   self,
  elems,
  elemtype 
)
Helper function to convert a python list to a std::vector

Definition at line 71 of file cafana.py.

71  def convert_to_vector(self, elems, elemtype):
72  '''Helper function to convert a python list to a std::vector'''
73  ret = self._cppyy.gbl.std.vector(elemtype)()
74  for e in elems: ret.push_back(e)
75  return ret
76 
77 
def convert_to_vector(self, elems, elemtype)
Definition: cafana.py:71
def cafana.PyCAFAna.CVar (   self,
  body 
)
Construct a new Var given the C++ body as a string

Definition at line 78 of file cafana.py.

Referenced by cafana.PyCAFAna.SimpleVar().

78  def CVar(self, body):
79  '''Construct a new Var given the C++ body as a string'''
80  var = 'pyvar_'+self._cppyy.gbl.ana.UniqueName()
81  text = '#include "StandardRecord/Proxy/SRProxy.h"\ndouble '+var+'_func(const caf::SRProxy* srp){\nconst caf::SRProxy& sr = *srp;\n'+body+'\n}\nconst ana::Var '+var+'('+var+'_func);'
82  self._cppyy.cppdef(text)
83  return getattr(self._cppyy.gbl, var)
84 
85 
def CVar(self, body)
Definition: cafana.py:78
def cafana.PyCAFAna.SimpleVar (   self,
  name 
)
Equivalent of the SIMPLEVAR() macro

Definition at line 86 of file cafana.py.

References cafana.PyCAFAna.CVar().

86  def SimpleVar(self, name):
87  '''Equivalent of the SIMPLEVAR() macro'''
88  return self.CVar('return sr.'+name+';')
89 
90 
def CVar(self, body)
Definition: cafana.py:78
def SimpleVar(self, name)
Definition: cafana.py:86

Member Data Documentation

cafana.PyCAFAna._cppyy
private

Definition at line 55 of file cafana.py.


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