Changeset 2497
- Timestamp:
- 11/10/03 14:08:04 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r2496 r2497 84 84 - added MGMenu 85 85 - added MProgressBar 86 87 * mona.cc: 88 - added ChangeContextMenus 89 - adapted to new MRawSocketRead interface 90 - assigned names to different tasks 91 - swiched off progress bar (temporarily) 92 - moved status display into thread 93 - exit thread by Exit() (seems to be necessary) 94 - added preliminary workaround for mssing RootPlugin 95 96 * mmain/MAnalysis.cc: 97 - removed external display 98 - added MStatusDisplay 99 100 * mmain/MMonteCarlo.cc: 101 - old workaround (MMcEvt) obsolete 86 102 87 103 -
trunk/MagicSoft/Mars/mmain/MAnalysis.cc
r2173 r2497 61 61 // 62 62 TGCompositeFrame *frame = CreateNewTab("Setup"); 63 63 /* 64 64 TGGroupFrame *grp = new TGGroupFrame(frame, "Setup Display"); 65 65 fList->Add(grp); … … 87 87 grp->AddFrame(fCheckButton1, laybut); 88 88 grp->AddFrame(fCheckButton2, laybut); 89 89 */ 90 90 TGLayoutHints *laygrp = new TGLayoutHints(kLHintsNormal|kLHintsExpandX, 20, 20, 20); 91 91 fList->Add(laygrp); 92 92 /* 93 93 frame->AddFrame(grp, laygrp); 94 */ 94 95 95 96 /* … … 120 121 // ====================================================================== 121 122 123 #include "MStatusDisplay.h" 122 124 #include "MParList.h" 123 125 #include "MTaskList.h" … … 138 140 #include "MEvtLoop.h" 139 141 #include "MHillas.h" 142 #include "MGeomApply.h" 140 143 141 144 void MAnalysis::CalculateHillas() … … 145 148 // parameter out of a Magic root file. 146 149 147 const Bool_t displhillas = fCheckButton1->GetState();148 const Bool_t displstarmap = fCheckButton2->GetState();150 const Bool_t displhillas = kTRUE;//fCheckButton1->GetState(); 151 const Bool_t displstarmap = kTRUE;//fCheckButton2->GetState(); 149 152 150 153 // … … 193 196 // 194 197 MReadMarsFile read("Events", fInputFile); 195 198 read.DisableAutoScheme(); 199 200 MGeomApply apply; 196 201 MMcPedestalCopy pcopy; 197 202 MMcPedestalNSBAdd pdnsb; … … 216 221 217 222 tlist.AddToList(&read); 223 tlist.AddToList(&apply); 218 224 tlist.AddToList(&pcopy); 219 225 tlist.AddToList(&pdnsb); … … 245 251 // Add ProgressBar to window 246 252 // 247 TGProgressBar *bar = CreateProgressBar(fTop2); 248 evtloop.SetProgressBar(bar); 253 TGProgressBar *bar = NULL; 254 if (displhillas || displstarmap) 255 { 256 MStatusDisplay *d=new MStatusDisplay; 257 evtloop.SetDisplay(d); 258 } 259 else 260 { 261 bar = CreateProgressBar(fTop2); 262 evtloop.SetProgressBar(bar); 263 } 264 249 265 250 266 // 251 267 // Execute your analysis 252 268 // 253 Bool_t rc =evtloop.Eventloop();269 /*Bool_t rc =*/ evtloop.Eventloop(); 254 270 255 271 // 256 272 // Remove progressbar from window 257 273 // 258 DestroyProgressBar(bar); 259 274 if (bar) 275 DestroyProgressBar(bar); 276 277 /* 260 278 if (!rc) 261 279 return; … … 270 288 plist.FindObject("MHHillasSrc")->DrawClone(); 271 289 plist.FindObject("MHNewImagePar")->DrawClone(); 272 /*273 plist.FindObject("HistSource")->DrawClone();274 plist.FindObject("HistAntiSrc")->DrawClone();275 */276 290 } 277 291 … … 281 295 cout << endl; 282 296 cout << "Calculation of Hillas Parameters finished without error!" << endl; 297 */ 283 298 } 284 299 -
trunk/MagicSoft/Mars/mmain/MMonteCarlo.cc
r2173 r2497 197 197 #include "MMcCollectionAreaCalc.h" 198 198 199 #if ROOT_VERSION_CODE < ROOT_VERSION(3,05,05) 199 200 #include "../mmc/MMcTrig.hxx" // FIXME: see FIXME below 201 #endif 200 202 201 203 Int_t MMonteCarlo::GetDim() const … … 228 230 plist.AddToList(&tlist); 229 231 232 #if ROOT_VERSION_CODE < ROOT_VERSION(3,05,05) 230 233 // 231 234 // FIXME: This line is needed that root finds the MMc-classes in the … … 235 238 // 236 239 MMcTrig trig; 240 #endif 237 241 238 242 // … … 326 330 plist.AddToList(&hists); 327 331 332 #if ROOT_VERSION_CODE < ROOT_VERSION(3,05,05) 328 333 // 329 334 // FIXME: This line is needed that root finds the MMc-classes in the … … 333 338 // 334 339 MMcTrig trig; 340 #endif 335 341 336 342 // … … 412 418 plist.AddToList(&hists); 413 419 420 #if ROOT_VERSION_CODE < ROOT_VERSION(3,05,05) 414 421 // 415 422 // FIXME: This line is needed that root finds the MMc-classes in the … … 419 426 // 420 427 MMcTrig trig; 428 #endif 421 429 422 430 // -
trunk/MagicSoft/Mars/mona.cc
r2386 r2497 1 #include <TROOT.h>2 1 #include <TApplication.h> 3 2 4 3 #include <TThread.h> 4 #include <TMethod.h> // GetMenuItems 5 5 6 6 #include "MParList.h" … … 17 17 #include "MOnlineDump2.h" 18 18 #include "MHTriggerLvl0.h" 19 #include "MHCamera.h" // ::Class() 19 20 20 21 #include "MStatusDisplay.h" … … 39 40 } 40 41 42 void Remove(TMethod *m, const char *name) 43 { 44 if (TString(m->GetName()).BeginsWith(name)) 45 m->SetMenuItem(kMenuNoMenu); 46 } 47 48 void ChangeContextMenus() 49 { 50 TList l; 51 MHCamera::Class()->GetMenuItems(&l); 52 TIter Next(&l); 53 TMethod *m=NULL; 54 while ((m=(TMethod*)Next())) 55 { 56 Remove(m, "DrawClone"); 57 Remove(m, "SetName"); 58 Remove(m, "Delete"); 59 Remove(m, "DrawClass"); 60 Remove(m, "Dump"); 61 Remove(m, "Inspect"); 62 Remove(m, "Smooth"); 63 Remove(m, "Fit"); 64 Remove(m, "Divide"); 65 Remove(m, "Add"); 66 Remove(m, "Multiply"); 67 Remove(m, "Delete"); 68 Remove(m, "SetLineAttributes"); 69 Remove(m, "SetFillAttributes"); 70 Remove(m, "SetMarkerAttributes"); 71 Remove(m, "SetDrawOption"); 72 } 73 } 74 41 75 Bool_t Loop(MStatusDisplay *display) 42 76 { … … 47 81 // 48 82 MRawSocketRead reader; 83 reader.SetPort(7000); 49 84 50 85 // … … 57 92 plist.AddToList(&tasks); 58 93 tasks.AddToList(&reader); 59 60 //MParList &plist = *(MParList*)ptr;61 //MTaskList &tasks = *(MTaskList*)plist.FindObject("MTaskList");62 94 63 95 MGeomApply geomapl; … … 66 98 tasks.AddToList(&ncalc); 67 99 68 MFillH fill1("MHCamEvent", "MCerPhotEvt"); 69 MFillH fill2("MHEvent", "MCerPhotEvt"); 100 MFillH fill1("MHEvent", "MCerPhotEvt", "MFillEvent"); 101 MFillH fill2("MHCamEvent", "MCerPhotEvt", "MFillCamEvent"); 102 103 MFRealTimePeriod filter; 104 fill1.SetFilter(&filter); 70 105 71 106 MHTriggerLvl0 trigmap(128, "Above 128"); 72 MFillH fill3(&trigmap, "MRawEvtData"); 73 74 MFRealTimePeriod filter; 75 fill2.SetFilter(&filter); 76 77 fill1.SetName("MFillCamEvent"); 78 fill2.SetName("MFillEvent"); 79 fill3.SetName("MFillTriggerLvl0"); 80 81 tasks.AddToList(&fill2); 107 MFillH fill3(&trigmap, "MRawEvtData", "MFillTriggerLvl0"); 108 82 109 tasks.AddToList(&filter); 83 110 tasks.AddToList(&fill1); 111 tasks.AddToList(&fill2); 84 112 tasks.AddToList(&fill3); 85 113 … … 91 119 MHillasCalc hcalc; 92 120 MHillasSrcCalc scalc; // !!Preliminary!! Will be removed later! 93 MFillH hfill3("MHHillas", "MHillas");94 MFillH hfill 6("MHHillasSrc","MHillasSrc");121 MFillH hfill3("MHHillas", "MHillas", "MFillHillas"); 122 MFillH hfill4("MHHillasSrc","MHillasSrc", "MFillHillasSrc"); 95 123 tasks.AddToList(&clean); 96 124 tasks.AddToList(&hcalc); 97 125 tasks.AddToList(&scalc); 98 126 tasks.AddToList(&hfill3); 99 tasks.AddToList(&hfill 6);127 tasks.AddToList(&hfill4); 100 128 101 129 MEvtLoop magic; 102 //plist.AddToList(&magic);103 130 magic.SetParList(&plist); 104 131 105 132 magic.SetDisplay(display); 133 magic.SetProgressBar((TGProgressBar*)NULL); 106 134 107 135 if (!magic.Eventloop()) … … 115 143 } 116 144 145 // 146 // By defining the function return type 'void' instead of 147 // 'void*' we tell TThread to create a detached thread, 148 // but calling Exit() in a detached thread results in a crash 149 // when the TGApplication is terminated. 150 // 117 151 void *thread(void *ptr) 118 152 { 119 // TThread::SetCancelAsynchronous(); 120 // TThread::SetCancelOn(); 121 MStatusDisplay *display=(MStatusDisplay*)ptr; 122 // display->Lock(); 153 MStatusDisplay d; 154 d.Resize(740, 600); 123 155 124 156 // … … 126 158 // user requested to exit the program. 127 159 // 128 while (d isplay->CheckStatus()!=MStatusDisplay::kFileExit)129 Loop( display);160 while (d.CheckStatus()!=MStatusDisplay::kFileExit) 161 Loop(&d); 130 162 131 163 gLog << dbg << "Exit System Loop... " << flush; … … 133 165 gLog << "done." << endl; 134 166 167 TThread::Self()->Exit(); 135 168 return 0; 136 169 } 137 170 171 /* 172 #if ROOT_VERSION_CODE < ROOT_VERSION(3,10,02) 173 #include <TRootGuiFactory.h> 174 #include <TPluginManager.h> 175 void InitGuiFactory() 176 { 177 if (gROOT->IsBatch()) 178 gROOT->SetBatch(kFALSE); 179 180 // 181 // Must be loaded by hand, because it is not loaded by TGApplication. 182 // We could also use TApplication instead, but TApplication doesn't 183 // deal with the DISPLAY variable in a convient way. 184 // 185 TPluginHandler *h; 186 if ((h = gROOT->GetPluginManager()->FindHandler("TGuiFactory", "root"))) 187 { 188 if (h->LoadPlugin() == -1) 189 return; 190 gGuiFactory = (TGuiFactory*)h->ExecPlugin(0); 191 } 192 } 193 #endif 194 */ 195 138 196 int main(int argc, char **argv) 139 197 { 140 TROOT simple("mona", "Magic ONline Analysis");141 TApplication app("MonaApp", &argc, argv);142 143 198 StartUpMessage(); 199 200 TApplication app("Mars", &argc, argv); 201 if (gROOT->IsBatch() || !gClient) 202 { 203 gLog << "Bombing... maybe your DISPLAY variable is not set correctly!" << endl; 204 return 1; 205 } 206 /* 207 TGApplication app("Mona", &argc, argv); 208 209 #if ROOT_VERSION_CODE < ROOT_VERSION(3,10,02) 210 InitGuiFactory(); 211 #endif 212 */ 213 214 ChangeContextMenus(); 144 215 145 216 // … … 147 218 // if the thread is terminated (by return) 148 219 // 149 MStatusDisplay d;150 d.Resize(740, 600);151 152 220 gLog << dbg << "Starting Thread..." << endl; 153 TThread t(thread , &d);221 TThread t(thread); 154 222 t.Run(); 155 223 156 gLog << dbg << "Starting System loop... " << endl;224 gLog << dbg << "Starting System loop... " << endl; 157 225 app.Run(kTRUE); 158 226 gLog << dbg << "System loop stopped." << endl;
Note:
See TracChangeset
for help on using the changeset viewer.