source: trunk/Mars/mmovie/MMovieData.cc@ 12670

Last change on this file since 12670 was 8397, checked in by tbretz, 18 years ago
*** empty log message ***
File size: 2.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): Thomas Bretz, 04/2007 <mailto:tbretz@astro.uni-wuerzburg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2007
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// MMovieData
28//
29/////////////////////////////////////////////////////////////////////////////
30#include "MMovieData.h"
31
32#include <TSpline.h>
33
34ClassImp(MMovieData);
35
36using namespace std;
37
38class MSpline3 : public TSpline3
39{
40public:
41 MSpline3(const char *title,
42 const TGraph *g, const char *opt=0,
43 Double_t valbeg=0, Double_t valend=0)
44 : TSpline3(title, g, opt, valbeg, valend)
45 {
46 }
47
48 Double_t GetXmin() const { return fXmin; } // Minimum value of abscissa
49 Double_t GetXmax() const { return fXmax; } // Maximum value of abscissa
50};
51
52// --------------------------------------------------------------------------
53//
54// Creates a MSignalPix object for each pixel in the event
55//
56MMovieData::MMovieData(const char *name, const char *title)
57{
58 fName = name ? name : "MMovieData";
59 fTitle = title ? title : "Storage container for movie data";
60
61 fSplines.SetOwner();
62}
63
64// --------------------------------------------------------------------------
65//
66// Reset, deletes all stored splines
67//
68void MMovieData::Reset()
69{
70 fSplines.Delete();
71}
72
73// --------------------------------------------------------------------------
74//
75// Add a new TSpline3 from a TGraph
76//
77void MMovieData::Add(const TGraph &g)
78{
79 TSpline *sp = new MSpline3(g.GetName(), &g, "b2 e2");
80 fSplines.Add(sp);
81}
82
83// --------------------------------------------------------------------------
84//
85// Check whether tm would extra- or interpolate. kTRUE means tm will
86// be interpolated.
87//
88Bool_t MMovieData::CheckRange(Int_t idx, Double_t tm) const
89{
90 const MSpline3 &sp = (*this)[idx];
91 return tm>=sp.GetXmin() && tm<=sp.GetXmax();
92}
93
94// --------------------------------------------------------------------------
95//
96// Return the value of the idx-th spline at x=tm
97//
98Double_t MMovieData::Eval(Int_t idx, Double_t tm) const
99{
100 return (*this)[idx].Eval(tm);
101}
Note: See TracBrowser for help on using the repository browser.