| 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 (tbretz@uni-sw.gwdg.de)
|
|---|
| 19 | !
|
|---|
| 20 | ! Copyright: MAGIC Software Development, 2000-2001
|
|---|
| 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 readCT1(const char *fname="~/data/CT1_97_on1.dat")
|
|---|
| 48 | {
|
|---|
| 49 | MParList plist;
|
|---|
| 50 |
|
|---|
| 51 | MHillas hillas;
|
|---|
| 52 | MHillasExt hillasext;
|
|---|
| 53 | MNewImagePar newimgpar;
|
|---|
| 54 | MTaskList tlist;
|
|---|
| 55 |
|
|---|
| 56 | plist.AddToList(&hillas);
|
|---|
| 57 | plist.AddToList(&hillasext);
|
|---|
| 58 | plist.AddToList(&newimgpar);
|
|---|
| 59 | plist.AddToList(&tlist);
|
|---|
| 60 |
|
|---|
| 61 | MCT1ReadAscii read(fname);
|
|---|
| 62 | MGeomApply geomapl;
|
|---|
| 63 | MClone clone("MCerPhotEvt");
|
|---|
| 64 | MImgCleanStd clean;
|
|---|
| 65 | MHillasCalc hcalc;
|
|---|
| 66 |
|
|---|
| 67 | geomapl.SetGeometry("MGeomCamCT1");
|
|---|
| 68 |
|
|---|
| 69 | tlist.AddToList(&read);
|
|---|
| 70 | tlist.AddToList(&geomapl);
|
|---|
| 71 | tlist.AddToList(&clone);
|
|---|
| 72 | tlist.AddToList(&clean);
|
|---|
| 73 | tlist.AddToList(&hcalc);
|
|---|
| 74 |
|
|---|
| 75 | MEvtLoop evtloop;
|
|---|
| 76 | evtloop.SetParList(&plist);
|
|---|
| 77 |
|
|---|
| 78 | if (!evtloop.PreProcess())
|
|---|
| 79 | return;
|
|---|
| 80 |
|
|---|
| 81 | MGeomCam *geomcam = (MGeomCam*)plist->FindObject("MGeomCam");
|
|---|
| 82 |
|
|---|
| 83 | Int_t icount = 0;
|
|---|
| 84 |
|
|---|
| 85 | MHCamera display[4];
|
|---|
| 86 | TCanvas c("Events", "Real Events", 600, 600);
|
|---|
| 87 | c.SetBorderMode(0);
|
|---|
| 88 | c.Divide(2,2);
|
|---|
| 89 | for (int i=0; i<4; i++)
|
|---|
| 90 | {
|
|---|
| 91 | display[i].SetGeometry(*geomcam);
|
|---|
| 92 | c.cd(i+1);
|
|---|
| 93 | display[i].Draw();
|
|---|
| 94 | gPad->cd(1);
|
|---|
| 95 | hillas.Draw();
|
|---|
| 96 | }
|
|---|
| 97 |
|
|---|
| 98 | // Use this if you don't want the event to be autoscaled
|
|---|
| 99 | //display.SetMinimum(0);
|
|---|
| 100 | //display.SetMaximum(100);
|
|---|
| 101 |
|
|---|
| 102 | while ((rc=tlist.Process()))
|
|---|
| 103 | {
|
|---|
| 104 | cout << "Event #" << icount++ << endl;
|
|---|
| 105 |
|
|---|
| 106 | MCerPhotEvt *evt = (MCerPhotEvt*)clone.GetClone();
|
|---|
| 107 | if (!evt) // If skipped due to MInputStreamId
|
|---|
| 108 | continue;
|
|---|
| 109 |
|
|---|
| 110 | display[0].SetCamContent(*(MCerPhotEvt*)clone.GetClone());
|
|---|
| 111 | display[1].SetCamContent(*(MCerPhotEvt*)plist.FindObject("MCerPhotEvt"));
|
|---|
| 112 | display[2].SetCamContent(*(MCamEvent*)plist.FindObject("MCameraData"));
|
|---|
| 113 | display[3].SetCamContent(*(MCamEvent*)plist.FindObject("MCameraData"));
|
|---|
| 114 | TArrayF lvl(2);
|
|---|
| 115 | lvl[0] = clean.GetCleanLvl2();
|
|---|
| 116 | lvl[1] = clean.GetCleanLvl1();
|
|---|
| 117 | display[3].SetLevels(lvl);
|
|---|
| 118 |
|
|---|
| 119 | for (int i=1; i<=4; i++)
|
|---|
| 120 | {
|
|---|
| 121 | c.GetPad(i)->GetPad(1)->Modified();
|
|---|
| 122 | c.GetPad(i)->GetPad(1)->Update();
|
|---|
| 123 | }
|
|---|
| 124 |
|
|---|
| 125 | hillas.Print(*geomcam);
|
|---|
| 126 | hillasext.Print(*geomcam);
|
|---|
| 127 | newimgpar.Print();
|
|---|
| 128 |
|
|---|
| 129 | if (!HandleInput())
|
|---|
| 130 | break;
|
|---|
| 131 | }
|
|---|
| 132 |
|
|---|
| 133 | evtloop.PostProcess();
|
|---|
| 134 | }
|
|---|