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

Last change on this file since 3016 was 2982, checked in by moralejo, 21 years ago
*** empty log message ***
File size: 3.6 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_mc.root"; // Output file name
42
43 Float_t CleanLev[2] = {4., 3.}; // Tail cuts for image analysis
44
45 Int_t BinsHigh[2] = {5, 9}; // First and last FADC bin of the range to be integrated,
46 Int_t BinsLow[2] = {5, 9}; // for high and low gain respectively.
47
48 // ------------------------------------------------------------------
49
50 //
51 // Create a empty Parameter List and an empty Task List
52 // The tasklist is identified in the eventloop by its name
53 //
54 MParList plist;
55
56 MTaskList tlist;
57
58 plist.AddToList(&tlist);
59
60 MSrcPosCam src;
61 src.SetReadyToSave();
62
63 plist.AddToList(&src);
64
65 //
66 // Now setup the tasks and tasklist:
67 // ---------------------------------
68 //
69 MReadMarsFile read("Events");
70
71 read.AddFile(AnalysisFilename);
72
73 read.DisableAutoScheme();
74
75 MImgCleanStd clean(CleanLev[0], CleanLev[1]); // Applies tail cuts to image.
76
77 MHillasCalc hcalc; // Calculates Hillas parameters not dependent on source position.
78 MHillasSrcCalc scalc; // Calculates source-dependent Hillas parameters
79
80 tlist.AddToList(&read);
81 tlist.AddToList(&clean);
82 // tlist.AddToList(&blind);
83 tlist.AddToList(&hcalc);
84 tlist.AddToList(&scalc); // Calculates Source-dependent Hillas parameters
85
86 //
87 // Open output file:
88 //
89 MWriteRootFile write(OutFilename); // Writes output
90 write.AddContainer("MRawRunHeader", "RunHeaders");
91 write.AddContainer("MMcRunHeader", "RunHeaders");
92 write.AddContainer("MSrcPosCam", "RunHeaders");
93 write.AddContainer("MMcEvt", "Events");
94 write.AddContainer("MHillas", "Events");
95 write.AddContainer("MHillasExt", "Events");
96 write.AddContainer("MHillasSrc", "Events");
97 write.AddContainer("MNewImagePar", "Events");
98
99 tlist.AddToList(&write); // Add task to write output.
100
101 //
102 // analysis loop
103 //
104
105 MEvtLoop evtloop;
106 MProgressBar bar;
107 bar.SetWindowName("Analyzing...");
108 evtloop.SetProgressBar(&bar);
109 evtloop.SetParList(&plist);
110
111 if (!evtloop.Eventloop())
112 return;
113
114 tlist.PrintStatistics();
115
116 return;
117}
Note: See TracBrowser for help on using the repository browser.