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

In This Package:

checkIBD.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 #
00003 # Quick check of multi-readout IBD events
00004 # --- bseilhan, 2009-06-29
00005 
00006 __all__ = ['plotIbdBasics']
00007 from GaudiPython.GaudiAlgs import GaudiAlgo
00008 from GaudiPython import SUCCESS, FAILURE
00009 from GaudiPython import gbl
00010 
00011 from DybPython.Util import irange
00012 from GaudiKernel import SystemOfUnits as units
00013 import ROOT
00014 
00015 TH1F = gbl.TH1F
00016 TH1D = gbl.TH1D
00017 TH2F = gbl.TH2F
00018 TH2D = gbl.TH2D
00019 
00020 class plotIbdBasics(GaudiAlgo):
00021 
00022     def __init__(self,name):
00023         GaudiAlgo.__init__(self,name)
00024         self.hist = {}
00025         # Counters
00026         return
00027     
00028     def initialize(self):
00029         print "Initializing the IBD basic ploter", self.name()
00030         status = GaudiAlgo.initialize(self)
00031         if status.isFailure(): return status
00032 
00033         # What services do you need?
00034         self.histSvc = self.svc('ITHistSvc', 'THistSvc')
00035 
00036         self.hist["TrigTime"] = TH1F("TrigTime","Trigger Time [s]",100,0.0,10.0)
00037         self.hist["Tdc"] = TH1F("Tdc","TDC Values",300,0,300)
00038         self.hist["Adc"] = TH1F("Adc","Adc Values",75,0,30000)
00039         
00040         status = self.histSvc.regHist('/file1/basics/TrigTime', \
00041                                           self.hist["TrigTime"])
00042         if status.isFailure(): return status
00043         
00044         status = self.histSvc.regHist('/file1/basics/tdc', \
00045                                           self.hist["Tdc"])
00046         if status.isFailure(): return status
00047         
00048         status = self.histSvc.regHist('/file1/basics/adc', \
00049                                           self.hist["Adc"])
00050         if status.isFailure(): return status
00051         
00052         return SUCCESS
00053 
00054     def execute(self):
00055         print "Executing plotIbdBasics", self.name()
00056         evt = self.evtSvc()
00057         rohdr = evt['/Event/Readout/ReadoutHeader']
00058         if rohdr == None:
00059             print "No ReadoutHeader in this Event"
00060             return SUCCESS
00061         ro = rohdr.readout()
00062         if ro == None:
00063             self.info("No Readout this cycle")
00064             return SUCCESS
00065         
00066         print ro.detector().detName()
00067         # Exercise 2: Histogram the readout trigger time
00068         self.hist["TrigTime"].Fill( ro.triggerTime().GetSeconds() )        
00069         # Exercise 3: Histogram the TDC values
00070         
00071         adcSum=0
00072         
00073         channelIDs = ro.channels() # Get list of channel IDs in the readout
00074         for channelID in channelIDs:
00075             channel = ro.channel(channelID) # get the data from the channel
00076             for tdc in channel.tdc(): # loop over list of TDC values on channel
00077                 self.hist["Tdc"].Fill( tdc )
00078             
00079             for adcClock in channel.adcClocks():
00080                 adc = channel.adcByClock(adcClock)
00081                 adcSum+=adc-500
00082                 # print adcClock, adc
00083         self.hist["Adc"].Fill( adcSum )
00084         print "AdcSum: ", adcSum
00085             
00086         return SUCCESS
00087     
00088     
00089     def finalize(self):
00090         print "Finalizing ", self.name()
00091         status = GaudiAlgo.finalize(self)
00092         return status
00093 
00094 def configure():
00095     from GaudiSvc.GaudiSvcConf import THistSvc
00096     histsvc = THistSvc()
00097     histsvc.Output = ["file1 DATAFILE='IbdBasicPlots.root' OPT='RECREATE' TYP='ROOT' "]
00098     from Gaudi.Configuration import ApplicationMgr
00099     theApp = ApplicationMgr()
00100     return
00101 
00102 def run(app):
00103     '''Configure and add this algorithm to job'''
00104 #    from Gaudi.Configuration import ApplicationMgr
00105 #    app = ApplicationMgr()
00106     app.ExtSvc += ["THistSvc"]
00107     plotBasics = plotIbdBasics("myBasics")
00108     app.addAlgorithm(plotBasics)
00109     pass
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 10:14:31 for SimSequencer by doxygen 1.7.4