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

Last change on this file since 5032 was 5021, checked in by moralejo, 20 years ago
*** empty log message ***
File size: 3.3 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 hcalc.Enable(MHillasCalc::kCalcHillasSrc);
76
77 tlist.AddToList(&read);
78 tlist.AddToList(&clean);
79 tlist.AddToList(&hcalc);
80
81 //
82 // Open output file:
83 //
84 MWriteRootFile write(OutFilename); // Writes output
85 write.AddContainer("MRawRunHeader", "RunHeaders");
86 write.AddContainer("MMcRunHeader", "RunHeaders", kFALSE);
87 write.AddContainer("MSrcPosCam", "RunHeaders");
88 write.AddContainer("MMcEvt", "Events", kFALSE);
89 write.AddContainer("MPointingPos", "Events", kFALSE);
90 write.AddContainer("MHillas", "Events");
91 write.AddContainer("MHillasExt", "Events");
92 write.AddContainer("MHillasSrc", "Events");
93 write.AddContainer("MNewImagePar", "Events");
94
95 tlist.AddToList(&write); // Add task to write output.
96
97 //
98 // analysis loop
99 //
100
101 MEvtLoop evtloop;
102 MProgressBar bar;
103 bar.SetWindowName("Analyzing...");
104 evtloop.SetProgressBar(&bar);
105 evtloop.SetParList(&plist);
106
107 if (!evtloop.Eventloop())
108 return;
109
110 tlist.PrintStatistics();
111
112 return;
113}
Note: See TracBrowser for help on using the repository browser.