Difference between revisions of "TAGM TW Calibration"

From GlueXWiki
Jump to: navigation, search
(Generating a ROOT file)
Line 1: Line 1:
 
== Overview ==
 
== Overview ==
The plugin TAGM_TW is used to determine the time-walk of the tagger microscope TDCs. Instead of using the fADC for a time reference, the RF signal is used. This is done by finding the RF time nearest to the fADC time, as the fADC has its timewalk corrected through firmware. This RF time provides an excellent reference for measuring the TAGM timewalk.
+
The plugin TAGM_TW is used to determine the time-walk of the tagger microscope TDCs. Instead of using the fADC for a time reference, the RF signal is used. This is done by finding the RF time nearest to the ADC time, as the ADC has its timewalk corrected through firmware. This RF time provides an excellent reference for measuring the TAGM timewalk.
  
In addition, the plugin can also be used to calibrate the microscope timing. It can align the adc to the RF and then match the tdc to the adc time. It does not align the microscope with the halls in the detector as another plugin does that already.
+
In addition, the plugin can also be used to calibrate the microscope timing. It can align the ADC to the RF and then match the TDC to the ADC time. It does not align the microscope with the halls in the detector as another plugin does that already.
  
 
For efficient calibrations, this plugin should be used on PS skims with about 500k events, though less may suffice. This is roughly the first 10 skim files for a run.
 
For efficient calibrations, this plugin should be used on PS skims with about 500k events, though less may suffice. This is roughly the first 10 skim files for a run.
  
The plugin produces timewalk curves (dt vs pulse peak) using both the "corrected" and uncorrected TDC times. The corrected tdc curves can be used to see the quality of the calibration. The plugin also produces plots of adc - RF for all columns, including individual fibers, as well as corrected tdc - adc.
+
The plugin produces timewalk curves (dt vs pulse peak) using both the "corrected" and uncorrected TDC times. The corrected TDC curves can be used to see the quality of the calibration. The plugin also produces plots of ADC - RF for all columns, including individual fibers, as well as corrected TDC - ADC.
  
 
Files:
 
Files:
Line 15: Line 15:
 
*display.C
 
*display.C
  
== Generating a ROOT file ==
+
Note: You must have your CCDB environment variables set as timing.py pulls the constants before generating new ones.
To run the plugin, use the following command:
+
  
<pre>
+
== Calibration Procedure ==
hd_root -PPLUGINS=TAGM_TW /path/to/PS-skim.evio
+
To calibrate the microscope, follow this procedure:
</pre>
+
  
If the calibrations vary greatly from previous runs, it might be useful to add the option -PTAGMHit:DELTA_T_ADC_TDC_MAX=500 in order to form hits if the tdc - adc time are within 500 ns of each other. If this difference is too large, it is likely the plugin will not histogram the event properly and thus the fit will fail.
+
# hd_root -PPLUGINS=TAGM_TW /path/to/PS-skim.evio
 +
# Get updated calibration constants for the ADC using the (ADC - RF) histogram
 +
## python timing.py -b <root file> <run number> rf
 +
## This produces the file adc_offsets-####.txt
 +
# ccdb add PHOTON_BEAM/microscope/fadc_time_offsets -v default -r ####-#### adc_offsets-####.txt
 +
# hd_root -PPLUGINS=TAGM_TW /path/to/PS-skim.evio
 +
# Now measure the timewalk
 +
## python tw.py -b <root file> <run number>
 +
## This produces the file tw-corr.txt
 +
# ccdb add PHOTON_BEAM/microscope/tdc_timewalk_corrections -v default -r ####-#### tw-corr.txt
 +
# hd_root -PPLUGINS=TAGM_TW /path/to/PS-skim.evio
 +
# With the adc aligned with the RF and the timewalk calibrated, align the TDC to the ADC
 +
## python timing.py -b <root file> <run> self
 +
## This generates the file tdc_offsets-####.txt
 +
# ccdb add PHOTON_BEAM/microscope/tdc_time_offsets -v default -r ####-#### tdc_offsets-####.txt
 +
# hd_root -PPLUGINS=TAGM_TW /path/to/PS-skim.evio
 +
# Check TDC - ADC timing distributions
  
== Using the ROOT macro ==
 
