source: branches/removing_cpp11_features/macros/tutorials/derotatedc.C@ 19848

Last change on this file since 19848 was 7159, checked in by tbretz, 20 years ago
*** empty log message ***
File size: 2.9 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, 4/2004 <mailto:tbretz@astro.uni-wuerzburg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2004
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// derotatedc.C
28// ============
29//
30// Derotate a MCamEvent and fill a histogram with derotated data
31// (sky-plot).
32//
33// As an input you need a merpped root file conataining DC information
34// from a camera report file. To be able to derotate you also need
35// aproproitate time-stamps and the corresponding pointing information.
36//
37// All events are filled into a 2D histograms - derotated.
38//
39// The example shows the usage of MHCamEventRot. The output is the derotated
40// sky-plot.
41//
42/////////////////////////////////////////////////////////////////////////////
43
44void derotatedc()
45{
46 //
47 // Create a empty Parameter List and an empty Task List
48 // The tasklist is identified in the eventloop by its name
49 //
50 MParList plist;
51
52 MTaskList tlist;
53 plist.AddToList(&tlist);
54
55 // Define Observatory location (for derotation)
56 MObservatory obs;
57 plist.AddToList(&obs);
58
59 // Set the camera geometry (for histogram size)
60 MGeomCamMagic cam;
61 plist.AddToList(&cam);
62
63 // setup pointing position
64 MPointingPos ppos;
65 ppos.SetSkyPosition(MAstro::Hms2Hor(5, 34, 31.9), MAstro::Dms2Deg(22, 0, 52.0));
66 plist.AddToList(&ppos);
67
68 // Define which file to read
69 MReadTree read("Currents", "../dc.root");
70 read.DisableAutoScheme();
71
72 // Derotated histogram to fill
73 MHCamEventRot hist;
74
75 // Set name of time container corresponding to your data
76 hist.SetNameTime("MTimeCurrents");
77
78 // Setup fill task
79 MFillH fill(&hist, "MCameraDC");
80
81 // Set a draw option for your 2D histogram
82 //fill.SetDrawOption("colz");
83
84 // Setup tasklist
85 tlist.AddToList(&read);
86 tlist.AddToList(&fill);
87
88 //
89 // Create and setup the eventloop
90 //
91 MEvtLoop evtloop;
92 evtloop.SetParList(&plist);
93
94 MStatusDisplay *d = new MStatusDisplay;
95 evtloop.SetDisplay(d);
96
97 //
98 // Execute your analysis
99 //
100 if (!evtloop.Eventloop())
101 return;
102
103 tlist.PrintStatistics();
104}
Note: See TracBrowser for help on using the repository browser.