## Refined TDC Offsets Determination

### Why Do This

Right now TDC offsets are determined by events from all triggers.
This will inevitably introduce ambiguity in determining the position of the
time zero because the triggers are not well alligned although we tried hard.
To solve this problem, we can use events from only one trigger to determine
the time zero.

### How To Do This

Currently we concentrate on some most important channels, namely,
240 CSIs(tdc[0]-tdc[239]), 40 PVs(tdc[240]-tdc[279]) and Beam counters(tdc[400]-tdc[406].
The scheme we used are:

- correct raw tdc by applying raw tdc offsets and linearization
- define T(CSI)-T(DEG)=a
- apply cuts:

- PROMPT gamma && a<10ns
- PIENUH gamma && a>20ns
- PIENUH positron && a>20ns

compare these results and find the best one.
According to the above plan, we use following three triggers:

PROMPT Gamma:

- tbit[4]==1 &&
- pvet->pv_edep[0]<0.2f &&
- asum->csi_sum<200 &&
- mwpc->wc1_n_hits == 0 &&
- mwpc->wc2_n_hits == 0
- tim_histo[i_count].time-time_deg_normal<10.f &&
- cadc[tim_histo[i_count].channel]>0

PIENUH Gamma:

- tbit[2]==1 &&
- pvet->pv_edep[0]<0.2f &&
- asum->csi_sum<200 &&
- mwpc->wc1_n_hits == 0 &&
- mwpc->wc2_n_hits == 0
- tim_histo[i_count].time-time_deg_normal > 20.f &&
- cadc[tim_histo[i_count].channel]>0

PIENUH POSITRON:

- tbit[2]==1 &&
- pvet->pv_edep[0]>0.2f &&
- pvet->pv_edep[0]<1.2 &&
- fabs(asum->csi_sum-70.)<10. &&
- mwpc->wc1_n_hits == 1 &&
- mwpc->wc2_n_hits == 1
- tim_histo[i_count].time-time_deg_normal > 20.f &&
- cadc[tim_histo[i_count].channel]>0

### Results

Indeed, the above methods improved the resolutions. It removed the double peak problem. Corrected tdc histograms for each CsI, filled with all triggers can be compared with those filled with trigger PIENUH_GAMMA. These histograms were from run21480 -- run21488. After comparing the results
from each trigger, we found for CSIs, PIENUH_GAMMA gives the best resolution, while for PVs and Beam counters, the only choices are PIENUH_GAMMA and PROMPT GAMMA respectively.
Following results are from run21910 to run21914.The attached are histograms
from different triggers for reference. The Gauss fit are done by Paw. In
analyzer, we use function gauss_fit() to do the fit which
gives out a better result.
CSI 0 tdc offset ,
CSI 110 tdc offset ,
PV 0 tdc offset,
beam counters

You can also compare all the results from raw tdc
offsets(all events) and Refined tdc offsets after applying above scheme.

### How To Use This Result

To use this, one has to add a few lines in tdccalib.c and histo.c. Then every N_RUNS(set in histo.c) the analyzer will calculate the tdc offsets and write the resuls to tdc_offset.dat. You can use '-c' option in analyzer to load this file.
The modified versiton of tdccalib.c are avalible. All modifications have been commented at the end of the line with '/* WL */'. The histo.c contains only code for calculating tdc offsets.

### Some Technical Notes

- Because we use tdcoffset values in odb as references, these values in odb should not be changed before eor routine in histo.c is finished. That's why we add a line in tdcoffset.dat setting "Correct Offsets = INT:2\n". This is to make sure that tdcoffsets values in odb will not be changed by tdccalib.c .

© 20 December 1999, Weidong LI, for the PIBETA collaboration