| 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@astro.uni-wuerzburg.de>
|
|---|
| 19 | !
|
|---|
| 20 | ! Copyright: MAGIC Software Development, 2000-2002
|
|---|
| 21 | !
|
|---|
| 22 | !
|
|---|
| 23 | \* ======================================================================== */
|
|---|
| 24 |
|
|---|
| 25 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 26 | //
|
|---|
| 27 | // This macro is an example of how to plot the value of a part of the
|
|---|
| 28 | // camera or the whole camera.
|
|---|
| 29 | //
|
|---|
| 30 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 31 |
|
|---|
| 32 | void sectorvstime()
|
|---|
| 33 | {
|
|---|
| 34 | // Initialize Mars environment
|
|---|
| 35 | MParList plist;
|
|---|
| 36 | MTaskList tlist;
|
|---|
| 37 | plist.AddToList(&tlist);
|
|---|
| 38 |
|
|---|
| 39 | // Create Magic camera geometry
|
|---|
| 40 | MGeomCamMagic cam;
|
|---|
| 41 | plist.AddToList(&cam);
|
|---|
| 42 |
|
|---|
| 43 | // Which DC file to read?
|
|---|
| 44 | MReportFileRead read("/data/MAGIC/Period013/cacodata/2004_01_26/dc_2004_01_26_05_35_10_12117_OffMrk421-1.txt");
|
|---|
| 45 | read.SetHasNoHeader();
|
|---|
| 46 | read.AddToList("MReportCurrents");
|
|---|
| 47 |
|
|---|
| 48 | // Initialize histogram
|
|---|
| 49 | MHSectorVsTime hist1;
|
|---|
| 50 | hist1.SetNameTime("MTimeCurrents");
|
|---|
| 51 |
|
|---|
| 52 | // Define sectors you want to display the mean from
|
|---|
| 53 | TArrayI s0(3);
|
|---|
| 54 | s0[0] = 6;
|
|---|
| 55 | s0[1] = 1;
|
|---|
| 56 | s0[2] = 2;
|
|---|
| 57 |
|
|---|
| 58 | // Define area index [0=inner, 1=outer]
|
|---|
| 59 | TArrayI inner(1);
|
|---|
| 60 | inner[0] = 0;
|
|---|
| 61 |
|
|---|
| 62 | // Don't call this if you want to have all sectors
|
|---|
| 63 | hist1.SetSectors(s0);
|
|---|
| 64 |
|
|---|
| 65 | // Don't call this if you want to have all area indices
|
|---|
| 66 | hist1.SetAreaIndex(inner);
|
|---|
| 67 |
|
|---|
| 68 | // Task to fill the histogram
|
|---|
| 69 | MFillH fill1(&hist1, "MCameraDC");
|
|---|
| 70 |
|
|---|
| 71 | // Also fill a histogram with the mean of all pixels
|
|---|
| 72 | MHCamEvent hist2;
|
|---|
| 73 | MFillH fill2(&hist2, "MCameraDC");
|
|---|
| 74 |
|
|---|
| 75 | // Setup Tasklist
|
|---|
| 76 | tlist.AddToList(&read);
|
|---|
| 77 | tlist.AddToList(&fill1);
|
|---|
| 78 | tlist.AddToList(&fill2);
|
|---|
| 79 |
|
|---|
| 80 | // Setup Eventloop
|
|---|
| 81 | MEvtLoop evtloop;
|
|---|
| 82 | evtloop.SetParList(&plist);
|
|---|
| 83 |
|
|---|
| 84 | // Run Eventloop
|
|---|
| 85 | if (!evtloop.Eventloop())
|
|---|
| 86 | return;
|
|---|
| 87 |
|
|---|
| 88 | // Print some statistics
|
|---|
| 89 | tlist.PrintStatistics();
|
|---|
| 90 |
|
|---|
| 91 | // Draw clones of the histograms
|
|---|
| 92 | hist1.DrawClone();
|
|---|
| 93 | hist2.DrawClone();
|
|---|
| 94 | }
|
|---|