Changeset 961 for trunk/MagicSoft/Mars/mbase
- Timestamp:
- 10/05/01 14:39:20 (23 years ago)
- Location:
- trunk/MagicSoft/Mars/mbase
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MClone.cc
r959 r961 25 25 ////////////////////////////////////////////////////////////////////////////// 26 26 // // 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 // -/- // 27 47 // // 28 48 ////////////////////////////////////////////////////////////////////////////// … … 52 72 // -------------------------------------------------------------------------- 53 73 // 54 // Constructor.74 // Constructor. Remembers the name to search for in the parameter list. 55 75 // 56 76 MClone::MClone(const char *par, const char *name, const char *title) … … 63 83 // -------------------------------------------------------------------------- 64 84 // 65 // Constructor.85 // Constructor. Remember the pointer of the object which has to be cloned. 66 86 // 67 87 MClone::MClone(const MParContainer *par, const char *name, const char *title) … … 74 94 // -------------------------------------------------------------------------- 75 95 // 76 // Destructor.96 // Destructor. Deletes the cloned object. 77 97 // 78 98 MClone::~MClone() … … 83 103 // -------------------------------------------------------------------------- 84 104 // 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. 90 107 // 91 108 Bool_t MClone::PreProcess(MParList *pList) 92 109 { 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; 103 128 } 104 129 130 // -------------------------------------------------------------------------- 131 // 132 // Delete the cloned object if one is existing 133 // 105 134 void MClone::Clear(Option_t *) 106 135 { 136 // 137 // Check if an object has been initialized 138 // 107 139 if (!fClone) 108 140 return; 109 141 142 // 143 // Delete it and set the pointer to NULL for the sanity check (above) 144 // 110 145 delete fClone; 111 146 fClone = NULL; … … 114 149 // -------------------------------------------------------------------------- 115 150 // 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. 117 153 // 118 154 Bool_t MClone::Process() 119 155 { 156 // 157 // Delete an existing clone 158 // 120 159 Clear(); 121 160 161 // 162 // Clone the given parameter container 163 // 122 164 fClone = fParContainer->Clone(); 123 165 -
trunk/MagicSoft/Mars/mbase/MClone.h
r959 r961 15 15 { 16 16 private: 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 19 19 20 TObject* fClone; 20 TObject* fClone; // pointer to the cloned object. deletion is handled by MClone 21 21 22 22 void Init(const char *name, const char *title); … … 34 34 void Clear(Option_t *opt=NULL); 35 35 36 ClassDef(MClone, 0) // Task to fill the Hillas parameters into histograms36 ClassDef(MClone, 0) // Task to clone (duplicate) an object in memory 37 37 }; 38 38 -
trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
r959 r961 46 46 // Afterwards the PostProcess functions are executed. // 47 47 // // 48 // // 49 // Maybe we can add a TProgressMeter sometimes later to be able to show // 50 // the progress graphically... // 51 // // 52 // // 48 53 ////////////////////////////////////////////////////////////////////////////// 49 #include "MEvtLoop.h"50 51 54 #include <iostream.h> 52 55 … … 98 101 // 99 102 // The proprocessing part of the eventloop. Be careful, this is 100 // for developers useonly!103 // for developers or use in special jobs only! 101 104 // 102 105 Bool_t MEvtLoop::PreProcess(const char *tlist) … … 144 147 // 145 148 // The processing part of the eventloop. Be careful, this is 146 // for developers useonly!149 // for developers or use in special jobs only! 147 150 // 148 151 void MEvtLoop::Process(Int_t maxcnt) const … … 200 203 // 201 204 // The postprocessing part of the eventloop. Be careful, this is 202 // for developers useonly!205 // for developers or use in special jobs only! 203 206 // 204 207 Bool_t MEvtLoop::PostProcess() const … … 218 221 Bool_t rc = PreProcess(); 219 222 223 // 224 // If all Tasks were PreProcesses successfully start Processing. 225 // 220 226 if (rc) 221 227 Process(maxcnt); 222 228 229 // 230 // Now postprocess all tasks. Only successfully preprocessed tasks are 231 // postprocessed. If the Postprocessing of one task fail return an error. 232 // 223 233 if (!PostProcess()) 224 234 return kFALSE; 225 235 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 // 226 241 return rc; 227 242 } -
trunk/MagicSoft/Mars/mbase/MFilter.cc
r858 r961 61 61 // collected in a MTaskList-object or are conected to the same // 62 62 // filter. // 63 // - If you want to use different filters for one task please look for//64 // t he MFilterList class.//63 // - If you want to use different filters (combined logically) for one // 64 // task please look for the MFilterList class. // 65 65 // - Be careful, the return value of IsExpressionTrue is NOT a real // 66 66 // boolean. You can return other values, too. // … … 71 71 72 72 ClassImp(MFilter); 73 74 // --------------------------------------------------------------------------75 //76 Bool_t MFilter::IsExpressionTrue() const77 {78 return kTRUE;79 }80 73 81 74 // -------------------------------------------------------------------------- -
trunk/MagicSoft/Mars/mbase/MFilter.h
r858 r961 1 1 #ifndef MFILTER_H 2 2 #define MFILTER_H 3 4 /////////////////////////////////////////////////////////////////////////////5 // //6 // MFilter //7 // //8 // Abstract base class for the filters //9 // //10 /////////////////////////////////////////////////////////////////////////////11 3 12 4 #ifndef MTASK_H … … 24 16 } 25 17 26 virtual Bool_t IsExpressionTrue() const ;18 virtual Bool_t IsExpressionTrue() const = 0; 27 19 28 20 virtual Bool_t PreProcess(MParList *pList); -
trunk/MagicSoft/Mars/mbase/MFilterList.h
r858 r961 44 44 void Print(Option_t *opt = ""); 45 45 46 ClassDef(MFilterList, 0) // List of several filters46 ClassDef(MFilterList, 0) // List to combine several filters logically 47 47 }; 48 48 -
trunk/MagicSoft/Mars/mbase/MTask.cc
r858 r961 43 43 // As an argument this function gets a pointer to the // 44 44 // 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. // 46 51 // // 47 // - Process(): executed for each event in the eventloop. Do i n//48 // one task after the other (as the occur in the//49 // tasklist) the action of one task. Only the tasks//50 // w ith 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. // 54 59 // // 55 60 // - PostProcess(): executed after the eventloop. Here you can close // 56 61 // output files, start display of the run parameter, // 57 // etc. // 62 // etc. PostProcess should be executed only if // 63 // PreProcess was successfull (returned kTRUE) // 58 64 // // 59 65 ///////////////////////////////////////////////////////////////////////////// … … 72 78 // the virtual implementation returns kTRUE 73 79 // 74 Bool_t MTask::PreProcess( MParList *pList)80 Bool_t MTask::PreProcess(MParList *pList) 75 81 { 76 82 return kTRUE; -
trunk/MagicSoft/Mars/mbase/MTaskList.cc
r959 r961 210 210 // -------------------------------------------------------------------------- 211 211 // 212 // do pre processing (before eventloop) of all tasks in the task-list212 // do pre processing (before eventloop) of all tasks in the task-list 213 213 // 214 214 Bool_t MTaskList::PreProcess(MParList *pList) … … 297 297 case kTRUE: 298 298 // 299 // everything was OK: go on 299 // everything was OK: go on with the next task 300 300 // 301 301 continue; … … 319 319 // -------------------------------------------------------------------------- 320 320 // 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. 322 323 // 323 324 Bool_t MTaskList::PostProcess() 324 325 { 325 326 *fLog << "Postprocessing... " << flush; 326 327 // FIXME: At the moment all tasks are post processed independ of328 // whether it was preprocessed or not.329 327 330 328 // … … 347 345 // 348 346 // loop over all tasks for postprocessing 347 // only tasks which have successfully been preprocessed are postprocessed. 349 348 // 350 349 while ( (task=(MTask*)Next()) ) … … 355 354 *fLog << task->GetName() << "... " << flush; 356 355 356 // 357 // FIXME: should we only skip this task? 358 // 357 359 if (!task->PostProcess()) 358 360 return kFALSE; -
trunk/MagicSoft/Mars/mbase/MWriteFile.h
r852 r961 22 22 virtual Bool_t PostProcess(); 23 23 24 ClassDef(MWriteFile, 0) // Class to write one container to an ascii file24 ClassDef(MWriteFile, 0) // Base class for tasks to write single containers to several output formats 25 25 }; 26 26 -
trunk/MagicSoft/Mars/mbase/MWriteRootFile.h
r852 r961 99 99 const char *tname=NULL, const char *ttitle=NULL); 100 100 101 ClassDef(MWriteRootFile, 0) // Class to write one container to a n asciifile101 ClassDef(MWriteRootFile, 0) // Class to write one container to a root file 102 102 }; 103 103
Note:
See TracChangeset
for help on using the changeset viewer.