source: trunk/MagicSoft/Mars/mtemp/MStarLocalPos.cc@ 4544

Last change on this file since 4544 was 4433, checked in by rwagner, 20 years ago
*** empty log message ***
File size: 5.8 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 expressed
14! * or implied warranty.
15! *
16!
17!
18! Author(s): Javier López , 4/2004 <mailto:jlopez@ifae.es>
19! Author(s): Robert Wagner, 7/2004 <mailto:rwagner@mppmu.mpg.de>
20!
21! Copyright: MAGIC Software Development, 2000-2004
22!
23!
24\* ======================================================================== */
25#include "MStarLocalPos.h"
26
27#include <TEllipse.h>
28#include <TMarker.h>
29
30#include "MLog.h"
31#include "MLogManip.h"
32
33ClassImp(MStarLocalPos);
34
35using namespace std;
36
37MStarLocalPos::MStarLocalPos(const char *name, const char *title)
38{
39
40 fName = name ? name : "MStarLocalPos";
41 fTitle = title ? title : "";
42
43 Reset();
44}
45
46void MStarLocalPos::Reset()
47{
48
49 //Expected position on camera
50 fMagExp = 0.;
51 fXExp = 0.;
52 fYExp = 0.;
53
54 //Info from calculation
55
56 fMagCalc = 0.;
57 fMaxCalc = 0.;
58 fMeanXCalc = 0.;
59 fMeanYCalc = 0.;
60 fSigmaMinorAxisCalc = 0.;
61 fSigmaMajorAxisCalc = 0.;
62
63 //Info from fit
64
65 fMagFit = 0.;
66 fMaxFit = 0.;
67 fMeanXFit = 0.;
68 fMeanYFit = 0.;
69 fSigmaMinorAxisFit = 0.;
70 fSigmaMajorAxisFit = 0.;
71 fChiSquare = 0.;
72 fNdof = 1;
73
74}
75
76void MStarLocalPos::SetExpValues(Float_t mag, Float_t x, Float_t y)
77{
78 fMagExp = mag;
79 fXExp = x;
80 fYExp = y;
81}
82
83void MStarLocalPos::SetCalcValues(Float_t mag, Float_t max, Float_t x, Float_t y, Float_t sigmaMinorAxis, Float_t sigmaMajorAxis)
84{
85 fMagCalc = mag;
86 fMaxCalc = max;
87 fMeanXCalc = x;
88 fMeanYCalc = y;
89 fSigmaMinorAxisCalc = sigmaMinorAxis;
90 fSigmaMajorAxisCalc = sigmaMajorAxis;
91}
92
93void MStarLocalPos::SetFitValues(Float_t mag, Float_t max, Float_t x, Float_t y, Float_t sigmaMinorAxis, Float_t sigmaMajorAxis, Float_t chiSquare, Int_t ndof)
94{
95 fMagFit = mag;
96 fMaxFit = max;
97 fMeanXFit = x;
98 fMeanYFit = y;
99 fSigmaMinorAxisFit = sigmaMinorAxis;
100 fSigmaMajorAxisFit = sigmaMajorAxis;
101 fChiSquare = chiSquare;
102 fNdof = ndof;
103}
104
105void MStarLocalPos::SetFitValues(Float_t mag, Float_t max, Float_t x, Float_t y, Float_t sigmaMinorAxis, Float_t sigmaMajorAxis, Float_t chiSquare, Int_t ndof, Float_t xx, Float_t xy, Float_t yy)
106{
107 SetFitValues(mag, max, x, y, sigmaMinorAxis, sigmaMajorAxis, chiSquare, ndof);
108 fXXErr = xx;
109 fYYErr = yy;
110 fXYErr = xy;
111}
112
113
114// --------------------------------------------------------------------------
115//
116// Paint the ellipse corresponding to the parameters
117//
118void MStarLocalPos::Paint(Option_t *opt)
119{
120 //Print a cross in the expected position
121
122 TMarker mexp(fXExp, fYExp, 29);
123 mexp.SetMarkerSize(3);
124 mexp.SetMarkerColor(94);
125 mexp.Paint();
126
127 if (fSigmaMinorAxisCalc>0. && fSigmaMajorAxisCalc>0.)
128 {
129 TEllipse ecalc(fMeanXCalc, fMeanYCalc, fSigmaMinorAxisCalc, fSigmaMajorAxisCalc, 0, 360, 0);
130 ecalc.SetLineWidth(3);
131 ecalc.SetLineColor(kRed);
132 ecalc.Paint();
133 }
134
135 if (fSigmaMinorAxisFit>0. || fSigmaMajorAxisFit>0.)
136 {
137 TEllipse efit(fMeanXFit, fMeanYFit, fSigmaMinorAxisFit, fSigmaMajorAxisFit, 0, 360, 0);
138 efit.SetLineWidth(3);
139 efit.SetLineColor(kBlack);
140 efit.Paint();
141 }
142}
143
144void MStarLocalPos::Print(Option_t *opt) const
145{
146 TString o = opt;
147
148 if (o.Contains("name", TString::kIgnoreCase) || opt == NULL)
149 {
150 *fLog << inf << "Star Name: \"" << this->GetName() << "\"" << endl;
151 }
152
153
154 if (o.Contains("mag", TString::kIgnoreCase) || opt == NULL)
155 {
156
157 *fLog << inf << "Star maginitude:" << endl;
158 *fLog << inf << " Expected \t" << setw(4) << fMagExp << endl;
159 *fLog << inf << " Calcultated \t " << setw(4) << fMagCalc << endl;
160 *fLog << inf << " Fitted \t " << setw(4) << fMagFit << endl;
161 }
162
163 if (o.Contains("max", TString::kIgnoreCase) || opt == NULL)
164 {
165 *fLog << inf << "Star Maximum:" << endl;
166 *fLog << inf << " Calcultated \t " << setw(4) << fMaxCalc << " uA" << endl;
167 *fLog << inf << " Fitted \t " << setw(4) << fMaxFit << " uA" << endl;
168 }
169
170 if (o.Contains("pos", TString::kIgnoreCase) || opt == NULL)
171 {
172 *fLog << inf << "Star position:" << endl;
173 *fLog << inf << " Expected \t X " << setw(4) << fXExp << " mm \tY " << setw(4) << fYExp << " mm" << endl;
174 *fLog << inf << " Calcultated \t X " << setw(4) << fMeanXCalc << " mm \tY " << setw(4) << fMeanYCalc << " mm" << endl;
175 *fLog << inf << " Fitted \t X " << setw(4) << fMeanXFit << " mm \tY " << setw(4) << fMeanYFit << " mm" << endl;
176 }
177
178 if (o.Contains("siz", TString::kIgnoreCase) || opt == NULL)
179 {
180 *fLog << inf << "Star size:" << endl;
181 *fLog << inf << " Calcultated \t X " << setw(4) << fSigmaMinorAxisCalc << " mm \tY " << setw(4) << fSigmaMajorAxisCalc << " mm" << endl;
182 *fLog << inf << " Fitted \t X " << setw(4) << fSigmaMinorAxisFit << " mm \tY " << setw(4) << fSigmaMajorAxisFit << " mm" << endl;
183 }
184
185 if (o.Contains("chi", TString::kIgnoreCase) || opt == NULL)
186 {
187 *fLog << inf << "Star Fit Quality:" << endl;
188 *fLog << inf << " ChiSquare/Ndof \t " << setw(3) << fChiSquare << "/" << fNdof << endl;
189 }
190
191 if (o.Contains("err", TString::kIgnoreCase) || opt == NULL)
192 {
193 *fLog << inf << "Minuit Error Matrix:" << endl;
194 *fLog << inf << " xx,xy,yy \t " << setw(3) << fXXErr << ", " << fXYErr << ", " << fYYErr << endl;
195 }
196
197
198}
Note: See TracBrowser for help on using the repository browser.