| 1 | /* ======================================================================== *\
|
|---|
| 2 | !
|
|---|
| 3 | ! *
|
|---|
| 4 | ! * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
|---|
| 5 | ! * Software. It is distributed to you in the hope that it can be a useful
|
|---|
| 6 | ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
|---|
| 7 | ! * It is distributed WITHOUT ANY WARRANTY.
|
|---|
| 8 | ! *
|
|---|
| 9 | ! * Permission to use, copy, modify and distribute this software and its
|
|---|
| 10 | ! * documentation for any purpose is hereby granted without fee,
|
|---|
| 11 | ! * provided that the above copyright notice appear in all copies and
|
|---|
| 12 | ! * that both that copyright notice and this permission notice appear
|
|---|
| 13 | ! * in supporting documentation. It is provided "as is" without express
|
|---|
| 14 | ! * or implied warranty.
|
|---|
| 15 | ! *
|
|---|
| 16 | !
|
|---|
| 17 | !
|
|---|
| 18 | ! Author(s): Thomas Bretz, 2/2007 <mailto:tbretz@astro.uni-wuerzburg.de>
|
|---|
| 19 | !
|
|---|
| 20 | ! Copyright: MAGIC Software Development, 2000-2007
|
|---|
| 21 | !
|
|---|
| 22 | !
|
|---|
| 23 | \* ======================================================================== */
|
|---|
| 24 |
|
|---|
| 25 | void mirrordelay()
|
|---|
| 26 | {
|
|---|
| 27 | TF1 fpar("Parab", "x*x/(4*[0])");
|
|---|
| 28 | TF1 fsph("Sphere", "-sqrt(4*[0]*[0] - x*x) + 2*[0]");
|
|---|
| 29 |
|
|---|
| 30 | Double_t F = 4.92; // Fokallaenge = 1/4a
|
|---|
| 31 | Double_t D = 4.5; // Mirror Diameter
|
|---|
| 32 | Double_t x = 1.85; // incident point for photon
|
|---|
| 33 |
|
|---|
| 34 | fsph.SetRange(-D*0.55, D*0.55);
|
|---|
| 35 | fpar.SetRange(-D*0.55, D*0.55);
|
|---|
| 36 |
|
|---|
| 37 | fpar.SetParameter(0, F);
|
|---|
| 38 | fsph.SetParameter(0, F);
|
|---|
| 39 |
|
|---|
| 40 | fpar.SetMaximum(F*1.05);
|
|---|
| 41 |
|
|---|
| 42 | TCanvas *c = new TCanvas;
|
|---|
| 43 | c->SetBorderMode(0);
|
|---|
| 44 | c->SetFrameBorderMode(0);
|
|---|
| 45 | c->SetFillColor(kWhite);
|
|---|
| 46 |
|
|---|
| 47 | TF1 *f = (TF1*)fpar.DrawClone();
|
|---|
| 48 | fsph.DrawClone("same");
|
|---|
| 49 |
|
|---|
| 50 | f->GetXaxis()->SetTitle("x [m]");
|
|---|
| 51 | f->GetYaxis()->SetTitle("y [m]");
|
|---|
| 52 | f->GetXaxis()->CenterTitle();
|
|---|
| 53 |
|
|---|
| 54 | TArrow l;
|
|---|
| 55 | l.SetLineColor(kBlue);
|
|---|
| 56 | l.DrawArrow(-x, F*1.05, -x, fsph.Eval(-x), 0.02);
|
|---|
| 57 | l.DrawArrow( x, F*1.05, x, fsph.Eval( x), 0.02);
|
|---|
| 58 | l.SetLineColor(kRed);
|
|---|
| 59 | l.DrawArrow(-x, fsph.Eval(-x), -x, fpar.Eval(-x), 0.02);
|
|---|
| 60 | l.DrawArrow( x, fsph.Eval(-x), x, fpar.Eval( x), 0.02);
|
|---|
| 61 | l.DrawArrow(-x, fpar.Eval(-x), 0, F, 0.02);
|
|---|
| 62 | l.DrawArrow(-x, fsph.Eval(-x), 0, F, 0.02);
|
|---|
| 63 | l.DrawArrow( x, fpar.Eval( x), 0, F, 0.02);
|
|---|
| 64 | l.DrawArrow( x, fsph.Eval( x), 0, F, 0.02);
|
|---|
| 65 |
|
|---|
| 66 | TMarker m;
|
|---|
| 67 | m.SetMarkerStyle(kStar);
|
|---|
| 68 | m.DrawMarker(0, F);
|
|---|
| 69 |
|
|---|
| 70 | // Plot run-time different versus distance
|
|---|
| 71 |
|
|---|
| 72 | c = new TCanvas;
|
|---|
| 73 | c->SetBorderMode(0);
|
|---|
| 74 | c->SetFrameBorderMode(0);
|
|---|
| 75 | c->SetFillColor(kWhite);
|
|---|
| 76 | c->SetGridx();
|
|---|
| 77 | c->SetGridy();
|
|---|
| 78 | c->SetRightMargin(0.01);
|
|---|
| 79 |
|
|---|
| 80 | TLegend leg(0.40, 0.6, 0.60, 0.85, "Focal length");//, "NDC");
|
|---|
| 81 |
|
|---|
| 82 | for (int i=-2; i<3; i++)
|
|---|
| 83 | {
|
|---|
| 84 | // Make sure to set the parameters BEFORE reusing the function!
|
|---|
| 85 | fsph.SetParameter(0, F+i*0.10*F);
|
|---|
| 86 | fpar.SetParameter(0, F+i*0.10*F);
|
|---|
| 87 |
|
|---|
| 88 | TF1 fdel1("Diff1", "Sphere-Parab");
|
|---|
| 89 | TF1 fdel2("Diff2", "TMath::Hypot(x-0, Parab-[0])-TMath::Hypot(x-0, Sphere-[0])");
|
|---|
| 90 | fdel2.SetParameter(0, F+i*0.10*F);
|
|---|
| 91 |
|
|---|
| 92 | TF1 fdel("Diff", "(Diff1+Diff2)/3e8*1e9");
|
|---|
| 93 | fdel.SetRange(-D*0.55, D*0.55);
|
|---|
| 94 | fdel.SetLineWidth(2);
|
|---|
| 95 | fdel.SetParameter(0, F+i*0.10*F);
|
|---|
| 96 |
|
|---|
| 97 | fdel.SetLineColor(kBlack+(abs(i)==2?3:abs(i)));
|
|---|
| 98 | if (i<0)
|
|---|
| 99 | fdel.SetLineStyle(2);
|
|---|
| 100 | if (i==0)
|
|---|
| 101 | fdel.SetLineStyle(kSolid);
|
|---|
| 102 | if (i>0)
|
|---|
| 103 | fdel.SetLineStyle(7);
|
|---|
| 104 |
|
|---|
| 105 | f = (TF1*)fdel.DrawClone(i==-2?"":"same");
|
|---|
| 106 |
|
|---|
| 107 | f->GetHistogram()->SetTitle("Arrival time delay for a spherical mirror");
|
|---|
| 108 |
|
|---|
| 109 | f->GetXaxis()->SetTitle("r [m]");
|
|---|
| 110 | f->GetYaxis()->SetTitle("Delay \\Delta t [ns]");
|
|---|
| 111 | f->GetXaxis()->CenterTitle();
|
|---|
| 112 | f->GetYaxis()->CenterTitle();
|
|---|
| 113 | f->GetYaxis()->SetTitleOffset(1.3);
|
|---|
| 114 |
|
|---|
| 115 | leg.AddEntry(f, Form("F=%.1fm", F+i*0.10*F));
|
|---|
| 116 | }
|
|---|
| 117 |
|
|---|
| 118 | leg.DrawClone();
|
|---|
| 119 | }
|
|---|