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 | ClassDef(MParameterD, 1) // Container to hold a generalized parameters (double)
|
---|
22 | };
|
---|
23 |
|
---|
24 | class MParameterDerr : public MParameterD
|
---|
25 | {
|
---|
26 | private:
|
---|
27 | Double_t fErr;
|
---|
28 |
|
---|
29 | public:
|
---|
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 |
|
---|
41 | class MParameterI : public MParContainer
|
---|
42 | {
|
---|
43 | private:
|
---|
44 | Int_t fVal;
|
---|
45 |
|
---|
46 | public:
|
---|
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 | /*
|
---|
58 | class MParameters : public MParContainer
|
---|
59 | {
|
---|
60 | private:
|
---|
61 | TObjArray fList;
|
---|
62 | TObjArray fNames;
|
---|
63 |
|
---|
64 | public:
|
---|
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
|
---|