ZDC Code Check with Trigger Files (Plus Detailed Instructions)

Introduction

We want to be able to monitor the zdc polarimetry in ~real time, which has required major overhauls of the code to run on the trigger data files.  This page has detailed instructions for running the code along with some checks.  I ran all checks on run number 10055017, which was taken sometime Feb 23rd or 24th with a min bias trigger.

 

Before you begin

This code runs on the trigger files on the online nodes.  Getting to the online nodes requires 3 steps:

  1. login to the rcf gateway rssh.rhic.bnl.gov
  2. ssh to stargw.starp.bnl.gov
  3. ssh to onl*.starp.bnl.gov

For that to all work you need to make sure your credentials are being forwarded.  If you are running putty that means having pageant running.

Coming things back and forth from there to the rcf nodes is also fun.  If you want to copy from onl* to an rcf node just do scp blah.blah you@rcf2.rhic.bnl.gov:/this/path/.  If you want to copy from rcf to onl*, get to stargw.starp.bnl.gov and scp you@rcf2.rhic.bnl.gov:/this/path/this/file .  I know these methods work, there may be better ones.

 

Location of Code and Data

Code is located at onl14.starp.bnl.gov:/ldaphome/aliceb/zdc/.  Trigger data files are mounted on /trg/trgdata, which is accessible from the online nodes

 

Analysis Overview

In general the analysis proceeds through these steps:

  1. Obtain the raw adc spectrum for the ZDC SMD.
  2. Correct the spectrum for pedestals and gain variations across channels.
  3. Obtain the raw spin bit pattern
  4. Correct this pattern for the abort gap
  5. Determine good hits above some threshold in the ZDC SMD after the pedestal and gain corrections.
  6. Match the good hits with the spin pattern and calculate asymmetries.

To do all this you have to run over the data twice - once to get the raw adc spectra and find the abort gaps and again to count hits and associate with spin states.

 

Analysis in Detail

  1. For each trigger data file for a particular run you run zdcAna_Tr with step=1.
  2. Now get the spin pattern from CAD using get_fill_pattern.pl --run=<run_number>
  3. Get the corrected pattern by running corrSpinPat.C.  (First copy the uncorrected array into the yellowUn and blueUn arrays).
  4. Obtain the ped and gain corrections by running pedAndGain.C
  5. Finally run zdcAna_Tr again with step=2.  Make sure you include the header file with the corrected spin pattern that corrSpinPat creates (uninclude any old one) and that you point to the correct text file that pedAndGain.C creates.  Repeat this for each trigger data file.
  6. You might also at some point want to make plots of the adc spectra for the zdc calorimeters and the smd strips as input to the high voltage setting.  You do this with adcPlots.C
  7. Obtain asymmetry plots with ana_4states.C

Checks

 The big addition here is correcting the raw spin bit pattern.  Below is a check with the example run.

 

 The raw spin bit pattern is:

Polarization patterns:
+1 = filled and positive
-1 = filled and negative
0 = unfilled and/or unpolarized

Yellow polarization pattern:
 1,  0,  1,  0, -1,  0, -1,  0,  1,  0,  1,  0, -1,  0, -1,  0,  1,  0,  1,  0, -1,  0, -1,  0,  1,  0,  1,
 0, -1,  0, -1,  0,  1,  0,  1,  0, -1,  0, -1,  0,  1,  0,  1,  0, -1,  0, -1,  0,  1,  0,  1,  0, -1,  0,
-1,  0,  1,  0,  1,  0, -1,  0, -1,  0,  1,  0,  1,  0, -1,  0, -1,  0,  1,  0,  1,  0, -1,  0, -1,  0,  1,
 0,  1,  0, -1,  0, -1,  0,  1,  0,  1,  0, -1,  0, -1,  0,  1,  0,  1,  0, -1,  0, -1,  0,  1,  0,  1,  0,
-1,  0, -1,  0,  0,  0,  0,  0,  0,  0,  0,  0,

Blue polarization pattern:
 1,  0, -1,  0,  1,  0, -1,  0, -1,  0,  1,  0, -1,  0,  1,  0,  1,  0, -1,  0,  1,  0, -1,  0, -1,  0,  1,
 0, -1,  0,  1,  0,  1,  0, -1,  0,  1,  0, -1,  0, -1,  0,  1,  0, -1,  0,  1,  0,  1,  0, -1,  0,  1,  0,
-1,  0, -1,  0,  1,  0, -1,  0,  1,  0,  1,  0, -1,  0,  1,  0, -1,  0, -1,  0,  1,  0, -1,  0,  1,  0,  1,
 0, -1,  0,  1,  0, -1,  0, -1,  0,  1,  0, -1,  0,  1,  0,  1,  0, -1,  0,  1,  0, -1,  0, -1,  0,  1,  0,
-1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,

The bx7 and bx48 patterns:

The abort gaps are 33-40 and 113-120.

 

To correct the spin pattern basically shift blue beam to the left by 80.  That way the blue abort gap hits the yellow at bunch 33.

 static const int yellowPat[120] ={1, 0, 1, 0, -1, 0, -1, 0, 1, 0, 1, 0, -1, 0, -1, 0, 1
, 0, 1, 0, -1, 0, -1, 0, 1, 0, 1, 0, -1, 0, -1, 0, 1, 0, 1, 0, -1, 0, -1, 0, 1, 0, 1, 0
, -1, 0, -1, 0, 1, 0, 1, 0, -1, 0, -1, 0, 1, 0, 1, 0, -1, 0, -1, 0, 1, 0, 1, 0, -1, 0,
-1, 0, 1, 0, 1, 0, -1, 0, -1, 0, 1, 0, 1, 0, -1, 0, -1, 0, 1, 0, 1, 0, -1, 0, -1, 0, 1,
 0, 1, 0, -1, 0, -1, 0, 1, 0, 1, 0, -1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0};

static const int bluePat[120] ={1, 0, -1, 0, 1, 0, -1, 0, -1, 0, 1, 0, -1, 0, 1, 0, 1,
0, -1, 0, 1, 0, -1, 0, -1, 0, 1, 0, -1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, -1, 0, 1
, 0, -1, 0, -1, 0, 1, 0, -1, 0, 1, 0, 1, 0, -1, 0, 1, 0, -1, 0, -1, 0, 1, 0, -1, 0, 1,
0, 1, 0, -1, 0, 1, 0, -1, 0, -1, 0, 1, 0, -1, 0, 1, 0, 1, 0, -1, 0, 1, 0, -1, 0, -1, 0,
 1, 0, -1, 0, 1, 0, 1, 0, -1, 0, 1, 0, -1, 0, -1, 0, 1, 0, -1, 0, 1, 0};
 

 Checking this: create pattern of filled & unfilled from above gives:

Looks good.