/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Public Attributes
UserTagging::Models::Data Class Reference

List of all members.

Public Member Functions

def __init__
def save
def addInt
def addFloat
def addIntArray
def addFloatArray
def set
def append
def get
def dump
def setInputHeaders
def addInputHeader

Public Attributes

 path
 header
 paraSet

Detailed Description

Model for UserData

Definition at line 7 of file Models.py.


Constructor & Destructor Documentation

def UserTagging::Models::Data::__init__ (   self,
  path = '' 
)

Definition at line 10 of file Models.py.

00011                                :
00012         self.path = path
00013         self.header = gbl.DayaBay.UserDataHeader()
00014         ROOT.SetOwnership(self.header, False)
00015         self.paraSet = ParameterSet()


Member Function Documentation

def UserTagging::Models::Data::save (   self)
Save Parameters to the UserDataHeader

Definition at line 17 of file Models.py.

00018                   :
00019         """Save Parameters to the UserDataHeader"""   
00020         
00021         for paraName, paraClass in self.paraSet.description.items():
00022             if paraClass == Int:
00023                 self.header.setInt(paraName, self.paraSet.__dict__[paraName])
00024                 self.paraSet.__setattr__(paraName, Int())
00025             elif paraClass == Float:
00026                 self.header.setFloat(paraName, self.paraSet.__dict__[paraName])
00027                 self.paraSet.__setattr__(paraName, Float())
00028             elif paraClass == IntArray:
00029                 self.header.setIntArray(paraName, gbl.std.vector('int')())
00030                 for value in self.paraSet.__dict__[paraName]:
00031                     self.header.get(paraName).value().push_back(value)
00032                 self.paraSet.__setattr__(paraName, IntArray())
00033             elif paraClass == FloatArray:
00034                 self.header.setFloatArray(paraName, gbl.std.vector('float')())
00035                 for value in self.paraSet.__dict__[paraName]:
00036                     self.header.get(paraName).value().push_back(value)
00037                 self.paraSet.__setattr__(paraName, FloatArray())
00038             else:
00039                 raise AttributeError(paraName + ' should not be in the description. ' + str(paraClass))
                                                     
def UserTagging::Models::Data::addInt (   self,
  paraList 
)

Definition at line 41 of file Models.py.

00042                                :
00043         self.paraSet.addInt(*paraList)
00044         return self
    
def UserTagging::Models::Data::addFloat (   self,
  paraList 
)

Definition at line 45 of file Models.py.

00046                                  :
00047         self.paraSet.addFloat(*paraList)
00048         return self
    
def UserTagging::Models::Data::addIntArray (   self,
  paraList 
)

Definition at line 49 of file Models.py.

00050                                     :
00051         self.paraSet.addIntArray(*paraList)
00052         return self
    
def UserTagging::Models::Data::addFloatArray (   self,
  paraList 
)

Definition at line 53 of file Models.py.

00054                                       :
00055         self.paraSet.addFloatArray(*paraList)
00056         return self
                
def UserTagging::Models::Data::set (   self,
  name,
  value 
)
set Int or Float

Definition at line 58 of file Models.py.

00059                               :
00060         """set Int or Float"""
00061         try:
00062             paraClass = self.paraSet.description[name]
00063         except KeyError:
00064             raise NameError('Parameter ' + name + ' is not defined yet')
00065         if paraClass in [Int, Float]:
00066             self.paraSet.__setattr__(name, value)
00067         else:
00068             raise AttributeError('Parameter ' + name + ' is an array. Use append() instead.')        
00069         
00070         return self
            
def UserTagging::Models::Data::append (   self,
  name,
  value 
)
append to IntArray or FloatArray

Definition at line 72 of file Models.py.

00073                                  :
00074         """append to IntArray or FloatArray"""
00075         try:
00076             paraClass = self.paraSet.description[name]
00077         except KeyError:
00078             raise NameError('Parameter ' + name + ' is not defined yet')
00079         try:
00080             self.paraSet.__dict__[name].append(value)
00081         except AttributeError:
00082             raise AttributeError('Parameter ' + name + ' is not array. Use set() instead.')
00083         return self

def UserTagging::Models::Data::get (   self,
  paraName 
)
wrapper of self.paraSet.get()

Definition at line 84 of file Models.py.

00085                            :
00086         '''wrapper of self.paraSet.get()'''             
00087         return self.paraSet.get(paraName)
               
def UserTagging::Models::Data::dump (   self)
wrapper of self.paraSet.dump()

Definition at line 89 of file Models.py.

00090                   :
00091         '''wrapper of self.paraSet.dump()'''    
00092         print "\n----- dumping ", self.path, ' ------'         
00093         self.paraSet.dump()
00094         return self

def UserTagging::Models::Data::setInputHeaders (   self,
  inputHeaders 
)
a workaround on PyROOT's poor verctor support 
on the original HeaderObject.setInputHeaders() 

inputHeaders: a python list of HeaderObject's

Definition at line 96 of file Models.py.

00097                                            :
00098         '''
00099         a workaround on PyROOT's poor verctor support 
00100         on the original HeaderObject.setInputHeaders() 
00101         
00102         inputHeaders: a python list of HeaderObject's
00103         '''
00104         self.header.inputHeaders().clear()
00105         for hdr in inputHeaders:
00106             self.header.addInputHeader(hdr)
00107         return self

def UserTagging::Models::Data::addInputHeader (   self,
  hdr 
)

Definition at line 109 of file Models.py.

00110                                  :
00111         self.header.addInputHeader(hdr)
00112         return self
00113 
# =========================================== 

Member Data Documentation

Definition at line 10 of file Models.py.

Definition at line 10 of file Models.py.

Definition at line 10 of file Models.py.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 10:02:01 for UserTagging by doxygen 1.7.4