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 | MMcCalibrationUpdate mccalibupdate;
|
---|
81 |
|
---|
82 | //
|
---|
83 | // Now introduce conversion factor from ADC counts to photons before camera for
|
---|
84 | // inner pixels. The corresponding value for outer pixels is then calculated
|
---|
85 | // automatically. Bear in mind that the conversion factor depend both on the
|
---|
86 | // parameters used in the camera simulation as well as on the number of
|
---|
87 | // integrated FADC slices. In the future it should be calculated in a previous
|
---|
88 | // event loop, either from the same MC file or from a MC calibration file
|
---|
89 | // written on purpose.
|
---|
90 | // (FIXME: the conversion must be calculated automatically from the analyzed file)
|
---|
91 | //
|
---|
92 | mccalibupdate.SetADC2PhInner(1.2586);
|
---|
93 |
|
---|
94 |
|
---|
95 | MCalibrate calib; // Transforms signals from ADC counts into photons.
|
---|
96 |
|
---|
97 | // MBlindPixelCalc blind;
|
---|
98 | // blind.SetUseInterpolation();
|
---|
99 |
|
---|
100 | MImgCleanStd clean(4.1,3.4); // Applies tail cuts to image.
|
---|
101 |
|
---|
102 |
|
---|
103 | MHillasCalc hcalc; // Calculates Hillas parameters not dependent on source position.
|
---|
104 | MHillasSrcCalc scalc; // Calculates source-dependent Hillas parameters
|
---|
105 | // (!!Preliminary!! Will be removed later!)
|
---|
106 |
|
---|
107 |
|
---|
108 | // ------------- user change -----------------
|
---|
109 |
|
---|
110 | MWriteRootFile write("star_mc.root"); // Writes output
|
---|
111 |
|
---|
112 | write.AddContainer("MRawRunHeader", "RunHeaders");
|
---|
113 | write.AddContainer("MMcRunHeader", "RunHeaders");
|
---|
114 | write.AddContainer("MSrcPosCam", "RunHeaders");
|
---|
115 | write.AddContainer("MMcEvt", "Events");
|
---|
116 | write.AddContainer("MHillas", "Events");
|
---|
117 | write.AddContainer("MHillasExt", "Events");
|
---|
118 | write.AddContainer("MHillasSrc", "Events");
|
---|
119 | write.AddContainer("MNewImagePar", "Events");
|
---|
120 |
|
---|
121 |
|
---|
122 | tlist.AddToList(&read);
|
---|
123 | tlist.AddToList(&geom);
|
---|
124 | tlist.AddToList(&pcopy);
|
---|
125 |
|
---|
126 | tlist.AddToList(&sigextract);
|
---|
127 | tlist.AddToList(&mccalibupdate);
|
---|
128 | tlist.AddToList(&calib);
|
---|
129 | tlist.AddToList(&clean);
|
---|
130 | // tlist.AddToList(&blind);
|
---|
131 | tlist.AddToList(&hcalc);
|
---|
132 | tlist.AddToList(&scalc);
|
---|
133 | tlist.AddToList(&write);
|
---|
134 |
|
---|
135 | //
|
---|
136 | // Create and set up the eventloop
|
---|
137 | //
|
---|
138 | MProgressBar bar;
|
---|
139 |
|
---|
140 | MEvtLoop evtloop;
|
---|
141 | evtloop.SetProgressBar(&bar);
|
---|
142 | evtloop.SetParList(&plist);
|
---|
143 |
|
---|
144 | //
|
---|
145 | // Execute your analysis
|
---|
146 | //
|
---|
147 | if (!evtloop.Eventloop())
|
---|
148 | return;
|
---|
149 |
|
---|
150 | tlist.PrintStatistics();
|
---|
151 | }
|
---|