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

Last change on this file since 1350 was 1350, checked in by tbretz, 22 years ago
*** empty log message ***
File size: 3.4 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-2002
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 sd = sin(hillas->GetDelta()); // [1]
72 const Double_t cd = cos(hillas->GetDelta()); // [1]
73
74
75 fHeadTail = cd*sx + sd*sy; // [mm]
76 fDist = sqrt(sx*sx + sy*sy); // [mm]
77 fAlpha = atan((cd*sy - sd*sx)/fHeadTail); // [rad]
78 fAlpha *= kRad2Deg; // [deg]
79
80 fHillas = hillas;
81
82 SetReadyToSave();
83}
84
85void MHillasSrc::Print(Option_t *) const
86{
87 *fLog << all;
88 *fLog << "Source dependant Image Parameters (" << GetName() << ")" << endl;
89 *fLog << " - Dist = " << fDist << " mm" << endl;
90 *fLog << " - Alpha = " << fAlpha << " deg" << endl;
91 *fLog << " - HeadTail = " << fHeadTail << " mm" << endl;
92}
93
94// -----------------------------------------------------------------------
95//
96// overloaded MParContainer to read MHillasSrc from an ascii file
97//
98void MHillasSrc::AsciiRead(ifstream &fin)
99{
100 fin >> fAlpha;
101 fin >> fDist;
102 fin >> fHeadTail;
103}
104
105// -----------------------------------------------------------------------
106//
107// overloaded MParContainer to write MHillasSrc to an ascii file
108/*
109void MHillasSrc::AsciiWrite(ofstream &fout) const
110{
111 fout << fAlpha << " " << fDist;
112}
113*/
Note: See TracBrowser for help on using the repository browser.