source: trunk/MagicSoft/Mars/macros/sectorvstime.C@ 7135

Last change on this file since 7135 was 3957, checked in by tbretz, 20 years ago
*** empty log message ***
File size: 2.8 KB
Line 
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-2004
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// sectorvstime.C
28// ==============
29//
30// In this example we plot the mean content of the right and left half of
31// camera. As an input we use a class derived from MCamEvent. Here this
32// are dc currents read directly from a camera control report file.
33//
34// The output are two histograms one for each half.
35//
36/////////////////////////////////////////////////////////////////////////////
37
38void sectorvstime()
39{
40 // Initialize Mars environment
41 MParList plist;
42 MTaskList tlist;
43 plist.AddToList(&tlist);
44
45 // Create Magic camera geometry
46 MGeomCamMagic cam;
47 plist.AddToList(&cam);
48
49 // Which DC file to read?
50 MReportFileRead read("/data/MAGIC/Period013/cacodata/2004_01_26/dc_2004_01_26_05_35_10_12117_OffMrk421-1.txt");
51 read.SetHasNoHeader();
52 read.AddToList("MReportCurrents");
53
54 // Initialize histogram
55 MHSectorVsTime hist1;
56 hist1.SetNameTime("MTimeCurrents");
57
58 // Define sectors you want to display the mean from
59 TArrayI s0(3);
60 s0[0] = 6;
61 s0[1] = 1;
62 s0[2] = 2;
63
64 // Define area index [0=inner, 1=outer]
65 TArrayI inner(1);
66 inner[0] = 0;
67
68 // Don't call this if you want to have all sectors
69 hist1.SetSectors(s0);
70
71 // Don't call this if you want to have all area indices
72 hist1.SetAreaIndex(inner);
73
74 // Task to fill the histogram
75 MFillH fill1(&hist1, "MCameraDC");
76
77 // Also fill a histogram with the mean of all pixels
78 MHCamEvent hist2;
79 MFillH fill2(&hist2, "MCameraDC");
80
81 // Setup Tasklist
82 tlist.AddToList(&read);
83 tlist.AddToList(&fill1);
84 tlist.AddToList(&fill2);
85
86 // Setup Eventloop
87 MEvtLoop evtloop;
88 evtloop.SetParList(&plist);
89
90 // Run Eventloop
91 if (!evtloop.Eventloop())
92 return;
93
94 // Print some statistics
95 tlist.PrintStatistics();
96
97 // Draw clones of the histograms
98 hist1.DrawClone();
99 hist2.DrawClone();
100}
Note: See TracBrowser for help on using the repository browser.