Changeset 2564
- Timestamp:
- 11/24/03 01:16:39 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 4 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r2563 r2564 46 46 - changed 'MRawEvtTime' to 'MTime' 47 47 - added some debugging output in case of kContinue 48 49 * mmain/MOnlineDump.[h,cc], mmain/MOnlineDisplay.[h,cc]: 50 - added 51 52 * mmain/MainLinkDef.h, mmain/Makefile: 53 - added MOnlineDump 54 - added MOnlineDisplay 55 56 * mona.cc: 57 - updated 48 58 49 59 -
trunk/MagicSoft/Mars/mmain/MainLinkDef.h
r2505 r2564 14 14 #pragma link C++ class MCameraDisplay+; 15 15 #pragma link C++ class MEventDisplay+; 16 #pragma link C++ class MOnlineDisplay+; 17 #pragma link C++ class MOnlineDump+; 16 18 17 19 #pragma link C++ class MGDisplayAdc+; -
trunk/MagicSoft/Mars/mmain/Makefile
r2521 r2564 37 37 MGDisplayAdc.cc \ 38 38 MEventDisplay.cc \ 39 MOnlineDisplay.cc \ 40 MOnlineDump.cc \ 39 41 MCameraDisplay.cc 40 42 -
trunk/MagicSoft/Mars/mona.cc
r2531 r2564 2 2 3 3 #include <TThread.h> 4 #include <TCanvas.h> 4 5 #include <TMethod.h> // GetMenuItems 6 7 #include <TGButton.h> 5 8 6 9 #include "MParList.h" … … 16 19 #include "MFRealTimePeriod.h" 17 20 #include "MHTriggerLvl0.h" 18 #include "MHCamera.h" // ::Class() 19 20 #include "MStatusDisplay.h" 21 #include "MHCamera.h" // ::Class(), SetFreezed 22 #include "MHCamEvent.h" // MHCamEvent 23 #include "MHEvent.h" // MHEvent::GetHist() 24 25 #include "MOnlineDump.h" 26 #include "MOnlineDisplay.h" 21 27 22 28 #include "MImgCleanStd.h" 23 29 #include "MHillasCalc.h" 24 30 #include "MHillasSrcCalc.h" 31 #include "MEventRateCalc.h" 25 32 26 33 #include "MArgs.h" … … 32 39 #include "MRawRunHeader.h" // MRawRunHeader 33 40 34 class MOnlineDump : public MTask 35 { 36 private: 37 MFillH *fFill1; 38 MFillH *fFill2; 39 MFillH *fFill3; 40 MFRealTimePeriod *fFilter; 41 42 UInt_t fRunNumber; 43 UInt_t fEvtNumber; 44 45 MRawEvtHeader *fRawEvtHeader; 46 MRawRunHeader *fRawRunHeader; 47 48 MTime *fEvtTime; 49 Double_t fTime; 50 51 void SetNoContextMenu(TObject *c) 52 { 53 if (fDisplay->HasCanvas((TCanvas*)c)) 54 c->ResetBit(kNoContextMenu); 55 } 56 void DisplayTriggerRate() 57 { 58 if (*fEvtTime==0) 59 fEvtTime->SetTime(gSystem->Now()); 60 61 if (fEvtNumber==0 || fRawRunHeader->GetRunNumber()!=fRunNumber) 62 { 63 fEvtNumber = fRawEvtHeader->GetDAQEvtNumber(); 64 fRunNumber = fRawRunHeader->GetRunNumber(); 65 fTime = *fEvtTime; 66 return; 67 } 68 69 const UInt_t evts = fRawEvtHeader->GetDAQEvtNumber() - fEvtNumber; 70 const Double_t sec = *fEvtTime-fTime; 71 72 if (evts>0 && sec>0 && fDisplay) 73 fDisplay->SetStatusLine2(Form("Trigger Rate: %.1fHz", evts/sec)); 74 } 75 76 public: 77 MOnlineDump() { fName = "MOnlineDump"; } 78 Int_t PreProcess(MParList *pList) 79 { 80 if (gROOT->IsBatch()) 81 { 82 *fLog << err << "We are in batch mode!" << endl; 83 return kFALSE; 84 } 85 if (!fDisplay) 86 { 87 *fLog << err << "fDisplay not set." << endl; 88 return kFALSE; 89 } 90 91 MTaskList *tasks = (MTaskList*)pList->FindObject("MTaskList"); 92 if (!tasks) 93 { 94 *fLog << err << "MTaskList not found... abort." << endl; 95 return kFALSE; 96 } 97 98 fFill1 = (MFillH*)tasks->FindObject("MFillCamEvent"); 99 if (!fFill1) 100 { 101 *fLog << err << "MFillCamEvent not found... abort." << endl; 102 return kFALSE; 103 } 104 fFill2 = (MFillH*)tasks->FindObject("MFillEvent"); 105 if (!fFill2) 106 { 107 *fLog << err << "MFillEvent not found... abort." << endl; 108 return kFALSE; 109 } 110 fFill3 = (MFillH*)tasks->FindObject("MFillTriggerLvl0"); 111 if (!fFill3) 112 { 113 *fLog << err << "MFillTriggerLvl0 not found... abort." << endl; 114 return kFALSE; 115 } 116 fRawEvtHeader = (MRawEvtHeader*)pList->FindObject("MRawEvtHeader"); 117 if (!fRawEvtHeader) 118 { 119 *fLog << err << "MRawEvtHeader not found... abort." << endl; 120 return kFALSE; 121 } 122 123 fRawRunHeader = (MRawRunHeader*)pList->FindObject("MRawRunHeader"); 124 if (!fRawRunHeader) 125 { 126 *fLog << err << "MRawRunHeader not found... abort." << endl; 127 return kFALSE;; 128 } 129 130 fEvtTime = (MTime*)pList->FindObject("MRawEvtTime"); 131 if (!fEvtTime) 132 { 133 *fLog << err << "MRawEvtTime not found... abort." << endl; 134 return kFALSE; 135 } 136 137 fRunNumber = 0xffffffff; 138 fEvtNumber = 0; 139 140 SetNoContextMenu((TObject*)fFill1->GetCanvas()); 141 SetNoContextMenu((TObject*)fFill2->GetCanvas()); 142 SetNoContextMenu((TObject*)fFill3->GetCanvas()); 143 144 return kTRUE; 145 } 146 Int_t Process() 147 { 148 DisplayTriggerRate(); 149 150 if (fDisplay) 151 fDisplay->SetProgressBarPosition((Float_t)fEvtNumber/fRawRunHeader->GetNumEvents()); 152 153 return kTRUE; 154 } 155 Int_t PostProcess() 156 { 157 if (fDisplay) 158 fDisplay->SetProgressBarPosition(1); 159 160 return kTRUE; 161 } 162 // ClassDef(MOnlineDump, 0) // Task to fill a histogram with data from a parameter container 163 }; 164 //ClassImp(MOnlineDump); 165 // -------------------------------------------------------------------- 41 using namespace std; 166 42 167 43 void StartUpMessage() … … 213 89 } 214 90 215 Bool_t Loop(MStatusDisplay *display, Int_t port) 216 { 91 Bool_t Loop(MOnlineDisplay *display, Int_t port) 92 { 93 display->Reset(); 94 217 95 // 218 96 // create the tasks which should be executed and add them to the list … … 238 116 tasks.AddToList(&ncalc); 239 117 118 MEventRateCalc tcalc; 119 tcalc.SetNumEvents(100); 120 tasks.AddToList(&tcalc); 121 240 122 MFillH fill1("MHEvent", "MCerPhotEvt", "MFillEvent"); 241 123 MFillH fill2("MHCamEvent", "MCerPhotEvt", "MFillCamEvent"); … … 248 130 249 131 tasks.AddToList(&filter); 132 250 133 tasks.AddToList(&fill1); 251 134 tasks.AddToList(&fill2); … … 254 137 MOnlineDump dump; 255 138 dump.SetFilter(&filter); 139 display->SetTask(&dump); 256 140 tasks.AddToList(&dump); 141 142 MHCamEvent hist("PedestalRms"); 143 hist.SetType(1); 144 plist.AddToList(&hist); 145 146 // ------------------------------------------- 147 148 MHCamEvent maxhi("MaxIdxHi", "Index of slice with maximum content (hi-gain)"); 149 MHCamEvent maxlo("MaxIdxLo", "Index of slice with maximum content (lo-gain)"); 150 maxhi.SetType(3); 151 maxlo.SetType(4); 152 plist.AddToList(&maxhi); 153 plist.AddToList(&maxlo); 154 155 // ------------------------------------------- 156 157 MFillH hfilla("MaxIdxHi", "MRawEvtData"); 158 MFillH hfillb("MaxIdxLo", "MRawEvtData"); 159 MFillH hfillc("Pedestals [MHCamEvent]", "MPedestalCam"); 160 MFillH hfilld("PedestalRms", "MPedestalCam"); 161 tasks.AddToList(&hfilla); 162 tasks.AddToList(&hfillb); 163 tasks.AddToList(&hfillc); 164 tasks.AddToList(&hfilld); 257 165 258 166 MImgCleanStd clean; … … 291 199 void *thread(void *ptr) 292 200 { 293 const Int_t port = *(Int_t*)ptr; 294 295 MStatusDisplay d; 296 d.Resize(740, 600); 201 const Int_t port = *((Int_t**)ptr)[0]; 202 MOnlineDisplay &d = *((MOnlineDisplay**)ptr)[1]; 297 203 298 204 // … … 303 209 Loop(&d, port); 304 210 305 gLog << dbg << "Exit System Loop... " << flush; 306 gSystem->ExitLoop(); 307 gLog << "done." << endl; 308 309 TThread::Self()->Exit(); 211 212 gLog << dbg << "Loop stopped... exit thread()" << endl; 213 310 214 return 0; 311 215 } … … 403 307 // if the thread is terminated (by return) 404 308 // 405 gLog << dbg << "Starting Thread..." << endl; 406 TThread t(thread, (void*)&port); 309 gLog << dbg << "Starting Display..." << flush; 310 MOnlineDisplay d; 311 d.SetBit(MStatusDisplay::kExitLoopOnExit); 312 gLog << "done." << endl; 313 314 // gDebug=1; 315 316 gLog << dbg << "Starting Thread..." << flush; 317 const void *ptr[2] = { &port, &d }; 318 TThread t(thread, ptr); 407 319 t.Run(); 320 gLog << "done." << endl; 408 321 409 322 gLog << dbg << "Starting System loop... " << endl; … … 411 324 gLog << dbg << "System loop stopped." << endl; 412 325 326 d.UnmapWindow(); 327 328 gLog << dbg << "Waiting for termination of thread... (be patient)" << endl; 329 while (t.GetState()!=TThread::kCanceledState) 330 gSystem->ProcessEvents(); 331 332 gLog << dbg << "Thread terminated... joining." << endl; 333 334 TThread::Join(t.GetId()); //- seems that it is implicitly done... why? 335 336 gLog << dbg << "Exit MONA." << endl; 337 413 338 return 0; 414 339 }
Note:
See TracChangeset
for help on using the changeset viewer.