Data Analysis - Timing Windows and Reference Times

From Xem2
Jump to navigationJump to search

Reference Times

Selecting Proper Reference Times

This step must be completed PRIOR to moving on to Timing Windows

Reference times are a copy of the pre-trigger that are distributed to all read-out controllers (ROCs). A copy of the reference signal

T.<spec>.<det>_tdcTimeRaw

as well as the detector signal is saved from the DAQ to the EVIO file for that run, which is used in hcana. Hall C uses multi-hit TDCs and ADCs, so there can be multiple hits within the match window width of the TDC or within the programmable trigger window of the ADC. The reference time is subtracted from the detector signals within hcana and saved to the

T.<spec>.<det>_adcTime
T.<spec>.<det>_tdcTime

variables.
Note: hcana uses the first hit within the TWW or PTW if multiple hits are present for all detectors other than Cherenkov detectors. For the Cherenkov detectors, the pulse with the largest amplitude is used.
The number of hits within a TWW or PTW is dependent on the physics data rate, the TWW or PTW length, and the number of pre-triggers required to fire the DAQ. Refer to the accidental rate exercise below to understand this in more detail. In order to subtract the correct reference time from all detectors, we must set the reference time cut, which decreases the probability hcana chooses the incorrect hit in the ADC or TDC of the reference time (copy of the pre-trigger). This type of data analysis procedure is generally considered a 'Cut' because we are restricting ourselves to the data that falls after a value or within a range that is motivated by physics by using a large number of events to inform our decision (statistical distribution).

TDC and ADC detector related reference time cuts are added to

PARAM/<spec>/GEN/<spec_letter>_reftime_cut_<run_period>.param
<spec> {SHMS,HMS}
<spec_letter> {p,h}
<run_period> {sp18, sp19, sp22}

files within the hallc_replay_XEM framework. The naming scheme for these parameters is <spec_letter><det>_<adc|tdc>refcut. The T.<spec>.<det>_tdcTimeRaw branches are not effected by reference time cuts. Only the T.<spec>.<det>_tdcTime branches (and any other reference time subtracted branches) are effected. One can apply reference time cuts to the Trigger Apparatus as well using the t_<spec>_trig_adcrefcut and t_<spec>_trig_tdcrefcut located in PARAM/TRIG/t<spec>.param file. These branches are less significant when the DAQ is only using one trigger type, which is explained in more detail in the histogram interpretation section.

Note that hDCREF5 was not available in Spring 2018 running.


Carlos Yero has created an Analysis Notes document, which contains important information about the possible reference times in different trigger configurations. Most of the information in this section is based on his document.

Carlos Yero DocDB ref. 1032 v1.

Accidental Rate Example

For the time being, follow along with Carlos Yero's example in his Analysis Note

Reference Time Histogram Interpretation

Interpreting results requiring the tdcTimeRaw branches becomes complicated when multiple triggers are in use. When only one trigger type is used, in singles mode for instance, that trigger must have triggered to read out the data. In hcana-april2020 version and later, events that had a value of T.<trig>.<signal>_tdcTimeRaw==0 means that that trigger did not fire. In the case for spring 2018 XEM production data was taken with EL-REAL trigger (pTRIG2). Drawing a histogram of the pTRIG2_tdcTimeRaw requiring the value to be zero will result in zero events being displayed (an empty histogram). You can have multiple hits within the window, and this is especially true when the trigger is heavily pre-scaled. When there are multiple hits on a TDC or ADC channel, the first event after a reference time cut is used to set the tdcTime branch (no Raw). The reference time cut is not applied to the tdcTimeRaw branch.

  • Add two plots. One with tdcTimeRaw branches (with and without reftime cut) and one with tdcTime with and without reftime cut. Notice nothing changes in the RAW histogram while some events move around in the tdcTime histogram.
  • Add plots illustrating the tdcTime is offset using the t_shms_tdcoffset and the adcTime plots are offset by t_shms_adc_tdc_offset compared to the tdcTime.

