| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

ADCalibData.py

Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 '''
00003 Usage:
00004 
00005 '''
00006 
00007 from UserTagging.UserTaggingAlg import UserTaggingAlg
00008 from GaudiPython import SUCCESS, FAILURE
00009 from GaudiPython import gbl
00010 
00011 class ADCalibData(UserTaggingAlg):
00012     '''Add AD Calibration Info to UserData'''
00013         
00014     # ----------------------------------------   
00015     def initTagList(self):  
00016         self.addTag('Dummy', ''
00017             ).addData('ADCalibData', '/Event/UserData/AD/ADCalibData'
00018             ).addInt('NPESum')
00019 
00020     # ----------------------------------------
00021     def check(self, evt):
00022         ADTag = evt['/Event/UserTag/Detector/AD']
00023         if not ADTag:
00024             return False
00025         
00026         calibHdr = evt['/Event/CalibReadout/CalibReadoutHeader']
00027         if not calibHdr:
00028             self.warning('cannot find calibHdr')
00029             return
00030         self.SaveCalibData(calibHdr)            
00031 
00032         self.tagIt('Dummy')
00033         
00034     # ----------------------------------------
00035     def SaveCalibData(self, calibHdr):
00036         '''Save calibration info to UserData'''
00037                 
00038         NPESum = 0.            
00039         readout = calibHdr.calibReadout()
00040         for channel in readout.channelReadout():
00041             sensorId = channel.pmtSensorId()
00042             pmtId = gbl.DayaBay.AdPmtSensor(sensorId.fullPackedData())
00043             if pmtId.ring() == 0: continue  # exclude 2'' PMTs
00044             for i in range(channel.size()):
00045                 charge = channel.charge(i)
00046                 NPESum += charge
00047         
00048         myData = self.tagSet.Dummy.dataSet.ADCalibData            
00049         myData.set("NPESum", NPESum)            
00050         # myData.dump()
00051         
00052 #####  Job Configuration for nuwa.py ########################################
00053 
00054 def configure(argv=[]):
00055     pass
00056 
00057 def run(app):
00058     app.ExtSvc += ["StaticCableSvc"]
00059     myAlg = ADCalibData("UserData::ADCalibData")
00060     app.addAlgorithm(myAlg)
00061     pass                    
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:10:48 2011 for UserTagging by doxygen 1.4.7