/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
TaggingExample::ADChannelData::ADChannelData Class Reference
Inheritance diagram for TaggingExample::ADChannelData::ADChannelData:
Inheritance graph
[legend]
Collaboration diagram for TaggingExample::ADChannelData::ADChannelData:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def initTagList
def check
def SaveReadoutData

Public Attributes

 cableSvc

Detailed Description

Add AD Channel Stats to UserData

Definition at line 11 of file ADChannelData.py.


Member Function Documentation

def TaggingExample::ADChannelData::ADChannelData::initTagList (   self)

Definition at line 15 of file ADChannelData.py.

00016                          :
00017         
00018         # Chao recommends method chaning since it's less typing and he is lazy.
00019         # A tag with no path (default to '') means no tag HeaderObject will be created
00020         # but this dummy tag is still need in order to manage the UserData 
00021         #
00022         self.addTag('Dummy', ''
00023             ).addData('ADChannelData', '/Event/UserData/AD/ADChannelData'
00024             ).addIntArray('board', 'connector', 'ring', 'column', 'hitCount'
00025             ).addFloatArray('adc0', 'preAdc0', 'charge0', 'tdc0', 'adcMax', 'charge')
00026 
00027         # or use Brett's preferred pythonic syntax:
00028         #
00029         # dummyTag = self.tagSet.Dummy = Tag()
00030         # myData = dummyTag.dataSet.ADChannelData = Data('/Event/UserData/AD/ADChannelData')
00031         #        
00032         # myData.paraSet.board     = IntArray()
00033         # myData.paraSet.connector = IntArray()
00034         # myData.paraSet.ring      = IntArray()
00035         # myData.paraSet.column    = IntArray()
00036         # myData.paraSet.hitCount  = IntArray()
00037         # 
00038         # myData.paraSet.adc0    = FloatArray()
00039         # myData.paraSet.preAdc0 = FloatArray()
00040         # myData.paraSet.charge0 = FloatArray()
00041         # myData.paraSet.tdc0    = FloatArray()
00042         # myData.paraSet.adcMax  = FloatArray()
00043         # myData.paraSet.charge  = FloatArray()
00044                 
00045         self.cableSvc = self.svc('ICableSvc','CableSvc')
00046         if self.cableSvc == None:
00047             self.error("Failed to get CableSvc")
00048             return FAILURE    
00049 

def TaggingExample::ADChannelData::ADChannelData::check (   self,
  evt 
)

Definition at line 51 of file ADChannelData.py.

00052                         :
00053         ADTag = evt['/Event/UserTag/Detector/AD']
00054         if not ADTag:
00055             return
00056         
00057         readoutHdr = evt['/Event/Readout/ReadoutHeader']
00058         if not readoutHdr:
00059             self.warning('cannot find readoutHdr')
00060             return
00061         self.SaveReadoutData(readoutHdr)        
00062         
00063         self.tagIt('Dummy')
                    
def TaggingExample::ADChannelData::ADChannelData::SaveReadoutData (   self,
  readoutHdr 
)

Definition at line 65 of file ADChannelData.py.

00066                                          :
00067         
00068         myData = self.getTag('Dummy').getData('ADChannelData')
00069                 
00070         svcMode = gbl.ServiceMode(readoutHdr.context(), 0)     
00071         daqCrate = readoutHdr.daqCrate()
00072         pmtCrate = daqCrate.asPmtCrate();
00073                 
00074         nChannels = 0
00075         for channel in pmtCrate.channelReadouts():
00076             nChannels += 1
00077             channelId = channel.channelId()
00078             board     = channelId.board()
00079             connector = channelId.connector()
00080             pmtId     = self.cableSvc.adPmtSensor(channelId, svcMode)
00081             ring      = pmtId.ring()
00082             column    = pmtId.column()
00083             
00084             myData.append('board', board
00085                 ).append('connector', connector
00086                 ).append('ring', ring
00087                 ).append('column', column
00088                 ).append('hitCount', channel.hitCount())
00089                 
00090             # or use Brett's preferred pythonic syntax:
00091             # myData.paraSet.board.append(board)
00092             # myData.paraSet.connector.append(connector)
00093             # myData.paraSet.ring.append(ring)
00094             # myData.paraSet.column.append(column)
00095             # myData.paraSet.hitCount.append(channel.hitCount())
00096                 
00097             adc0 = channel.adc(0)
00098             preAdc0 = channel.preAdcAvg(0)
00099             if channel.isHighGainAdc(0):
00100                 charge0 = adc0 - preAdc0
00101             else:
00102                 charge0 = (adc0 - preAdc0) * 20
00103             tdc0 = channel.tdc(0)
00104             
00105             myData.append('adc0', adc0
00106                 ).append('preAdc0', preAdc0
00107                 ).append('charge0', charge0
00108                 ).append('tdc0', tdc0)
00109                      
00110             adcMax = adc0
00111             charge = charge0
00112             for i in range(1, channel.hitCount()):
00113                 adc = channel.adc(i)
00114                 preAdc = channel.preAdcAvg(i)
00115 
00116                 if channel.isHighGainAdc(i):
00117                     if (adc > adcMax): adcMax = adc 
00118                     charge += (adc - preAdc)
00119                 else:
00120                     if (adc*20 > adcMax): adcMax = adc*20
00121                     charge += (adc - preAdc) * 20
00122                     
00123             myData.append('adcMax', adcMax
00124                 ).append('charge', charge)
00125         
00126         # you can print all branches of UserData    
00127         # myData.dump()
00128         # or an individual branch
00129         # print 'charge: ', myData.get('charge')
00130             
                

Member Data Documentation

Definition at line 15 of file ADChannelData.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 09:54:29 for TaggingExample by doxygen 1.7.4