source: trunk/MagicSoft/Mars/macros/starmc2.C@ 4915

Last change on this file since 4915 was 4101, checked in by moralejo, 21 years ago
*** empty log message ***
File size: 3.4 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): Abelardo Moralejo 1/2004 <mailto:moralejo@pd.infn.it>
19 ! Thomas Bretz 5/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
20 !
21 ! Copyright: MAGIC Software Development, 2000-2004
22 !
23 !
24 \* ======================================================================== */
25
26/////////////////////////////////////////////////////////////////////////////
27//
28// STARMC2 - STandard Analysis and Reconstruction (MC example)
29//
30// This macro converts into image parameters an input file of MC data
31// previously calibrated (see mccalibrate.C).
32//
33//
34/////////////////////////////////////////////////////////////////////////////
35
36#include "MImgCleanStd.h"
37
38void starmc2()
39{
40 Char_t* AnalysisFilename = "calibrated_data.root"; // File to be analyzed
41 Char_t* OutFilename = "star.root"; // Output file name
42
43 Float_t CleanLev[2] = {4., 3.}; // Tail cuts for image analysis
44
45 // ------------------------------------------------------------------
46
47 //
48 // Create a empty Parameter List and an empty Task List
49 // The tasklist is identified in the eventloop by its name
50 //
51 MParList plist;
52
53 MTaskList tlist;
54
55 plist.AddToList(&tlist);
56
57 MSrcPosCam src;
58 src.SetReadyToSave();
59
60 plist.AddToList(&src);
61
62 //
63 // Now setup the tasks and tasklist:
64 // ---------------------------------
65 //
66 MReadMarsFile read("Events");
67
68 read.AddFile(AnalysisFilename);
69
70 read.DisableAutoScheme();
71
72 MImgCleanStd clean(CleanLev[0], CleanLev[1]); // Applies tail cuts to image.
73
74 MHillasCalc hcalc; // Calculates Hillas parameters not dependent on source position.
75 MHillasSrcCalc scalc; // Calculates source-dependent Hillas parameters
76
77 tlist.AddToList(&read);
78 tlist.AddToList(&clean);
79 tlist.AddToList(&hcalc);
80 tlist.AddToList(&scalc); // Calculates Source-dependent Hillas parameters
81
82 //
83 // Open output file:
84 //
85 MWriteRootFile write(OutFilename); // Writes output
86 write.AddContainer("MRawRunHeader", "RunHeaders");
87 write.AddContainer("MMcRunHeader", "RunHeaders", kFALSE);
88 write.AddContainer("MSrcPosCam", "RunHeaders");
89 write.AddContainer("MMcEvt", "Events", kFALSE);
90 write.AddContainer("MPointingPos", "Events", kFALSE);
91 write.AddContainer("MHillas", "Events");
92 write.AddContainer("MHillasExt", "Events");
93 write.AddContainer("MHillasSrc", "Events");
94 write.AddContainer("MNewImagePar", "Events");
95
96 tlist.AddToList(&write); // Add task to write output.
97
98 //
99 // analysis loop
100 //
101
102 MEvtLoop evtloop;
103 MProgressBar bar;
104 bar.SetWindowName("Analyzing...");
105 evtloop.SetProgressBar(&bar);
106 evtloop.SetParList(&plist);
107
108 if (!evtloop.Eventloop())
109 return;
110
111 tlist.PrintStatistics();
112
113 return;
114}
Note: See TracBrowser for help on using the repository browser.