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

List of all members.

Public Member Functions

def initTagList
def check
def SaveReadoutData

Public Attributes

 cableSvc

Detailed Description

Add AD Readout (DaqFormat) Info to UserData

Definition at line 11 of file ADReadoutData.py.


Member Function Documentation

def TaggingExample::ADReadoutData::ADReadoutData::initTagList (   self)

Definition at line 15 of file ADReadoutData.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('ADReadoutData', '/Event/UserData/AD/ADReadoutData'
00024             ).addInt('nChannels', 'nHits'
00025             ).addFloat('chargeSum')
00026         
00027         # or use Brett's preferred pythonic syntax:
00028         #
00029         # self.tagSet.Dummy = Tag()
00030         # self.tagSet.Dummy.dataSet.ADReadoutData = Data('/Event/UserData/AD/ADReadoutData')
00031         # paraSet = self.tagSet.Dummy.dataSet.ADReadoutData.paraSet
00032         # paraSet.nChannels = Int()
00033         # paraSet.nHits = Int()
00034         # paraSet.chargeSum = Float()
00035         
00036         # you can do other necessary initialization here
00037         self.cableSvc = self.svc('ICableSvc','CableSvc')
00038         if self.cableSvc == None:
00039             self.error("Failed to get CableSvc")
00040             return FAILURE

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

Definition at line 42 of file ADReadoutData.py.

00043                         :
00044 
00045         # check if this is an 'AD' event
00046         ADTag = evt['/Event/UserTag/Detector/AD']
00047         if not ADTag:
00048             return False
00049         
00050         # save some useful user data
00051         readoutHdr = evt['/Event/Readout/ReadoutHeader']
00052         if not readoutHdr:
00053             self.warning('cannot find readoutHdr')
00054             return
00055         self.SaveReadoutData(readoutHdr)            
00056         
00057         # tag the event so the user data can be saved
00058         self.tagIt('Dummy')
00059         
00060         # or use Brett's favorate syntax
00061         # self.tagSet.Dummy.tagIt()
        
def TaggingExample::ADReadoutData::ADReadoutData::SaveReadoutData (   self,
  readoutHdr 
)
Save Readout (DaqFormat) Info to UserData

Definition at line 63 of file ADReadoutData.py.

00064                                          :
00065         '''Save Readout (DaqFormat) Info to UserData'''
00066                 
00067         nChannels = 0
00068         nHits = 0
00069         chargeSum = 0.
00070         
00071         # calculate the variables ...    
00072         svcMode = gbl.ServiceMode(readoutHdr.context(), 0)     
00073         daqCrate = readoutHdr.daqCrate()
00074         pmtCrate = daqCrate.asPmtCrate()
00075        
00076         for channel in pmtCrate.channelReadouts():
00077             # channel = channelPair.second
00078             channelId = channel.channelId()
00079             board = channelId.board()
00080             connector = channelId.connector()
00081             pmtId = self.cableSvc.adPmtSensor(channelId, svcMode)
00082             ring = pmtId.ring()
00083             if ring == 0: continue   # exclude 2'' PMT
00084             
00085             nChannels += 1
00086             nHits += channel.hitCount()
00087             for i in range(channel.hitCount()):
00088                 adc = channel.adc(i)
00089                 preAdc = channel.preAdcAvg(i)
00090 
00091                 if channel.isHighGainAdc(i): 
00092                     adc = adc - preAdc
00093                 else:
00094                     adc = (adc - preAdc) * 20
00095                 
00096                 chargeSum += adc
00097 
00098         # ...
00099         
00100         # save the variables to the User Data
00101         myData = self.getTag('Dummy').getData('ADReadoutData')
00102         myData.set("nChannels", nChannels       
00103             ).set("nHits", nHits
00104             ).set("chargeSum", chargeSum)
00105                     
00106         # or use Brett's preferred pythonic syntax
00107         #
00108         # myData = self.tagSet.Dummy.dataSet.ADReadoutData
00109         # paraSet = myData.paraSet
00110         # paraSet.nChannels = nChannels
00111         # paraSet.nHits = nHits
00112         # paraSet.chargeSum = chargeSum
00113         
00114         # you can print all branches of UserData
00115         # myData.dump()
00116         # or an individual branch
00117         # print 'nChannels', myData.get('nChannels')
                       

Member Data Documentation

Definition at line 15 of file ADReadoutData.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