source: trunk/MagicSoft/Mars/manalysis/MHillasSrcCalc.cc@ 1471

Last change on this file since 1471 was 1471, checked in by tbretz, 22 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): Rudolf Bock 10/2001 <mailto:Rudolf.Bock@cern.ch>
20!
21! Copyright: MAGIC Software Development, 2000-2002
22!
23!
24\* ======================================================================== */
25
26//////////////////////////////////////////////////////////////////////////////
27//
28// MHillasSrcCalc
29//
30// Task to calculate the source dependant part of the hillas parameters
31//
32//////////////////////////////////////////////////////////////////////////////
33#include "MHillasSrcCalc.h"
34
35#include <fstream.h>
36
37#include "MParList.h"
38
39#include "MHillasSrc.h"
40
41#include "MLog.h"
42#include "MLogManip.h"
43
44ClassImp(MHillasSrcCalc);
45
46// -------------------------------------------------------------------------
47//
48// Default constructor. The first argument is the name of a container
49// containing the source position in the camera plain (MScrPosCam).
50// The default is "MSrcPosCam". hil is the name of a container
51// of type MHillasSrc (or derived) in which the parameters are stored
52// The default is "MHillasSrc"
53//
54MHillasSrcCalc::MHillasSrcCalc(const char *src, const char *hil,
55 const char *name, const char *title)
56{
57 fName = name ? name : "MHillasSrcCalc";
58 fTitle = title ? title : "add parameters dependent on source position (MHillasSrc)";
59
60 fSrcName = src;
61 fHillasName = hil;
62}
63
64// -------------------------------------------------------------------------
65//
66Bool_t MHillasSrcCalc::PreProcess(MParList *pList)
67{
68 fHillas = (MHillas*)pList->FindObject("MHillas");
69 if (!fHillas)
70 {
71 *fLog << err << dbginf << "MHillas not found... aborting." << endl;
72 return kFALSE;
73 }
74
75 fSrcPos = (MSrcPosCam*)pList->FindObject(fSrcName, "MSrcPosCam");
76 if (!fSrcPos)
77 {
78 *fLog << err << dbginf << fSrcName << " [MSrcPosCam] not found... aborting." << endl;
79 return kFALSE;
80 }
81
82 fHillasSrc = (MHillasSrc*)pList->FindCreateObj("MHillasSrc", fHillasName);
83 if (!fHillasSrc)
84 return kFALSE;
85
86 fHillasSrc->SetSrcPos(fSrcPos);
87
88 return kTRUE;
89}
90
91// -------------------------------------------------------------------------
92//
93Bool_t MHillasSrcCalc::Process()
94{
95 return fHillasSrc->Calc(fHillas) ? kTRUE : kCONTINUE;
96}
97
98
99void MHillasSrcCalc::SavePrimitive(ofstream &out, Option_t *o="")
100{
101 out << " MHillasSrcCalc " << ToLower(fName) << "(\"";
102 out << fSrcName << "\", \"" << fHillasName << "\", \"";
103 out << fName << "\", \"" << fTitle << "\");" << endl;
104}
Note: See TracBrowser for help on using the repository browser.