Ignore:
Timestamp:
03/22/04 14:25:56 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mdata
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mdata/MData.cc

    r2173 r3572  
    1818!   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2002
     20!   Copyright: MAGIC Software Development, 2000-2004
    2121!
    2222!
     
    5353//      (s.MReadTree)
    5454//
     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//
    5559//   The 'must' ist represented by the =0 in the class header. In the C++
    5660//   language this is called an abstract member function. Because the
  • trunk/MagicSoft/Mars/mdata/MDataArray.cc

    r2206 r3572  
    1818!   Author(s): Thomas Bretz  08/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2002
     20!   Copyright: MAGIC Software Development, 2000-2004
    2121!
    2222!
     
    208208        v(ncols) = (*this)(ncols);
    209209}
     210
     211void MDataArray::SetVariables(const TArrayD &arr)
     212{
     213    fList.ForEach(MData, SetVariables)(arr);
     214}
  • trunk/MagicSoft/Mars/mdata/MDataArray.h

    r2114 r3572  
    5656    void Delete(Option_t *option="") { fList.Delete(option); }
    5757
     58    void SetVariables(const TArrayD &arr);
     59
    5860    ClassDef(MDataArray, 1) // An array of MData containers
    5961};
  • trunk/MagicSoft/Mars/mdata/MDataChain.cc

    r2928 r3572  
    1818!   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2003
     20!   Copyright: MAGIC Software Development, 2000-2004
    2121!
    2222!
     
    108108//   kRadToDeg  for   static Double_t TMath::RadToDeg();
    109109//   kDegToRad  for   static Double_t TMath::DegToRad();
     110//
    110111// Remark: In older root versions only Pi() and E() are implemented in
    111112//         TMath.
    112113//
     114// If you want to use variables, eg for fits you can use [0], [1], ...
     115// These values are initialized with 0 and set by calling
     116// SetVariables().
    113117//
    114118// REMARK:
     
    439443        case '8':
    440444        case '9':
     445        case '[':
     446        case ']':
    441447            if ((txt[0]!='-' && txt[0]!='+') || isdigit(txt[1]) || txt[1]=='.')
    442448            {
     449                if (!txt.IsNull() && txt[0]=='[')
     450                {
     451                    Int_t first = GetBracket(txt, '[', ']');
     452                    TString op  = txt(1, first-1);
     453                    txt.Remove(0, first+1);
     454
     455                    newmember = new MDataValue(0, atoi(op));
     456                    break;
     457                }
     458
    443459                char *end;
    444460                Double_t num = strtod(txt.Data(), &end);
     
    706722}
    707723
     724void MDataChain::SetVariables(const TArrayD &arr)
     725{
     726    return fMember->SetVariables(arr);
     727}
  • trunk/MagicSoft/Mars/mdata/MDataChain.h

    r2521 r3572  
    6464    TString GetDataMember() const;
    6565
     66    void SetVariables(const TArrayD &arr);
     67
    6668    ClassDef(MDataChain, 1) // A chain/concatenation of MData objects
    6769};
  • trunk/MagicSoft/Mars/mdata/MDataElement.cc

    r2173 r3572  
    1818!   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2002
     20!   Copyright: MAGIC Software Development, 2000-2004
    2121!
    2222!
  • trunk/MagicSoft/Mars/mdata/MDataElement.h

    r1524 r3572  
    3636    Double_t operator()() { return GetValue(); }
    3737
     38    void SetVariables(const TArrayD &arr) { }
     39
    3840    ClassDef(MDataElement, 1) // MData object corresponding to a element of an MHMatrix
    3941};
  • trunk/MagicSoft/Mars/mdata/MDataList.cc

    r2557 r3572  
    1818!   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2002
     20!   Copyright: MAGIC Software Development, 2000-2004
    2121!
    2222!
     
    372372    return str;
    373373}
     374
     375void MDataList::SetVariables(const TArrayD &arr)
     376{
     377    fMembers.ForEach(MData, SetVariables)(arr);
     378}
  • trunk/MagicSoft/Mars/mdata/MDataList.h

    r2557 r3572  
    5151    TString GetDataMember() const;
    5252
     53    void SetVariables(const TArrayD &arr);
     54
    5355    ClassDef(MDataList, 1) // A concatenation of MData objects by one operator
    5456};
  • trunk/MagicSoft/Mars/mdata/MDataMember.cc

    r2710 r3572  
    1818!   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2002
     20!   Copyright: MAGIC Software Development, 2000-2004
    2121!
    2222!
  • trunk/MagicSoft/Mars/mdata/MDataMember.h

    r2710 r3572  
    4343    Bool_t IsInt() const { return TestBit(kIsInt); }
    4444
     45    void SetVariables(const TArrayD &arr) { }
     46
    4547    ClassDef(MDataMember, 1) // MData object corresponding to a single data member of a Mars container
    4648};
  • trunk/MagicSoft/Mars/mdata/MDataValue.cc

    r2173 r3572  
    1818!   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2002
     20!   Copyright: MAGIC Software Development, 2000-2004
    2121!
    2222!
     
    2828//
    2929//   An MData object which corresponds to a simple value like 5.5, or 7.9
     30//   it can be set as variable object by giving it an index in the
     31//   constructor, only in this case SetVariables takes action
    3032//
    3133/////////////////////////////////////////////////////////////////////////////
     34#include "MDataValue.h"
    3235
    33 #include "MDataValue.h"
     36#include <TArrayD.h>
    3437
    3538#include "MLog.h"
     
    4649TString MDataValue::GetRule() const
    4750{
     51    if (fIndex>=0)
     52    {
     53        TString str("[");
     54        str += fIndex;
     55        str += "]";
     56        return str;
     57    }
     58
    4859    TString str;
    4960    str += fValue;
     
    5162}
    5263
     64void MDataValue::SetVariables(const TArrayD &arr)
     65{
     66    if (fIndex>=0 && fIndex<arr.GetSize())
     67        fValue = arr[fIndex];
     68}
  • trunk/MagicSoft/Mars/mdata/MDataValue.h

    r1896 r3572  
    11#ifndef MARS_MDataValue
    22#define MARS_MDataValue
    3 
    4 /////////////////////////////////////////////////////////////////////////////
    5 //                                                                         //
    6 //  MDataValue                                                             //
    7 //                                                                         //
    8 /////////////////////////////////////////////////////////////////////////////
    93
    104#ifndef MARS_MData
     
    126#endif
    137
     8class TArrayD;
     9
    1410class MDataValue : public MData
    1511{
    1612private:
    1713    Double_t fValue;
     14    Int_t    fIndex;
    1815
    1916public:
    20     MDataValue(Double_t v = 0) : fValue(v)
     17    MDataValue(Double_t v = 0, Int_t idx=-1) : fValue(v), fIndex(idx)
    2118    {
    2219    }
     
    2825    Bool_t IsReadyToSave() const { return kFALSE; }
    2926
    30     //void Print(Option_t *opt = "") const;
    3127    TString GetRule() const;
     28
     29    void SetVariables(const TArrayD &arr);
    3230
    3331    ClassDef(MDataValue, 1) // MData object corresponding to a single value
Note: See TracChangeset for help on using the changeset viewer.