| 1 | /* ======================================================================== *\
 | 
|---|
| 2 | !
 | 
|---|
| 3 | ! *
 | 
|---|
| 4 | ! * This file is part of MARS, the MAGIC Analysis and Reconstruction
 | 
|---|
| 5 | ! * Software. It is distributed to you in the hope that it can be a useful
 | 
|---|
| 6 | ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
 | 
|---|
| 7 | ! * It is distributed WITHOUT ANY WARRANTY.
 | 
|---|
| 8 | ! *
 | 
|---|
| 9 | ! * Permission to use, copy, modify and distribute this software and its
 | 
|---|
| 10 | ! * documentation for any purpose is hereby granted without fee,
 | 
|---|
| 11 | ! * provided that the above copyright notice appear in all copies and
 | 
|---|
| 12 | ! * that both that copyright notice and this permission notice appear
 | 
|---|
| 13 | ! * in supporting documentation. It is provided "as is" without express
 | 
|---|
| 14 | ! * or implied warranty.
 | 
|---|
| 15 | ! *
 | 
|---|
| 16 | !
 | 
|---|
| 17 | !
 | 
|---|
| 18 | !   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
 | 
|---|
| 19 | !
 | 
|---|
| 20 | !   Copyright: MAGIC Software Development, 2000-2004
 | 
|---|
| 21 | !
 | 
|---|
| 22 | !
 | 
|---|
| 23 | \* ======================================================================== */
 | 
|---|
| 24 | 
 | 
|---|
| 25 | /////////////////////////////////////////////////////////////////////////////
 | 
|---|
| 26 | //
 | 
|---|
| 27 | //   MData
 | 
|---|
| 28 | //
 | 
|---|
| 29 | //   This base class defines an interface to a generalized value.
 | 
|---|
| 30 | //   This value can be a simple number, it can also be a data member
 | 
|---|
| 31 | //   of a class or some kind of concatenation of MData objects.
 | 
|---|
| 32 | //
 | 
|---|
| 33 | //   A class inheriting from MData must implement:
 | 
|---|
| 34 | //
 | 
|---|
| 35 | //    - Double_t GetValue() const
 | 
|---|
| 36 | //      which return the value corresponding to the object
 | 
|---|
| 37 | //
 | 
|---|
| 38 | //    - Bool_t IsValid() const
 | 
|---|
| 39 | //      should tell whether the object is valid (eg if the object parses
 | 
|---|
| 40 | //      a string the result might be invalid)
 | 
|---|
| 41 | //
 | 
|---|
| 42 | //    - Bool_t PreProcess(const MParList *plist)
 | 
|---|
| 43 | //      which can be used to get some necessary data (befor processing)
 | 
|---|
| 44 | //      from the parlist.
 | 
|---|
| 45 | //
 | 
|---|
| 46 | //    - TString GetRule()
 | 
|---|
| 47 | //      returns the rule as a text which would recreate the same structure
 | 
|---|
| 48 | //      when used in a MDataChain
 | 
|---|
| 49 | //
 | 
|---|
| 50 | //    - TString GetDataMember()
 | 
|---|
| 51 | //      returns the names (seperated by a comma) used by this class. This
 | 
|---|
| 52 | //      is mainly used for the AutoScheme when reading data from a file.
 | 
|---|
| 53 | //      (s.MReadTree)
 | 
|---|
| 54 | //
 | 
|---|
| 55 | //    - void SetVariables(const TArrayD &arr)
 | 
|---|
| 56 | //      is used to distribute variable numbers through lists holding
 | 
|---|
| 57 | //      MDatas to its counterpart (mainly to MDataValue)
 | 
|---|
| 58 | //
 | 
|---|
| 59 | //   The 'must' ist represented by the =0 in the class header. In the C++
 | 
|---|
| 60 | //   language this is called an abstract member function. Because the
 | 
|---|
| 61 | //   class contains abstract member function which makes it impossible
 | 
|---|
| 62 | //   to create an instance of this class one calls it also:
 | 
|---|
| 63 | //   abstract base class
 | 
|---|
| 64 | //
 | 
|---|
| 65 | /////////////////////////////////////////////////////////////////////////////
 | 
|---|
| 66 | 
 | 
|---|
| 67 | #include "MData.h"
 | 
|---|
| 68 | 
 | 
|---|
| 69 | #include <fstream>
 | 
|---|
| 70 | 
 | 
|---|
| 71 | #include "MLog.h"
 | 
|---|
| 72 | 
 | 
|---|
| 73 | ClassImp(MData);
 | 
|---|
| 74 | 
 | 
|---|
| 75 | using namespace std;
 | 
|---|
| 76 | 
 | 
|---|
| 77 | Bool_t MData::AsciiWrite(ostream &out) const
 | 
|---|
| 78 | {
 | 
|---|
| 79 |     out << GetValue() << " ";
 | 
|---|
| 80 |     return kTRUE;
 | 
|---|
| 81 | }
 | 
|---|
| 82 | 
 | 
|---|
| 83 | void MData::Print(Option_t *opt) const
 | 
|---|
| 84 | {
 | 
|---|
| 85 |     *fLog << GetRule() << flush;
 | 
|---|
| 86 | }
 | 
|---|