Changeset 1481 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
08/05/02 14:30:21 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
28 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r1480 r1481  
    11                                                                  -*-*- END -*-*-
    22
     3 2002/08/05: Thomas Bretz
     4
     5   * mbase/MEvtLoop.[h,cc]:
     6     - added a warning in case of duplicate names in the lists
     7     - added orresponding member functions (HasDuplicateNames)
     8     - added some sanity checks, checking for an open file
     9
     10   * mbase/MFilter.[h,cc]:
     11     - added GetRule virtual member function
     12
     13   * mbase/MFilterList.[h,cc]:
     14     - added GetRule
     15     - added StreamPrimitive
     16     - added name and title to the constructor
     17     - set version number to 1
     18
     19   * mbase/MTask.h:
     20     - removed const qualifiers from fFilter (seems, that the root io
     21       doesn't like it)
     22
     23   * mdata/MDataChain.[h,cc], mdata/MDataList.[h,cc], mdata/MDataMember.[h,cc],
     24     mdata/MDataValue.[h,cc]:
     25     - set class version to 1
     26     - added default constructor if missing
     27     - added fDataMember to MDataMember (formaly fName isn't stored)
     28
     29   * mfilter/MF.[h,cc], mfilter/MFAlpha.[h,cc], mfilter/MFDataMember.[h,cc],
     30     mfilter/MFParticleId.[h,cc], mfilter/MFTriggerLvl1.[h,cc]:
     31     - added StreamPrimitive
     32     - removed const qualifiers from data members
     33     - added the "!" to the data member storing the result
     34     - added GetRule
     35
     36   * mhist/MFillH.[h,cc]:
     37     - fixed some small bugs in StreamPrimitive
     38
     39   * mhist/MH3.[h,cc]:
     40     - added the missing const-qualifier of StreamPrimitive
     41
     42
     43
    344 2002/08/06: Wolfgang Wittek
    445
    546   * mbase/MTask.cc :
    6      - redefinition of default argument in MTask:SavePrimitive removed
     47     - redefinition of default argument in MTask::SavePrimitive removed
    748
    849
  • trunk/MagicSoft/Mars/mbase/MEvtLoop.cc

    r1476 r1481  
    7070#include "MEvtLoop.h"
    7171
    72 #include <time.h>
    73 #include <fstream.h>     // ofstream, SavePrimitive
     72#include <time.h>           // time_t
     73#include <fstream.h>        // ofstream, SavePrimitive
    7474#include <iostream.h>
    7575
    76 #include <TSystem.h>
     76#include <TFile.h>          // gFile
     77#include <TSystem.h>        // gSystem
    7778#include <TStopwatch.h>
    7879#include <TGProgressBar.h>
     
    352353// to a macro. In the original root implementation it is used to write
    353354// gui elements to a macro-file.
    354 
    355355//
    356356void MEvtLoop::SavePrimitive(ofstream &out, Option_t *)
    357357{
    358     fParList->SavePrimitive(out);
     358    if (HasDuplicateNames("MEvtLoop::SavePrimitive"))
     359    {
     360        out << "   // !" << endl;
     361        out << "   // ! WARNING - Your eventloop (MParList, MTaskList, ...) contains more than" << endl;
     362        out << "   // ! one object (MParContainer, MTask, ...) with the same name. The created macro" << endl;
     363        out << "   // ! may need manual intervention before it can be used." << endl;
     364        out << "   // !" << endl;
     365        out << endl;
     366    }
     367
     368    if (fParList)
     369        fParList->SavePrimitive(out);
    359370
    360371    out << "   MEvtLoop evtloop;" << endl;
    361     out << "   evtloop.SetParList(&" << ToLower(fParList->GetName()) << ");" << endl;
     372    if (fParList)
     373        out << "   evtloop.SetParList(&" << ToLower(fParList->GetName()) << ");" << endl;
     374    else
     375        out << "   // fParList empty..." << endl;
    362376    out << "   if (!evtloop.Eventloop())" << endl;
    363377    out << "      return;" << endl;
    364378}
    365379
     380// --------------------------------------------------------------------------
     381//
     382// Get a list of all conmtainer names which are somehow part of the
     383// eventloop. Chack for duplicate members and print a warning if
     384// duplicates are found. Return kTRUE if duplicates are found, otherwise
     385// kFALSE;
     386//
     387Bool_t MEvtLoop::HasDuplicateNames(TObjArray &arr, const TString txt) const
     388{
     389    arr.Sort();
     390
     391    TIter Next(&arr);
     392    TObject *obj;
     393    TString name;
     394    Bool_t found = kFALSE;
     395    while ((obj=Next()))
     396    {
     397        if (name==obj->GetName())
     398        {
     399            if (!found)
     400            {
     401                *fLog << warn << endl;
     402                *fLog << " ! WARNING (" << txt << ")" << endl;
     403                *fLog << " ! Your eventloop (MParList, MTaskList, ...) contains more than" << endl;
     404                *fLog << " ! one object (MParContainer, MTask, ...) with the same name." << endl;
     405                *fLog << " ! Creating a macro from it using MEvtLoop::MakeMacro may create" << endl;
     406                *fLog << " ! a macro which needs manual intervention before it can be used." << endl;
     407                found = kTRUE;
     408            }
     409            *fLog << " ! Please rename: " << obj->GetName() << endl;
     410        }
     411        name = obj->GetName();
     412    }
     413
     414    return found;
     415}
     416
     417// --------------------------------------------------------------------------
     418//
     419// Get a list of all conmtainer names which are somehow part of the
     420// eventloop. Chack for duplicate members and print a warning if
     421// duplicates are found. Return kTRUE if duplicates are found, otherwise
     422// kFALSE;
     423//
     424Bool_t MEvtLoop::HasDuplicateNames(const TString txt) const
     425{
     426    if (!fParList)
     427        return kFALSE;
     428
     429    TObjArray list;
     430    list.SetOwner();
     431
     432    fParList->GetNames(list);
     433
     434    return HasDuplicateNames(list, txt);
     435}
     436
     437// --------------------------------------------------------------------------
     438//
     439// Reads a saved eventloop from a file. The default name is "Evtloop".
     440// Therefor an open file must exist (See TFile for more information)
     441//
     442//  eg:
     443//        TFile file("myfile.root", "READ");
     444//        MEvtLoop evtloop;
     445//        evtloop.Read();
     446//        evtloop.MakeMacro("mymacro");
     447//
    366448Int_t MEvtLoop::Read(const char *name)
    367449{
     450    if (!gFile)
     451    {
     452        *fLog << err << "MEvtloop::Read: No file found. Please create a TFile first." << endl;
     453        return 0;
     454    }
     455
     456    if (!gFile->IsOpen())
     457    {
     458        *fLog << err << "MEvtloop::Read: File not open. Please open the TFile first." << endl;
     459        return 0;
     460    }
     461
    368462    Int_t n = 0;
    369463    TObjArray list;
    370464
    371465    n += TObject::Read(name);
     466
     467    if (n==0)
     468    {
     469        *fLog << err << "MEvtloop::Read: No objects read." << endl;
     470        return 0;
     471    }
     472
    372473    n += list.Read((TString)name+"_names");
    373474
    374475    fParList->SetNames(list);
    375476
     477    HasDuplicateNames(list, "MEvtLoop::Read");
     478
    376479    return n;
    377480}
    378481
     482// --------------------------------------------------------------------------
     483//
     484// Writes a eventloop to a file. The default name is "Evtloop".
     485// Therefor an open file must exist (See TFile for more information)
     486//
     487//  eg:
     488//        TFile file("myfile.root", "RECREATE");
     489//        MEvtLoop evtloop;
     490//        evtloop.Write();
     491//        file.Close();
     492//
    379493Int_t MEvtLoop::Write(const char *name, Int_t option, Int_t bufsize)
    380494{
     495    if (!gFile)
     496    {
     497        *fLog << err << "MEvtloop::Write: No file found. Please create a TFile first." << endl;
     498        return 0;
     499    }
     500
     501    if (!gFile->IsOpen())
     502    {
     503        *fLog << err << "MEvtloop::Write: File not open. Please open the TFile first." << endl;
     504        return 0;
     505    }
     506
     507    if (!gFile->IsWritable())
     508    {
     509        *fLog << err << "MEvtloop::Write: File not writable." << endl;
     510        return 0;
     511    }
     512
    381513    Int_t n = 0;
    382514
     
    386518    fParList->GetNames(list);
    387519
     520    n += TObject::Write(name, option, bufsize);
     521
     522    if (n==0)
     523    {
     524        *fLog << err << "MEvtloop::Read: No objects written." << endl;
     525        return 0;
     526    }
     527
    388528    n += list.Write((TString)name+"_names", kSingleKey);
    389     n += TObject::Write(name, option, bufsize);
     529
     530    HasDuplicateNames(list, "MEvtLoop::Write");
    390531
    391532    return n;
  • trunk/MagicSoft/Mars/mbase/MEvtLoop.h

    r1474 r1481  
    2727
    2828    enum { kIsOwner = BIT(14) };
     29
     30    Bool_t HasDuplicateNames(const TString txt) const;
     31    Bool_t HasDuplicateNames(TObjArray &arr, const TString txt) const;
    2932
    3033public:
  • trunk/MagicSoft/Mars/mbase/MFilter.cc

    r1211 r1481  
    9898    return kTRUE;
    9999}
     100
     101TString MFilter::GetRule() const
     102{
     103    return "<GetRule not available for " + fName + ">";
     104}
  • trunk/MagicSoft/Mars/mbase/MFilter.h

    r1211 r1481  
    1919    virtual Bool_t PostProcess();
    2020
     21    virtual TString GetRule() const;
     22
    2123    ClassDef(MFilter, 0)                // Abstract base class for the filters
    2224};
  • trunk/MagicSoft/Mars/mbase/MFilterList.cc

    r1283 r1481  
    3131#include "MFilterList.h"
    3232
     33#include <fstream.h>
     34
    3335#include <TString.h>
    3436
     
    5355//      lor, ||  : is a logical or
    5456//
    55 MFilterList::MFilterList(const char *type)
    56 {
     57MFilterList::MFilterList(const char *type, const char *name, const char *title)
     58{
     59    fName  = name  ? name  : "MFilterList";
     60    fTitle = title ? title : "List combining filters logically.";
     61
    5762    fFilterType = kEAnd;
    5863
     
    236241void MFilterList::Print(Option_t *opt) const
    237242{
     243    *fLog << all << GetRule(opt) << flush;
     244}
     245
     246// --------------------------------------------------------------------------
     247//
     248// Implementation of SavePrimitive. Used to write the call to a constructor
     249// to a macro. In the original root implementation it is used to write
     250// gui elements to a macro-file.
     251//
     252void MFilterList::StreamPrimitive(ofstream &out) const
     253{
     254    out << "   MFilterList " << ToLower(fName) << "(\"";
     255
     256    switch (fFilterType)
     257    {
     258    case kEAnd:
     259        out << "&";
     260        break;
     261
     262    case kEOr:
     263        out  << "|";
     264        break;
     265
     266    case kEXor:
     267        out  << "^";
     268        break;
     269
     270    case kELAnd:
     271        out << "&&";
     272        break;
     273
     274    case kELOr:
     275        out << "||";
     276        break;
     277    }
     278
     279    out << fName << "\", \"" << fName << "\", \"" << fTitle << "\");" << endl << endl;
     280
     281    TIter Next(&fFilters);
     282
     283    TObject *cont = NULL;
     284    while ((cont=Next()))
     285    {
     286        cont->SavePrimitive(out, "");
     287
     288        out << "   " << ToLower(fName) << ".AddToList(&";
     289        out << ToLower(cont->GetName()) << ");" << endl << endl;
     290    }
     291}
     292
     293TString MFilterList::GetRule(Option_t *opt) const
     294{
    238295    TString str(opt);
    239296    const Bool_t verbose = str.Contains("V", TString::kIgnoreCase);
    240297
    241     //*fLog << all << "(" << GetName() << "=" << (int)fFilterType << ")";
    242 
    243     *fLog << all << "(";
     298    TString ret = "(";
    244299
    245300    TIter Next(&fFilters);
     
    251306    //
    252307    if (!filter)
    253     {
    254         *fLog << "<empty>)" << flush;
    255         return;
    256     }
    257 
    258     filter->Print();
     308        return "<empty>";
     309
     310    ret += filter->GetRule();
    259311
    260312    while ((filter=(MFilter*)Next()))
     
    263315        {
    264316        case kEAnd:
    265             *fLog << (verbose?" and ":" & ");
     317            ret += (verbose?" and ":" & ");
    266318            break;
    267319
    268320        case kEOr:
    269             *fLog << (verbose?" or ":" | ");
     321            ret += (verbose?" or ":" | ");
    270322            break;
    271323
    272324        case kEXor:
    273             *fLog << (verbose?" xor ":" ^ ");
     325            ret += (verbose?" xor ":" ^ ");
    274326            break;
    275327
    276328        case kELAnd:
    277             *fLog << (verbose?" land ":" && ");
     329            ret += (verbose?" land ":" && ");
    278330            break;
    279331
    280332        case kELOr:
    281             *fLog << (verbose?" lor ":" || ");
     333            ret += (verbose?" lor ":" || ");
    282334            break;
    283335        }
    284336
    285         filter->Print();
    286     }
    287 
    288     *fLog << ")" << flush;
    289 }
    290 
     337        ret += filter->GetRule();
     338    }
     339
     340    return ret+")";
     341}
  • trunk/MagicSoft/Mars/mbase/MFilterList.h

    r1020 r1481  
    2929    enum { kIsOwner = BIT(14) };
    3030
     31    void StreamPrimitive(ofstream &out) const;
     32
    3133public:
    32     MFilterList(const char *type="&&");
     34    MFilterList(const char *type="&&", const char *name=NULL, const char *title=NULL);
    3335    MFilterList(MFilterList &ts);
    3436    ~MFilterList()
     
    4850
    4951    void Print(Option_t *opt = "") const;
     52    TString GetRule(Option_t *opt="") const;
    5053
    51     ClassDef(MFilterList, 0)            // List to combine several filters logically
     54    ClassDef(MFilterList, 1)            // List to combine several filters logically
    5255};
    5356
  • trunk/MagicSoft/Mars/mbase/MTask.h

    r1477 r1481  
    2424    TList *fListOfBranches; //! List of Branch names for auto enabeling scheme
    2525
    26     const MFilter *fFilter; // Filter for conditional task execution
     26    MFilter *fFilter;      // Filter for conditional task execution
    2727
    2828    Bool_t fIsPreprocessed; //! Indicates the success of the PreProcessing (set by MTaskList)
     
    6868    virtual ~MTask();
    6969
    70     void SetFilter(const MFilter *filter) { fFilter=filter; }
     70    void SetFilter(MFilter *filter) { fFilter=filter; }
    7171    const MFilter *GetFilter() const      { return fFilter; }
    7272    virtual void PrintStatistics(const Int_t lvl=0) const;
  • trunk/MagicSoft/Mars/mdata/MDataChain.cc

    r1474 r1481  
    496496    switch (fOperatorType)
    497497    {
    498     case kEAbs:      str += "abs"   ; break;
    499     case kELog:      str += "log"   ; break;
    500     case kELog10:    str += "log10" ; break;
    501     case kESin:      str += "sin"   ; break;
    502     case kECos:      str += "cos"   ; break;
    503     case kETan:      str += "tan"   ; break;
    504     case kESinH:     str += "sinh"  ; break;
    505     case kECosH:     str += "cosh"  ; break;
    506     case kETanH:     str += "tanh"  ; break;
    507     case kEASin:     str += "asin"  ; break;
    508     case kEACos:     str += "acos"  ; break;
    509     case kEATan:     str += "atan"  ; break;
    510     case kESqrt:     str += "sqrt"  ; break;
    511     case kEExp:      str += "exp"   ; break;
    512     case kEPow10:    str += "pow10" ; break;
    513     case kESgn:      str += "sgn"   ; break;
    514     case kENegative: str += "-"     ; break;
    515     case kEPositive: str += "+"     ; break;
     498    case kEAbs:      str += "abs"  ; break;
     499    case kELog:      str += "log"  ; break;
     500    case kELog10:    str += "log10"; break;
     501    case kESin:      str += "sin"  ; break;
     502    case kECos:      str += "cos"  ; break;
     503    case kETan:      str += "tan"  ; break;
     504    case kESinH:     str += "sinh" ; break;
     505    case kECosH:     str += "cosh" ; break;
     506    case kETanH:     str += "tanh" ; break;
     507    case kEASin:     str += "asin" ; break;
     508    case kEACos:     str += "acos" ; break;
     509    case kEATan:     str += "atan" ; break;
     510    case kESqrt:     str += "sqrt" ; break;
     511    case kEExp:      str += "exp"  ; break;
     512    case kEPow10:    str += "pow10"; break;
     513    case kESgn:      str += "sgn"  ; break;
     514    case kENegative: str += "-"    ; break;
     515    case kEPositive: str += "+"    ; break;
    516516    case kENoop:
    517517        break;
  • trunk/MagicSoft/Mars/mdata/MDataChain.h

    r1474 r1481  
    6767    TString GetRule() const;
    6868
    69     ClassDef(MDataChain, 0) // A chain/concatenation of MData objects
     69    ClassDef(MDataChain, 1) // A chain/concatenation of MData objects
    7070};
    7171
  • trunk/MagicSoft/Mars/mdata/MDataList.cc

    r1474 r1481  
    3838// --------------------------------------------------------------------------
    3939//
     40//   Default Constructor. Not for usage!
     41//
     42MDataList::MDataList()
     43{
     44    fSign = kENone;
     45}
     46
     47// --------------------------------------------------------------------------
     48//
    4049//   Constructor.
    4150//
    42 //   Specify the boolean operation which is used to evaluate the
    43 //   result of this list. If no operation is specified "land" is
    44 //   used.
     51//   Specify the operation which is used to evaluate the
     52//   result of this list.
    4553//
    4654//   Options:
    47 //      and, &   : is a bitwise and
    48 //      or, |    : is a bitwise or
    49 //      xor, ^   : is a bitwise exclusive or
    50 //      land, && : is a logical and
    51 //      lor, ||  : is a logical or
     55//      *,  /,  -,  +
    5256//
    5357MDataList::MDataList(char type)
  • trunk/MagicSoft/Mars/mdata/MDataList.h

    r1474 r1481  
    2929
    3030public:
     31    MDataList();
    3132    MDataList(char type);
    3233    MDataList(MDataList &ts);
     
    4950    TString GetRule() const;
    5051
    51     ClassDef(MDataList, 0) // A concatenation of MData objects by one operator
     52    ClassDef(MDataList, 1) // A concatenation of MData objects by one operator
    5253};
    5354
  • trunk/MagicSoft/Mars/mdata/MDataMember.cc

    r1474 r1481  
    3636//
    3737/////////////////////////////////////////////////////////////////////////////
     38#include "MDataMember.h"
    3839
    39 #include "MDataMember.h"
     40#include <fstream.h>
    4041
    4142#include <TMethodCall.h>
     
    5960    fObject = obj;
    6061    fCall   = call;
     62
     63    fDataMember = (TString)obj->GetName() + "." + call->GetName();
    6164}
    6265
     
    7275    fObject = obj;
    7376    fCall   = obj->GetterMethod(call);
     77
     78    fDataMember = (TString)obj->GetName() + "." + call;
    7479}
    7580
     
    8287    if (!fCall)
    8388    {
    84         *fLog << err << "No TMethodCall for " << fName << " of ";
     89        *fLog << err << "No TMethodCall for " << fDataMember << " of ";
    8590        *fLog << fObject->GetName() << " available... returning 0." << endl;
    8691        return 0;
     
    100105
    101106    default:
    102         *fLog << err << "DataMember " << fName << " of ";
     107        *fLog << err << "DataMember " << fDataMember << " of ";
    103108        *fLog << fObject->GetName() << " neither int nor float... returning 0." << endl;
    104109        return 0;
     
    120125        return kTRUE;
    121126
    122     TString cname(fName);
    123     TString mname(fName);
     127    TString cname(fDataMember);
     128    TString mname(fDataMember);
    124129
    125130    const char *dot = strrchr(cname, '.');
     
    167172TString MDataMember::GetRule() const
    168173{
    169     return fName;
     174    return fDataMember;
    170175}
  • trunk/MagicSoft/Mars/mdata/MDataMember.h

    r1474 r1481  
    1515{
    1616private:
     17    TString fDataMember;
     18
    1719    MParContainer *fObject;
    1820    TMethodCall   *fCall;
    1921
    2022public:
    21     MDataMember(const char *member) : fObject(NULL), fCall(NULL)
     23    MDataMember(const char *member=NULL) : fObject(NULL), fCall(NULL)
    2224    {
    23         fName = member;
     25        fDataMember = member;
    2426    }
     27
    2528    MDataMember(MParContainer *obj, TMethodCall *call);
    2629    MDataMember(MParContainer *obj, const TString call);
     
    3538    TString GetRule() const;
    3639
    37     ClassDef(MDataMember, 0) // MData object corresponding to a single data member of a Mars container
     40    ClassDef(MDataMember, 1) // MData object corresponding to a single data member of a Mars container
    3841};
    3942
  • trunk/MagicSoft/Mars/mdata/MDataValue.h

    r1474 r1481  
    3131    TString GetRule() const;
    3232
    33     ClassDef(MDataValue, 0) // MData object corresponding to a single value
     33    ClassDef(MDataValue, 1) // MData object corresponding to a single value
    3434};
    3535
  • trunk/MagicSoft/Mars/mfilter/MF.cc

    r1283 r1481  
    7171#include "MF.h"
    7272
     73#include <ctype.h>        // isalnum, ...
    7374#include <stdlib.h>       // strtod, ...
    74 #include <ctype.h>        // isalnum, ...
     75#include <fstream.h>      // ofstream, ...
    7576
    7677#include <TMethodCall.h>
     
    368369    return fFilter->IsExpressionTrue();
    369370}
     371
     372void MF::StreamPrimitive(ofstream &out) const
     373{
     374    out << "   MF " << ToLower(fName) << "";
     375}
     376
  • trunk/MagicSoft/Mars/mfilter/MF.h

    r1283 r1481  
    2424    MFilter *ParseString(TString txt, Int_t level);
    2525
     26    void StreamPrimitive(ofstream &out) const;
     27
    2628public:
    2729    MF(const char *text, const char *name=NULL, const char *title=NULL);
  • trunk/MagicSoft/Mars/mfilter/MFAlpha.cc

    r1276 r1481  
    2828//                                                                         //
    2929/////////////////////////////////////////////////////////////////////////////
    30 
    3130#include "MFAlpha.h"
    3231
    3332#include <math.h>
     33#include <fstream.h>
     34
     35#include "MLog.h"
     36#include "MLogManip.h"
    3437
    3538#include "MParList.h"
    36 #include "MLog.h"
    37 #include "MLogManip.h"
    3839
    3940#include "MHillasSrc.h"
     
    5354// --------------------------------------------------------------------------
    5455//
    55 MFAlpha::MFAlpha(const MHillasSrc *hillas, const char type, const Float_t val,
     56MFAlpha::MFAlpha(MHillasSrc *hillas, const char type, const Float_t val,
    5657                 const char *name, const char *title) : fHillas(hillas)
    5758{
     
    111112}
    112113
     114void MFAlpha::StreamPrimitive(ofstream &out) const
     115{
     116    if (fHillas)
     117        fHillas->SavePrimitive(out);
     118
     119    out << "   MFParticleId " << ToLower(fName) << "(";
     120
     121    if (fHillas)
     122        out << "&" << ToLower(fHillas->GetName());
     123    else
     124        out << "\"" << fContName << "\"";
     125
     126    out << ", '" << (fFilterType==kELowerThan?"<":">") << "', " << fValue << ");" << endl;
     127
     128}
  • trunk/MagicSoft/Mars/mfilter/MFAlpha.h

    r1276 r1481  
    1818{
    1919private:
    20     const MHillasSrc *fHillas;
     20    MHillasSrc *fHillas;
    2121    TString fContName;
    2222
     
    2424    FilterType_t fFilterType;
    2525
    26     Bool_t  fResult;
     26    Bool_t  fResult; //!
    2727    Float_t fValue; // [deg]
    2828
     
    3030              const char *name, const char *title);
    3131
     32    void StreamPrimitive(ofstream &out) const;
     33
    3234public:
    33     MFAlpha(const char       *cname="MHillas", const char type='>', const Float_t deg=15,
     35    MFAlpha(const char *cname="MHillas", const char type='>', const Float_t deg=15,
    3436            const char *name=NULL, const char *title=NULL);
    35     MFAlpha(const MHillasSrc *hillas,          const char type='>', const Float_t deg=15,
     37    MFAlpha(MHillasSrc *hillas, const char type='>', const Float_t deg=15,
    3638            const char *name=NULL, const char *title=NULL);
    3739
     
    4042    Bool_t Process();
    4143
    42     ClassDef(MFAlpha, 0) // A Filter for cuts in fabs(alpha)
     44    ClassDef(MFAlpha, 1) // A Filter for cuts in fabs(alpha)
    4345};
    4446
  • trunk/MagicSoft/Mars/mfilter/MFDataMember.cc

    r1333 r1481  
    4242//
    4343/////////////////////////////////////////////////////////////////////////////
     44#include "MFDataMember.h"
    4445
    45 #include "MFDataMember.h"
     46#include <fstream.h>
    4647
    4748#include <TMethodCall.h>
     
    9798void MFDataMember::Print(Option_t *) const
    9899{
    99     fData.Print();
    100     *fLog << (fFilterType==kELowerThan?"<":">") << fValue << flush;
     100    *fLog << GetRule() << flush;
    101101}
     102
     103void MFDataMember::StreamPrimitive(ofstream &out) const
     104{
     105    out << "   MFDataMember " << ToLower(fName) << "(\"";
     106    out << fData.GetRule() << "\", '";
     107    out << (fFilterType==kELowerThan?"<":">");
     108    out << "', " << fValue << ");" << endl;
     109}
     110
     111TString MFDataMember::GetRule() const
     112{
     113    TString ret = fData.GetRule();
     114    ret += fFilterType==kELowerThan?"<":">";
     115    ret += fValue;
     116    return ret;
     117}
     118
  • trunk/MagicSoft/Mars/mfilter/MFDataMember.h

    r1333 r1481  
    2525    FilterType_t fFilterType;
    2626
    27     Bool_t  fResult;
     27    Bool_t  fResult;           //!
    2828    Double_t fValue;
     29
     30    void StreamPrimitive(ofstream &out) const;
    2931
    3032public:
     
    3739
    3840    void Print(Option_t *opt = "") const;
     41    TString GetRule() const;
    3942
    40     ClassDef(MFDataMember, 0) // A Filter for cuts in any data member
     43    ClassDef(MFDataMember, 1) // A Filter for cuts in any data member
    4144};
    4245
  • trunk/MagicSoft/Mars/mfilter/MFParticleId.cc

    r1337 r1481  
    2525/////////////////////////////////////////////////////////////////////////////
    2626//                                                                         //
    27 //   MFParticleId                                                         //
     27//   MFParticleId                                                          //
     28//                                                                         //
     29//  A filter to choose between different particle types, identified by     //
     30//  their monte carlo particle type. For a list of idetifiers see          //
     31//  mbase/MAGIC.h                                                          //
    2832//                                                                         //
    2933/////////////////////////////////////////////////////////////////////////////
    30 
    3134#include "MFParticleId.h"
    3235
    33 #include "MParList.h"
     36#include <fstream.h>
     37
    3438#include "MLog.h"
    3539#include "MLogManip.h"
     40
     41#include "MParList.h"
    3642
    3743#include "MMcEvt.hxx"
     
    5157// --------------------------------------------------------------------------
    5258//
    53 MFParticleId::MFParticleId(const MMcEvt *mcevt, const char type, const Int_t val,
     59MFParticleId::MFParticleId(MMcEvt *mcevt, const char type, const Int_t val,
    5460                           const char *name, const char *title) : fMcEvt(mcevt)
    5561{
     
    117123}
    118124
     125void MFParticleId::StreamPrimitive(ofstream &out) const
     126{
     127    if (fMcEvt)
     128        fMcEvt->SavePrimitive(out);
     129
     130    out << "   MFParticleId " << ToLower(fName) << "(";
     131
     132    if (fMcEvt)
     133        out << "&" << ToLower(fMcEvt->GetName());
     134    else
     135        out << "\"" << fContName << "\"";
     136
     137    out << ", '" << (fFilterType==kEEqual?"=":"!") << "', ";
     138
     139    switch (fValue)
     140    {
     141    case kGAMMA:
     142        out << "kGAMMA";
     143        break;
     144    case kPROTON:
     145        out << "kPROTON";
     146        break;
     147    case kHELIUM:
     148        out << "kHELIUM";
     149        break;
     150    case kOXYGEN:
     151        out << "kOXYGEN";
     152        break;
     153    case kIRON:
     154        out << "kIRON";
     155        break;
     156    default:
     157        out << fValue;
     158    }
     159    out << ");" << endl;
     160}
  • trunk/MagicSoft/Mars/mfilter/MFParticleId.h

    r1337 r1481  
    1818{
    1919private:
    20     const MMcEvt *fMcEvt;
     20    MMcEvt *fMcEvt;
    2121    TString fContName;
    2222
     
    2424    FilterType_t fFilterType;
    2525
    26     Bool_t fResult;
     26    Bool_t fResult;    //!
    2727    Int_t  fValue;
    2828
     
    3030              const char *name, const char *title);
    3131
     32    void StreamPrimitive(ofstream &out) const;
     33
    3234public:
    3335    MFParticleId(const char *cname="MMcEvt", const char type='=', const Int_t val=0,
    3436                 const char *name=NULL, const char *title=NULL);
    35     MFParticleId(const MMcEvt *mcevt, const char type='=', const Int_t val=0,
     37    MFParticleId(MMcEvt *mcevt, const char type='=', const Int_t val=0,
    3638                 const char *name=NULL, const char *title=NULL);
    3739
     
    4042    Bool_t Process();
    4143
    42     ClassDef(MFParticleId, 0)           // A Filter for the Level 1 Trigger
     44    ClassDef(MFParticleId, 1)           // A Filter for the Level 1 Trigger
    4345};
    4446
  • trunk/MagicSoft/Mars/mfilter/MFTriggerLvl1.cc

    r1211 r1481  
    2828//                                                                         //
    2929/////////////////////////////////////////////////////////////////////////////
    30 
    3130#include "MFTriggerLvl1.h"
    3231
    33 #include "MParList.h"
     32#include <fstream.h>
     33
    3434#include "MLog.h"
    3535#include "MLogManip.h"
     36
     37#include "MParList.h"
    3638
    3739#include "MMcTrig.hxx"
     
    5153// --------------------------------------------------------------------------
    5254//
    53 MFTriggerLvl1::MFTriggerLvl1(const MMcTrig *mctrig, const char type, const Int_t val,
     55MFTriggerLvl1::MFTriggerLvl1(MMcTrig *mctrig, const char type, const Int_t val,
    5456                             const char *name, const char *title) : fMcTrig(mctrig)
    5557{
     
    116118}
    117119
     120void MFTriggerLvl1::StreamPrimitive(ofstream &out) const
     121{
     122    if (fMcTrig)
     123        fMcTrig->SavePrimitive(out);
     124
     125    out << "   MFTriggerLvl1 " << ToLower(fName) << "(";
     126
     127    if (fMcTrig)
     128        out << "&" << ToLower(fMcTrig->GetName());
     129    else
     130        out << "\"" << fContName << "\"";
     131
     132    out << ", '" << (fFilterType==kELowerThan?"<":">") << "', " << fValue << ");" << endl;
     133
     134}
  • trunk/MagicSoft/Mars/mfilter/MFTriggerLvl1.h

    r1211 r1481  
    1818{
    1919private:
    20     const MMcTrig *fMcTrig;
     20    MMcTrig *fMcTrig;
    2121    TString fContName;
    2222
    2323    typedef enum { kELowerThan, kEGreaterThan } FilterType_t;
    24     FilterType_t fFilterType;
     24    FilterType_t fFilterType; 
    2525
    26     Bool_t fResult;
     26    Bool_t fResult;             //!
    2727    Int_t  fValue;
    2828
     
    3030              const char *name, const char *title);
    3131
     32    void StreamPrimitive(ofstream &out) const;
     33
    3234public:
    3335    MFTriggerLvl1(const char *cname="MMcTrig", const char type='>', const Int_t val=0,
    3436                  const char *name=NULL, const char *title=NULL);
    35     MFTriggerLvl1(const MMcTrig *mctrig,      const char type='>', const Int_t val=0,
     37    MFTriggerLvl1(MMcTrig *mctrig, const char type='>', const Int_t val=0,
    3638                  const char *name=NULL, const char *title=NULL);
    3739
     
    4042    Bool_t Process();
    4143
    42     ClassDef(MFTriggerLvl1, 0)          // A Filter for the Level 1 Trigger
     44    ClassDef(MFTriggerLvl1, 1) // A Filter for the Level 1 Trigger
    4345};
    4446
  • trunk/MagicSoft/Mars/mhist/MFillH.cc

    r1477 r1481  
    364364    else
    365365        out << "\"" << fHName << "\"";
    366     out << ", ";
    367366
    368367    if (fParContainer)
    369         out << "&" << ToLower(fParContainer->GetName());
     368        out << ", &" << ToLower(fParContainer->GetName());
    370369    else
    371         out << "\"" << fParContainerName << "\"";
     370        if (!fParContainerName.IsNull())
     371            out << ", \"" << fParContainerName << "\"";
    372372
    373373    out << ");" << endl;
  • trunk/MagicSoft/Mars/mhist/MH3.cc

    r1477 r1481  
    384384// gui elements to a macro-file.
    385385//
    386 void MH3::StreamPrimitive(ofstream &out)
     386void MH3::StreamPrimitive(ofstream &out) const
    387387{
    388388    TString name = ToLower(fName);
  • trunk/MagicSoft/Mars/mhist/MH3.h

    r1477 r1481  
    2424    Double_t    fScale[3];
    2525
    26     void StreamPrimitive(ofstream &out);
     26    void StreamPrimitive(ofstream &out) const;
    2727
    2828public:
Note: See TracChangeset for help on using the changeset viewer.