Ignore:
Timestamp:
11/04/02 10:06:08 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mdata
Files:
11 edited

Legend:

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

    r1476 r1574  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@uni-sw.gwdg.de>
     18!   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    2020!   Copyright: MAGIC Software Development, 2000-2002
     
    4444//      from the parlist.
    4545//
     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//   The 'must' ist represented by the =0 in the class header. In the C++
     56//   language this is called an abstract member function. Because the
     57//   class contains abstract member function which makes it impossible
     58//   to create an instance of this class one calls it also:
     59//   abstract base class
     60//
    4661/////////////////////////////////////////////////////////////////////////////
    4762
  • trunk/MagicSoft/Mars/mdata/MData.h

    r1474 r1574  
    2121    virtual Bool_t   PreProcess(const MParList *plist) = 0;
    2222    virtual TString  GetRule() const = 0;
     23    virtual TString  GetDataMember() const { return ""; }
    2324
    2425    Double_t operator()() { return GetValue(); }
  • trunk/MagicSoft/Mars/mdata/MDataArray.cc

    r1499 r1574  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  08/2002 <mailto:tbretz@uni-sw.gwdg.de>
     18!   Author(s): Thomas Bretz  08/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    2020!   Copyright: MAGIC Software Development, 2000-2002
     
    2626//
    2727//   MDataArray
     28//
     29//   An Array of MData derived classes.
     30//   It can be used, eg, in MHMatrix for description of the columns.
    2831//
    2932/////////////////////////////////////////////////////////////////////////////
     
    4245static const TString gsDefTitle = "Array to store MData cntainers";
    4346
     47// --------------------------------------------------------------------------
     48//
     49// Constructor
     50//
    4451MDataArray::MDataArray(const char *name, const char *title)
    4552{
     
    4855}
    4956
     57// --------------------------------------------------------------------------
     58//
     59// Add a new data rule as a new entry (MDataChain)
     60//
    5061void MDataArray::AddEntry(const TString rule)
    5162{
     
    5566}
    5667
     68// --------------------------------------------------------------------------
     69//
     70// Add a new data as a new entry (MData). If the destructor of MDataArray
     71// should delete the object set its bit kCanDelete
     72//
     73void MDataArray::AddEntry(MData *data)
     74{
     75    fList.Add(data);
     76}
     77
     78// --------------------------------------------------------------------------
     79//
     80// Return the i-th entry
     81//
    5782MData &MDataArray::operator[](Int_t i) const
    5883{
     
    6085}
    6186
     87// --------------------------------------------------------------------------
     88//
     89// Return the data value of the i-th entry
     90//
    6291Double_t MDataArray::operator()(Int_t i)
    6392{
     
    6594}
    6695
     96// --------------------------------------------------------------------------
     97//
     98// PreProcesses all members in the list
     99//
    67100Bool_t MDataArray::PreProcess(const MParList *plist)
    68101{
     
    82115}
    83116
     117// --------------------------------------------------------------------------
     118//
     119// Print the rules for all entries of the array
     120//
    84121void MDataArray::Print(Option_t *opt) const
    85122{
     
    102139}
    103140
     141// --------------------------------------------------------------------------
     142//
     143// Implementation of SavePrimitive. Used to write the call to a constructor
     144// to a macro. In the original root implementation it is used to write
     145// gui elements to a macro-file.
     146//
    104147void MDataArray::StreamPrimitive(ofstream &out) const
    105148{
     
    119162        out << "   " << GetUniqueName() << ".AddEntry(\"" << data->GetRule() << "\");" << endl;
    120163}
     164
     165// --------------------------------------------------------------------------
     166//
     167// Return the data members existing in this array in a comma-seperated list
     168// (This is mainly used for MTask::AddToBranchList)
     169//
     170TString MDataArray::GetDataMember() const
     171{
     172    TString str;
     173
     174    TIter Next(&fList);
     175    MData *data = NULL;
     176    while ((data=(MData*)Next()))
     177    {
     178        if (data->GetDataMember().IsNull())
     179            continue;
     180
     181        str += ",";
     182        str += data->GetDataMember();
     183    }
     184    return str;
     185}
  • trunk/MagicSoft/Mars/mdata/MDataArray.h

    r1488 r1574  
    2828
    2929    void AddEntry(const TString rule);
     30    void AddEntry(MData *data);
    3031
    3132    MData &operator[](Int_t i) const;
     
    3334
    3435    Bool_t PreProcess(const MParList *plist);
     36
     37    TString GetDataMember() const;
    3538
    3639    void Print(Option_t *opt = "") const;
  • trunk/MagicSoft/Mars/mdata/MDataChain.cc

    r1524 r1574  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@uni-sw.gwdg.de>
     18!   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    2020!   Copyright: MAGIC Software Development, 2000-2002
     
    9595ClassImp(MDataChain);
    9696
     97// --------------------------------------------------------------------------
     98//
     99//  Constructor which takes a rule and a surrounding operator as argument
     100//
    97101MDataChain::MDataChain(const char *rule, OperatorType_t op)
    98102    : fOperatorType(op)
     
    104108}
    105109
     110// --------------------------------------------------------------------------
     111//
     112//  Default constructor
     113//
    106114MDataChain::MDataChain()
    107115    : fMember(NULL), fOperatorType(kENoop)
     
    109117}
    110118
     119// --------------------------------------------------------------------------
     120//
     121// Constructor taking a rule as an argument. For more details see
     122// class description
     123//
    111124MDataChain::MDataChain(const char *rule, const char *name, const char *title)
    112125    : fOperatorType(kENoop)
     
    220233}
    221234
     235// --------------------------------------------------------------------------
     236//
     237// Core of the data chain. Here the chain is constructed out of the rule.
     238//
    222239MData *MDataChain::ParseString(TString txt, Int_t level)
    223240{
     
    420437}
    421438
     439// --------------------------------------------------------------------------
     440//
     441// Returns the value described by the rule
     442//
    422443Double_t MDataChain::GetValue() const
    423444{
     
    498519        */
    499520
     521// --------------------------------------------------------------------------
     522//
     523// Builds a rule from all the chain members. This is a rule which could
     524// be used to rebuild the chain.
     525//
    500526TString MDataChain::GetRule() const
    501527{
     
    541567    return str;
    542568}
     569
     570// --------------------------------------------------------------------------
     571//
     572// Return a comma seperated list of all data members used in the chain.
     573// This is mainly used in MTask::AddToBranchList
     574//
     575TString MDataChain::GetDataMember() const
     576{
     577    return fMember->GetDataMember();
     578}
  • trunk/MagicSoft/Mars/mdata/MDataChain.h

    r1524 r1574  
    6666
    6767    TString GetRule() const;
     68    TString GetDataMember() const;
    6869
    6970    ClassDef(MDataChain, 1) // A chain/concatenation of MData objects
  • trunk/MagicSoft/Mars/mdata/MDataElement.cc

    r1524 r1574  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@uni-sw.gwdg.de>
     18!   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    2020!   Copyright: MAGIC Software Development, 2000-2002
  • trunk/MagicSoft/Mars/mdata/MDataList.cc

    r1481 r1574  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@uni-sw.gwdg.de>
     18!   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    2020!   Copyright: MAGIC Software Development, 2000-2002
     
    182182}
    183183
     184// --------------------------------------------------------------------------
     185//
     186// PreProcesses all members in the list
     187//
    184188Bool_t MDataList::PreProcess(const MParList *plist)
    185189{
     
    259263    */
    260264
     265// --------------------------------------------------------------------------
     266//
     267// Builds a rule from all the list members. This is a rule which could
     268// be used to rebuild the list using the constructor of a MDataChain
     269//
    261270TString MDataList::GetRule() const
    262271{
     
    306315    return str;
    307316}
     317
     318// --------------------------------------------------------------------------
     319//
     320// Return a comma seperated list of all data members used in the chain.
     321// This is mainly used in MTask::AddToBranchList
     322//
     323TString MDataList::GetDataMember() const
     324{
     325    TString str;
     326
     327    TIter Next(&fMembers);
     328
     329    MData *member=(MData*)Next();
     330
     331    if (!member->GetDataMember().IsNull())
     332        str += member->GetDataMember();
     333
     334    while ((member=(MData*)Next()))
     335    {
     336        if (!member->GetDataMember().IsNull())
     337        {
     338            str += ",";
     339            str += member->GetDataMember();
     340        }
     341    }
     342
     343    return str;
     344}
  • trunk/MagicSoft/Mars/mdata/MDataList.h

    r1481 r1574  
    4949//    void Print(Option_t *opt = "") const;
    5050    TString GetRule() const;
     51    TString GetDataMember() const;
    5152
    5253    ClassDef(MDataList, 1) // A concatenation of MData objects by one operator
  • trunk/MagicSoft/Mars/mdata/MDataMember.cc

    r1481 r1574  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@uni-sw.gwdg.de>
     18!   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    2020!   Copyright: MAGIC Software Development, 2000-2002
     
    170170*/
    171171
     172// --------------------------------------------------------------------------
     173//
     174// Builds a rule which cn be used in a MDataChain to describe this object
     175//
    172176TString MDataMember::GetRule() const
    173177{
    174178    return fDataMember;
    175179}
     180
     181// --------------------------------------------------------------------------
     182//
     183// Returns the data member.
     184// This is mainly used in MTask::AddToBranchList
     185//
     186TString MDataMember::GetDataMember() const
     187{
     188    return fDataMember;
     189}
  • trunk/MagicSoft/Mars/mdata/MDataMember.h

    r1481 r1574  
    3737    //void Print(Option_t *opt = "") const;
    3838    TString GetRule() const;
     39    TString GetDataMember() const;
    3940
    4041    ClassDef(MDataMember, 1) // MData object corresponding to a single data member of a Mars container
Note: See TracChangeset for help on using the changeset viewer.