source: trunk/Mars/mbase/MParameters.h@ 18577

Last change on this file since 18577 was 18568, checked in by tbretz, 8 years ago
Implemented function SetupFits to be able to read from a fits file.
File size: 3.0 KB
Line 
1#ifndef MARS_MParameters
2#define MARS_MParameters
3
4#ifndef MARS_MParContainer
5#include "MParContainer.h"
6#endif
7
8class MParameterD : public MParContainer
9{
10private:
11 Double_t fVal;
12
13protected:
14 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
15
16public:
17 MParameterD(const char *name=NULL, const char *title=NULL);
18
19 void SetVal(Double_t v) { fVal = v; }
20 Double_t GetVal() const { return fVal; }
21
22 void Print(Option_t *o="") const;
23 Bool_t SetupFits(fits &fin);
24
25 Double_t *GetPtr() { return &fVal; }
26
27 ClassDef(MParameterD, 1) // Container to hold a generalized parameters (double)
28};
29
30class MParameterDerr : public MParameterD
31{
32private:
33 Double_t fErr;
34
35 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
36
37public:
38 MParameterDerr(const char *name=NULL, const char *title=NULL);
39
40 void SetVal(Double_t v) { MParameterD::SetVal(v); }
41 void SetVal(Double_t v, Double_t e) { SetVal(v); fErr = e; }
42 Double_t GetErr() const { return fErr; }
43
44 void Print(Option_t *o="") const;
45 Bool_t SetupFits(fits &fin);
46
47 ClassDef(MParameterDerr, 2) // Container to hold a generalized parameters (double) and its Error
48};
49
50class MParameterI : public MParContainer
51{
52private:
53 Int_t fVal;
54
55 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
56
57public:
58 MParameterI(const char *name=NULL, const char *title=NULL);
59
60 void SetVal(Int_t v) { fVal = v; }
61 Int_t GetVal() const { return fVal; }
62
63 void Print(Option_t *o="") const;
64 Bool_t SetupFits(fits &fin);
65
66 Int_t *GetPtr() { return &fVal; }
67
68 ClassDef(MParameterI, 1) // Container to hold a generalized parameters (integer)
69};
70
71/*
72class MParameters : public MParContainer
73{
74private:
75 TObjArray fList;
76 TObjArray fNames;
77
78public:
79 MParameters(const char *name=NULL, const char *title=NULL)
80 {
81 fName = name ? name : "MParameters";
82 fTitle = title ? title : "Additional temporary parameters";
83
84 SetReadyToSave();
85 }
86
87 MParamaterI &AddInteger(const TString name, const TString title, Int_t val=0)
88 {
89 MParameterI &p = *new MParameterI(name, title);
90 p.SetValue(val);
91
92 fList.Add(&p);
93
94 TNamed &n = *new TNamed(name, title);
95 fNames.Add(&n);
96
97 return p;
98 }
99
100 MParameterD &AddDouble(const TString name, const TString title, Double_t val=0)
101 {
102 MParameterD &p = *new MParameterD(name, title);
103 p.SetValue(val);
104
105 fList.Add(&p);
106
107 TNamed &n = *new TNamed(name, title);
108 fNames.Add(&n);
109
110 return p;
111 }
112
113 const TObjArray &GetList()
114 {
115 fList.SetNames(&fNames);
116 return fList;
117 }
118
119 MParameterD *GetParameterD(const TString &name)
120 {
121 fList.SetNames(&fNames);
122 return (MParamaterD*)fList.FindObject(name);
123 }
124
125 MParameterI *GetParameterI(const TString &name)
126 {
127 fList.SetNames(&fNames);
128 return (MParameterI*)fList.FindObject(name);
129 }
130
131 ClassDef(MParameters, 1) // List to hold generalized parameters (MParameterD/I)
132 }
133 */
134#endif
Note: See TracBrowser for help on using the repository browser.