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, 03/2005 <mailto:tbretz@astro.uni-wuerzburg.de>
|
---|
19 | !
|
---|
20 | ! Copyright: MAGIC Software Development, 2000-2005
|
---|
21 | !
|
---|
22 | !
|
---|
23 | \* ======================================================================== */
|
---|
24 |
|
---|
25 | /////////////////////////////////////////////////////////////////////////////
|
---|
26 | //
|
---|
27 | // MHNewImagePar2
|
---|
28 | //
|
---|
29 | ////////////////////////////////////////////////////////////////////////////
|
---|
30 | #include "MHNewImagePar2.h"
|
---|
31 |
|
---|
32 | #include <math.h>
|
---|
33 |
|
---|
34 | #include <TH1.h>
|
---|
35 | #include <TPad.h>
|
---|
36 | #include <TCanvas.h>
|
---|
37 |
|
---|
38 | #include "MLog.h"
|
---|
39 | #include "MLogManip.h"
|
---|
40 |
|
---|
41 | #include "MGeomCam.h"
|
---|
42 | #include "MBinning.h"
|
---|
43 | #include "MParList.h"
|
---|
44 |
|
---|
45 | #include "MHillas.h"
|
---|
46 | #include "MNewImagePar2.h"
|
---|
47 |
|
---|
48 | ClassImp(MHNewImagePar2);
|
---|
49 |
|
---|
50 | using namespace std;
|
---|
51 |
|
---|
52 | // --------------------------------------------------------------------------
|
---|
53 | //
|
---|
54 | // Setup histograms
|
---|
55 | //
|
---|
56 | MHNewImagePar2::MHNewImagePar2(const char *name, const char *title)
|
---|
57 | : fGeom(0)
|
---|
58 | {
|
---|
59 | fName = name ? name : "MHNewImagePar2";
|
---|
60 | fTitle = title ? title : "Histograms of new image parameters 2";
|
---|
61 |
|
---|
62 | fHistBorder1.SetName("Border1");
|
---|
63 | fHistBorder1.SetTitle("Border Line of border pixels (pixel border)");
|
---|
64 | fHistBorder1.SetXTitle("Border [\\circ]]");
|
---|
65 | fHistBorder1.SetYTitle("Counts");
|
---|
66 | fHistBorder1.SetDirectory(NULL);
|
---|
67 | fHistBorder1.UseCurrentStyle();
|
---|
68 | fHistBorder1.SetFillStyle(4000);
|
---|
69 |
|
---|
70 | fHistBorder2.SetName("Border2");
|
---|
71 | fHistBorder2.SetTitle("Border Line of border pixels (pixel center)");
|
---|
72 | fHistBorder2.SetXTitle("Border [\\circ]]");
|
---|
73 | fHistBorder2.SetYTitle("Counts");
|
---|
74 | fHistBorder2.SetDirectory(NULL);
|
---|
75 | fHistBorder2.UseCurrentStyle();
|
---|
76 | fHistBorder2.SetLineColor(kBlue);
|
---|
77 | fHistBorder2.SetFillStyle(4000);
|
---|
78 | }
|
---|
79 |
|
---|
80 | // --------------------------------------------------------------------------
|
---|
81 | //
|
---|
82 | // Setup the Binning for the histograms automatically if the correct
|
---|
83 | // instances of MBinning
|
---|
84 | //
|
---|
85 | Bool_t MHNewImagePar2::SetupFill(const MParList *plist)
|
---|
86 | {
|
---|
87 | fGeom = (MGeomCam*)plist->FindObject("MGeomCam");
|
---|
88 | if (!fGeom)
|
---|
89 | {
|
---|
90 | *fLog << err << "MGeomCam not found... abort." << endl;
|
---|
91 | return kFALSE;
|
---|
92 | }
|
---|
93 |
|
---|
94 | const MBinning *bins = (MBinning*)plist->FindObject("BinningBorder");
|
---|
95 | if (!bins)
|
---|
96 | {
|
---|
97 | MBinning b;
|
---|
98 | b.SetEdges(87, 0, 10);
|
---|
99 | b.Apply(fHistBorder1);
|
---|
100 | b.Apply(fHistBorder2);
|
---|
101 | }
|
---|
102 | else
|
---|
103 | {
|
---|
104 | bins->Apply(fHistBorder1);
|
---|
105 | bins->Apply(fHistBorder2);
|
---|
106 | }
|
---|
107 |
|
---|
108 | return kTRUE;
|
---|
109 | }
|
---|
110 |
|
---|
111 |
|
---|
112 | // --------------------------------------------------------------------------
|
---|
113 | //
|
---|
114 | // Fill the histograms with data from a MNewImagePar2 container.
|
---|
115 | //
|
---|
116 | Int_t MHNewImagePar2::Fill(const MParContainer *par, const Stat_t w)
|
---|
117 | {
|
---|
118 | const MNewImagePar2 *h = dynamic_cast<const MNewImagePar2*>(par);
|
---|
119 | if (!h)
|
---|
120 | {
|
---|
121 | *fLog << err << "MHNewImagePar2::Fill: Pointer (!=NULL) expected." << endl;
|
---|
122 | return kERROR;
|
---|
123 | }
|
---|
124 |
|
---|
125 | const Double_t scale = fGeom->GetConvMm2Deg();
|
---|
126 |
|
---|
127 | fHistBorder1.Fill(h->GetBorderLinePixel() *scale, w);
|
---|
128 | fHistBorder2.Fill(h->GetBorderLineCenter()*scale, w);
|
---|
129 |
|
---|
130 | return kTRUE;
|
---|
131 | }
|
---|
132 |
|
---|
133 | // --------------------------------------------------------------------------
|
---|
134 | //
|
---|
135 | // Creates a new canvas and draws the two histograms into it.
|
---|
136 | // Be careful: The histograms belongs to this object and won't get deleted
|
---|
137 | // together with the canvas.
|
---|
138 | //
|
---|
139 | void MHNewImagePar2::Draw(Option_t *)
|
---|
140 | {
|
---|
141 | TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
|
---|
142 | pad->SetBorderMode(0);
|
---|
143 |
|
---|
144 | AppendPad("");
|
---|
145 |
|
---|
146 | gPad->SetBorderMode(0);
|
---|
147 | MH::DrawSame(fHistBorder1, fHistBorder2, "Border Line");
|
---|
148 | }
|
---|