source: tags/Mars-V2.1.1/mbase/MParameters.h

Last change on this file was 9035, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 2.7 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 Double_t *GetPtr() { return &fVal; }
22
23 ClassDef(MParameterD, 1) // Container to hold a generalized parameters (double)
24};
25
26class MParameterDerr : public MParameterD
27{
28private:
29 Double_t fErr;
30
31public:
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
43class MParameterI : public MParContainer
44{
45private:
46 Int_t fVal;
47
48public:
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/*
62class MParameters : public MParContainer
63{
64private:
65 TObjArray fList;
66 TObjArray fNames;
67
68public:
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
Note: See TracBrowser for help on using the repository browser.