source: trunk/MagicSoft/Mars/mgui/MAitoff.cc@ 2925

Last change on this file since 2925 was 2281, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 2.9 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, 7/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2003
21!
22!
23\* ======================================================================== */
24
25//////////////////////////////////////////////////////////////////////////////
26//
27// MAitoff
28//
29//////////////////////////////////////////////////////////////////////////////
30#include "MAitoff.h"
31
32#include <TMath.h>
33#include <TMarker.h>
34#include <TVirtualPad.h>
35
36#include "MH.h"
37
38ClassImp(MAitoff);
39
40using namespace std;
41
42void MAitoff::Transform(Double_t lon, Double_t lat, Double_t &x, Double_t &y)
43{
44 Double_t b = lon;
45 Double_t sa = lat;
46
47 Double_t alpha2 = sa/kRad2Deg /2.;
48 Double_t delta = b/kRad2Deg;
49
50 Double_t r2 = sqrt(2.);
51 Double_t f = 2.*r2/TMath::Pi();
52 Double_t cdec = cos(delta);
53 Double_t denom = sqrt(1.+cdec*cos(alpha2));
54 x = cdec*sin(alpha2)*2.*r2/denom;
55 y = sin(delta);
56
57 x /= f/kRad2Deg;
58 y /= f/kRad2Deg;
59}
60
61void MAitoff::Draw(Option_t *)
62{
63 if (!gPad)
64 MH::MakeDefCanvas();
65
66 gPad->Range(-200, -80, 200, 80);
67
68 TMarker m;
69 Double_t x, y;
70
71 for (int i=-180; i<180; i+=3) { Transform( 60, i, x, y); m.DrawMarker(x, y); }
72 for (int i=-180; i<180; i+=3) { Transform( 30, i, x, y); m.DrawMarker(x, y); }
73 for (int i=-180; i<180; i+=3) { Transform( 0, i, x, y); m.DrawMarker(x, y); }
74 for (int i=-180; i<180; i+=3) { Transform(-30, i, x, y); m.DrawMarker(x, y); }
75 for (int i=-180; i<180; i+=3) { Transform(-60, i, x, y); m.DrawMarker(x, y); }
76
77 for (int i=-90; i<90; i++) { Transform(i, -180, x, y); m.DrawMarker(x, y); }
78 for (int i=-90; i<90; i++) { Transform(i, -135, x, y); m.DrawMarker(x, y); }
79 for (int i=-90; i<90; i++) { Transform(i, -90, x, y); m.DrawMarker(x, y); }
80 for (int i=-90; i<90; i++) { Transform(i, -45, x, y); m.DrawMarker(x, y); }
81 for (int i=-90; i<90; i++) { Transform(i, 0, x, y); m.DrawMarker(x, y); }
82 for (int i=-90; i<90; i++) { Transform(i, 45, x, y); m.DrawMarker(x, y); }
83 for (int i=-90; i<90; i++) { Transform(i, 90, x, y); m.DrawMarker(x, y); }
84 for (int i=-90; i<90; i++) { Transform(i, 135, x, y); m.DrawMarker(x, y); }
85 for (int i=-90; i<90; i++) { Transform(i, 180, x, y); m.DrawMarker(x, y); }
86}
Note: See TracBrowser for help on using the repository browser.