source: trunk/MagicSoft/Mars/manalysis/MHillasSrc.cc@ 1203

Last change on this file since 1203 was 1203, checked in by rkb, 23 years ago
*** empty log message ***
File size: 3.2 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): Thomas Bretz 12/2000 <mailto:tbretz@uni-sw.gwdg.de>
19! Author(s): Harald Kornmayer 1/2001
20! Author(s): Rudolf Bock 10/2001 <mailto:Rudolf.Bock@cern.ch>
21!
22! Copyright: MAGIC Software Development, 2000-2001
23!
24!
25\* ======================================================================== */
26
27/////////////////////////////////////////////////////////////////////////////
28//
29// MHillasSrc
30//
31// Storage Container for image parameters
32//
33// source-dependent image parameters
34// fAlpha angle between major axis and line source-to-center
35// fDist distance from source to center of ellipse
36//
37/////////////////////////////////////////////////////////////////////////////
38#include "MHillasSrc.h"
39
40#include <fstream.h>
41
42#include "MLog.h"
43#include "MLogManip.h"
44
45#include "MSrcPosCam.h"
46
47ClassImp(MHillasSrc);
48
49// --------------------------------------------------------------------------
50//
51// Default constructor.
52//
53MHillasSrc::MHillasSrc(const char *name, const char *title)
54{
55 fName = name ? name : "MHillasSrc";
56 fTitle = title ? title : "parameters depending in source position";
57}
58
59// --------------------------------------------------------------------------
60//
61// calculation of source-dependent parameters
62//
63void MHillasSrc::Calc(const MHillas *hillas)
64{
65 const Double_t mx = hillas->GetMeanX(); // [mm]
66 const Double_t my = hillas->GetMeanY(); // [mm]
67
68 const Double_t sx = mx - fSrcPos->GetX(); // [mm]
69 const Double_t sy = my - fSrcPos->GetY(); // [mm]
70
71 const Double_t tand = tan(hillas->GetDelta()); // [1]
72
73 fDist = sqrt(sx*sx + sy*sy); // [mm]
74 fAlpha = atan2(sy - tand*sx, sx + tand*sy); // [rad]
75 fAlpha *= kRad2Deg; // [deg]
76
77 fHillas = hillas;
78
79 SetReadyToSave();
80}
81
82void MHillasSrc::Print(Option_t *) const
83{
84 *fLog << all;
85 *fLog << "Source dependant Image Parameters (" << GetName() << ")" << endl;
86 *fLog << " - Dist = " << fDist << " mm" << endl;
87 *fLog << " - Alpha = " << fAlpha << " deg" << endl;
88}
89
90// -----------------------------------------------------------------------
91//
92// overloaded MParContainer to read MHillasSrc from an ascii file
93//
94void MHillasSrc::AsciiRead(ifstream &fin)
95{
96 fin >> fAlpha;
97 fin >> fDist;
98}
99
100// -----------------------------------------------------------------------
101//
102// overloaded MParContainer to write MHillasSrc to an ascii file
103//
104void MHillasSrc::AsciiWrite(ofstream &fout) const
105{
106 fout << fAlpha << " " << fDist;
107}
Note: See TracBrowser for help on using the repository browser.