Changeset 860 for trunk/MagicSoft/Mars
- Timestamp:
- 07/09/01 16:13:19 (23 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r859 r860 1 1 -*-*- END -*-*- 2 3 2001/07/09: Thomas Bretz 4 5 * mbase/MParList.cc: 6 - made handling of already existing containers in AddToList a bit 7 more convinient 8 9 * mbase/MTaskList.[h,cc]: 10 - added come comments 11 - made handling of already existing tasks in AddToList a bit 12 more convinient 13 - Added name-argument to constructor 14 15 * mraw/MRawFileRead.[cc, h]: 16 - move file-open check from constructor to PreProcess 17 - added variable for filename 18 19 * mraw/MRawFileWrite.[cc,h]: 20 - moved fOut->Write from PostProcess to destructor 21 - removed PostProcess 22 23 24 2 25 2001/07/06: Thomas Bretz 3 26 -
trunk/MagicSoft/Mars/NEWS
r847 r860 4 4 5 5 - Added a task to write a container to an Ascii file (MWriteAsciiFile) 6 7 - Added a task to write several container to a root file (MWriteRootFile) 6 8 7 - Added calculation of the Enegry Threshold 9 - Added calculation of the Enegry Threshold (MMcThresholdCalc) 8 10 9 - Added calculation of the collection area 11 - Added calculation of the collection area (MMcCollectionAreaCalc) 10 12 11 13 - removed some bugs in the Hillas calculation 14 15 - added filters to be able to control the task execution dependent on 16 a parameter (for example: the number of level 1 triggers in a MC-file) 12 17 13 18 -
trunk/MagicSoft/Mars/mbase/MParList.cc
r858 r860 57 57 { 58 58 *fName = name ? name : "MParList"; 59 *fTitle = title ? title : " List of Parameter Containers";59 *fTitle = title ? title : "A list of Parameter Containers"; 60 60 61 61 // … … 100 100 // If 'where' is given, the object will be added after this. 101 101 // 102 Bool_t MParList::AddToList(MParContainer * obj, MParContainer *where)102 Bool_t MParList::AddToList(MParContainer *cont, MParContainer *where) 103 103 { 104 104 // … … 106 106 // 107 107 108 if (!obj) return kTRUE; 109 110 *fLog << "Adding " << obj->GetName() << " to " << GetName() << "... " << flush; 111 // 112 // check if it is in the list yet 113 // 114 if (fContainer.FindObject(obj)) 108 if (!cont) 109 return kFALSE; 110 111 // 112 // Get Name of new container 113 // 114 const char *name = cont->GetName(); 115 116 // 117 // Check if the new container is already existing in the list 118 // 119 const TObject *objn = fContainer.FindObject(name); 120 const TObject *objt = fContainer.FindObject(cont); 121 122 if (objn || objt) 115 123 { 116 *fLog << dbginf << "Container already added" << endl; 117 return kTRUE; 124 // 125 // If the container is already in the list ignore it. 126 // 127 if (objt || objn==cont) 128 { 129 *fLog << dbginf << "Warning: Container '" << cont->GetName() << ", 0x" << (void*)cont; 130 *fLog << "' already existing in '" << GetName() << "'... ignoring." << endl; 131 return kTRUE; 132 } 133 134 // 135 // Otherwise add it to the list, but print a warning message 136 // 137 *fLog << dbginf << "Warning: Container with the same name '" << cont->GetName(); 138 *fLog << "' already existing in '" << GetName() << "'." << endl; 139 *fLog << "You may not be able to get a pointer to container task by name." << endl; 118 140 } 119 141 120 142 // 121 143 // check if you want to add the new parameter container somewhere 122 // special (in that case you specify "where")144 // special (in that case you specify "where") 123 145 // 124 146 if (where) … … 126 148 if (!fContainer.FindObject(where)) 127 149 { 128 *fLog << dbginf << " Cannot find parameter container after which the new one should be added!" << endl;150 *fLog << dbginf << "Error: Cannot find parameter container after which the new one should be added!" << endl; 129 151 return kFALSE; 130 152 } 131 153 } 132 154 133 fContainer.Add(obj); 155 *fLog << "Adding " << name << " to " << GetName() << "... " << flush; 156 157 fContainer.Add(cont); 134 158 *fLog << "Done." << endl; 135 159 -
trunk/MagicSoft/Mars/mbase/MTaskList.cc
r858 r860 27 27 // MTaskList // 28 28 // // 29 // Collection of tasks to be processed in the eventloop // 29 // Collection of tasks. // 30 // // 31 // A tasklist is necessary to run the eventloop. It contains the scheduled // 32 // tasks, which should be executed in your program. // 33 // // 34 // To add a task use AddToList. // 35 // // 36 // The tasklist itself is a task, too. You can add a tasklist to another // 37 // tasklist. This makes sense, if you want to filter the execution of // 38 // more than one task of your tasklist using the same filter. // 39 // // 40 // The tasks in the list are idetified by their names. If more than one // 41 // task has the same name, the tasklist will still work correctly, but // 42 // you might run into trouble trying to get a pointer to a task by name // 43 // from the list. // 30 44 // // 31 45 ///////////////////////////////////////////////////////////////////////////// … … 47 61 // this name in the parameter list (by MEvtLoop::SetParList) 48 62 // 49 MTaskList::MTaskList(const char * title)50 { 51 *fName = "MTaskList";52 *fTitle = title ? title : " List for Tasks";63 MTaskList::MTaskList(const char *name, const char *title) 64 { 65 *fName = name ? name : "MTaskList"; 66 *fTitle = title ? title : "A list for tasks to be executed"; 53 67 } 54 68 … … 95 109 Bool_t MTaskList::AddToList(MTask *task, const char *type, MTask *where) 96 110 { 111 // FIXME: We agreed to put the task into list in an ordered way. 112 113 // 114 // Sanity check 115 // 97 116 if (!task) 98 return kTRUE; 99 117 return kFALSE; 118 119 // 120 // Get Name of new task 121 // 100 122 const char *name = task->GetName(); 101 123 102 // FIXME: We agreed to put the task into list in an ordered way. 103 104 if (fTasks.FindObject(task)) 105 { 106 *fLog << dbginf << "Task already existing." << endl; 107 return kTRUE; 108 } 109 110 if (fTasks.FindObject(name)) 111 { 112 *fLog << dbginf << "'" << name << "' exists in List already." << endl; 113 return kTRUE; 124 // 125 // Check if the new task is already existing in the list 126 // 127 const TObject *objn = fTasks.FindObject(name); 128 const TObject *objt = fTasks.FindObject(task); 129 130 if (objn || objt) 131 { 132 // 133 // If the task is already in the list ignore it. 134 // 135 if (objt || objn==task) 136 { 137 *fLog << dbginf << "Warning: Task '" << task->GetName() << ", 0x" << (void*)task; 138 *fLog << "' already existing in '" << GetName() << "'... ignoring." << endl; 139 return kTRUE; 140 } 141 142 // 143 // Otherwise add it to the list, but print a warning message 144 // 145 *fLog << dbginf << "Warning: Task with the same name '" << task->GetName(); 146 *fLog << "' already existing in '" << GetName() << "'." << endl; 147 *fLog << "You may not be able to get a pointer to this task by name." << endl; 114 148 } 115 149 … … 118 152 if (!fTasks.FindObject(where)) 119 153 { 120 *fLog << dbginf << " Cannot find task after which the new task should be scheduled!" << endl;154 *fLog << dbginf << "Error: Cannot find task after which the new task should be scheduled!" << endl; 121 155 return kFALSE; 122 156 } -
trunk/MagicSoft/Mars/mbase/MTaskList.h
r858 r860 28 28 29 29 public: 30 MTaskList(const char * title=NULL);30 MTaskList(const char *name=NULL, const char *title=NULL); 31 31 32 32 MTaskList(MTaskList &ts); -
trunk/MagicSoft/Mars/mmain/MEvtDisp.cc
r749 r860 33 33 34 34 enum { 35 M_BUT_DISP1_EVT, 36 M_BUT_DISP1_PED, 37 M_BUT_DISP1_CAL ,35 M_BUT_DISP1_EVT, 36 M_BUT_DISP1_PED, 37 M_BUT_DISP1_CAL 38 38 }; 39 39 -
trunk/MagicSoft/Mars/mmontecarlo/MMcCollectionAreaCalc.h
r853 r860 14 14 { 15 15 private: 16 MMcEvt *fMcEvt;17 MMcTrig *fMcTrig;16 const MMcEvt *fMcEvt; 17 const MMcTrig *fMcTrig; 18 18 19 19 MHMcCollectionArea *fCollArea; -
trunk/MagicSoft/Mars/mraw/MRawFileRead.cc
r859 r860 97 97 // open the input stream 98 98 // 99 fFileName = fname; 99 100 fIn = new ifstream(fname); 100 101 if (!(*fIn))102 *fLog << "Error: Trying to open file '" << fname << "'" << endl;103 101 } 104 102 … … 131 129 { 132 130 // 133 // remember the pointer to the parameter list fur further usage 134 // 131 // first of all check if opening the file in the constructor was 132 // successfull 133 // 134 if (!(*fIn)) 135 { 136 *fLog << "Error: Cannot open file '" << fFileName << "'" << endl; 137 return kFALSE; 138 } 135 139 136 140 // -
trunk/MagicSoft/Mars/mraw/MRawFileRead.h
r698 r860 24 24 MTime *fRawEvtTime; // raw evt time information container to fill from file 25 25 26 TString fFileName; 26 27 ifstream *fIn; //! buffered input stream (file to read from) 27 28 -
trunk/MagicSoft/Mars/mraw/MRawFileWrite.cc
r859 r860 77 77 { 78 78 // 79 // delete instance, this laso does a fOut->Close() 80 // 79 // delete instance, this also does a fOut->Close() 80 // 81 if (fOut->IsOpen()) 82 fOut->Write(); 83 81 84 delete fOut; 82 85 } … … 104 107 if (!fOut->IsOpen()) 105 108 { 106 *fLog << dbginf << " Cannot open file '" << fOut->GetName() << "'" << endl;109 *fLog << dbginf << "Error: Cannot open file '" << fOut->GetName() << "'" << endl; 107 110 return kFALSE; 108 111 } … … 200 203 // 201 204 const UShort_t type = fRawEvtHeader->GetTrigType(); 202 205 cout << "W" << flush; 203 206 // 204 207 // writa data to the tree. the tree is choosen by the type of the event … … 225 228 } 226 229 227 228 // --------------------------------------------------------------------------229 //230 // Close the TFile object and delete it.231 //232 Bool_t MRawFileWrite::PostProcess()233 {234 //235 // empty data stream236 //237 fOut->Write();238 239 return kTRUE;240 }241 -
trunk/MagicSoft/Mars/mraw/MRawFileWrite.h
r852 r860 43 43 Bool_t PreProcess(MParList *pList); 44 44 Bool_t Process(); 45 Bool_t PostProcess();46 45 47 46 ClassDef(MRawFileWrite, 0) // Task to write the raw data containers to a root file
Note:
See TracChangeset
for help on using the changeset viewer.