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 | // STARMC - STandard Analysis and Reconstruction (MC example)
|
---|
29 | //
|
---|
30 | // This macro is a version of the standard converter to convert raw data
|
---|
31 | // into image parameters, made to show how to run analysis on MC files.
|
---|
32 | //
|
---|
33 | /////////////////////////////////////////////////////////////////////////////
|
---|
34 |
|
---|
35 | #include "MImgCleanStd.h"
|
---|
36 |
|
---|
37 | void starmc()
|
---|
38 | {
|
---|
39 | //
|
---|
40 | // This is a demonstration program which calculates the image
|
---|
41 | // parameters from Magic Monte Carlo files (output of camera).
|
---|
42 |
|
---|
43 | //
|
---|
44 | // Create a empty Parameter List and an empty Task List
|
---|
45 | // The tasklist is identified in the eventloop by its name
|
---|
46 | //
|
---|
47 | MParList plist;
|
---|
48 |
|
---|
49 | MTaskList tlist;
|
---|
50 |
|
---|
51 | plist.AddToList(&tlist);
|
---|
52 |
|
---|
53 | MSrcPosCam src;
|
---|
54 | src.SetReadyToSave();
|
---|
55 |
|
---|
56 | plist.AddToList(&src);
|
---|
57 |
|
---|
58 | //
|
---|
59 | // Now setup the tasks and tasklist:
|
---|
60 | // ---------------------------------
|
---|
61 | //
|
---|
62 | MReadMarsFile read("Events");
|
---|
63 |
|
---|
64 | // ------------- user change -----------------
|
---|
65 |
|
---|
66 | read.AddFile("Gamma_zbin*.root");
|
---|
67 |
|
---|
68 | read.DisableAutoScheme();
|
---|
69 |
|
---|
70 | MGeomApply geom; // Reads in geometry from MC file and sets the right sizes for
|
---|
71 | // several parameter containers.
|
---|
72 |
|
---|
73 | MMcPedestalCopy pcopy;
|
---|
74 | // Copies pedestal data from the MC file run fadc header to the MPedestalCam container.
|
---|
75 |
|
---|
76 | MExtractSignal sigextract;
|
---|
77 | // Define ADC slices to be integrated in high and low gain:
|
---|
78 | sigextract.SetRange(0, 5, 0, 5);
|
---|
79 |
|
---|
80 | MMcCalibrationCalc mccalibcalc;
|
---|
81 | // Define conversion factor from ADC counts to photons before camera for
|
---|
82 | // inner pixels. The corresponding value for outer pixels is then calculated
|
---|
83 | // automatically. Bear in mind that the conversion factor depend both on the
|
---|
84 | // parameters used in the camera simulation as well as on the number of
|
---|
85 | // integrated FADC slices. In the future it should be calculated in a previous
|
---|
86 | // event loop, either from the same MC file or from a MC calibration file
|
---|
87 | // written on purpose.
|
---|
88 | mccalibcalc.SetADC2PhInner(1.2586);
|
---|
89 |
|
---|
90 |
|
---|
91 | MCalibrate calib; // Transforms signals from ADC counts into photons.
|
---|
92 |
|
---|
93 | // MBlindPixelCalc blind;
|
---|
94 | // blind.SetUseInterpolation();
|
---|
95 |
|
---|
96 | MImgCleanStd clean(4.1,3.4); // Applies tail cuts to image.
|
---|
97 |
|
---|
98 |
|
---|
99 | MHillasCalc hcalc; // Calculates Hillas parameters not dependent on source position.
|
---|
100 | MHillasSrcCalc scalc; // Calculates source-dependent Hillas parameters
|
---|
101 | // (!!Preliminary!! Will be removed later!)
|
---|
102 |
|
---|
103 |
|
---|
104 | // ------------- user change -----------------
|
---|
105 |
|
---|
106 | MWriteRootFile write("star_mc.root"); // Writes output
|
---|
107 |
|
---|
108 | write.AddContainer("MRawRunHeader", "RunHeaders");
|
---|
109 | write.AddContainer("MMcRunHeader", "RunHeaders");
|
---|
110 | write.AddContainer("MSrcPosCam", "RunHeaders");
|
---|
111 | write.AddContainer("MMcEvt", "Events");
|
---|
112 | write.AddContainer("MHillas", "Events");
|
---|
113 | write.AddContainer("MHillasExt", "Events");
|
---|
114 | write.AddContainer("MHillasSrc", "Events");
|
---|
115 | write.AddContainer("MNewImagePar", "Events");
|
---|
116 |
|
---|
117 |
|
---|
118 | tlist.AddToList(&read);
|
---|
119 | tlist.AddToList(&geom);
|
---|
120 | tlist.AddToList(&pcopy);
|
---|
121 | tlist.AddToList(&sigextract);
|
---|
122 | tlist.AddToList(&mccalibcalc);
|
---|
123 | tlist.AddToList(&calib);
|
---|
124 | tlist.AddToList(&clean);
|
---|
125 | // tlist.AddToList(&blind);
|
---|
126 | tlist.AddToList(&hcalc);
|
---|
127 | tlist.AddToList(&scalc);
|
---|
128 | tlist.AddToList(&write);
|
---|
129 |
|
---|
130 | //
|
---|
131 | // Create and set up the eventloop
|
---|
132 | //
|
---|
133 | MProgressBar bar;
|
---|
134 |
|
---|
135 | MEvtLoop evtloop;
|
---|
136 | evtloop.SetProgressBar(&bar);
|
---|
137 | evtloop.SetParList(&plist);
|
---|
138 |
|
---|
139 | //
|
---|
140 | // Execute your analysis
|
---|
141 | //
|
---|
142 | if (!evtloop.Eventloop())
|
---|
143 | return;
|
---|
144 |
|
---|
145 | tlist.PrintStatistics();
|
---|
146 | }
|
---|