| 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 | class MParameters : public MParContainer
|
|---|
| 58 | {
|
|---|
| 59 | private:
|
|---|
| 60 | TObjArray fList;
|
|---|
| 61 | TObjArray fNames;
|
|---|
| 62 |
|
|---|
| 63 | public:
|
|---|
| 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
|
|---|