source: trunk/MagicSoft/Mars/macros/tutorials/mirrordelay.C@ 8322

Last change on this file since 8322 was 8322, checked in by tbretz, 18 years ago
*** empty log message ***
File size: 3.1 KB
Line 
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
25void mirrordelay()
26{
27 TF1 fpar("Parab", "[0]*x*x");
28 TF1 fsph("Sphere", "-sqrt([0]*[0] - x*x)+[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, 1./(4*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
79 TLegend leg(0.40, 0.6, 0.60, 0.85);//, "NDC");
80
81 TF1 fdel("Diff", "(Sphere-Parab+TMath::Hypot(x-0, Parab-[0])-[0])/3e8*1e9");
82 fdel.SetRange(-D*0.55, D*0.55);
83 fdel.SetLineWidth(2);
84
85 for (int i=-2; i<3; i++)
86 {
87
88 fdel.SetParameter(0, F+i*0.10*F);
89 fdel.SetLineColor(kBlack+(abs(i)==2?3:abs(i)));
90 if (i<0)
91 fdel.SetLineStyle(2);
92 if (i==0)
93 fdel.SetLineStyle(kSolid);
94 if (i>0)
95 fdel.SetLineStyle(7);
96
97 f = (TF1*)fdel.DrawClone(i==-2?"":"same");
98
99 f->GetXaxis()->SetTitle("x [m]");
100 f->GetYaxis()->SetTitle("Delay \\Delta t [ns]");
101 f->GetXaxis()->CenterTitle();
102
103 leg.AddEntry(f, Form("F=%.1fm", F+i*0.10*F));
104 }
105
106 leg.DrawClone();
107}
Note: See TracBrowser for help on using the repository browser.