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): Wolfgang Wittek, 10/2003 <mailto:wittek@mppmu.mpg.de>
|
---|
19 | !
|
---|
20 | ! Copyright: MAGIC Software Development, 2000-2003
|
---|
21 | !
|
---|
22 | !
|
---|
23 | \* ======================================================================== */
|
---|
24 |
|
---|
25 | /////////////////////////////////////////////////////////////////////////////
|
---|
26 | //
|
---|
27 | // MH2dimFunction
|
---|
28 | //
|
---|
29 | // container of histograms for the parameters of the 2-dim function
|
---|
30 | // describing the shower image
|
---|
31 | //
|
---|
32 | ////////////////////////////////////////////////////////////////////////////
|
---|
33 | #include "MH2dimFunction.h"
|
---|
34 |
|
---|
35 | #include <math.h>
|
---|
36 |
|
---|
37 | #include <TH1.h>
|
---|
38 | #include <TPad.h>
|
---|
39 | #include <TCanvas.h>
|
---|
40 |
|
---|
41 | #include "MLog.h"
|
---|
42 | #include "MLogManip.h"
|
---|
43 |
|
---|
44 | #include "MGeomCam.h"
|
---|
45 | #include "MBinning.h"
|
---|
46 | #include "MParList.h"
|
---|
47 |
|
---|
48 | #include "MHillas.h"
|
---|
49 | #include "M2dimFunction.h"
|
---|
50 |
|
---|
51 | ClassImp(MH2dimFunction);
|
---|
52 |
|
---|
53 | using namespace std;
|
---|
54 |
|
---|
55 | // --------------------------------------------------------------------------
|
---|
56 | //
|
---|
57 | // Setup histograms
|
---|
58 | //
|
---|
59 | MH2dimFunction::MH2dimFunction(const char *name, const char *title)
|
---|
60 | {
|
---|
61 | fName = name ? name : "MH2dimFunction";
|
---|
62 | fTitle = title ? title : "Histograms of parameters of 2-dim function";
|
---|
63 |
|
---|
64 | fHistXbarYbar.SetName("shower-maximum");
|
---|
65 | fHistXbarYbar.SetTitle("position of maximum of shower");
|
---|
66 | fHistXbarYbar.SetXTitle("x-position of maximum of shower image");
|
---|
67 | fHistXbarYbar.SetYTitle("y-position of maximum of shower image");
|
---|
68 | fHistXbarYbar.SetDirectory(NULL);
|
---|
69 | fHistXbarYbar.SetFillStyle(4000);
|
---|
70 | fHistXbarYbar.UseCurrentStyle();
|
---|
71 |
|
---|
72 | fHistAmp.SetName("Amplitude parameter");
|
---|
73 | fHistAmp.SetTitle("amplitude parameter");
|
---|
74 | fHistAmp.SetXTitle("amplitude parameter");
|
---|
75 | fHistAmp.SetYTitle("Counts");
|
---|
76 | fHistAmp.SetDirectory(NULL);
|
---|
77 | fHistAmp.SetFillStyle(4000);
|
---|
78 | fHistAmp.UseCurrentStyle();
|
---|
79 |
|
---|
80 | fHistMajor.SetName("Length parameter");
|
---|
81 | fHistMajor.SetTitle("length parameter");
|
---|
82 | fHistMajor.SetXTitle("length parameter");
|
---|
83 | fHistMajor.SetYTitle("Counts");
|
---|
84 | fHistMajor.SetDirectory(NULL);
|
---|
85 | fHistMajor.SetLineColor(kBlue);
|
---|
86 | fHistMajor.SetFillStyle(4000);
|
---|
87 | fHistMajor.UseCurrentStyle();
|
---|
88 |
|
---|
89 | fHistMinor.SetName("Width parameter");
|
---|
90 | fHistMinor.SetTitle("width parameter");
|
---|
91 | fHistMinor.SetXTitle("width parameter");
|
---|
92 | fHistMinor.SetYTitle("Counts");
|
---|
93 | fHistMinor.SetDirectory(NULL);
|
---|
94 | fHistMinor.SetLineColor(kGreen);
|
---|
95 | fHistMinor.SetFillStyle(4000);
|
---|
96 | fHistMinor.UseCurrentStyle();
|
---|
97 |
|
---|
98 | fHistAsym.SetName("Asymmetry parameter");
|
---|
99 | fHistAsym.SetTitle("asymmetry parameter");
|
---|
100 | fHistAsym.SetXTitle("asymmetry parameter");
|
---|
101 | fHistAsym.SetYTitle("Counts");
|
---|
102 | fHistAsym.SetDirectory(NULL);
|
---|
103 | fHistAsym.SetFillStyle(4000);
|
---|
104 | fHistAsym.UseCurrentStyle();
|
---|
105 |
|
---|
106 | MBinning bins;
|
---|
107 |
|
---|
108 | bins.SetEdges(100, 0, 1);
|
---|
109 | bins.Apply(fHistAmp);
|
---|
110 |
|
---|
111 | bins.SetEdges(100, 0, 1);
|
---|
112 | bins.Apply(fHistMajor);
|
---|
113 |
|
---|
114 | bins.SetEdges(100, 0, 1);
|
---|
115 | bins.Apply(fHistMinor);
|
---|
116 |
|
---|
117 | bins.SetEdges(100, 0, 1);
|
---|
118 | bins.Apply(fHistAsym);
|
---|
119 | }
|
---|
120 |
|
---|
121 | // --------------------------------------------------------------------------
|
---|
122 | //
|
---|
123 | // Setup the Binning for the histograms automatically if the correct
|
---|
124 | // instances of MBinning
|
---|
125 | //
|
---|
126 | Bool_t MH2dimFunction::SetupFill(const MParList *plist)
|
---|
127 | {
|
---|
128 | ApplyBinning(*plist, "XbarYbar", &fHistXbarYbar);
|
---|
129 | ApplyBinning(*plist, "Amp", &fHistAmp);
|
---|
130 | ApplyBinning(*plist, "Major", &fHistMajor);
|
---|
131 | ApplyBinning(*plist, "Minor", &fHistMinor);
|
---|
132 | ApplyBinning(*plist, "Asym", &fHistAsym);
|
---|
133 |
|
---|
134 | return kTRUE;
|
---|
135 | }
|
---|
136 |
|
---|
137 |
|
---|
138 | // --------------------------------------------------------------------------
|
---|
139 | //
|
---|
140 | // Fill the histograms with data from a M2dimFunction container.
|
---|
141 | //
|
---|
142 | Bool_t MH2dimFunction::Fill(const MParContainer *par, const Stat_t w)
|
---|
143 | {
|
---|
144 | if (!par)
|
---|
145 | {
|
---|
146 | *fLog << err << "MH2dimFunction::Fill: Pointer (!=NULL) expected." << endl;
|
---|
147 | return kFALSE;
|
---|
148 | }
|
---|
149 |
|
---|
150 | const M2dimFunction &h = *(M2dimFunction*)par;
|
---|
151 |
|
---|
152 | fHistXbarYbar.Fill(h.GetXbar(), h.GetYbar(), w);
|
---|
153 | fHistAmp.Fill(h.GetAmp(), w);
|
---|
154 |
|
---|
155 | fHistMajor.Fill(h.GetMajor(), w);
|
---|
156 | fHistMinor.Fill(h.GetMinor(), w);
|
---|
157 |
|
---|
158 | fHistAsym.Fill(h.GetAsym(), w);
|
---|
159 |
|
---|
160 | return kTRUE;
|
---|
161 | }
|
---|
162 |
|
---|
163 | // --------------------------------------------------------------------------
|
---|
164 | //
|
---|
165 | // Creates a new canvas and draws the two histograms into it.
|
---|
166 | // Be careful: The histograms belongs to this object and won't get deleted
|
---|
167 | // together with the canvas.
|
---|
168 | //
|
---|
169 | void MH2dimFunction::Draw(Option_t *)
|
---|
170 | {
|
---|
171 | TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
|
---|
172 | pad->SetBorderMode(0);
|
---|
173 |
|
---|
174 | AppendPad("");
|
---|
175 |
|
---|
176 | pad->Divide(2,2);
|
---|
177 |
|
---|
178 | pad->cd(1);
|
---|
179 | gPad->SetBorderMode(0);
|
---|
180 | TAxis &x = *fHistLeakage1.GetXaxis();
|
---|
181 | x.SetRangeUser(0.0, x.GetXmax());
|
---|
182 | MH::DrawSame(fHistLeakage1, fHistLeakage2, "Leakage1 and Leakage2");
|
---|
183 |
|
---|
184 | pad->cd(2);
|
---|
185 | gPad->SetBorderMode(0);
|
---|
186 | MH::DrawSame(fHistCorePix, fHistUsedPix, "Number of core/used Pixels");
|
---|
187 |
|
---|
188 | pad->cd(3);
|
---|
189 | gPad->SetBorderMode(0);
|
---|
190 | MH::DrawSame(fHistConc1, fHistConc, "Concentrations");
|
---|
191 |
|
---|
192 | pad->cd(4);
|
---|
193 | gPad->SetBorderMode(0);
|
---|
194 |
|
---|
195 | pad->Modified();
|
---|
196 | pad->Update();
|
---|
197 | }
|
---|
198 |
|
---|
199 | //==========================================================================
|
---|
200 |
|
---|
201 |
|
---|
202 |
|
---|
203 |
|
---|
204 |
|
---|
205 |
|
---|