# Setting the BBCal and HCal thresholds

## BBCal Discriminator threshold conversion factor

See details of threshold value for GEn in logbook 

## HCal Discriminator threshold conversion factor

The conversion between the HCal sum trigger discriminator threshold in mV to energy deposited in the scintillators in MeV is approximately 6.914 MeV/mV.

This was calculated using cosmic rays. The average cosmic ray deposits ~14 MeV in scintillators for a single PMT and this corresponds to an fADC integral of roughly 8 pC. If a spectrum of the cosmic rays' amplitudes is made the peak is at 18 mV in the fADC. Now we track this 18 mV at the fADC back in the electronics to the PMT output. First the 18 mV is multiplied by 2.5 which is the approximate amplitude attenuation due to the 100 m cables connecting the DAQ and FE electronics. This gives a 45 mV signal out of the FE amplifiers. These are 10x amps so this equated to 4.5 mV signals out of the PMTs for the average cosmic ray which deposited 14 MeV in the scintillator.

Now we track the signal forward from the PMT to the HCal sum trigger discriminator on the FE. We have 4.5 mV off the PMT multiplied 10x to 45 mV out of the FE amplifier. This then passes through a 50-50 splitter panel leaving 22.5 mV. This signal then passes through the FE summing modules which attenuate the signal by a factor of 0.09 giving 2.025 mV that enters the HCal sum discriminator. This 2.025 mV signal corresponds to 14 MeV deposited in the scintillators. This gives a conversion factor of 6.914 MeV/mV.

Example: Say the kinetic energy of the elastic nucleons is 5.3 GeV and you want a threshold of 50% of this energy. First calculate the amount of energy the nucleons deposit in HCal's scintillators, which is ~7.95% of the total energy. 5.3 GeV * 0.0795 = 0.42135 GeV deposited in the HCal scintillators. The target threshold is half this energy, or 210.675 MeV. Now divide by the conversion factor. 210.675 MeV/ 6.914 MeV/mV = 30.47 mV for our discriminator threshold setting. Note that this is the discriminator threshold readback value and not the DAC voltage setting, which will need to be tuned to give the proper readback.

## How to adjust BBCal and HCal discriminator thresholds

Mostly, DAC control GUI could have been opened in DAQ vnc, so if it is running there use it. If due to some reason the Digital to Analog (DAC) control GUI is not up there, then please follow the instruction below.

• First Method (step 1 and 6):

1. Click on the HCAL/BBCAL Thresholds icon on the SBS_CODA_scipts window in the DAQ vnc as shown in the figure below. This will open the DAC control gui, so you can go to step 6 now. • Second Method (step 2, 3, 4, 5, 6):

``` ssh -Y sbs-onl@adaq1
```

3. Set the environment variables using:

``` source setup.sh
```

5. Execute the following command to open the DAC control GUI:

``` python3 DAC_Control_GUI.py
```

You will see these lines in terminal. 6. A new DAC GUI should pop up which has instructions to load, initialize and save the settings and adjust the thresholds. The terminal in which the command was executed should also print the previous settings of all the channels.

• Second, click on "Initialize mpv04" to initialize the library
• Now, click on "Save settings" to save the settings or
• Go to the "Enter DAC Output Voltage Setting (V)" and enter the desired output voltage of the DAC channel. Then, click on "Set Voltage" after entering new output voltage.
• [Note: this sets the DAC output voltage which is not equal to the threshold setting. The predicted threshold setting can be seen in the "Predicted Discriminator Threshold (mV)" column and the actual readback for the HCal sum trigger threshold and BBCal Hi Discriminators 1 and 2 can be seen in the "Threshold Readback (mV)" column.]
• Make sure that BBCal Hi Discriminator 1 and BBCal Hi Discriminator 2 have the same readbacks. You might need to tweak the set value for one of them a little to match the readbacks.
• It is also possible to query the readbacks on aslow@adaqsc using:
``` caget SBSDaqPi1:thresh1 - for HCAL threshold
caget SBSDaqPi1:thresh2 - for BBCAL DISC HI1
caget SBSDaqPi1:thresh3 - for BBCAL DISC HI2
```
• DAC control gui can be found open in another vnc, which can be accessed from any Hall A counting hall machine following command:
``` vncviewer adaq1:7
```

## Checking the discriminator setting on previous runs

The discriminator settings are saved to the EPICs data each run. One can check the EPICS data on the HALOG per run_number at the entry with the title:

```Start_Run_EPICS_run_<run_number>
```

Scroll down to the following values and assess the thresholds as described:

• SBSDaqPi1:thresh1 -> HCal threshold (mV)
• SBSDaqPi1:thresh2 -> BBCal Hi 1 (mV)
• SBSDaqPi1:thresh3 -> BBCal Hi 2 (mV)

## Checking the expected energy deposited and thresholds for GEn kinematics

From the full range of theta contained in the acceptance of Bigbite, the lowest estimated energy of elastic protons and neutrons sampled in HCal can be calculated. To check this, from a terminal:

• ssh a-onl@aonl<x>, where x = 1, 2, or 4
• gohcal
• cd hcal/threshold
• source kin_gen.sh <kinematic>, where kinematic = 1, 2, 3, or 4

A short readout will be produced in the terminal which gives useful information, including a recommended threshold value (in mV) for HCal. Presently, the lowest possible threshold for HCal due to amplification of low energy noise is:

• 25 mV

If a lower threshold is required, contact an HCal expert first.