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): Markus Gaug, 11/2003 <mailto:markus@ifae.es>
|
---|
19 | !
|
---|
20 | ! Copyright: MAGIC Software Development, 2000-2004
|
---|
21 | !
|
---|
22 | !
|
---|
23 | \* ======================================================================== */
|
---|
24 | /////////////////////////////////////////////////////////////////////////////
|
---|
25 | //
|
---|
26 | // stdCalib.C
|
---|
27 | //
|
---|
28 | // This macros is based on the calibration macro from Markus Gaug.
|
---|
29 | // It processes a Pedestal file and writes a file with the containers
|
---|
30 | //
|
---|
31 | // Needed arguments are retrieved from the file "marsconfig".
|
---|
32 | // A typical config file looks like this:
|
---|
33 | // inpath: /data/MAGIC/Period015/rootdata/2004_03_21/
|
---|
34 | // outpath: /data/MAGIC/Period015/calibdata/2004_03_21/
|
---|
35 | // pedfile: 21297
|
---|
36 | // calfile: 21297
|
---|
37 | //
|
---|
38 | // inpath: is the path to the merpped root files
|
---|
39 | // outpath: is the path where to store the F0 files
|
---|
40 | // pedfilexxx: specifies which pedestal files to use. If more then 1 file
|
---|
41 | // is specified, all files are processed but only 1 output file
|
---|
42 | // is written.
|
---|
43 | //
|
---|
44 | // The macro searches for the pulser colour which corresponds to the calibration
|
---|
45 | // run number. If the run number is smaller than 20000, pulser colour "CT1"
|
---|
46 | // is assumed, otherwise, it searches for the strings "green", "blue", "uv" or
|
---|
47 | // "ct1" in the filenames. If no colour or multiple colours are found, the
|
---|
48 | // execution is aborted.
|
---|
49 | //
|
---|
50 | // The container MBadPixelsCam is created and followed during the execution of the
|
---|
51 | // rest of the macro.
|
---|
52 | //
|
---|
53 | // The container MCalibrationQECam is created and followed during the execution of the
|
---|
54 | // rest of the macro.
|
---|
55 | //
|
---|
56 | // A loop over the calibration files is performed using the class MJCalibration.
|
---|
57 | // The call to MJCalibration skips the relative time calibration, which can be
|
---|
58 | // uncommented as well.
|
---|
59 | //
|
---|
60 | /////////////////////////////////////////////////////////////////////////////
|
---|
61 |
|
---|
62 |
|
---|
63 | //
|
---|
64 | // Tell if you want to calibrate times:
|
---|
65 | //
|
---|
66 | static const Bool_t useTimes = kTRUE;
|
---|
67 | //static const Bool_t useTimes = kFALSE;
|
---|
68 |
|
---|
69 | void stdCalib()
|
---|
70 | {
|
---|
71 |
|
---|
72 | // turn of colors for logging to a file
|
---|
73 | gLog.SetNoColors();
|
---|
74 |
|
---|
75 | // Get configuration from the "marsconfig" configuration file.
|
---|
76 | TEnv env("marsconfig");
|
---|
77 |
|
---|
78 | // Here we get the input and output directory paths from the configuration
|
---|
79 | // file
|
---|
80 | const char* inpath = env.GetValue("inpath",".");
|
---|
81 | const char* outpath = env.GetValue("outpath",".");
|
---|
82 | Int_t prun = env.GetValue( "pedfile", 0);
|
---|
83 | Int_t crun = env.GetValue( "calfile", 0);
|
---|
84 |
|
---|
85 |
|
---|
86 | //
|
---|
87 | // Choose the signal Extractor:
|
---|
88 | //
|
---|
89 | // MExtractFixedWindowPeakSearch extractor;
|
---|
90 | // MExtractSlidingWindow extractor;
|
---|
91 | MExtractFixedWindow extractor;
|
---|
92 |
|
---|
93 | //
|
---|
94 | // Set Ranges or Windows
|
---|
95 | //
|
---|
96 | extractor.SetRange(3,14,3,14);
|
---|
97 | // extractor.SetWindows(8,8);
|
---|
98 |
|
---|
99 | //
|
---|
100 | // Choose the arrival time Extractor:
|
---|
101 | //
|
---|
102 | // MExtractTimeHighestIntegral timeext;
|
---|
103 | MExtractTimeFastSpline timeext;
|
---|
104 | //
|
---|
105 | // Set Ranges or Windows
|
---|
106 | //
|
---|
107 | timeext.SetRange(2,12,4,14);
|
---|
108 |
|
---|
109 | MRunIter pruns;
|
---|
110 | MRunIter cruns;
|
---|
111 |
|
---|
112 | pruns.AddRun(prun,inpath);
|
---|
113 | cruns.AddRun(crun,inpath);
|
---|
114 |
|
---|
115 | gStyle->SetOptStat(1);
|
---|
116 | gStyle->SetOptFit();
|
---|
117 |
|
---|
118 | MStatusDisplay *display = new MStatusDisplay;
|
---|
119 | display->SetUpdateTime(3000);
|
---|
120 | display->Resize(850,700);
|
---|
121 |
|
---|
122 | MCalibrationQECam qecam;
|
---|
123 | MBadPixelsCam badcam;
|
---|
124 |
|
---|
125 | //
|
---|
126 | // If you want to exclude pixels from the beginning, read
|
---|
127 | // an ascii-file with the corr. pixel numbers (see MBadPixelsCam)
|
---|
128 | //
|
---|
129 | // badcam.AsciiRead("badpixels.dat");
|
---|
130 |
|
---|
131 |
|
---|
132 | /************************************/
|
---|
133 | /* LOOP1: READ PEDESTAL INFORMATION */
|
---|
134 | /************************************/
|
---|
135 | MJPedestal pedloop;
|
---|
136 | pedloop.SetInput(&pruns);
|
---|
137 | pedloop.SetOutputPath(outpath); // This is needed to read the pedestal container file
|
---|
138 |
|
---|
139 | if (!pedloop.Process())
|
---|
140 | return;
|
---|
141 |
|
---|
142 | /**********************************/
|
---|
143 | /* LOOP2: CALIBRATION COMPUTATION */
|
---|
144 | /**********************************/
|
---|
145 | MJCalibration calloop;
|
---|
146 |
|
---|
147 | //
|
---|
148 | // If you want to calibrate the times as well, choose:
|
---|
149 | //
|
---|
150 | calloop.SetRelTimeCalibration(useTimes);
|
---|
151 | calloop.SetExtractor(&extractor);
|
---|
152 | calloop.SetTimeExtractor(&timeext);
|
---|
153 | calloop.SetInput(&cruns);
|
---|
154 | calloop.SetOutputPath(outpath);
|
---|
155 | calloop.SetDisplay(display);
|
---|
156 | calloop.SetQECam(qecam);
|
---|
157 | calloop.SetBadPixels(pedloop.GetBadPixels());
|
---|
158 |
|
---|
159 | // TObject::SetObjectStat(kTRUE);
|
---|
160 |
|
---|
161 | calloop.Process(pedloop.GetPedestalCam());
|
---|
162 |
|
---|
163 | // gObjectTable->Print();
|
---|
164 |
|
---|
165 | }
|
---|
166 |
|
---|
167 |
|
---|