cms-gem-daq-project / ctp7_modules

0 stars 13 forks source link

New Feature: Cross-check SBIT Mapping & Rate Calculation in OH FPGA #43

Closed bdorney closed 6 years ago

bdorney commented 6 years ago

Description

I have long suspected there is an issue in the trigger data the v3 electronics are sending. This provides several new calibration routines (and supporting infrastructure) to qualify the trigger data in the v3 electronics. When a new set of electronics hardware, CTP7 firmware, or OH firmware is released two main questions should be asked:

  1. Is the mapping of vfat channel to sbit in the OH correct?
  2. Is the measurement of rate of sbits done by the OH/CTP7 correct?

This PR adds the required RPC methods for answering these questions.

New Supporting Methods

setChannelRegistersVFAT3SimpleLocal(...)

The present RPC method for setting VFAT3 channel registers setChannelRegistersVFAT3Local(...) and it's non-local counterpart takes six separate arrays for:

While this offers flexibility it doesn't pair well with the getting the channel registers using getChannelRegistersVFAT3Local(...) which returns a single array of channel register data where each element is the 16 bit channel register in question. Additionally looking to the future the DB will most likely not store six different columns for the channel register data.

Hence an additional function has been added which takes only a single array and pairs well with the existing get method.

It has been incorporated into the same remote method and a check for the key simple toggles between setChannelRegistersVFAT3Local(...) and setChannelRegistersVFAT3SimpleLocal(...).

See documentation in include/vfat3.h found in this PR for usage.

confCalPulseLocal(...)

Multiple local methods:

Require configuring the cal pulse for a particular channel. This method provides the functionality to do so.

See documentation found in src/calibration_routines.cpp for usage. Not sure if this should be placed in vfat3.cpp/h but it seemed appropriate to be found in the calibration library.

checkSbitMappingWithCalPulseLocal(...)

This specifically addresses the first goal mentioned at the top of this PR. This method will:

  1. Store the current channel register settings,
  2. Mask all channels and disable the calpulse for all unmasked vfats,
  3. For the vfat of interest unmask a single channel and enable the calpulse,
  4. Send nevts number of calpulses,
  5. readout the sbits observed by the CTP7 and unpack the data,
  6. Mask the channel again and disable the calpulse
  7. repeat steps 3 through 6 for all channels on the vfat of interest
  8. Revert to the original channel register settings

This allows the user to check that the (vfat,chan) being pulsed is the same as the (vfat,sbit) being observed by the OH/CTP7 and confirm the mapping. It will also report the sbit cluster size.

See documentation in src/calibration_routines.cpp for usage.

checkSbitRateWithCalPulseLocal()

This specifically addresses the second goal mentioned at the top of this PR. This method will:

  1. Store the current channel register settings,
  2. Mask all channels and disable the calpulse for all unmasked vfats,
  3. For the vfat of interest unmask a single channel and enable the calpulse,
  4. Send calpulses at a specific rate using the TTC Generator for a fixed time,
  5. readout the rate counters on the CTP7 and OH,
  6. Stop sending calpulses, then mask the channel again and disable the calpulse,
  7. repeat steps 3 through 6 for all channels on the vfat of interest
  8. revert to the original channel register settings

This allows to confirm that the known rate pulsed matches the measured rate by the CTP7, specifically this is reading out registers:

The first is the number of sbits for VFATX seen in GEM_AMC.OH.OHX.FPGA.TRIG.CNT.SBIT_CNT_TIME_MAX which then gives the rate.

The second is the sum of all sbit clusters from all vfats observed by the OH.

The third is the rate observed by the CTP7.

In this case all three values should be the same.

Types of changes

Motivation and Context

Goals 1 & 2 at the top of this page.

How Has This Been Tested?

http://cmsonline.cern.ch/cms-elog/1058329

Screenshots (if appropriate):

Channel pulsed, sbit observed sbitobsvschanpulsed_validsbits_calenabled_sumofallrates

rate pulsed, rate observed rateobservedvsratepulsed_validsbits

Checklist: