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

List of all members.

Public Member Functions

def __init__
def initialize
def execute
def finalize

Public Attributes

 plot

Detailed Description

Definition at line 19 of file Viewer.py.


Constructor & Destructor Documentation

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

Definition at line 21 of file Viewer.py.

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


Member Function Documentation

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

Definition at line 26 of file Viewer.py.

00027                         :
00028         status = GaudiAlgo.initialize(self)
00029         print "Init EsViewerAlg",self.name()
00030         if status.isFailure(): return status
00031         return SUCCESS

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

Definition at line 32 of file Viewer.py.

00033                      :
00034         print "Executing EsViewerAlg",self.name()
00035         evt = self.evtSvc()
00036         hdr = evt["/Event/Elec/ElecHeader"]
00037         crateHdr = hdr.crateHeader()
00038         crates = crateHdr.crates()
00039         crate = crates[DayaBay.Detector(0x01,1)]
00040         # Signal clock ticks [ns]
00041         hitDt = 12.5
00042         energyDt = 1.5625
00043         esumDt = 6.25
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(6,17):
00050             boardId = DayaBay.FeeChannelId(board,0,0x01,1)
00051             boardNhit = nhitBoard[boardId]
00052             #print "init size: ",boardNhit.size()
00053             if nhitSignal == None:
00054                 nhitSignal = [0] * boardNhit.size()
00055             for cycle in range(boardNhit.size()):
00056                 nhitSignal[cycle] += boardNhit[cycle]
00057         nhitClock = [tick*hitDt for tick in range(boardNhit.size())]
00058         self.plot["nhit"] = TGraph(boardNhit.size(),
00059                                    array('f',nhitClock),
00060                                    array('f',nhitSignal))
00061                                    
00062         # Plot energy sum
00063         energySum = None 
00064         energySize = None
00065         for connector in range(1,17):
00066             for board in range(1,24):
00067                 channelId = DayaBay.FeeChannelId(board,connector,0x01,1)
00068                 channel = crate.channel(channelId)
00069                 energyChannel = channel.energy()
00070                 if energyChannel.size() == 0:
00071                     continue
00072                 if energySum == None:
00073                     energySum = [0] * energyChannel.size()
00074                     energySize = energyChannel.size()
00075                 for cycle in range(energyChannel.size()):
00076                     energySum[cycle] += energyChannel[cycle]
00077         energyClock = [tick*energyDt for tick in range(energySize)]
00078         self.plot["energySum"] = TGraph(energySize,
00079                                    array('f',energyClock),
00080                                    array('f',energySum))
00081         # Draw an example channel
00082         tdc = None
00083         flag = 0
00084         channel = None
00085         for connector in range(1,17):
00086           if flag == 1: 
00087               break
00088           for board in range(1,24):
00089               # Look for a channel with hits
00090               channelId = DayaBay.FeeChannelId(board,connector,0x01,1)
00091               channel = crate.channel(channelId)
00092               tdc = channel.tdc()
00093               if tdc.size() > 0:
00094                   print "Found a hit channel"
00095                   flag = 1
00096                   break
00097         if flag == 0:
00098             print "No hit channel found"
00099         if flag == 1:
00100             energy = channel.energy()
00101             energyClock = [tick*energyDt for tick in range(energy.size())]
00102             self.plot["energy"] = TGraph(energy.size(),
00103                                          array('f',energyClock),
00104                                          array('f',energy))
00105             hit = channel.hit()
00106             hitClock = [tick*hitDt for tick in range(hit.size())]
00107             self.plot["hit"] = TGraph(hit.size(),
00108                                       array('f',hitClock),
00109                                       array('f',hit))
00110             adcLow = channel.adcLow()
00111             adcLowClock = [tick*adcDt for tick in range(adcLow.size())]
00112             self.plot["adcLow"] = TGraph(adcLow.size(),
00113                                          array('f',adcLowClock),
00114                                          array('f',adcLow))
00115             adcHigh = channel.adcHigh()
00116             adcHighClock = [tick*adcDt for tick in range(adcHigh.size())]
00117             self.plot["adcHigh"] = TGraph(adcHigh.size(),
00118                                           array('f',adcHighClock),
00119                                           array('f',adcHigh))
00120             esumTotal = crate.esumTotal()
00121             energyClock = [tick*esumDt for tick in range(esumTotal.size())]
00122             self.plot["esumTotal"] = TGraph(esumTotal.size(),
00123                                           array('f',energyClock),
00124                                           array('f',esumTotal))
00125             esumLower = crate.esumLower()
00126             energyClock = [tick*esumDt for tick in range(esumLower.size())]
00127             self.plot["esumLower"] = TGraph(esumLower.size(),
00128                                           array('f',energyClock),
00129                                           array('f',esumLower))
00130             esumUpper = crate.esumUpper()
00131             energyClock = [tick*esumDt for tick in range(esumUpper.size())]
00132             self.plot["esumUpper"] = TGraph(esumUpper.size(),
00133                                           array('f',energyClock),
00134                                           array('f',esumUpper))
00135         return SUCCESS

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

Definition at line 136 of file Viewer.py.

00137                       :
00138         print "Finalizing EsViewerAlg",self.name()
00139         outFile = TFile("elecSimPlots.root","RECREATE")
00140         for key in self.plot.keys():
00141             self.plot[key].SetTitle(key)
00142             self.plot[key].SetName(key)
00143             self.plot[key].GetXaxis().SetTitle("time [ns]")
00144             self.plot[key].Write()
00145         status = GaudiAlgo.finalize(self)
00146         return status


Member Data Documentation

Definition at line 21 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 Fri May 16 2014 10:16:37 for ElecSim by doxygen 1.7.4