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

Last change on this file since 9492 was 6514, checked in by moralejo, 20 years ago
*** empty log message ***
File size: 4.7 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_gamma_train.root"; // File to be analyzed
41 Char_t* AnalysisFilename = "calibrated_gamma_test.root"; // File to be analyzed
42
43 TString* OutFilename;
44
45 // Output file name
46 // OutFilename = new TString("star_gamma_train.root"); // Output file name
47 OutFilename = new TString("star_gamma_test.root"); // Output file name
48
49 MImgCleanStd clean(10., 5.); // Applies tail cuts to image.
50 clean.SetMethod(MImgCleanStd::kAbsolute);
51
52 // WARNING: the tightness of the tail cuts depends on the signal extraction method
53 // used in mccalibrate.C!! (some methods result in positively biased signals)
54
55 // ------------------------------------------------------------------
56
57 //
58 // Create a empty Parameter List and an empty Task List
59 // The tasklist is identified in the eventloop by its name
60 //
61 MParList plist;
62
63 MTaskList tlist;
64
65 plist.AddToList(&tlist);
66
67 MSrcPosCam src;
68 //
69 // FOR WOBBLE MODE!! Set source position on camera here.
70 // src.SetX(120.);
71 // units: mm. This 120 mm correspond to MC wobble mode w+ for zbin>0
72 //
73
74 src.SetReadyToSave();
75
76 plist.AddToList(&src);
77
78 //
79 // Now setup the tasks and tasklist:
80 // ---------------------------------
81 //
82 MReadMarsFile read("Events");
83
84 read.AddFile(AnalysisFilename);
85 read.DisableAutoScheme();
86
87
88 MHillasCalc hcalc; // Calculates Hillas parameters not dependent on source position.
89 hcalc.Enable(MHillasCalc::kCalcHillasSrc);
90
91 tlist.AddToList(&read);
92 tlist.AddToList(&clean);
93 tlist.AddToList(&hcalc);
94
95 //
96 // Open output file(s):
97 //
98 MWriteRootFile write(OutFilename->Data()); // Writes output
99 //
100 // Add MC containers only if they exist.
101 // In this way you can also run on real calibrated data.
102 //
103 write.AddContainer("MRawRunHeader", "RunHeaders");
104 write.AddContainer("MMcRunHeader", "RunHeaders", kFALSE);
105 write.AddContainer("MGeomCam", "RunHeaders", kFALSE);
106 write.AddContainer("MMcConfigRunHeader", "RunHeaders", kFALSE);
107 write.AddContainer("MMcCorsikaRunHeader", "RunHeaders", kFALSE);
108 write.AddContainer("MMcFadcHeader", "RunHeaders", kFALSE);
109 write.AddContainer("MMcTrigHeader", "RunHeaders", kFALSE);
110
111 write.AddContainer("MMcEvt", "Events", kFALSE);
112 write.AddContainer("MPointingPos", "Events", kFALSE);
113 write.AddContainer("MMcTrig", "Events", kFALSE);
114 write.AddContainer("MSrcPosCam", "Events", kFALSE);
115 write.AddContainer("MRawEvtHeader", "Events");
116 write.AddContainer("MHillas", "Events");
117 write.AddContainer("MHillasExt", "Events");
118 write.AddContainer("MHillasSrc", "Events");
119 write.AddContainer("MImagePar", "Events");
120 write.AddContainer("MNewImagePar", "Events");
121 write.AddContainer("MConcentration","Events");
122
123 //
124 // Next line makes that the tree "OriginalMC" containing the MMcEvtBasic
125 // container for all produced Corsika events from which the events in the
126 // normal "Events" tree derive:
127 //
128 write.AddCopySource("OriginalMC");
129
130 tlist.AddToList(&write);
131
132 //
133 // analysis loop
134 //
135
136 MEvtLoop evtloop;
137 MProgressBar bar;
138 bar.SetWindowName("Analyzing...");
139 evtloop.SetProgressBar(&bar);
140 evtloop.SetParList(&plist);
141
142 if (!evtloop.Eventloop())
143 return;
144
145 tlist.PrintStatistics();
146
147 return;
148}
Note: See TracBrowser for help on using the repository browser.