Ignore:
Timestamp:
10/05/01 14:39:20 (23 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mbase
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mbase/MClone.cc

    r959 r961  
    2525//////////////////////////////////////////////////////////////////////////////
    2626//                                                                          //
     27//  MClone                                                                  //
     28//                                                                          //
     29//  This task clones a given paramter container. You can either specify     //
     30//  the name of the container which should be cloned or a pointer to the    //
     31//  container. If you specify a name the preprocessing tries to find the    //
     32//  corresponding container in the parameter list.                          //
     33//  Cloning in this context means duplicating the object in memory. This    //
     34//  may be used if you change an object in the eventloop (eg. the image     //
     35//  cleaning is changing the image) and you want to compare both 'version'  //
     36//  of this object afterwards.                                              //
     37//  The cloned object can be accessed by using MClone::GetClone.            //
     38//  To clone the container more than once use several instances of MClone.  //
     39//  The object does only exist until a new object is cloned. It is deleted  //
     40//  in the destructor.                                                      //
     41//                                                                          //
     42//  Input Containers:                                                       //
     43//   MParContainer                                                          //
     44//                                                                          //
     45//  Output Containers:                                                      //
     46//   -/-                                                                    //
    2747//                                                                          //
    2848//////////////////////////////////////////////////////////////////////////////
     
    5272// --------------------------------------------------------------------------
    5373//
    54 // Constructor.
     74//  Constructor. Remembers the name to search for in the parameter list.
    5575//
    5676MClone::MClone(const char *par, const char *name, const char *title)
     
    6383// --------------------------------------------------------------------------
    6484//
    65 // Constructor.
     85//  Constructor. Remember the pointer of the object which has to be cloned.
    6686//
    6787MClone::MClone(const MParContainer *par, const char *name, const char *title)
     
    7494// --------------------------------------------------------------------------
    7595//
    76 // Destructor.
     96//  Destructor. Deletes the cloned object.
    7797//
    7898MClone::~MClone()
     
    83103// --------------------------------------------------------------------------
    84104//
    85 // Checks the parameter list for the existance of the parameter container. If
    86 // the name of it was given in the constructor. It checks also for the
    87 // existance of the histogram container in the parameter list if a name was
    88 // given. If it is not available it tried to create a histogram container
    89 // with the same type as the given object name.
     105//  Checks the parameter list for the existance of the parameter container. If
     106//  the name of it was given in the constructor.
    90107//
    91108Bool_t MClone::PreProcess(MParList *pList)
    92109{
    93     if (!fParContainer)
    94     {
    95         fParContainer = (MParContainer*)pList->FindObject(fParContainerName);
    96         if (!fParContainer)
    97         {
    98             *fLog << dbginf << fParContainerName << " not found... aborting." << endl;
    99             return kFALSE;
    100         }
    101     }
    102     return kTRUE;
     110    //
     111    // The pointer is already given by the user.
     112    //
     113    if (fParContainer)
     114        return kTRUE;
     115
     116    //
     117    // Try to find the parameter container with the given name in the list
     118    //
     119    fParContainer = (MParContainer*)pList->FindObject(fParContainerName);
     120    if (fParContainer)
     121        return kTRUE;
     122
     123    //
     124    // If it couldn't get found stop Eventloop
     125    //
     126    *fLog << dbginf << fParContainerName << " not found... aborting." << endl;
     127    return kFALSE;
    103128}
    104129
     130// --------------------------------------------------------------------------
     131//
     132//  Delete the cloned object if one is existing
     133//
    105134void MClone::Clear(Option_t *)
    106135{
     136    //
     137    // Check if an object has been initialized
     138    //
    107139    if (!fClone)
    108140        return;
    109141
     142    //
     143    // Delete it and set the pointer to NULL for the sanity check (above)
     144    //
    110145    delete fClone;
    111146    fClone = NULL;
     
    114149// --------------------------------------------------------------------------
    115150//
    116 // Fills the data from the parameter conatiner into the histogram container
     151//  Deletes an existing clone and clones the object (parameter container)
     152//  again.
    117153//
    118154Bool_t MClone::Process()
    119155{
     156    //
     157    // Delete an existing clone
     158    //
    120159    Clear();
    121160
     161    //
     162    // Clone the given parameter container
     163    //
    122164    fClone = fParContainer->Clone();
    123165
  • trunk/MagicSoft/Mars/mbase/MClone.h

    r959 r961  
    1515{
    1616private:
    17     const MParContainer *fParContainer;
    18     TString fParContainerName;
     17    const MParContainer *fParContainer; // pointer to container which has to be cloned
     18    TString fParContainerName;          // given name to search for in the parameterlist
    1919
    20     TObject* fClone;
     20    TObject* fClone;                    // pointer to the cloned object. deletion is handled by MClone
    2121
    2222    void Init(const char *name, const char *title);
     
    3434    void Clear(Option_t *opt=NULL);
    3535
    36     ClassDef(MClone, 0) // Task to fill the Hillas parameters into histograms
     36    ClassDef(MClone, 0) // Task to clone (duplicate) an object in memory
    3737};
    3838   
  • trunk/MagicSoft/Mars/mbase/MEvtLoop.cc

    r959 r961  
    4646// Afterwards the PostProcess functions are executed.                       //
    4747//                                                                          //
     48//                                                                          //
     49//  Maybe we can add a TProgressMeter sometimes later to be able to show    //
     50//  the progress graphically...                                             //
     51//                                                                          //
     52//                                                                          //
    4853//////////////////////////////////////////////////////////////////////////////
    49 #include "MEvtLoop.h"
    50 
    5154#include <iostream.h>
    5255
     
    98101//
    99102// The proprocessing part of the eventloop. Be careful, this is
    100 // for developers use only!
     103// for developers or use in special jobs only!
    101104//
    102105Bool_t MEvtLoop::PreProcess(const char *tlist)
     
    144147//
    145148// The processing part of the eventloop. Be careful, this is
    146 // for developers use only!
     149// for developers or use in special jobs only!
    147150//
    148151void MEvtLoop::Process(Int_t maxcnt) const
     
    200203//
    201204//  The postprocessing part of the eventloop. Be careful, this is
    202 //  for developers use only!
     205// for developers or use in special jobs only!
    203206//
    204207Bool_t MEvtLoop::PostProcess() const
     
    218221    Bool_t rc = PreProcess();
    219222
     223    //
     224    // If all Tasks were PreProcesses successfully start Processing.
     225    //
    220226    if (rc)
    221227        Process(maxcnt);
    222228
     229    //
     230    // Now postprocess all tasks. Only successfully preprocessed tasks are
     231    // postprocessed. If the Postprocessing of one task fail return an error.
     232    //
    223233    if (!PostProcess())
    224234        return kFALSE;
    225235
     236    //
     237    // If postprocessing of all preprocessed tasks was sucefully return rc.
     238    // This gives an error in case the preprocessing has failed already.
     239    // Otherwise the eventloop is considered: successfully.
     240    //
    226241    return rc;
    227242}
  • trunk/MagicSoft/Mars/mbase/MFilter.cc

    r858 r961  
    6161//      collected in a MTaskList-object or are conected to the same        //
    6262//      filter.                                                            //
    63 //    - If you want to use different filters for one task please look for  //
    64 //      the MFilterList class.                                             //
     63//    - If you want to use different filters (combined logically) for one  //
     64//      task please look for the MFilterList class.                        //
    6565//    - Be careful, the return value of IsExpressionTrue is NOT a real     //
    6666//      boolean. You can return other values, too.                         //
     
    7171
    7272ClassImp(MFilter);
    73 
    74 // --------------------------------------------------------------------------
    75 //
    76 Bool_t MFilter::IsExpressionTrue() const
    77 {
    78     return kTRUE;
    79 }
    8073
    8174// --------------------------------------------------------------------------
  • trunk/MagicSoft/Mars/mbase/MFilter.h

    r858 r961  
    11#ifndef MFILTER_H
    22#define MFILTER_H
    3 
    4 /////////////////////////////////////////////////////////////////////////////
    5 //                                                                         //
    6 // MFilter                                                                 //
    7 //                                                                         //
    8 // Abstract base class for the filters                                     //
    9 //                                                                         //
    10 /////////////////////////////////////////////////////////////////////////////
    113
    124#ifndef MTASK_H
     
    2416    }
    2517
    26     virtual Bool_t IsExpressionTrue() const;
     18    virtual Bool_t IsExpressionTrue() const = 0;
    2719
    2820    virtual Bool_t PreProcess(MParList *pList);
  • trunk/MagicSoft/Mars/mbase/MFilterList.h

    r858 r961  
    4444    void Print(Option_t *opt = "");
    4545
    46     ClassDef(MFilterList, 0)            // List of several filters
     46    ClassDef(MFilterList, 0)            // List to combine several filters logically
    4747};
    4848
  • trunk/MagicSoft/Mars/mbase/MTask.cc

    r858 r961  
    4343//                     As an argument this function gets a pointer to the  //
    4444//                     parameter list. You can stop the execution by       //
    45 //                     kFALSE instread of kTRUE.                           //
     45//                     returning kFALSE instead of kTRUE. If an error      //
     46//                     occured and you return kFALSE make sure, that       //
     47//                     any action is closed correctly and all newly        //
     48//                     created object are deleted. The PostProcess in      //
     49//                     such a case won't be executed by the Tasklist or    //
     50//                     Eventloop.                                          //
    4651//                                                                         //
    47 //   - Process():      executed for each event in the eventloop. Do in     //
    48 //                     one task after the other (as the occur in the       //
    49 //                     tasklist) the action of one task. Only the tasks    //
    50 //                     with a Stream ID which matches the actual ID of the //
    51 //                     task list are executed. A task can return kFALSE    //
    52 //                     to stop the execuition of the pending taks in a     //
    53 //                     list or kCONTINUE to skip the pending tasks.        //
     52//   - Process():      executed for each event in the eventloop. Do it     //
     53//                     one task after the other (as they occur in the      //
     54//                     tasklist). Only the tasks with a Stream ID          //
     55//                     which matches the actual ID of the tasklist        //
     56//                     are executed. A task can return kFALSE to           //
     57//                     stop the execuition of the tasklist or              //
     58//                     kCONTINUE to skip the pending tasks.                //
    5459//                                                                         //
    5560//   - PostProcess():  executed after the eventloop. Here you can close    //
    5661//                     output files, start display of the run parameter,   //
    57 //                     etc.                                                //
     62//                     etc. PostProcess should be executed only if         //
     63//                     PreProcess was successfull (returned kTRUE)         //
    5864//                                                                         //
    5965/////////////////////////////////////////////////////////////////////////////
     
    7278// the virtual implementation returns kTRUE
    7379//
    74 Bool_t MTask::PreProcess( MParList *pList )
     80Bool_t MTask::PreProcess(MParList *pList)
    7581{
    7682    return kTRUE;
  • trunk/MagicSoft/Mars/mbase/MTaskList.cc

    r959 r961  
    210210// --------------------------------------------------------------------------
    211211//
    212 // do pre processing (before eventloop) of all tasks in the task-list
     212//  do pre processing (before eventloop) of all tasks in the task-list
    213213//
    214214Bool_t MTaskList::PreProcess(MParList *pList)
     
    297297        case kTRUE:
    298298            //
    299             // everything was OK: go on
     299            // everything was OK: go on with the next task
    300300            //
    301301            continue;
     
    319319// --------------------------------------------------------------------------
    320320//
    321 // do post processing (before eventloop) of all tasks in the task-list
     321//  do post processing (before eventloop) of all tasks in the task-list
     322//  only tasks which have successfully been preprocessed are postprocessed.
    322323//
    323324Bool_t MTaskList::PostProcess()
    324325{
    325326    *fLog << "Postprocessing... " << flush;
    326 
    327     // FIXME: At the moment all tasks are post processed independ of
    328     // whether it was preprocessed or not.
    329327
    330328    //
     
    347345    //
    348346    //  loop over all tasks for postprocessing
     347    //  only tasks which have successfully been preprocessed are postprocessed.
    349348    //
    350349    while ( (task=(MTask*)Next()) )
     
    355354        *fLog << task->GetName() << "... " << flush;
    356355
     356        //
     357        // FIXME: should we only skip this task?
     358        //
    357359        if (!task->PostProcess())
    358360            return kFALSE;
  • trunk/MagicSoft/Mars/mbase/MWriteFile.h

    r852 r961  
    2222    virtual Bool_t PostProcess();
    2323
    24     ClassDef(MWriteFile, 0)     // Class to write one container to an ascii file
     24    ClassDef(MWriteFile, 0)     // Base class for tasks to write single containers to several output formats
    2525};
    2626
  • trunk/MagicSoft/Mars/mbase/MWriteRootFile.h

    r852 r961  
    9999                      const char *tname=NULL, const char *ttitle=NULL);
    100100
    101     ClassDef(MWriteRootFile, 0) // Class to write one container to an ascii file
     101    ClassDef(MWriteRootFile, 0) // Class to write one container to a root file
    102102};
    103103
Note: See TracChangeset for help on using the changeset viewer.