1 | ///////////////////////////////////////////////////////////////////////
|
---|
2 | //
|
---|
3 | // MHStarMap
|
---|
4 | //
|
---|
5 | // This class contains a 2-dimensional histogram. It should show some
|
---|
6 | // kind of star map. The algorith which calculates the star map
|
---|
7 | // from the Hillas parameters (Fill) can be enhanced.
|
---|
8 | //
|
---|
9 | ///////////////////////////////////////////////////////////////////////
|
---|
10 |
|
---|
11 | #include "MHStarMap.h"
|
---|
12 |
|
---|
13 | #include <TH2.h>
|
---|
14 | #include <TStyle.h>
|
---|
15 | #include <TCanvas.h>
|
---|
16 |
|
---|
17 | #include "MHillas.h"
|
---|
18 |
|
---|
19 | ClassImp(MHStarMap)
|
---|
20 |
|
---|
21 | MHStarMap::MHStarMap (const char *name, const char *title)
|
---|
22 | {
|
---|
23 | //
|
---|
24 | // default constructor
|
---|
25 | // creates an a list of histograms for all pixels and both gain channels
|
---|
26 | //
|
---|
27 |
|
---|
28 | //
|
---|
29 | // set the name and title of this object
|
---|
30 | //
|
---|
31 |
|
---|
32 | *fName = name ? name : "MHStarMap" ;
|
---|
33 | *fTitle = title ? title : "Container for a Star Map" ;
|
---|
34 |
|
---|
35 | //
|
---|
36 | // loop over all Pixels and create two histograms
|
---|
37 | // one for the Low and one for the High gain
|
---|
38 | // connect all the histogram with the container fHist
|
---|
39 | //
|
---|
40 | fStarMap = new TH2F("Star Map", "Counts",
|
---|
41 | 50, -300, 300,
|
---|
42 | 50, -300, 300);
|
---|
43 | }
|
---|
44 |
|
---|
45 | MHStarMap::~MHStarMap()
|
---|
46 | {
|
---|
47 | delete fStarMap;
|
---|
48 | }
|
---|
49 |
|
---|
50 | void MHStarMap::Draw(Option_t *)
|
---|
51 | {
|
---|
52 | TCanvas *c = new TCanvas("Star Map", "Star Map created from Hillas Parameters", 500, 500);
|
---|
53 |
|
---|
54 | gStyle->SetPalette(1, 0);
|
---|
55 | fStarMap->Draw("colz");
|
---|
56 |
|
---|
57 | c->Modified();
|
---|
58 | c->Update();
|
---|
59 | }
|
---|
60 |
|
---|
61 | void MHStarMap::Fill(MHillas *par)
|
---|
62 | {
|
---|
63 | const float dist = par->GetDist();
|
---|
64 | const float theta = par->GetTheta();
|
---|
65 | const float alpha = par->GetAlpha()/kRad2Deg;
|
---|
66 |
|
---|
67 | const float m = tan(theta+alpha-kPI);
|
---|
68 | const float t = dist*(sin(theta)-cos(theta)*m);
|
---|
69 |
|
---|
70 | float y0 = -m*300+t;
|
---|
71 | for (int i=-297; i<300; i+=3)
|
---|
72 | {
|
---|
73 | const float y1 = m*i+t;
|
---|
74 |
|
---|
75 | // if (y1<=y0-3 || y1>=y0+3)
|
---|
76 | // continue;
|
---|
77 |
|
---|
78 | fStarMap->Fill(i, y1);
|
---|
79 | y0 = y1;
|
---|
80 | }
|
---|
81 | }
|
---|
82 |
|
---|