source: trunk/MagicSoft/Mars/mbase/MParameters.h@ 7981

Last change on this file since 7981 was 7188, checked in by tbretz, 19 years ago
*** empty log message ***
File size: 2.6 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
13public:
14 MParameterD(const char *name=NULL, const char *title=NULL);
15
16 void SetVal(Double_t v) { fVal = v; }
17 Double_t GetVal() const { return fVal; }
18
19 void Print(Option_t *o="") const;
20
21 ClassDef(MParameterD, 1) // Container to hold a generalized parameters (double)
22};
23
24class MParameterDerr : public MParameterD
25{
26private:
27 Double_t fErr;
28
29public:
30 MParameterDerr(const char *name=NULL, const char *title=NULL);
31
32 void SetVal(Double_t v) { MParameterD::SetVal(v); }
33 void SetVal(Double_t v, Double_t e) { SetVal(v); fErr = e; }
34 Double_t GetErr() const { return fErr; }
35
36 void Print(Option_t *o="") const;
37
38 ClassDef(MParameterDerr, 2) // Container to hold a generalized parameters (double) and its Error
39};
40
41class MParameterI : public MParContainer
42{
43private:
44 Int_t fVal;
45
46public:
47 MParameterI(const char *name=NULL, const char *title=NULL);
48
49 void SetVal(Int_t v) { fVal = v; }
50 Int_t GetVal() const { return fVal; }
51
52 void Print(Option_t *o="") const;
53
54 ClassDef(MParameterI, 1) // Container to hold a generalized parameters (integer)
55};
56
57/*
58class MParameters : public MParContainer
59{
60private:
61 TObjArray fList;
62 TObjArray fNames;
63
64public:
65 MParameters(const char *name=NULL, const char *title=NULL)
66 {
67 fName = name ? name : "MParameters";
68 fTitle = title ? title : "Additional temporary parameters";
69
70 SetReadyToSave();
71 }
72
73 MParamaterI &AddInteger(const TString name, const TString title, Int_t val=0)
74 {
75 MParameterI &p = *new MParameterI(name, title);
76 p.SetValue(val);
77
78 fList.Add(&p);
79
80 TNamed &n = *new TNamed(name, title);
81 fNames.Add(&n);
82
83 return p;
84 }
85
86 MParameterD &AddDouble(const TString name, const TString title, Double_t val=0)
87 {
88 MParameterD &p = *new MParameterD(name, title);
89 p.SetValue(val);
90
91 fList.Add(&p);
92
93 TNamed &n = *new TNamed(name, title);
94 fNames.Add(&n);
95
96 return p;
97 }
98
99 const TObjArray &GetList()
100 {
101 fList.SetNames(&fNames);
102 return fList;
103 }
104
105 MParameterD *GetParameterD(const TString &name)
106 {
107 fList.SetNames(&fNames);
108 return (MParamaterD*)fList.FindObject(name);
109 }
110
111 MParameterI *GetParameterI(const TString &name)
112 {
113 fList.SetNames(&fNames);
114 return (MParameterI*)fList.FindObject(name);
115 }
116
117 ClassDef(MParameters, 1) // List to hold generalized parameters (MParameterD/I)
118 }
119 */
120#endif
Note: See TracBrowser for help on using the repository browser.