Ignore:
Timestamp:
05/03/06 14:13:48 (19 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mtools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mtools/MTFillMatrix.cc

    r7642 r7687  
    183183//------------------------------------------------------------------------
    184184//
     185// Function serving AddPreCuts, AddPreTasks and AddPostTasks
     186//
     187void MTFillMatrix::Add(const TList &src, const TClass *cls, TList &dest)
     188{
     189    TIter Next(&src);
     190    TObject *obj=0;
     191    while ((obj=Next()))
     192        if (obj->InheritsFrom(cls))
     193            dest.Add(obj);
     194}
     195
     196//------------------------------------------------------------------------
     197//
    185198// Add a cut which is used to fill the matrix, eg "MMcEvt.fOartId<1.5"
    186199// (The rule is applied, nit inverted: The matrix is filled with
     
    211224void MTFillMatrix::AddPreCuts(const TList &list)
    212225{
    213     TIter Next(&list);
    214     TObject *obj=0;
    215     while ((obj=Next()))
    216         if (obj->InheritsFrom(MFilter::Class()))
    217             fPreCuts.Add(obj);
     226    Add(list, MFilter::Class(), fPreCuts);
     227}
     228
     229//------------------------------------------------------------------------
     230//
     231// Add a task which is executed before the precuts. If kCanDelete is set
     232// MJOptimize takes the ownership.
     233//
     234void MTFillMatrix::AddPreTask(MTask *t)
     235{
     236    fPreTasks.Add(t);
     237}
     238
     239//------------------------------------------------------------------------
     240//
     241// Add all entries deriving from MTask from list to PreTasks.
     242// The ownership is not affected.
     243//
     244void MTFillMatrix::AddPreTasks(const TList &list)
     245{
     246    Add(list, MTask::Class(), fPreTasks);
     247}
     248
     249//------------------------------------------------------------------------
     250//
     251// Add a task which is executed after the precuts. If kCanDelete is set
     252// MJOptimize takes the ownership.
     253//
     254void MTFillMatrix::AddPostTask(MTask *t)
     255{
     256    fPostTasks.Add(t);
     257}
     258
     259//------------------------------------------------------------------------
     260//
     261// Add all entries deriving from MTask from list to PostTasks.
     262// The ownership is not affected.
     263//
     264void MTFillMatrix::AddPostTasks(const TList &list)
     265{
     266    Add(list, MTask::Class(), fPostTasks);
    218267}
    219268
     
    315364    MFillH fill1(fDestMatrix1);
    316365    MFillH fill2(fDestMatrix2);
    317     if (selector)
    318     {
    319         fill1.SetFilter(&split);
    320         fill2.SetFilter(&invsplit);
    321     }
     366    fill1.SetFilter(&split);
     367    fill2.SetFilter(&invsplit);
    322368
    323369    // entries in MTaskList
    324370    tlist.AddToList(fReader);        // Read events
     371    tlist.AddToList(fPreTasks);      // PreTasks
    325372    if (fPreCuts.GetEntries()>0)
    326373        tlist.AddToList(&cont0);     // PreCuts
     
    328375        tlist.AddToList(&cont);      // select a sample of events
    329376    tlist.AddToList(&invsplit);      // process invsplit (which implicitly processes split)
     377    tlist.AddToList(fPostTasks);     // PostTasks
    330378    if (fDestMatrix1)
    331379        tlist.AddToList(&fill1);     // fill matrix 1
  • trunk/MagicSoft/Mars/mtools/MTFillMatrix.h

    r7413 r7687  
    3131
    3232    TList     fPreCuts;
     33    TList     fPreTasks;
     34    TList     fPostTasks;
     35
     36    void Add(const TList &src, const TClass *cls, TList &dest);
    3337
    3438    Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
     
    8084    void AddPreCuts(const TList &list);
    8185
     86    void AddPreTask(MTask *t);
     87    void AddPreTasks(const TList &list);
     88
     89    void AddPostTask(MTask *t);
     90    void AddPostTasks(const TList &list);
     91
    8292    Bool_t Process(const MParList &plist=MParList());
    8393    Bool_t WriteMatrix1(const TString &fname) const { return WriteMatrix(fDestMatrix1, fname, 1); }
Note: See TracChangeset for help on using the changeset viewer.