source: releases/Mars.2014.05.26/macros/star.C@ 19594

Last change on this file since 19594 was 3957, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 4.1 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, 5/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2004
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// STAR - STandard Analysis and Reconstruction
28//
29// This macro is the standard converter to convert raw data into image
30// parameters. It is a demonstration how the star-executable implementation
31// looks like.
32//
33// As an input you need a Merpp output file (raw data).
34// All parameters are written to an output file called starfile.root.
35// For the calculation an arbitrary signal extractor (MCerPhotAnal2/Calc)
36// is used.
37//
38/////////////////////////////////////////////////////////////////////////////
39
40void star()
41{
42 //
43 // Create a empty Parameter List and an empty Task List
44 // The tasklist is identified in the eventloop by its name
45 //
46 MParList plist;
47
48 MTaskList tlist;
49 plist.AddToList(&tlist);
50
51 //
52 // Now setup the tasks and tasklist:
53 // ---------------------------------
54 //
55 MReadMarsFile read("Events");
56 read.DisableAutoScheme();
57
58 // ------------- user change -----------------
59 read.AddFile("~/MC/test_sample/Gamma_zbin0_0_*.root");
60
61 MGeomApply apply;
62 MMcPedestalCopy pcopy;
63 MMcPedestalNSBAdd pnsb;
64
65 MCerPhotCalc ncalc;
66 MCerPhotAnal2 nanal;
67
68 MFDataMember f1("MRawRunHeader.fRunType", '>', 255.5);
69 MFDataMember f2("MRawRunHeader.fRunType", '<', 255.5);
70
71 ncalc.SetFilter(&f1);
72 nanal.SetFilter(&f2);
73
74 MBlindPixelCalc blind;
75 blind.SetUseInterpolation();
76
77 MSigmabarCalc sgcal;
78 MImgCleanStd clean;
79 MHillasCalc hcalc;
80 MHillasSrcCalc scalc; // !!Preliminary!! Will be removed later!
81
82 // ------------- user change -----------------
83 MWriteRootFile write("starfile.root");
84
85 tlist.AddToList(&read);
86 tlist.AddToList(&f1);
87 tlist.AddToList(&f2);
88 tlist.AddToList(&apply);
89 tlist.AddToList(&pcopy);
90 tlist.AddToList(&pnsb);
91 tlist.AddToList(&ncalc);
92 tlist.AddToList(&nanal);
93 tlist.AddToList(&blind);
94 tlist.AddToList(&sgcal);
95 tlist.AddToList(&clean);
96 tlist.AddToList(&hcalc);
97 tlist.AddToList(&scalc);
98 tlist.AddToList(&write);
99
100 // ------------- user change -----------------
101 // You may use the "UPDATE" option in the constructor
102 // of MWriteRootFile to update an existing file.
103 //
104 // tlist.SetSerialNumber(1); // Serial number of telescope
105 write.AddContainer(write.AddSerialNumber("MMcEvt"), "Events", kFALSE);
106 write.AddContainer(write.AddSerialNumber("MSigmabar"), "Events");
107 write.AddContainer(write.AddSerialNumber("MHillas"), "Events");
108 write.AddContainer(write.AddSerialNumber("MHillasExt"), "Events");
109 write.AddContainer(write.AddSerialNumber("MHillasSrc"), "Events");
110 write.AddContainer(write.AddSerialNumber("MNewImagePar"), "Events");
111 write.AddContainer(write.AddSerialNumber("MSrcPosCam"), "RunHeaders");
112 write.AddContainer("MRawRunHeader", "RunHeaders");
113 write.AddContainer("MMcRunHeader", "RunHeaders", kFALSE);
114
115 //
116 // Create and set up the eventloop
117 //
118 MProgressBar bar;
119
120 MEvtLoop evtloop;
121 evtloop.SetProgressBar(&bar);
122 evtloop.SetParList(&plist);
123
124 //
125 // Execute your analysis
126 //
127 if (!evtloop.Eventloop())
128 return;
129
130 tlist.PrintStatistics();
131}
Note: See TracBrowser for help on using the repository browser.