1 | #ifndef MARS_MParameters
|
---|
2 | #define MARS_MParameters
|
---|
3 |
|
---|
4 | #ifndef MARS_MParContainer
|
---|
5 | #include "MParContainer.h"
|
---|
6 | #endif
|
---|
7 |
|
---|
8 | class MParameterD : public MParContainer
|
---|
9 | {
|
---|
10 | private:
|
---|
11 | Double_t fVal;
|
---|
12 |
|
---|
13 | public:
|
---|
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 | Double_t *GetPtr() { return &fVal; }
|
---|
22 |
|
---|
23 | ClassDef(MParameterD, 1) // Container to hold a generalized parameters (double)
|
---|
24 | };
|
---|
25 |
|
---|
26 | class MParameterDerr : public MParameterD
|
---|
27 | {
|
---|
28 | private:
|
---|
29 | Double_t fErr;
|
---|
30 |
|
---|
31 | public:
|
---|
32 | MParameterDerr(const char *name=NULL, const char *title=NULL);
|
---|
33 |
|
---|
34 | void SetVal(Double_t v) { MParameterD::SetVal(v); }
|
---|
35 | void SetVal(Double_t v, Double_t e) { SetVal(v); fErr = e; }
|
---|
36 | Double_t GetErr() const { return fErr; }
|
---|
37 |
|
---|
38 | void Print(Option_t *o="") const;
|
---|
39 |
|
---|
40 | ClassDef(MParameterDerr, 2) // Container to hold a generalized parameters (double) and its Error
|
---|
41 | };
|
---|
42 |
|
---|
43 | class MParameterI : public MParContainer
|
---|
44 | {
|
---|
45 | private:
|
---|
46 | Int_t fVal;
|
---|
47 |
|
---|
48 | public:
|
---|
49 | MParameterI(const char *name=NULL, const char *title=NULL);
|
---|
50 |
|
---|
51 | void SetVal(Int_t v) { fVal = v; }
|
---|
52 | Int_t GetVal() const { return fVal; }
|
---|
53 |
|
---|
54 | void Print(Option_t *o="") const;
|
---|
55 |
|
---|
56 | Int_t *GetPtr() { return &fVal; }
|
---|
57 |
|
---|
58 | ClassDef(MParameterI, 1) // Container to hold a generalized parameters (integer)
|
---|
59 | };
|
---|
60 |
|
---|
61 | /*
|
---|
62 | class MParameters : public MParContainer
|
---|
63 | {
|
---|
64 | private:
|
---|
65 | TObjArray fList;
|
---|
66 | TObjArray fNames;
|
---|
67 |
|
---|
68 | public:
|
---|
69 | MParameters(const char *name=NULL, const char *title=NULL)
|
---|
70 | {
|
---|
71 | fName = name ? name : "MParameters";
|
---|
72 | fTitle = title ? title : "Additional temporary parameters";
|
---|
73 |
|
---|
74 | SetReadyToSave();
|
---|
75 | }
|
---|
76 |
|
---|
77 | MParamaterI &AddInteger(const TString name, const TString title, Int_t val=0)
|
---|
78 | {
|
---|
79 | MParameterI &p = *new MParameterI(name, title);
|
---|
80 | p.SetValue(val);
|
---|
81 |
|
---|
82 | fList.Add(&p);
|
---|
83 |
|
---|
84 | TNamed &n = *new TNamed(name, title);
|
---|
85 | fNames.Add(&n);
|
---|
86 |
|
---|
87 | return p;
|
---|
88 | }
|
---|
89 |
|
---|
90 | MParameterD &AddDouble(const TString name, const TString title, Double_t val=0)
|
---|
91 | {
|
---|
92 | MParameterD &p = *new MParameterD(name, title);
|
---|
93 | p.SetValue(val);
|
---|
94 |
|
---|
95 | fList.Add(&p);
|
---|
96 |
|
---|
97 | TNamed &n = *new TNamed(name, title);
|
---|
98 | fNames.Add(&n);
|
---|
99 |
|
---|
100 | return p;
|
---|
101 | }
|
---|
102 |
|
---|
103 | const TObjArray &GetList()
|
---|
104 | {
|
---|
105 | fList.SetNames(&fNames);
|
---|
106 | return fList;
|
---|
107 | }
|
---|
108 |
|
---|
109 | MParameterD *GetParameterD(const TString &name)
|
---|
110 | {
|
---|
111 | fList.SetNames(&fNames);
|
---|
112 | return (MParamaterD*)fList.FindObject(name);
|
---|
113 | }
|
---|
114 |
|
---|
115 | MParameterI *GetParameterI(const TString &name)
|
---|
116 | {
|
---|
117 | fList.SetNames(&fNames);
|
---|
118 | return (MParameterI*)fList.FindObject(name);
|
---|
119 | }
|
---|
120 |
|
---|
121 | ClassDef(MParameters, 1) // List to hold generalized parameters (MParameterD/I)
|
---|
122 | }
|
---|
123 | */
|
---|
124 | #endif
|
---|