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

Last change on this file since 7090 was 6915, checked in by tbretz, 20 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/*
57class MParameters : public MParContainer
58{
59private:
60 TObjArray fList;
61 TObjArray fNames;
62
63public:
64 MParameters(const char *name=NULL, const char *title=NULL)
65 {
66 fName = name ? name : "MParameters";
67 fTitle = title ? title : "Additional temporary parameters";
68
69 SetReadyToSave();
70 }
71
72 MParamaterI &AddInteger(const TString name, const TString title, Int_t val=0)
73 {
74 MParameterI &p = *new MParameterI(name, title);
75 p.SetValue(val);
76
77 fList.Add(&p);
78
79 TNamed &n = *new TNamed(name, title);
80 fNames.Add(&n);
81
82 return p;
83 }
84
85 MParameterD &AddDouble(const TString name, const TString title, Double_t val=0)
86 {
87 MParameterD &p = *new MParameterD(name, title);
88 p.SetValue(val);
89
90 fList.Add(&p);
91
92 TNamed &n = *new TNamed(name, title);
93 fNames.Add(&n);
94
95 return p;
96 }
97
98 const TObjArray &GetList()
99 {
100 fList.SetNames(&fNames);
101 return fList;
102 }
103
104 MParameterD *GetParameterD(const TString &name)
105 {
106 fList.SetNames(&fNames);
107 return (MParamaterD*)fList.FindObject(name);
108 }
109
110 MParameterI *GetParameterI(const TString &name)
111 {
112 fList.SetNames(&fNames);
113 return (MParameterI*)fList.FindObject(name);
114 }
115
116 ClassDef(MParameters, 1) // List to hold generalized parameters (MParameterD/I)
117 }
118 */
119#endif
Note: See TracBrowser for help on using the repository browser.