| 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 | ClassDef(MParameterD, 1) // Container to hold a generalized parameters (double)
|
|---|
| 20 | };
|
|---|
| 21 |
|
|---|
| 22 | class MParameterI : public MParContainer
|
|---|
| 23 | {
|
|---|
| 24 | private:
|
|---|
| 25 | Int_t fVal;
|
|---|
| 26 |
|
|---|
| 27 | public:
|
|---|
| 28 | MParameterI(const char *name=NULL, const char *title=NULL);
|
|---|
| 29 |
|
|---|
| 30 | void SetVal(Int_t v) { fVal = v; }
|
|---|
| 31 | Int_t GetVal() const { return fVal; }
|
|---|
| 32 |
|
|---|
| 33 | ClassDef(MParameterI, 1) // Container to hold a generalized parameters (integer)
|
|---|
| 34 | };
|
|---|
| 35 | /*
|
|---|
| 36 | class MParameters : public MParContainer
|
|---|
| 37 | {
|
|---|
| 38 | private:
|
|---|
| 39 | TObjArray fList;
|
|---|
| 40 | TObjArray fNames;
|
|---|
| 41 |
|
|---|
| 42 | public:
|
|---|
| 43 | MParameters(const char *name=NULL, const char *title=NULL)
|
|---|
| 44 | {
|
|---|
| 45 | fName = name ? name : "MParameters";
|
|---|
| 46 | fTitle = title ? title : "Additional temporary parameters";
|
|---|
| 47 |
|
|---|
| 48 | SetReadyToSave();
|
|---|
| 49 | }
|
|---|
| 50 |
|
|---|
| 51 | MParamaterI &AddInteger(const TString name, const TString title, Int_t val=0)
|
|---|
| 52 | {
|
|---|
| 53 | MParameterI &p = *new MParameterI(name, title);
|
|---|
| 54 | p.SetValue(val);
|
|---|
| 55 |
|
|---|
| 56 | fList.Add(&p);
|
|---|
| 57 |
|
|---|
| 58 | TNamed &n = *new TNamed(name, title);
|
|---|
| 59 | fNames.Add(&n);
|
|---|
| 60 |
|
|---|
| 61 | return p;
|
|---|
| 62 | }
|
|---|
| 63 |
|
|---|
| 64 | MParameterD &AddDouble(const TString name, const TString title, Double_t val=0)
|
|---|
| 65 | {
|
|---|
| 66 | MParameterD &p = *new MParameterD(name, title);
|
|---|
| 67 | p.SetValue(val);
|
|---|
| 68 |
|
|---|
| 69 | fList.Add(&p);
|
|---|
| 70 |
|
|---|
| 71 | TNamed &n = *new TNamed(name, title);
|
|---|
| 72 | fNames.Add(&n);
|
|---|
| 73 |
|
|---|
| 74 | return p;
|
|---|
| 75 | }
|
|---|
| 76 |
|
|---|
| 77 | const TObjArray &GetList()
|
|---|
| 78 | {
|
|---|
| 79 | fList.SetNames(&fNames);
|
|---|
| 80 | return fList;
|
|---|
| 81 | }
|
|---|
| 82 |
|
|---|
| 83 | MParameterD *GetParameterD(const TString &name)
|
|---|
| 84 | {
|
|---|
| 85 | fList.SetNames(&fNames);
|
|---|
| 86 | return (MParamaterD*)fList.FindObject(name);
|
|---|
| 87 | }
|
|---|
| 88 |
|
|---|
| 89 | MParameterI *GetParameterI(const TString &name)
|
|---|
| 90 | {
|
|---|
| 91 | fList.SetNames(&fNames);
|
|---|
| 92 | return (MParameterI*)fList.FindObject(name);
|
|---|
| 93 | }
|
|---|
| 94 |
|
|---|
| 95 | ClassDef(MParameters, 1) // List to hold generalized parameters (MParameterD/I)
|
|---|
| 96 | }
|
|---|
| 97 | */
|
|---|
| 98 | #endif
|
|---|