next up previous contents
Next: Accessing Permanent Data Structures Up: Writing Code to Access Previous: Photons Created in the   Contents

Comparing Times

If you are not familiar with the way SNO records times it might be as well to see section A.1 before reading further. There are 3 types times recorded in the event data structure:-

10Mhz
This is an absolute time recorded in words JDY/UT1/UT2 of the EV and MC banks. For EV is is the trigger time and for MC it is the generation time. These times, which are also know as Universal Date Stamps, can be compared as follows:-

 
      double precision     delta_time , universal_date_compare
 
.
.
.
 
      delta_time = universal_date_compare( iq(lev+KEV_JDY),
     +                                     iq(lmc+KMC_JDY) )
This gives a time difference in nsec and can be used to compare any combination of EV and MC banks, but suffers from two drawbacks:-

For both these reasons, this would not be a good way to measure short time durations (say minutes or less) but would be fine over longer time periods. The routine UNIVERSAL_DATE_UPDATE can be used to construct new Universal Date Stamps by adding an nsec offset.

50MHz

This is an absolute time recorded in GTR words of the EV and MC banks. For EV is is the trigger time and for MC it is the generation time. These times compared as follows:-

 
      double precision     delta_time , get_double
 
.
.
.
 
      delta_time =   get_double(lev+KEV_GTR)
     +             - get_double(lmc+KMC_GTR)
This gives a time difference in nsec and again can be used to compare any combination of EV and MC banks. Again EV times are rounded onto 20nsec boundaries, but this does not represent a precisions loss: that is how the global trigger is defined! However, as with comparing 10MHz times, this method suffers from two drawbacks:-

For both these reasons, this is only good for comparing short time periods (certainly less than the 2 day rollover) and even then care has to be taken to compensate if the rollover occurred between the two times.

Relative Times
These are times held in banks below the EV and the MC and give nsec times relative to the 10MHz and 50Mhz clocks held in the supporting EV or MC. Consequently times within a single EV or MC subtree may be compared directly e.g.:-

 
      real                 d_time
      double precision     delta_time , get_double
 
.
.
.
 
      delta_time =   get_double(lmcvx+KMCVX_TIM)
     +             - get_double(lmcpm+KMCPM_TIM)
 
      d_time     = rq(lpmt+KPMT_PT) - rq(lfttv+KFTXV_T)

but times in different subtrees cannot be compared without also correcting for the times between the two supporting EV or MC banks as described above. Comparing times between EV and MC subtrees is further complicated by the facts that:-

From all that has gone above it may sound as is comparing times is a rather daunting task! Fear not, a utility called TIME_DIFFERENCE has been written just to cover all this complication. In essence any two times can be compared, in the same or different EV/MC subtrees. The routine relocates times between subtrees using the 10MHz or 50Mhz clocks choosing which ever is more accurate. It also corrects EV subtree times so that they can be directly compared to MC times. For example, to compare a fitted time to a MC vertex time:-

 
      double precision     delta_time , time_difference
      integer              iretc
 
.
.
.
 
      delta_time =   time_difference( lmcvx+KMCVX_TIM,
     +                                lfttv+KFTXV_T,
     +                                iretc, 0, 0)

iretc is a return code which should 0 (KSU_OK) if the routine was abled to compute the difference. The two trailing zeros are only used if comparing times in the Px banks. For more details see the routine itself.


next up previous contents
Next: Accessing Permanent Data Structures Up: Writing Code to Access Previous: Photons Created in the   Contents
sno Guest Acct 2009-09-09