PSC TW Calibration

From GlueXWiki
Jump to: navigation, search


The plugin PSC_TW is used to determine the time-walk of the pair spectrometer coarse counter TDCs. Instead of using the fADC for a time reference, the RF signal is used. This plugin will generate a ROOT file from an EVIO or HDDM file that contains 16 histograms, the time difference versus pedestal-subtracted pulse peak amplitude for all 16 coarse counter modules. A separate ROOT macro will analyze and fit these histograms and provide a table for the CCDB as well as an output ROOT file containing the results for verification.


  • JEventProcessor_PSC_TW.h
  • tw_corr.C
  • psc_tw_parms_calib_chal.out

Generating a ROOT file

To run the plugin, use the following command:

hd_root -PPLUGINS=PSC_TW /path/to/datafile

If a different output filename must be used, change the output file name by adding the following to the hd_root command

-o new_filename.root
  • Note: If a file other than hd_root.root is used as the input file for the fitting macro, the macro will need it's input file changed.

Using the ROOT macro

Once the file ROOT file has been generated use the macro tw_corr.C in the following way

$ root -l -b -q 'tw_corr.C("hd_root.root")'

This will load the macro tw_corr.C and then call the method tw_corr(). Once it finishes it will exit ROOT. No display will be set.

  • Screen output has been turned off by default. If you would like to see the results as they are computed, change the flag OUTPUT to true at the top of the macro.
  • If the input file is not hd_root.root, edit the command so that it matches the correct filename.

Verifying the corrections

The ROOT macro tw_corr.C will create an output ROOT file called results.root which will contain the time-walk histograms before and after the corrections as well as the TProfile used for fitting. It will also create a text file sigmas.out that contains the final sigmas of the timing distributions.

results.root contains three main directories: dt_vs_pp, dt_vs_pp_corr, and dt_vs_pp_profile.

  • dt_vs_pp
    • There are two subdirectories: dt_vs_pp_L, dt_vs_pp_R
    • These directories contain the initial time-walk curves for the 8 modules in both the left and right arms
  • dt_vs_pp_corr
    • There are two subdirectories: dt_vs_pp_corr_L, dt_vs_pp_corr_R
    • These directories contain the corrected time-walk curves for the 8 modules in both the left and right arms
  • dt_vs_pp_profile
    • There are two subdirectories: dt_vs_pp_profile_L, dt_vs_pp_profile_R
    • These directories contain the TProfile plots used during the fitting process.

The histograms in dt_vs_pp_corr should be horizontal and the sigmas in sigmas.out should be about 120 ps.

Adding the time-walk parameters to CCDB

To add files to the CCDB, type the following

ccdb add /PHOTON_BEAM/pair_spectrometer/tdc_timewalk_corrections -v default -r $RunNo-$RunNo psc_tw_parms.out

To start with initial default parameters, add psc_tw_parms_calib_chal.out.

Debugging the ROOT macro

If problems arise with the ROOT macro, set the flag DEBUG to true. This will print out the current position of the code and can help narrow down the problem.