def _handlePPSCNTR(this, msgWords): # Calculate & verify number of arguments provided. nArgs = len(msgWords) - 1 # -1 because message type isn't an argument. if nArgs != 2: logger.error( ("CTU_Host._handlePPSCNTR(): I expected the PPSCNTR " + "message to have 2 arguments but it had %d. " + "Ignoring message...") % nArgs) # Parse out all the arguments into appropriately named # attributes of a _PPSCNTR_Record instance. ppscntr_rec = this._PPSCNTR_Record( ) # Create new empty PPSCNTR record object. ppscntr_rec.pps_num = msgWords[ 1] # Sequence number of a PPS rising edge from the GPS. ppscntr_rec.fast_cnt = msgWords[ 2] # Sequence number of our fast time counter # (currently a 750 Mcps dual-edge triggered counter clocked by a 350 MHz PLL # clock derived from the 10 MHz OCXO clock) logger.normal(("CTU received PPS rising edge #%d from " + "GPS at time-counter value %d.") % (int(ppscntr_rec.pps_num), int(ppscntr_rec.fast_cnt))) this.pps_inbox.contents = ppscntr_rec # Remember this record. this.publisher.publish(publisher.Issue('PPSCNTR', ppscntr_rec))
def _handle_CON_PULSE( this, msgWords ): # e.g., CON_PULSE,3186,3462552667,3,1,3462608072,2,(0,(2,2),5) # Calculate & verify number of arguments provided. nArgs = len(msgWords) - 1 # -1 because message type isn't an argument. if nArgs != 7: logger.error( ("ShowerDetectorHost._handle_CON_PULSE(): " + "I expected the CON_PULSE message to have 7 " + "arguments, but it had %d. Ignoring message...") % nArgs) conpuls_rec = this._CON_PULSE_Record() # Parse out the individual arguments into named fields of a data structure. conpuls_rec.time_ref = this._TimeSync_Ref( ) # Create time-reference sub-object of the data record. conpuls_rec.time_ref.sync_num = msgWords[ 1] # Sequence number of last synchronization pulse received. conpuls_rec.time_ref.pll_cyc = msgWords[ 2] # Sequence number of clock cycle for the fast PLL on the FEDM. conpuls_rec.chan_id = msgWords[ 3] # Channel # (1-3) of the channel this pulse was received on. conpuls_rec.pulse_num = msgWords[ 4] # Sequence number of candidate coincidence pulses sent for this channel. conpuls_rec.start_pllcyc = msgWords[ 5] # PLL cycle # for 1st leading edge in this pulse. conpuls_rec.deltas_list = msgWords[ 6] # Nested parenthesized list of PLL cycle-count deltas, e.g., "(0,(2,2),5)". this.conpuls_inbox.contents = conpuls_rec # Remember this record. this.publisher.publish(publisher.Issue('CON_PULSE', conpuls_rec))
def _handle_FIFO_FULL(this, msgWords): # e.g., FIFO_FULL,2392,3407048110,3,1 # Calculate & verify number of arguments provided. nArgs = len(msgWords) - 1 # -1 because message type isn't an argument. if nArgs != 4: logger.error( ("ShowerDetectorHost._handle_FIFO_FULL(): " + "I expected the FIFO_FULL message to have 4 " + "arguments, but it had %d. Ignoring message...") % nArgs) # Parse out the individual arguments into named fields of a data structure. fifull_rec = this._FIFO_FULL_Record() fifull_rec.time_ref = this._TimeSync_Ref( ) # Create time-reference sub-object of the data record. fifull_rec.time_ref.sync_num = msgWords[ 1] # Sequence number of last synchronization pulse received. fifull_rec.time_ref.pll_cyc = msgWords[ 2] # Sequence number of clock cycle for the fast PLL on the FEDM. fifull_rec.chan_id = msgWords[ 3] # Channel # (1-3) of the channel that generated this event. fifull_rec.n_events = msgWords[ 4] # The number of distinct FIFO_FULL events on this channel that occurred since the last report. this.fifull_inbox.contents = fifull_rec # Remember this record. this.publisher.publish(publisher.Issue('FIFO_FULL', fifull_rec))
def _handle_NC_PULSES( this, msgWords ): # e.g., NC_PULSES,1618,3352941653,3352948689,115,68,203 # Calculate & verify number of arguments provided. nArgs = len(msgWords) - 1 # -1 because message type isn't an argument. if nArgs != 6: logger.error( ("ShowerDetectorHost._handle_NS_PULSES(): " + "I expected the NC_PULSES message to have 6 " + "arguments, but it had %d. Ignoring message...") % nArgs) ncpuls_rec = this._NC_PULSES_Record() # Create new empty NC_PULSES record object. ncpuls_rec.time_ref = this._TimeSync_Ref( ) # Create time-reference sub-object of the data record. ncpuls_rec.time_ref.sync_num = msgWords[ 1] # Sequence number of last synchronization pulse received. ncpuls_rec.time_ref.pll_cyc = msgWords[ 2] # Sequence number of clock cycle for the fast PLL on the FEDM. ncpuls_rec.last_pllcyc = msgWords[ 3] # PLL counter value of last pulse skipped. ncpuls_rec.chan1_npuls = msgWords[ 4] # Number of non-coincidence pulses skipped from PMT input channel #1. ncpuls_rec.chan2_npuls = msgWords[ 5] # Number of non-coincidence pulses skipped from PMT input channel #2. ncpuls_rec.chan3_npuls = msgWords[ 6] # Number of non-coincidence pulses skipped from PMT input channel #3. this.ncpuls_inbox.contents = ncpuls_rec # Remember this record. this.publisher.publish(publisher.Issue('NC_PULSES', ncpuls_rec))
def _handle_DAC_LEVELS( this, msgWords ): # e.g., DAC_LEVELS,-0.200,-2.500,-0.299,-0.447,-0.669,-1.000 # Calculate & verify number of arguments provided. nArgs = len(msgWords) - 1 # -1 because message type isn't an argument. if nArgs != 6: logger.error( ("ShowerDetectorHost._handle_DAC_LEVELS(): " + "I expected the DAC_LEVELS message to have 6 " + "arguments, but it had %d. Ignoring message...") % nArgs) daclevs_rec = this._DAC_LEVELS_Record() # Create new empty DAC_LEVELS record object. daclevs_rec.level1 = msgWords[1] # Voltage level of 1st threshold DAC. daclevs_rec.level2 = msgWords[2] # Voltage level of 2nd threshold DAC. daclevs_rec.level3 = msgWords[3] # Voltage level of 3rd threshold DAC. daclevs_rec.level4 = msgWords[4] # Voltage level of 4th threshold DAC. daclevs_rec.level5 = msgWords[5] # Voltage level of 5th threshold DAC. daclevs_rec.level6 = msgWords[6] # Voltage level of 6th threshold DAC. logger.normal("Threshold levels are: [%f,%f,%f,%f,%f] (Volts)" % ( float(daclevs_rec.level1), float(daclevs_rec.level3), # skip DAC#2 'cuz it broke float(daclevs_rec.level4), float(daclevs_rec.level5), float(daclevs_rec.level6))) this.daclevs_inbox.contents = daclevs_rec # Remember this record. this.publisher.publish(publisher.Issue('DAC_LEVELS', daclevs_rec))
def _handle_LOST_PULSES(this, msgWords): # e.g., LOST_PULSES,2,1 # Calculate & verify number of arguments provided. nArgs = len(msgWords) - 1 # -1 because message type isn't an argument. if nArgs != 2: logger.error( ("ShowerDetectorHost._handle_LOST_PULSES(): " + "I expected the LOST_PULSE message to have 2 " + "arguments, but it had %d. Ignoring message...") % nArgs) lostpuls_rec = this._LOST_PULSES_Record() # Parse out the individual arguments into named fields of a data structure. lostpuls_rec.chan_id = msgWords[ 1] # Channel # (1-3) of the channel whose software pulse buffer overflowed. lostpuls_rec.n_lost = msgWords[ 2] # Number of pulses on this channel that had to be discarded since the last report. this.lostpuls_inbox.contents = lostpuls_rec # Remember this record. this.publisher.publish(publisher.Issue('LOST_PULSES', lostpuls_rec))