| 1 | #ifndef MARS_MDataChain
 | 
|---|
| 2 | #define MARS_MDataChain
 | 
|---|
| 3 | 
 | 
|---|
| 4 | /////////////////////////////////////////////////////////////////////////////
 | 
|---|
| 5 | //                                                                         //
 | 
|---|
| 6 | //  MDataList                                                              //
 | 
|---|
| 7 | //                                                                         //
 | 
|---|
| 8 | //  List of several filters                                                //
 | 
|---|
| 9 | //                                                                         //
 | 
|---|
| 10 | /////////////////////////////////////////////////////////////////////////////
 | 
|---|
| 11 | 
 | 
|---|
| 12 | #ifndef MARS_MData
 | 
|---|
| 13 | #include "MData.h"
 | 
|---|
| 14 | #endif
 | 
|---|
| 15 | 
 | 
|---|
| 16 | class MDataChain : public MData
 | 
|---|
| 17 | {
 | 
|---|
| 18 | private:
 | 
|---|
| 19 |     MData *fMember; // Filter
 | 
|---|
| 20 | 
 | 
|---|
| 21 |     // PLEASE, always add new enums to the end of the enumeration,
 | 
|---|
| 22 |     // otherwise you would break loading old data chains...
 | 
|---|
| 23 |     typedef enum {
 | 
|---|
| 24 |         kENoop,
 | 
|---|
| 25 |         kELog, kELog2, kELog10,
 | 
|---|
| 26 |         kEAbs,
 | 
|---|
| 27 |         kESin, kECos, kETan, kESinH, kECosH, kETanH,
 | 
|---|
| 28 |         kEASin, kEACos, kEATan, kEASinH, kEACosH, kEATanH,
 | 
|---|
| 29 |         kESqrt, kESqr, kEPow10, kEExp,
 | 
|---|
| 30 |         kESgn,
 | 
|---|
| 31 |         kEPositive,
 | 
|---|
| 32 |         kENegative,
 | 
|---|
| 33 |         kEFloor, kECeil, kERound,
 | 
|---|
| 34 |         kERad2Deg, kEDeg2Rad, kERandom,
 | 
|---|
| 35 |         kERandomP, kERandomE, kERandomI, kERandomG, kERandomL,
 | 
|---|
| 36 |         kEIsNaN, kEFinite
 | 
|---|
| 37 |     } OperatorType_t;
 | 
|---|
| 38 | 
 | 
|---|
| 39 |     OperatorType_t fOperatorType;
 | 
|---|
| 40 | 
 | 
|---|
| 41 |     OperatorType_t ParseOperator(TString txt) const;
 | 
|---|
| 42 | 
 | 
|---|
| 43 |     Int_t IsAlNum(TString txt);
 | 
|---|
| 44 |     Int_t GetBracket(TString txt, char open, char close);
 | 
|---|
| 45 | 
 | 
|---|
| 46 |     void   SimplifyString(TString &txt) const;
 | 
|---|
| 47 |     void   AddParenthesis(TString &test, const TString op="^%*/+-") const;
 | 
|---|
| 48 |     MData *ParseString(TString txt, Int_t level=0);
 | 
|---|
| 49 |     MData *ParseDataMember(TString txt);
 | 
|---|
| 50 | 
 | 
|---|
| 51 |     MDataChain(const char *rule, OperatorType_t op);
 | 
|---|
| 52 | 
 | 
|---|
| 53 | public:
 | 
|---|
| 54 |     MDataChain(const char *rule=NULL, const char *name=NULL, const char *title=NULL);
 | 
|---|
| 55 |     ~MDataChain();
 | 
|---|
| 56 | 
 | 
|---|
| 57 |     // MData
 | 
|---|
| 58 |     Double_t GetValue() const;
 | 
|---|
| 59 | 
 | 
|---|
| 60 |     Bool_t IsValid() const { return fMember ? kTRUE : kFALSE; }
 | 
|---|
| 61 |     Bool_t PreProcess(const MParList *plist);
 | 
|---|
| 62 | 
 | 
|---|
| 63 |     TString GetRule() const;
 | 
|---|
| 64 |     TString GetDataMember() const;
 | 
|---|
| 65 |     //void    ReconstructElements() { if (fMember) fMember->ReconstructElements(); }
 | 
|---|
| 66 | 
 | 
|---|
| 67 |     // MParContainer
 | 
|---|
| 68 |     Bool_t IsReadyToSave() const;
 | 
|---|
| 69 |     void SetVariables(const TArrayD &arr);
 | 
|---|
| 70 |     Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
 | 
|---|
| 71 | 
 | 
|---|
| 72 |     ClassDef(MDataChain, 1) // A chain/concatenation of MData objects
 | 
|---|
| 73 | };
 | 
|---|
| 74 | 
 | 
|---|
| 75 | #endif
 | 
|---|