// ----------------------------------------------------------------------------------- // /* ROOT macro for analysing measurements of the length of the lecture table in Auditorium A at NBI. The measurements were done first with a 30cm ruler, and then a 2m folding ruler, and each person was asked not only to state the measurement, but also their estimated uncertainty. None of the persons could see previous measurements in order to get the largest degree of independence. The data sample also includes the measurements from last years course, giving a chance to compare with a completely independent measurement. Author: Troels C. Petersen (NBI/CERN) Email: Troels.Petersen@cern.ch Date: 7th of September 2010 */ // ----------------------------------------------------------------------------------- // // ----------------------------------------------------------------------------------- // void TableMeasurements() { // ----------------------------------------------------------------------------------- // gROOT->Reset(); // Set the showing of statistics and fitting results (0 means off, 1111 means all on): gStyle->SetOptStat(1111); // gStyle->SetOptStat(0); gStyle->SetOptFit(1111); // gStyle->SetOptFit(0); // Statistics and fitting results replaced in: // gStyle->SetStatX(0.52); // Top left corner. // gStyle->SetStatY(0.86); // gStyle->SetStatX(0.89); // Bottom right corner. // gStyle->SetStatY(0.33); // Set the graphics: gStyle->SetStatBorderSize(1); gStyle->SetStatFontSize(0.055); gStyle->SetCanvasColor(4); gStyle->SetPalette(1); // ------------------------------------------------------------------ // // Get data in arrays: // ------------------------------------------------------------------ // const int Nmeas09 = 17; double Lc09[Nmeas09] = {335.5, 325.0, 306.2, 335.9, 335.5, 335.2, 336.0, 335.9, 335.0, 335.0, 336.0, 335.6, 335.2, 335.7, 317.0, 335.0, 335.6}; double Ec09[Nmeas09] = { 0.5, 5.0, 1.1, 0.7, 3.0, 1.5, 1.0, 0.2, 1.0, 0.5, 4.0, 0.6, 3.0, 3.0, 0.8, 1.1, 1.0}; double Ld09[Nmeas09] = {336.5, 336.5, 136.6, 336.3, 336.3, 136.5, 336.5, 336.1, 336.5, 335.4, 336.5, 336.6, 336.6, 336.4, 336.3, 336.3, 335.6}; double Ed09[Nmeas09] = { 0.2, 0.1, 0.4, 0.4, 2.0, 1.0, 0.2, 0.07, 0.5, 0.5, 0.2, 0.2, 0.3, 0.3, 0.2, 0.3, 0.25}; // Note: Third last measurement with a 30cm ruler was actually done with a 20cm ruler! const int Nmeas10 = 24; char* names[Nmeas10] = {"Troels", "Bjarke", "Bo F", "Martin", "Kjartan", "Heidi", "Sonja", "Tina", "Christoffer", "Kristoffer", "Peter", "Diana", "Silvia", "Lars", "Simon", "Logi", "Ninna", "Jeppe", "Kasper", "Song", "Alexander", "Rastin", "Dan", "Bo M"}; double Lc10[Nmeas10] = {336.5, 337.0, 336.1, 336.4, 340.0, 306.0, 336.5, 300.0, 340.0, 335.0, 335.0, 339.0, 340.0, 305.0, 336.7, 335.0, 340.0, 337.0, 330.0, 336.3, 336.0, 333.0, 367.0, 337.0}; double Ec10[Nmeas10] = { 0.5, 0.1, 10.0, 1.0, 10.0, 5.0, 2.0, 10.0, 15.0, 12.0, 5.0, 2.0, 10.0, 5.0, 0.4, 10.0, 33.0, 2.0, 3.0, 1.2, 2.0, 2.0, 1.5, 1.0}; double Ld10[Nmeas10] = {336.5, 336.0, 336.4, 336.0, 336.0, 306.0, 336.5, 335.0, 337.0, 336.5, 336.0, 336.0, 337.0, 335.0, 336.4, 337.0, 335.0, 336.0, 375.0, 336.4, 336.3, 336.0, 336.0, 336.5}; double Ed10[Nmeas10] = { 0.1, 0.3, 0.3, 0.2, 5.0, 0.5, 1.0, 2.0, 5.0, 0.5, 1.0, 0.5, 5.0, 5.0, 0.1, 5.0, 5.0, 0.5, 2.0, 0.2, 0.2, 1.0, 1.0, 0.5}; // Note: Kasper thought that his second measurement was a bit wierd - he wasn't entirely sure of his calculation. // Print the data: printf(" Measurement: With 30cm ruler With 2m folding ruler \n"); for (int i=0; i < Nmeas10; i++) { printf(" %2d %12s %6.2f +- %5.2f cm %6.2f +- %4.2f cm \n", i+1, names[i], Lc10[i], Ec10[i], Ld10[i], Ed10[i]); } // ------------------------------------------------------------------ // // Put data into histograms: // ------------------------------------------------------------------ // // Make histograms: TH1F* Hist_Lc = new TH1F("Hist_Lc", "Histogram of Length - 30cm ruler", 200, 0.0, 400.0); TH1F* Hist_Ec = new TH1F("Hist_Ec", "Histogram of Errors - 30cm ruler", 100, 0.0, 10.0); TH1F* Hist_Ld = new TH1F("Hist_Ld", "Histogram of Length - 2m folding rule", 200, 0.0, 400.0); TH1F* Hist_Ed = new TH1F("Hist_Ed", "Histogram of Errors - 2m folding rule", 100, 0.0, 5.0); // Put data into the histograms: for (int i=0; i < Nmeas10; i++) { Hist_Lc->Fill(Lc10[i]); Hist_Ec->Fill(Ec10[i]); Hist_Ld->Fill(Ld10[i]); Hist_Ed->Fill(Ed10[i]); } // ------------------------------------------------------------------ // // Fit data and make plots: // ------------------------------------------------------------------ // // Make canvas: canvas = new TCanvas("canvas","",250,20,1000,750); // Make a new window canvas->SetFillColor(0); // Make it white canvas->Divide(2,2); // Divide it into a 2x2 window canvas->cd(1); TF1* gauss_Lc = new TF1("gauss_Lc", "gaus", 0.0, 400.0); Hist_Lc->Fit("gauss_Lc","R"); // Option "R" means: Use the function range only! canvas->cd(2); Hist_Ld->Draw(); canvas->cd(3); Hist_Ec->Draw(); canvas->cd(4); Hist_Ed->Draw(); canvas->Update(); canvas->SaveAs("LengthOfTable.eps"); } //---------------------------------------------------------------------------------- /* Start by taking a close look at the data, both by inspecting the numbers, and then by considering the histograms produced by running the macro. Questions: ---------- 1) Given this data set, which (if any) corrections would you consider making to the measurements, and how would you justify them? Would you also make any corrections to the associated errors? And are there any data points, which you would exclude? 2) Given the (possibly) updated dataset, fit the length measurements with a Gaussian distribution, both for the 30cm and the 2m ruler cases. Should the binning be changed for these fits? And is the Gaussian distribution justified? 3) Given two succesful fits, the width of these Gaussians actually give an estimate of the uncertainty in the measurements. How do they compare to the uncertainties estimated by the people making the measurements? How much was the estimated uncertainties lowered from first to second type of measurement? Was this justified? 4) Is there any correlation between the measurements? And is there any correlation between the errors on the measurements? And finally is there any correlation between the accuracy of the measurements (i.e. how close they are to the mean) and their associated uncertainty? If this is the case, then it somewhat justifies weighting the measurements according to their uncertainty (see below). 5) Try to calculate the mean and then the weighted mean. How much difference does this make? Why? Advanced questions: ------------------- 1) Is the length of the table different when measured with a 30cm and a 2m ruler - quantify this statement! I.e. what is the difference, and what is the uncertainty on that difference? Is this significantly away from 0? How big an effect on the 30cm ruler would this correspond to (i.e. is it really 30cm)? 2) In question 2) above you chose a binning - does this have any influence on the result? 3) If you were asked for the best estimate of the length of the table, what would you do? (If posssible, read Bevington page 58!) */ //----------------------------------------------------------------------------------