Homework Handout #1


  1. Find or write a function to calculate c2. Make this for the general case of two distributions of points (which easily reduces into the set of points vs. a function case). Include error bars. Include an option for asymmetric errors. It may be that canned routines exist to do a lot of this, but to make one simple call which does it all you might need to write a “wrapper” routine. Also make a function to compute P(c2,n).


  1. Properly plot the data in this file (see web for link). Each line is an already-averaged data point of TDC value vs. pulser delay, for each of a lot of channels of electronics. The format: (supermodule, box, end, delay (ns), TDC count). I've so far been unable to recover the previous step, from which these numbers were derived and which would let you calculate an error on each TDC value. IIRC, there was a jitter in these values of only a tick or two – try an error of plus or minus one tick. Suck all these into your program. Pick a channel (ie, a SM/Box/End combo). Choose a function to fit the points, your goal is to get a TDC tick to nanosecond conversion. Why did you choose this function? Fit the data and add the function to your plot. Include all the necessary information for the consumer of your plot to understand what you did. What are the errors on the fit? How would you calculate the errors on each point if you had the few hundred points which were averaged to get each line in this file? Now fit all the channels in there, and plot distributions of the fit parameters. How uniform are the timing electronics?


  1. Write a wrapper fitting function which will take your data, errors, and a request to fit a polynomial of degree m, a Gaussian, an exponential, or an arbitrary function, and returns the fit parameters, errors on the fit parameters, a c2, and the probability. Have it call the appropriate subroutines to do the most efficient thing for the type of function it's getting. Only worry about the 1D case for now.