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

Last change on this file since 8317 was 8317, checked in by tbretz, 18 years ago
*** empty log message ***
File size: 2.4 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.5; // Fokallaenge = 1/4a
31 Double_t D = 4.5; // Mirror Diameter
32 Double_t x = 1.85;
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
44 TF1 *f = (TF1*)fpar.DrawClone();
45 fsph.DrawClone("same");
46
47 f->GetXaxis()->SetTitle("x [m]");
48 f->GetYaxis()->SetTitle("y [m]");
49 f->GetXaxis()->CenterTitle();
50
51 TArrow l;
52 l.SetLineColor(kBlue);
53 l.DrawArrow(-x, F*1.05, -x, fsph.Eval(-x), 0.02);
54 l.DrawArrow( x, F*1.05, x, fsph.Eval( x), 0.02);
55 l.SetLineColor(kRed);
56 l.DrawArrow(-x, fsph.Eval(-x), -x, fpar.Eval(-x), 0.02);
57 l.DrawArrow( x, fsph.Eval(-x), x, fpar.Eval( x), 0.02);
58 l.DrawArrow(-x, fpar.Eval(-x), 0, F, 0.02);
59 l.DrawArrow(-x, fsph.Eval(-x), 0, F, 0.02);
60 l.DrawArrow( x, fpar.Eval( x), 0, F, 0.02);
61 l.DrawArrow( x, fsph.Eval( x), 0, F, 0.02);
62
63 TMarker m;
64 m.SetMarkerStyle(kStar);
65 m.DrawMarker(0, F);
66
67 c = new TCanvas;
68 c->SetGridx();
69 c->SetGridy();
70
71 TF1 del("Diff", "(Sphere-Parab+TMath::Hypot(x-0, Parab-[0])-[0])/3e8*1e9");
72 del.SetParameter(0, F);
73
74 del.SetRange(-D*0.55, D*0.55);
75 f = (TF1*)diff.DrawClone();
76
77 f->GetXaxis()->SetTitle("x [m]");
78 f->GetYaxis()->SetTitle("delay [ns]");
79 f->GetXaxis()->CenterTitle();
80}
Note: See TracBrowser for help on using the repository browser.