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

Last change on this file since 8321 was 8321, checked in by tbretz, 18 years ago
*** empty log message ***
File size: 2.6 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;
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 c = new TCanvas;
71 c->SetBorderMode(0);
72 c->SetFrameBorderMode(0);
73 c->SetFillColor(kWhite);
74 c->SetGridx();
75 c->SetGridy();
76
77 TF1 fdel("Diff", "(Sphere-Parab+TMath::Hypot(x-0, Parab-[0])-[0])/3e8*1e9");
78 fdel.SetParameter(0, F);
79
80 fdel.SetRange(-D*0.55, D*0.55);
81 f = (TF1*)fdel.DrawClone();
82
83 f->GetXaxis()->SetTitle("x [m]");
84 f->GetYaxis()->SetTitle("Delay \\Delta t [ns]");
85 f->GetXaxis()->CenterTitle();
86}
Note: See TracBrowser for help on using the repository browser.