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

List of all members.

Public Member Functions

def __init__
def initialize
def execute
def finalize
def isNewChannel
def isNewDetector
def prepareDetectorHistograms
def prepareChannelHistograms

Public Attributes

 lastReadoutTime
 activeChannelIds
 activeDetectors

Detailed Description

Definition at line 29 of file OnlineOfflineTest.py.


Constructor & Destructor Documentation

def DataQuality::OnlineOfflineTest::OnlineOfflineAlg::__init__ (   self,
  name 
)

Definition at line 31 of file OnlineOfflineTest.py.

00032                            :
00033         DybPythonAlg.__init__(self,name)
00034         return


Member Function Documentation

def DataQuality::OnlineOfflineTest::OnlineOfflineAlg::initialize (   self)

Definition at line 35 of file OnlineOfflineTest.py.

00036                         :
00037         status = DybPythonAlg.initialize(self)
00038         if status.isFailure(): return status
00039         self.info("initializing")
00040 
00041         self.lastReadoutTime = None
00042         self.activeChannelIds = []
00043         self.activeDetectors = []
00044 
00045         return SUCCESS

def DataQuality::OnlineOfflineTest::OnlineOfflineAlg::execute (   self)

Definition at line 46 of file OnlineOfflineTest.py.

00047                      :
00048         self.info("executing")
00049         
00050         # Access current data
00051         evt = self.evtSvc()
00052         readoutHdr = evt["/Event/Readout/ReadoutHeader"]
00053         if readoutHdr == None:
00054             self.error("Failed to get current readout header")
00055             return FAILURE
00056 
00057         readout = readoutHdr.readout()
00058         if readout == None:
00059             self.error("Failed to get readout from header")
00060             return FAILURE
00061 
00062         detector = readout.detector()
00063         if self.isNewDetector( detector ):
00064             self.prepareDetectorHistograms( detector )
00065         detectorName = readout.detector().detName()
00066         detectorPath = "/file1/" + detectorName
00067         # Loop over channel data
00068         nChannels = 0
00069         for channelPair in readout.channelReadout():
00070             channel = channelPair.second
00071             channelId = channel.channelId()
00072             if self.isNewChannel( channelId ):
00073                 self.prepareChannelHistograms( channelId )
00074 
00075             # Make path for histograms
00076             path = "%s/board_%d_connector_%d" % (detectorPath,
00077                                                  channelId.board(),
00078                                                  channelId.connector())
00079             self.debug("Processing channel with path: "+path)
00080             # TDC data by channel
00081             for tdc in channel.tdc():
00082                 self.debug("Type of tdc hist: "+str(type( self.stats[path + "/tdc"] )))
00083                 self.stats[path + "/tdc"].Fill( tdc )
00084                 self.debug("Filled path with tdc: "+str(tdc))
00085             # ADC data by channel
00086             self.debug("Processing adc data with path: "+path)
00087             for adcPair in channel.adc():
00088                 adcClock = adcPair.first
00089                 adc = adcPair.second
00090                 self.stats[path + "/adc"].Fill( adc )
00091             # Hit Rate
00092             channelIndex = channelId.board()*16 + channelId.connector()
00093             self.stats[detectorPath + "/hitRate"].Fill( channelIndex )
00094             nChannels += 1
00095 
00096         # Readout histograms
00097         self.debug("Processing readout with path: "+detectorPath)
00098         # Number of hit channels
00099         self.stats[detectorPath + "/nChannels"].Fill( nChannels )
00100         # Number of Triggers by type
00101         self.stats[detectorPath + "/triggerType"].Fill( readout.triggerType() )
00102         # Time Between Triggered Readout
00103         if self.lastReadoutTime != None:
00104             # Skip first readout
00105             dT_trigger = TimeStamp( readout.triggerTime() )
00106             dT_trigger.Subtract( self.lastReadoutTime )
00107             self.debug("Dt Readout: "+str(dT_trigger.GetSeconds()))
00108             self.stats[detectorPath + "/dT_trigger"].Fill(
00109                                                        dT_trigger.GetSeconds() )
00110 
00111         # Set time of last readout
00112         self.lastReadoutTime = TimeStamp(readout.triggerTime())
00113         self.debug("done execute")
00114         return SUCCESS
        
def DataQuality::OnlineOfflineTest::OnlineOfflineAlg::finalize (   self)

Definition at line 115 of file OnlineOfflineTest.py.

00116                       :
00117         self.info("finalizing")
00118         # Fill summary histograms
00119         for channelInt in self.activeChannelIds:
00120             channelId = FeeChannelId( channelInt )
00121             detectorPath = "/file1/" + channelId.detName()
00122             path = "%s/board_%d_connector_%d" % (detectorPath,
00123                                                  channelId.board(),
00124                                                  channelId.connector())
00125             channelIndex = channelId.board()*16 + channelId.connector()
00126             # ADC summary
00127             meanAdc = self.stats[path + "/adc"].GetMean()
00128             rmsAdc = self.stats[path + "/adc"].GetRMS()
00129             self.stats[detectorPath + "/meanAdc"].Fill(channelIndex, meanAdc)
00130             self.stats[detectorPath + "/rmsAdc"].Fill(channelIndex, rmsAdc)
00131         for detectorInt in self.activeDetectors:
00132             # Hit Rate summary
00133             detector = Detector( detectorInt )
00134             detectorPath = "/file1/" + detector.detName()
00135             nReadouts = self.stats[detectorPath + "/nChannels"].GetEntries()
00136             self.stats[detectorPath + "/hitRate"].Scale( 1 / nReadouts )
00137 
00138         status = DybPythonAlg.finalize(self)
00139         return status

