| 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  12/2000 <mailto:tbretz@uni-sw.gwdg.de> | 
|---|
| 19 | ! | 
|---|
| 20 | !   Copyright: MAGIC Software Development, 2000-2001 | 
|---|
| 21 | ! | 
|---|
| 22 | ! | 
|---|
| 23 | \* ======================================================================== */ | 
|---|
| 24 |  | 
|---|
| 25 |  | 
|---|
| 26 | Bool_t HandleInput() | 
|---|
| 27 | { | 
|---|
| 28 | TTimer timer("gSystem->ProcessEvents();", 50, kFALSE); | 
|---|
| 29 | while (1) | 
|---|
| 30 | { | 
|---|
| 31 | // | 
|---|
| 32 | // While reading the input process gui events asynchronously | 
|---|
| 33 | // | 
|---|
| 34 | timer.TurnOn(); | 
|---|
| 35 | TString input = Getline("Type 'q' to exit, <return> to go on: "); | 
|---|
| 36 | timer.TurnOff(); | 
|---|
| 37 |  | 
|---|
| 38 | if (input=="q\n") | 
|---|
| 39 | return kFALSE; | 
|---|
| 40 |  | 
|---|
| 41 | if (input=="\n") | 
|---|
| 42 | return kTRUE; | 
|---|
| 43 | }; | 
|---|
| 44 |  | 
|---|
| 45 | return kFALSE; | 
|---|
| 46 | } | 
|---|
| 47 |  | 
|---|
| 48 | void readMagic(const char *fname="~/data/Gamma_0_7*.root") | 
|---|
| 49 | { | 
|---|
| 50 | MParList plist; | 
|---|
| 51 |  | 
|---|
| 52 | MGeomCamMagic geomcam; | 
|---|
| 53 | MHillas       hillas; | 
|---|
| 54 | MHillasExt    hillasext; | 
|---|
| 55 | MNewImagePar  newimgpar; | 
|---|
| 56 | MTaskList     tlist; | 
|---|
| 57 |  | 
|---|
| 58 | plist.AddToList(&geomcam); | 
|---|
| 59 | plist.AddToList(&hillas); | 
|---|
| 60 | plist.AddToList(&hillasext); | 
|---|
| 61 | plist.AddToList(&newimgpar); | 
|---|
| 62 | plist.AddToList(&tlist); | 
|---|
| 63 |  | 
|---|
| 64 | MReadMarsFile read("Events", fname); | 
|---|
| 65 | read.DisableAutoScheme(); | 
|---|
| 66 |  | 
|---|
| 67 | MPrint print1("MMcEvt"); | 
|---|
| 68 | MPrint print2("MRawEvtHeader"); | 
|---|
| 69 | print1.EnableSkip(); | 
|---|
| 70 | print2.EnableSkip(); | 
|---|
| 71 |  | 
|---|
| 72 | MMcPedestalCopy   pcopy; | 
|---|
| 73 | MMcPedestalNSBAdd pnsb; | 
|---|
| 74 | MCerPhotCalc      ncalc; | 
|---|
| 75 | MBlindPixelCalc   blind; | 
|---|
| 76 | blind.SetUseInterpolation(); | 
|---|
| 77 | MClone            clone("MCerPhotEvt"); | 
|---|
| 78 | MImgCleanStd      clean; | 
|---|
| 79 | MHillasCalc       hcalc; | 
|---|
| 80 |  | 
|---|
| 81 |  | 
|---|
| 82 | tlist.AddToList(&read); | 
|---|
| 83 | tlist.AddToList(&print1); | 
|---|
| 84 | tlist.AddToList(&print2); | 
|---|
| 85 | tlist.AddToList(&pcopy); | 
|---|
| 86 | tlist.AddToList(&pnsb); | 
|---|
| 87 | tlist.AddToList(&ncalc); | 
|---|
| 88 | tlist.AddToList(&blind); | 
|---|
| 89 | tlist.AddToList(&clone); | 
|---|
| 90 | tlist.AddToList(&clean); | 
|---|
| 91 | tlist.AddToList(&hcalc); | 
|---|
| 92 |  | 
|---|
| 93 | MEvtLoop evtloop; | 
|---|
| 94 | evtloop.SetParList(&plist); | 
|---|
| 95 |  | 
|---|
| 96 | if (!evtloop.PreProcess()) | 
|---|
| 97 | return; | 
|---|
| 98 |  | 
|---|
| 99 | MCamDisplay display(&geomcam); | 
|---|
| 100 | display.Draw(); | 
|---|
| 101 |  | 
|---|
| 102 | while (tlist.Process()) | 
|---|
| 103 | { | 
|---|
| 104 | cout << "Event #" << read.GetNumEntry() ":" << endl; | 
|---|
| 105 |  | 
|---|
| 106 | display.FillPhotNum(*(MCerPhotEvt*)clone.GetClone()); | 
|---|
| 107 | gPad->Modified(); | 
|---|
| 108 | gPad->Update(); | 
|---|
| 109 |  | 
|---|
| 110 | if (!HandleInput()) | 
|---|
| 111 | break; | 
|---|
| 112 |  | 
|---|
| 113 | hillas.Draw(); | 
|---|
| 114 | hillas.Print(); | 
|---|
| 115 | hillasext.Print(); | 
|---|
| 116 | newimgpar.Print(); | 
|---|
| 117 |  | 
|---|
| 118 | display.FillPhotNum(*(MCerPhotEvt*)plist.FindObject("MCerPhotEvt")); | 
|---|
| 119 | gPad->Modified(); | 
|---|
| 120 | gPad->Update(); | 
|---|
| 121 |  | 
|---|
| 122 | if (!HandleInput()) | 
|---|
| 123 | break; | 
|---|
| 124 | } | 
|---|
| 125 |  | 
|---|
| 126 | evtloop.PostProcess(); | 
|---|
| 127 | } | 
|---|
| 128 |  | 
|---|