Determining Reference Time Cuts

Within the hallc_replay_XEM framework there are PARAM files that ignore the previously set reference time cuts for each trigger configuration expected in the XEM analysis (SHMS singles, HMS singles, COIN (not added yet)). There are specific DEF-files, which define the histograms used for determining good Reference Times (See Carlos Yero's Analysis Note). These files are used to determine the reference time cut values. A corresponding SCRIPT for each trigger configuration exists that uses the relevant PARAM file and DEF-files. The reference time and timing windows portions of data analysis can be found in the TIMING directories because we are looking at the timing of incoming detector hits and ignoring accidental signals based on those TIMING cuts.

Location of PARAM files
PARAM/SHMS/GEN/p_no_reference_times.param
PARAM/HMS/GEN/h_no_reference_times.param
COIN Not added yet
Location of DEF-files
DEF-files/<trig>/TIMING/no_reference_times.def, <trig> = (SHMS,HMS,COIN)
Location of SCRIPTS
SCRIPTS/<trig>/TIMING/replay_no_reference_times_<det>.C, <trig>=(SHMS,HMS,COIN), <det>=(shms,hms,coin)
Output ROOTfiles
ROOTfiles/<trig>/TIMING/<det>_noReferenceTime_runNo_Nevents.root, <trig>=(SHMS,HMS,COIN), <det>=(shms,hms,coin)
Post-replay analysis
UTIL_XEM/reference_times_setup.C
Run the run_<spec>_no_reference_times script.
The output histograms (saved in current directory as move_me.root) are visually inspected, and the corresponding cut is determined by a trained eye.
Saving results
Place reftime cut rootfile in online location
Note: This is only possible because there are only histograms and canvases in this root file. Do not add large root files to the /group/ disk!
Follow the web location guide for proper placement of the information.

Running the Reference Times Script

  • Navigate to your hallc_replay_XEM directory.
  • Source /group/c-xem2/software/setup.csh
  • From your hallc_replay_XEM directory, run hcana and load the TIMING script for reference times
    • .L SCRIPTS/SHMS/TIMING/replay_no_reference_times_shms.C
  • The arguments to the script are RunNumber and MaxEvent. We need at least 1000000 events to determine the reference times. Choose a run that has at least 1M events and has a good portion of beam-on time.
    • After running the script, you should check that at least 1000000 events were replayed. Just because you asked for 1M evts, doesn't mean there are that many in the file.
  • The rootfile should appear under ROOTfiles/SHMS/TIMING/shms_noReferenceTime_<runNo>_1000000.root
  • Load the post-replay script located in the UTIL_XEM directory called reference_time_setup.C
    • If UTIL_XEM is not in your local hallc_replay_XEM git repository, then you should go back to the stating out section page of data analysis section. Follow along with the setting up the replay section.
  • There are three functions within this file, which you can check by tab-completing run_ followed by the tab key. In this case, we are determining the reference times for a SHMS run
    • run_shms_reference_time_setup(TString infile, TString outfile = "move_me.root")
    • The full path from the top directory of hallc_replay_XEM is used for the infile. You can optionally put in the output rootfile path and name, but for this example we will leave it as move_me.root.
  • Opening the move_me.root file will show 7 canvases with histograms on them.

Viewing on the Web

  • These root files can be viewed on the web using our jsroot website:

hallcweb.jlab.org/xem2 and logging in with your CUE username and password. For the PRACTICE, we have set up a COMPARISON location in the group location.

    • mv move_me.root /group/c-xem2/www/hallcweb/html/COMPARISONS/<your_name>/EMC/SHMS/REFERENCE_TIMES/shms_run_<runNo>.root
    • Now add the name of this file to the plot_reftimes.htm file that you can copy from Casey's WEB directory (up one directory to where you saved the file above)
    • cp /group/c-xem2/www/hallcweb/html/COMPARISONS/<your_name>/EMC/SHMS/REFERENCE_TIMES/plot_reftimes.htm <path_to_your_COMPARISONS>
    • Edit the plot_reftimes.htm and ensure the correct root filename is listed in the files HTML tag of 'simpleGUI'.
Online Running Information
Expert Check Frequency Reporting Sections
Casey Morean Every kinematic change Commissioning Activity
Every trigger change Page on XEM Web JSROOT

Selecting Proper Timing Windows

Note: This must be completed AFTER setting reference time cuts
Hits can be detected in the ADC and TDC TWW or PTW that do not come from the physics event that triggered the DAQ. When pre-scaling, some events could be true physics events, but not the trigger that fired the DAQ. Timing windows are somewhat loose cuts that exclude background events by measuring the difference in time between the ADC pulse time and TDC pulse time. There are corresponding branches in hcana that specify this difference.
AdcTdcDiffTime = TdcTime[ipmt] - AdcPulseTime[ipmt] hodoscope
AdcTdcDiffTime = HodoStartTime - AdcPulseTime[ipmt] - offset others, excluding DC

HodoStartTime is the Hodoscope time projected at the focal plane
TdcTime and AdcPulseTime is the detector TDC and ADC pulse time respectively for a given PMT in that detector.
Offset is the average adctdc_offset for the hodoscope planes

It is important to note here, that each AdcTdcDiffTime branch is a member of their respective detector class, and are stored as vectors indexed by PMT number. For example, the SHMS calorimeter has three different branches, one for pre-shower positive, one for pre-shower negative, and one for the fly's eye calorimeter. The pre-shower and shower are sometimes referred to as the pre-radiator and radiator.
P.cal.pr.goodPosAdcTdcDiffTime
P.cal.pr.goodNegAdcTdcDiffTime
P.cal.fly.goodAdcTdcDiffTime

It is important to note here the word good is capitalized for the hodoscopes.

According to Carlos Yero's Analysis Notes:

"The time difference should be a δ-function, however due to the finite detector resolutions, it has a finite width and gaussian in shape. Events that are far away from the main peak are clearly out-of-time indicating that the ADC pulse time and TDC Time are NOT correlated with the same event, and a time window cut must be made."

Components that need a Timing Window include
Detectors - hodoscope, calorimeter, Cherenkov
Drift Chambers - Cut on raw drift time
Triggers - Triggers associated with a specific detector (SHMS, HMS, COIN)

Picking the trigger component time window values is trickier than the detector components. This is because all the trigger components are listed in one long list and the time window min and time window max values are hard to pick out. A multiplicity cut can also be placed to assist in determining the correct events. For the drift chambers, the nhit variable should be used.

Running the Timing Windows Script

  • Navigate to your hallc_replay_XEM directory. Ensure you are on the correct pass branch
  • Source /group/c-xem2/software/setup.csh
  • Run hcana and load the TIMING script for timing windows
    • .L SCRIPTS/SHMS/TIMING/replay_no_timing_windows_shms.C
  • The arguments to the script are RunNumber and MaxEvent. We need at least 1000000 events to determine the timing windows. Use a run relevant for your kinematic setting with at least 1M events. Check the online replays if needed.
    • After running the script, you should check that at least 1000000 events were replayed. Just because you asked for 1M evts, doesn't mean there are that many in the file.
  • The rootfile should appear under ROOTfiles/SHMS/TIMING/shms_noTimingWindows_<runNo>_1000000.root
  • Load the post-replay script located in the CALIBRATION directory called timing_windows_setup.C using hcana
  • There are three functions within this file, which you can check by tab-completing run_ followed by the tab key. In this case, we are determining the timing windows for a SHMS run
    • run_shms_timing_windows(TString infile="", TString outfile = "", runNo=0)
    • The full path from the top directory of hallc_replay_XEM is used for the infile. You must put in the output rootfile path and name. Don't forget to enter the run number. This is how hcana determines what the previous windows were.
    • When setting the timing windows, and not just checking them change newWindows to true, and set the width to the desired default window width.
  • Opening the outfile file will show many canvases with histograms on them. We want to put these onto the web for all to view.

Viewing on the Web

For the PRACTICE, we have set up a COMPARISON location in the group location.

    • When a histogram has red bars, it is because the code found the main peak outside of the previously set timing windows. In the case of the calorimeter, this is usually because not enough true events are found for edge PMTs even in 1M events.
    • mv outfile.root /group/c-xem2/www/hallcweb/html/COMPARISONS/<your_name>/EMC/SHMS/TIMING_WINDOWS/shms_run_<runNo>_timing_windows.root
    • Now add the name of this file to the plot_reftimes.htm file that you can copy from Casey's WEB directory
    • cp /group/c-xem2/www/hallcweb/html/COMPARISONS/<your_name>/EMC/SHMS/TIMING_WINDOWS/plot_timing_windows.htm <path_to_your_COMPARISONS>
    • Edit the plot_reftimes.htm and ensure the correct root filename is listed in the files HTML tag of 'simpleGUI'.
  • If setting the new timing windows, they are not set automatically. One must take the lines output by the code to the terminal and add them to the respective detector CUTS files. One may need to adjust some PMT windows by hand. This script acts merely to speed up the timing windows setting task.

Make sure the proper hodo offsets are set BEFORE determining timing windows. I bring this up because hcana-april2020 update had hodo offsets different than 200 to use previous timing windows..

Online Running Information
Responsibility Check Frequency Reporting Sections
Casey Morean Every kinematic change Commissioning Activity
Every trigger change Page on XEM Web JSROOT

Parameters and Branches Referenced Here

Reference Time Parameters

SHMS

ADC reference time cut hcana parameters
All SHMS ADCs are cut based on pFADC_TREF_ROC2
phodo_adcrefcut
pngcer_adcrefcut
phgcer_adcrefcut
paero_adcrefcut
pcal_adcrefcut
TDC reference time cut hcana parameters
DC TDCs are determined by one value which is applied to 10 DCREFs pDCREF1-10. Hodoscope TDCs are read back on pTref1-2
pdc_tdcrefcut
phodo_tdcrefcut
ADC TDC reference time cut parameters in hcana for trigger legs
Not usually set when only one trigger type is in use.
t_shms_trig_tdcrefcut
t_shms_trig_adcrefcut
TDC offset
Default value is 300. Not sure why this would be changed.
t_shms_tdcoffset
ADC TDC offset value
Default value is 200. This was changed for sp18 data to account for changes to HODO timing. Typically this does not need changed.
t_shms_adc_tdc_offset

HMS

ADC reference time cut hcana parameters
All HMS ADCs are cut based on hFADC_TREF_ROC1
hhodo_adcrefcut
hcer_adcrefcut
haero_adcrefcut
hcal_adcrefcut
TDC reference time cut hcana parameters
DC TDCs are determined by one value which is applied to 2 DCREFs hDCREF1,5. Hodoscope TDCs are read back on hTref2 and trigger read back on hTref1.
hDCREF5 was added fall of 2018.
hdc_tdcrefcut
hhodo_tdcrefcut
ADC TDC reference time cut parameters in hcana for trigger legs
Not usually set when only one trigger type is in use.
t_hms_trig_tdcrefcut
t_hms_trig_adcrefcut
TDC offset
Default value is 300. Not sure why this would be changed.
t_shms_tdcoffset
ADC TDC offset value
Default value is 200. This was changed for sp18 data to account for changes to HODO timing. Typically this does not need changed.
t_shms_adc_tdc_offset

Reference Time Branches

SHMS

T.shms.pFADC_TREF_ROC2_adcPulseTimeRaw
T.shms.pT{1,2}_tdcTimeRaw
T.shms.pDCREF{1,2,3,4,5,6,7,8,9,10}_tdcTimeRaw

HMS

T.hms.hFADC_TREF_ROC1_adcPulseTimeRaw
T.hms.hT{1,2}_tdcTimeRaw
T.hms.hDCREF{1,2,3,4,5}_tdcTimeRaw

Timing Window Parameters

Timing Window Branches