| 1 | /* ======================================================================== *\ | 
|---|
| 2 | ! | 
|---|
| 3 | ! * | 
|---|
| 4 | ! * This file is part of MARS, the MAGIC Analysis and Reconstruction | 
|---|
| 5 | ! * Software. It is distributed to you in the hope that it can be a useful | 
|---|
| 6 | ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes. | 
|---|
| 7 | ! * It is distributed WITHOUT ANY WARRANTY. | 
|---|
| 8 | ! * | 
|---|
| 9 | ! * Permission to use, copy, modify and distribute this software and its | 
|---|
| 10 | ! * documentation for any purpose is hereby granted without fee, | 
|---|
| 11 | ! * provided that the above copyright notice appear in all copies and | 
|---|
| 12 | ! * that both that copyright notice and this permission notice appear | 
|---|
| 13 | ! * in supporting documentation. It is provided "as is" without express | 
|---|
| 14 | ! * or implied warranty. | 
|---|
| 15 | ! * | 
|---|
| 16 | ! | 
|---|
| 17 | ! | 
|---|
| 18 | !   Author(s): Thomas Bretz, 5/2003 <mailto:tbretz@astro.uni-wuerzburg.de> | 
|---|
| 19 | ! | 
|---|
| 20 | !   Copyright: MAGIC Software Development, 2000-2003 | 
|---|
| 21 | ! | 
|---|
| 22 | ! | 
|---|
| 23 | \* ======================================================================== */ | 
|---|
| 24 |  | 
|---|
| 25 | Bool_t HandleInput() | 
|---|
| 26 | { | 
|---|
| 27 | TTimer timer("gSystem->ProcessEvents();", 50, kFALSE); | 
|---|
| 28 | while (1) | 
|---|
| 29 | { | 
|---|
| 30 | // | 
|---|
| 31 | // While reading the input process gui events asynchronously | 
|---|
| 32 | // | 
|---|
| 33 | timer.TurnOn(); | 
|---|
| 34 | TString input = Getline("Type 'q' to exit, <return> to go on: "); | 
|---|
| 35 | timer.TurnOff(); | 
|---|
| 36 |  | 
|---|
| 37 | if (input=="q\n") | 
|---|
| 38 | return kFALSE; | 
|---|
| 39 |  | 
|---|
| 40 | if (input=="\n") | 
|---|
| 41 | return kTRUE; | 
|---|
| 42 | }; | 
|---|
| 43 |  | 
|---|
| 44 | return kFALSE; | 
|---|
| 45 | } | 
|---|
| 46 |  | 
|---|
| 47 | void readcurrents(const char *fname="../currents/dcs_arcturus.dat") | 
|---|
| 48 | { | 
|---|
| 49 | MParList plist; | 
|---|
| 50 |  | 
|---|
| 51 | MGeomCamMagic geomcam; | 
|---|
| 52 | MCurrents     cur; | 
|---|
| 53 | MTaskList     tlist; | 
|---|
| 54 |  | 
|---|
| 55 | plist.AddToList(&geomcam); | 
|---|
| 56 | plist.AddToList(&cur); | 
|---|
| 57 | plist.AddToList(&tlist); | 
|---|
| 58 |  | 
|---|
| 59 | MReadCurrents read(fname); | 
|---|
| 60 | /* | 
|---|
| 61 | read.AddFile("../currents/dcs_arcturus2.dat"); | 
|---|
| 62 | read.AddFile("../currents/dcs_arcturus3.dat"); | 
|---|
| 63 | read.AddFile("../currents/dcs_arcturus4.dat"); | 
|---|
| 64 | read.AddFile("../currents/dcs_arcturus5.dat"); | 
|---|
| 65 | read.AddFile("../currents/dcs_arcturus6.dat"); | 
|---|
| 66 | read.AddFile("../currents/dcs_arcturus7.dat"); | 
|---|
| 67 | read.AddFile("../currents/dcs_arcturus8.dat"); | 
|---|
| 68 | read.AddFile("../currents/dcs_arcturus9.dat"); | 
|---|
| 69 | read.AddFile("../currents/dcs_arcturus10.dat"); | 
|---|
| 70 | */ | 
|---|
| 71 | tlist.AddToList(&read); | 
|---|
| 72 |  | 
|---|
| 73 | MEvtLoop evtloop; | 
|---|
| 74 | evtloop.SetParList(&plist); | 
|---|
| 75 |  | 
|---|
| 76 | if (!evtloop.PreProcess()) | 
|---|
| 77 | return; | 
|---|
| 78 |  | 
|---|
| 79 | MHCamera display(geomcam); | 
|---|
| 80 | display.Draw(); | 
|---|
| 81 | gPad->SetLogy(); | 
|---|
| 82 |  | 
|---|
| 83 | int gifcnt = 0; | 
|---|
| 84 |  | 
|---|
| 85 | while (tlist.Process()) | 
|---|
| 86 | { | 
|---|
| 87 | // cur.Print(); | 
|---|
| 88 | display.SetCamContent(cur); | 
|---|
| 89 | gPad->Modified(); | 
|---|
| 90 | gPad->Update(); | 
|---|
| 91 | // Remove the comments if you want to go through the file | 
|---|
| 92 | // event-by-event: | 
|---|
| 93 | //        if (!HandleInput()) | 
|---|
| 94 | //            break; | 
|---|
| 95 | } | 
|---|
| 96 |  | 
|---|
| 97 | evtloop.PostProcess(); | 
|---|
| 98 | } | 
|---|