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

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