def DataQuality::OnlineOfflineTest::OnlineOfflineAlg::isNewChannel (   self,
  channelId 
)

Definition at line 140 of file OnlineOfflineTest.py.

00141                                      :
00142         # Check if this channel has been seen
00143         if channelId.fullPackedData() in self.activeChannelIds:
00144             return False
00145         return True

def DataQuality::OnlineOfflineTest::OnlineOfflineAlg::isNewDetector (   self,
  detector 
)

Definition at line 146 of file OnlineOfflineTest.py.

00147                                      :
00148         # Check if this detector has been seen
00149         if detector.fullPackedData() in self.activeDetectors:
00150             return False
00151         return True

def DataQuality::OnlineOfflineTest::OnlineOfflineAlg::prepareDetectorHistograms (   self,
  detector 
)

Definition at line 152 of file OnlineOfflineTest.py.

00153                                                  :
00154         # Prepare the empty histograms for this detector
00155         path = "/file1/" + detector.detName()
00156         self.debug("Making histograms at path: "+path)
00157         # Number of hit channels in each readout
00158         self.stats[path + "/nChannels"] = TH1F("nChannels",
00159                                                "Number of Hit Channels",
00160                                                250,0,250)
00161         hist = self.stats[path + "/nChannels"]
00162         hist.GetXaxis().SetTitle("Number of Hit Channels")
00163         hist.GetYaxis().SetTitle("Number of Triggered Readouts")
00164         # Number of Triggers by type
00165         self.stats[path + "/triggerType"] = TH1F("triggerType",
00166                                                  "Trigger Type",
00167                                                  4096,0,4096)
00168         hist = self.stats[path + "/triggerType"]
00169         hist.GetXaxis().SetTitle("Trigger Type")
00170         hist.GetYaxis().SetTitle("Number of Triggered Readouts")
00171         # Time Between Triggered Readout
00172         self.stats[path + "/dT_trigger"] = TH1F("dT_trigger",
00173                                                 "Time between triggers [s]",
00174                                                 1000,0,1)
00175         hist = self.stats[path + "/dT_trigger"]
00176         hist.GetXaxis().SetTitle("Time Between Triggered Readouts [s]")
00177         hist.GetYaxis().SetTitle("Number of Triggered Readouts / 1 ms")
00178         # Summary Histograms
00179         # Mean ADC by channel
00180         self.stats[path + "/meanAdc"] = TH1F("meanAdc",
00181                                    "Mean ADC by channel",
00182                                    300,0,300)
00183         hist = self.stats[path + "/meanAdc"]
00184         hist.GetXaxis().SetTitle("Channel Index (Board*16 + Connector)")
00185         hist.GetYaxis().SetTitle("Mean ADC value")
00186         # RMS ADC by channel
00187         self.stats[path + "/rmsAdc"] = TH1F("rmsAdc",
00188                                    "RMS ADC by channel (board*16 + connector)",
00189                                    300,0,300)
00190         hist = self.stats[path + "/rmsAdc"]
00191         hist.GetXaxis().SetTitle("Channel Index (Board*16 + Connector)")
00192         hist.GetYaxis().SetTitle("RMS of ADC values")
00193         # Hit Rate by channel
00194         self.stats[path + "/hitRate"] = TH1F("hitRate",
00195                                    "Hit Rate by channel",
00196                                    300,0,300)
00197         hist = self.stats[path + "/hitRate"]
00198         hist.GetXaxis().SetTitle("Channel Index (Board*16 + Connector)")
00199         hist.GetYaxis().SetTitle("Number of Hits / Number of Triggered Readouts")
00200         self.activeDetectors.append( detector.fullPackedData() )
00201         return

def DataQuality::OnlineOfflineTest::OnlineOfflineAlg::prepareChannelHistograms (   self,
  channelId 
)

Definition at line 202 of file OnlineOfflineTest.py.

00203                                                  :
00204         # Prepare the empty histograms for this channel
00205         path = "/file1/%s/board_%d_connector_%d" % (channelId.detName(),
00206                                                     channelId.board(),
00207                                                     channelId.connector())
00208         self.debug("Making histograms at path: "+path)
00209         # TDC data by channel
00210         self.stats[path + "/tdc"] = TH1F("tdc",
00211                                          "TDC Values",
00212                                          4096,0,4096)
00213         hist = self.stats[path + "/tdc"]
00214         hist.GetXaxis().SetTitle("TDC value")
00215         hist.GetYaxis().SetTitle("Number of TDCs")
00216         # ADC data by channel
00217         self.stats[path + "/adc"] = TH1F("adc",
00218                                          "ADC Values",
00219                                          4096,0,4096)
00220         hist = self.stats[path + "/adc"]
00221         hist.GetXaxis().SetTitle("ADC value")
00222         hist.GetYaxis().SetTitle("Number of ADCs")
00223         self.activeChannelIds.append( channelId.fullPackedData() )
00224         return


Member Data Documentation

Definition at line 35 of file OnlineOfflineTest.py.

Definition at line 35 of file OnlineOfflineTest.py.

Definition at line 35 of file OnlineOfflineTest.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:06:20 for DataQuality by doxygen 1.7.4