Once the file ROOT file has been generated use the macro tw_corr.C in the following way
 
  
<pre>
+
== Verifying the timewalk corrections ==
$ root -l -b -q 'tw_corr.C("hd_root.root")'
+
The ROOT macro display.C will show the timewalk distributions for all channels.
</pre>
+
  
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.
+
<pre> root -l 'display.C("/path/to/rootfile.root")'</pre>
 
+
*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.
+
*There is also a flag for debugging, DEBUG, that can be set to true for additional screen output.
+
 
+
*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
+
**These directories contain the initial time-walk curves for the 100 readout channels
+
*dt_vs_pp_corr
+
**These directories contain the corrected time-walk curves for the 100 readout channels
+
*dt_vs_pp_profile
+
**These directories contain the TProfile plots used during the fitting process.
+
 
+
The histograms in dt_vs_pp_corr should be roughly horizontal for good channels. Low amplitude channels may not be horizontal.
+
 
+
In the main directory there are two summary plots, sigmas_before and sigmas_after, which show the timing resolution for each channel before and after the corrections.
+
 
+
== Adding the time-walk parameters to CCDB ==
+
To add files to the CCDB, type the following
+
 
+
<pre>
+
ccdb add /PHOTON_BEAM/microscope/tdc_timewalk_corrections -v default -r $RunNo-$RunNo tagm_tw_parms.out
+
</pre>
+
 
+
To start with initial default parameters, add tagm_tw_parms_defaults.out.
+

Revision as of 20:23, 7 February 2017

Overview

The plugin TAGM_TW is used to determine the time-walk of the tagger microscope TDCs. Instead of using the fADC for a time reference, the RF signal is used. This is done by finding the RF time nearest to the ADC time, as the ADC has its timewalk corrected through firmware. This RF time provides an excellent reference for measuring the TAGM timewalk.

In addition, the plugin can also be used to calibrate the microscope timing. It can align the ADC to the RF and then match the TDC to the ADC time. It does not align the microscope with the halls in the detector as another plugin does that already.

For efficient calibrations, this plugin should be used on PS skims with about 500k events, though less may suffice. This is roughly the first 10 skim files for a run.

The plugin produces timewalk curves (dt vs pulse peak) using both the "corrected" and uncorrected TDC times. The corrected TDC curves can be used to see the quality of the calibration. The plugin also produces plots of ADC - RF for all columns, including individual fibers, as well as corrected TDC - ADC.

Files:

  • JEventProcessor_TAGM_TW.cc
  • JEventProcessor_TAGM_TW.h
  • tw.py
  • timing.py
  • display.C

Note: You must have your CCDB environment variables set as timing.py pulls the constants before generating new ones.

Calibration Procedure

To calibrate the microscope, follow this procedure:

  1. hd_root -PPLUGINS=TAGM_TW /path/to/PS-skim.evio
  2. Get updated calibration constants for the ADC using the (ADC - RF) histogram
    1. python timing.py -b <root file> <run number> rf
    2. This produces the file adc_offsets-####.txt
  3. ccdb add PHOTON_BEAM/microscope/fadc_time_offsets -v default -r ####-#### adc_offsets-####.txt
  4. hd_root -PPLUGINS=TAGM_TW /path/to/PS-skim.evio
  5. Now measure the timewalk
    1. python tw.py -b <root file> <run number>
    2. This produces the file tw-corr.txt
  6. ccdb add PHOTON_BEAM/microscope/tdc_timewalk_corrections -v default -r ####-#### tw-corr.txt
  7. hd_root -PPLUGINS=TAGM_TW /path/to/PS-skim.evio
  8. With the adc aligned with the RF and the timewalk calibrated, align the TDC to the ADC
    1. python timing.py -b <root file> <run> self
    2. This generates the file tdc_offsets-####.txt
  9. ccdb add PHOTON_BEAM/microscope/tdc_time_offsets -v default -r ####-#### tdc_offsets-####.txt
  10. hd_root -PPLUGINS=TAGM_TW /path/to/PS-skim.evio
  11. Check TDC - ADC timing distributions


Verifying the timewalk corrections

The ROOT macro display.C will show the timewalk distributions for all channels.

 root -l 'display.C("/path/to/rootfile.root")'