Public Member Functions | |
def | __init__ |
def | initialize |
def | execute |
def | finalize |
Definition at line 33 of file PrintRawData.py.
def PrintRawData::PrintRawDataAlg::__init__ | ( | self, | ||
name | ||||
) |
Definition at line 35 of file PrintRawData.py.
00035 : 00036 DybPythonAlg.__init__(self,name) 00037 return 00038 def initialize(self):
def PrintRawData::PrintRawDataAlg::initialize | ( | self | ) |
Definition at line 39 of file PrintRawData.py.
00039 : 00040 status = DybPythonAlg.initialize(self) 00041 if status.isFailure(): return status 00042 self.info("initializing") 00043 00044 # Example histogram: Total raw ADC sum for each trigger 00045 self.stats["/file1/myhists/adcSum"] = TH1F("adcSum", 00046 "Sum of raw ADC values for each trigger", 00047 2000,0,20000) 00048 return SUCCESS 00049 def execute(self):
def PrintRawData::PrintRawDataAlg::execute | ( | self | ) |
Definition at line 50 of file PrintRawData.py.
00050 : 00051 self.info("executing") 00052 00053 evt = self.evtSvc() 00054 00055 # Access the Readout Header. This is a container for the readout data 00056 readoutHdr = evt["/Event/Readout/ReadoutHeader"] 00057 if readoutHdr == None: 00058 self.error("Failed to get current readout header") 00059 return FAILURE 00060 00061 # Access the Readout. This is the data from one trigger. 00062 readout = readoutHdr.daqCrate().asPmtCrate() 00063 if readout == None: 00064 self.info("No readout this cycle") 00065 return SUCCESS 00066 00067 # Get the detector ID for this trigger 00068 detector = readout.detector() 00069 self.info("Detector Name: "+detector.detName()) 00070 00071 # Trigger Type: This is an integer of the type for this trigger 00072 self.info("Trigger Type: "+str( readout.triggerType() )) 00073 # Event Number: A count of the trigger, according to the DAQ 00074 self.info("Event Number: "+str( readout.eventNumber() )) 00075 00076 # Trigger Time: Absolute time of trigger for this raw data 00077 triggerTime = readout.triggerTime() 00078 # Trigger Time [Seconds]: Trigger time in seconds from some day in 1990 00079 self.info("Trigger Time [Seconds part]: " 00080 +str( triggerTime.GetSec() )) 00081 # Trigger Time [Nanoseconds]: Nanoseconds part of trigger time 00082 self.info("Trigger Time [Nanoseconds part]: " 00083 +str( triggerTime.GetNanoSec() )) 00084 # Full Trigger Time: Seconds + nanoseconds 00085 # Warning: When you add this together, it will lose some precision. 00086 self.info("Full Trigger Time: " 00087 +str( triggerTime.GetSec() 00088 +triggerTime.GetNanoSec()*1.0e-9 )) 00089 00090 # Loop over each channel data in this trigger 00091 adcSum = 0 00092 for channel in readout.channelReadouts(): 00093 channelId = channel.channelId() 00094 00095 # The channel ID contains the detector ID, electronics board number, 00096 # and the connector number on the board. 00097 self.info("Channel ID:" 00098 +" detector=" 00099 +channelId.detName() 00100 +" board=" 00101 +str(channelId.board()) 00102 +" connector=" 00103 +str(channelId.connector())) 00104 00105 # Loop over hits for this channel 00106 for hitIdx in range( channel.hitCount() ): 00107 # TDC data for this channel 00108 # 00109 # The TDC is an integer count of the time between the time 00110 # the PMT pulse arrived at the channel, and the time the 00111 # trigger reads out the data. Therefore, a larger TDC = 00112 # earlier time. One TDC count ~= 1.5625 nanoseconds. 00113 # 00114 tdc = channel.tdc( hitIdx ) 00115 self.info("TDC value: "+str( tdc )) 00116 00117 # ADC data for this channel 00118 # 00119 # The ADC is an integer count of the charge of the PMT 00120 # pulse. It is 12 bits (0 to 4095). There are two ADCs 00121 # for every PMT channel (High gain and Low gain). Only 00122 # the high gain ADC is recorded by default. If the high 00123 # gain ADC is saturated (near 4095), then the low gain ADC 00124 # is recorded instead. 00125 # 00126 # For the Mini Dry Run data, one PMT photoelectron makes 00127 # about 20 high gain ADC counts and about 1 low gain ADC 00128 # count. There is an offset (Pedestal) for each ADC of 00129 # ~70 ADC counts (ie. no signal = ~70 ADC, 1 photoelectron 00130 # = ~90 ADC, 2 p.e. = ~110 ADC, etc.) 00131 # 00132 # The ADC peal cycle is a record of the clock cycle which had 00133 # the 'peak' ADC. 00134 # 00135 # ADC Gain: Here is a description of ADC gain for these values 00136 # Unknown = 0 00137 # High = 1 00138 # Low = 2 00139 # 00140 adc = channel.adc( hitIdx ) 00141 preAdc = channel.preAdcAvg( hitIdx ) 00142 peakCycle = channel.peakCycle( hitIdx ) 00143 isHighGain = channel.isHighGainAdc( hitIdx ) 00144 self.info("ADC value: "+str(adc) 00145 + " (preAdc: "+str( preAdc )+"," 00146 + " peak cycle: "+str( peakCycle )+"," 00147 + " isHighGain?: "+str( isHighGain )+")") 00148 # Add to total ADC sum for this trigger 00149 if isHighGain == 1: 00150 adcSum += (adc-preAdc) 00151 else: 00152 # Adjust low gain adc to high gain scale 00153 adcSum += (adc-preAdc) * 19 00154 00155 # Add this trigger to histogram of ADC sum 00156 self.stats["/file1/myhists/adcSum"].Fill( adcSum ) 00157 return SUCCESS 00158 def finalize(self):
def PrintRawData::PrintRawDataAlg::finalize | ( | self | ) |
Definition at line 159 of file PrintRawData.py.
00159 : 00160 self.info("finalizing") 00161 status = DybPythonAlg.finalize(self) 00162 return status 00163 ##### Job Configuration for nuwa.py ########################################