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

List of all members.

Public Member Functions

def __init__
def initialize
def execute
def finalize

Public Attributes

 eventEntries
 fadcEntries

Detailed Description

Algorithm to test RPC readout simulation

Definition at line 18 of file CheckFadc.py.


Constructor & Destructor Documentation

def CheckFadc::CheckAlg::__init__ (   self,
  myname 
)

Definition at line 23 of file CheckFadc.py.

00024                              :
00025         ''' '''
00026         DybPythonAlg.__init__(self,myname)
00027         return


Member Function Documentation

def CheckFadc::CheckAlg::initialize (   self)

Definition at line 28 of file CheckFadc.py.

00029                         :
00030         status = DybPythonAlg.initialize(self)
00031         if status.isFailure(): return status
00032         self.info("initializing")
00033         
00034         self.eventEntries = [0]*4
00035         self.fadcEntries  = [0]*4
00036         # Make FADC histograms
00037         for adIdx in range(1,5):
00038             for fadcChIdx in range(1,9):
00039                 # averaged waveforms     
00040                 pathname = "/file1/AD" + str(adIdx) + "/average/"
00041                 self.stats.defaultPath = pathname
00042                 histName  = "FADC_ch" + str(fadcChIdx)
00043                 histTitle = "FADC channel " + str(fadcChIdx)
00044                 self.stats[histName] = TH1F(histName,histTitle,120,-0.5,119.5)
00045                 self.stats[histName].SetLineColor(4)
00046                 # single event waveforms
00047                 pathname = "/file1/AD" + str(adIdx) + "/single/"
00048                 self.stats.defaultPath = pathname
00049                 for histIdx in range(1,nFadcExample+1):
00050                     histExName  = "FADC_#" + str(histIdx) + "_ch" + str(fadcChIdx)
00051                     self.stats[histExName] = TH1F(histExName,"",120,-0.5,119.5)
00052                     self.stats[histExName].SetLineColor(4)
00053         return SUCCESS

def CheckFadc::CheckAlg::execute (   self)

Definition at line 54 of file CheckFadc.py.

00055                      :
00056         evt = self.evtSvc()
00057 
00058         rohdr = evt["/Event/Readout/ReadoutHeader"]
00059         if rohdr == None:
00060             self.info("No ReadoutHeader header this cycle")
00061         else :
00062             daq = rohdr.daqCrate()
00063             if daq == None:
00064                 self.info("No daq crate this cycle")
00065             else :
00066                 if (daq.detector().isAD()):
00067                     # rought energy estimate
00068                     pmtReadout = daq.asPmtCrate();
00069                     energy = 0
00070                     recordEvent = False
00071                     negChannels = 0
00072                     pmtChannels = pmtReadout.pmtChannelReadouts()
00073                     for pmtChannel in pmtChannels:
00074                         rawCharge = pmtChannel.deltaAdc(0) / 18.
00075                         energy += rawCharge
00076                         if rawCharge < 0:
00077                             negChannels += 1
00078                         if rawCharge < 0:
00079                             recordEvent = False
00080                     energy /= 160.
00081                     # only record 1-3 MeV range
00082                     # try to skip obvious muons and muon retriggers
00083                     if energy > 1 and energy < 3 and negChannels < 2:
00084                         self.info("Detector: %s"%(daq.detector().detName()))
00085                         self.info("Energy: %s"%(energy))
00086                         detNo = daq.detector().detectorId()
00087                         fadcChannels = pmtReadout.fadcChannelReadouts()
00088                         self.eventEntries[detNo-1] += 1
00089                         nFadcChannels = fadcChannels.size()
00090                         if fadcChannels.size() == 0:
00091                             self.info("No FADC data recorded")
00092                         else:
00093                             self.info("FADC data found")
00094                             self.fadcEntries[detNo-1] += 1
00095                             for fadcChIdx in range(len(fadcChannels)):
00096                                 waveform = fadcChannels[fadcChIdx].samples();
00097                                 histName = "FADC_ch" + str(fadcChIdx+1)
00098                                 for dacIdx in range(len(waveform)):
00099                                     dac = waveform[dacIdx]
00100                                     # fill averaged FADC waveforms
00101                                     pathname = "/file1/AD" + str(detNo) + "/average/"
00102                                     self.stats.defaultPath = pathname
00103                                     self.stats[histName].Fill(dacIdx,dac);
00104                                     # record some single event waveforms
00105                                     if self.fadcEntries[detNo-1] < nFadcExample+1:
00106                                         pathname = "/file1/AD" + str(detNo) + "/single/"
00107                                         self.stats.defaultPath = pathname
00108                                         histExName  = "FADC_#" + str(self.fadcEntries[detNo-1]) + "_ch" + str(fadcChIdx+1)
00109                                         histExTitle = "E = " + str(energy) + " MeV, channel " + str(fadcChIdx+1)
00110                                         self.stats[histExName].SetTitle(histExTitle) 
00111                                         self.stats[histExName].Fill(dacIdx,dac);
00112                                   
        return SUCCESS
def CheckFadc::CheckAlg::finalize (   self)

Definition at line 115 of file CheckFadc.py.

00116                       :
00117         recordNothing = True
00118         self.info("****************************************************")
00119         for adIdx in range(1,5):      
00120             if self.fadcEntries[adIdx-1] > 0:
00121                 recordNothing = False
00122                 pathname = "/file1/AD" + str(adIdx) + "/average/"
00123                 self.stats.defaultPath = pathname
00124                 norm = 1./self.fadcEntries[adIdx-1]
00125                 for fadcChIdx in range(1,9):
00126                     histName  = "FADC_ch" + str(fadcChIdx)
00127                     self.stats[histName].Scale(norm)
00128                 self.info("AD :  %s"%(adIdx))
00129                 self.info("Number of selected events:  %s"%(self.eventEntries[adIdx-1]))
00130                 self.info("Number of events with FADC: %s"%(self.fadcEntries[adIdx-1]))
00131         if recordNothing:
00132             self.warning("No FADC waveforms recorded, try to process more events")
00133         status = DybPythonAlg.finalize(self)
00134         return status


Member Data Documentation

Definition at line 28 of file CheckFadc.py.

Definition at line 28 of file CheckFadc.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:04:10 for AdBasicFigs by doxygen 1.7.4