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

In This Package:

ElecSim::Viewer::EsViewerAlg Class Reference

Inheritance diagram for ElecSim::Viewer::EsViewerAlg:
[legend]
Collaboration diagram for ElecSim::Viewer::EsViewerAlg:
[legend]
List of all members.

Public Member Functions

def __init__
def initialize
def execute
def finalize

Public Attributes

 plot
 cableSvc
 testH

Detailed Description

Definition at line 19 of file Viewer.py.


Member Function Documentation

def ElecSim::Viewer::EsViewerAlg::__init__ (   self,
  name 
)

Definition at line 21 of file Viewer.py.

00021                            :
00022         GaudiAlgo.__init__(self,name)
00023         print "Making EsViewerAlg",name
00024         self.plot = {}
00025 
    def initialize(self):

def ElecSim::Viewer::EsViewerAlg::initialize (   self  ) 

Definition at line 26 of file Viewer.py.

00026                         :
00027         status = GaudiAlgo.initialize(self)
00028         print "Init EsViewerAlg",self.name()
00029         if status.isFailure(): return status
00030         #self.cableSvc = self.svc('ICableSvc','StaticCableSvc')
00031         #self.testH = TH1F("testH","Test Histogram",100,0.0,2.0)
00032         return SUCCESS
00033 
    def execute(self):

def ElecSim::Viewer::EsViewerAlg::execute (   self  ) 

Definition at line 34 of file Viewer.py.

00034                      :
00035         print "Executing EsViewerAlg",self.name()
00036         evt = self.evtSvc()
00037         hdr = evt["/Event/Elec/ElecHeader"]
00038         crateHdr = hdr.crateHeader()
00039         crates = crateHdr.crates()
00040         crate = crates[DayaBay.Detector(0x01,1)]
00041         # Signal clock ticks [ns]
00042         hitDt = 12.5
00043         energyDt = 1
00044         adcDt = 25
00045         tdcDt = 25./16.
00046         # Draw entire crate nhit signal
00047         nhitBoard = crate.nhit()
00048         nhitSignal = None
00049         for board in range(1,13):
00050             boardId = DayaBay.FeeChannelId(board,0,0x01,1)
00051             boardNhit = nhitBoard[boardId]
00052             if nhitSignal == None:
00053                 nhitSignal = [0] * boardNhit.size()
00054             for cycle in range(boardNhit.size()):
00055                 nhitSignal[cycle] += boardNhit[cycle]
00056         nhitClock = [tick*hitDt for tick in range(boardNhit.size())]
00057         self.plot["nhit"] = TGraph(boardNhit.size(),
00058                                    array('f',nhitClock),
00059                                    array('f',nhitSignal))
00060         # Draw an example channel
00061         channel = None
00062         tdc = None
00063         for connector in range(1,17):
00064             # Look for a channel with hits
00065             channelId = DayaBay.FeeChannelId(1,connector,0x01,1)
00066             channel = crate.channel(channelId)
00067             tdc = channel.tdc()
00068             if tdc.size() > 0:
00069                 print "Found a hit channel"
00070                 break
00071         energy = channel.energy()
00072         energyClock = [tick*energyDt for tick in range(energy.size())]
00073         self.plot["energy"] = TGraph(energy.size(),
00074                                      array('f',energyClock),
00075                                      array('f',energy))
00076         hit = channel.hit()
00077         hitClock = [tick*hitDt for tick in range(hit.size())]
00078         self.plot["hit"] = TGraph(hit.size(),
00079                                   array('f',hitClock),
00080                                   array('f',hit))
00081         adcLow = channel.adcLow()
00082         adcLowClock = [tick*adcDt for tick in range(adcLow.size())]
00083         self.plot["adcLow"] = TGraph(adcLow.size(),
00084                                      array('f',adcLowClock),
00085                                      array('f',adcLow))
00086         adcHigh = channel.adcHigh()
00087         adcHighClock = [tick*adcDt for tick in range(adcHigh.size())]
00088         self.plot["adcHigh"] = TGraph(adcHigh.size(),
00089                                       array('f',adcHighClock),
00090                                       array('f',adcHigh))
00091         print nhitSignal
00092         return SUCCESS
00093 
    def finalize(self):

def ElecSim::Viewer::EsViewerAlg::finalize (   self  ) 

Definition at line 94 of file Viewer.py.

00094                       :
00095         print "Finalizing EsViewerAlg",self.name()
00096         outFile = TFile("elecSimPlots.root","RECREATE")
00097         for key in self.plot.keys():
00098             self.plot[key].SetTitle(key)
00099             self.plot[key].SetName(key)
00100             self.plot[key].GetXaxis().SetTitle("time [ns]")
00101             self.plot[key].Write()
00102             #canvas = TCanvas()
00103             #self.plot[key].Draw("APL")
00104             #canvas.SaveAs(key+".root")
00105         status = GaudiAlgo.finalize(self)
00106         return status
00107 
def configure():


Member Data Documentation

ElecSim::Viewer::EsViewerAlg::plot

Definition at line 24 of file Viewer.py.

ElecSim::Viewer::EsViewerAlg::cableSvc

Definition at line 30 of file Viewer.py.

ElecSim::Viewer::EsViewerAlg::testH

Definition at line 31 of file Viewer.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 Mon Apr 11 20:49:28 2011 for ElecSim by doxygen 1.4.7