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): Martin Merck, 05/2004 <mailto:merck@astro.uni-wuerzburg.de>
|
---|
19 | ! Markus Gaug, 11/2003 <mailto:markus@ifae.es>
|
---|
20 | !
|
---|
21 | ! Copyright: MAGIC Software Development, 2000-2004
|
---|
22 | !
|
---|
23 | !
|
---|
24 | \* ======================================================================== */
|
---|
25 | /////////////////////////////////////////////////////////////////////////////
|
---|
26 | //
|
---|
27 | // stdPed.C
|
---|
28 | //
|
---|
29 | // This macros is based on the calibration macro from Markus Gaug.
|
---|
30 | // It processes a Pedestal file and writes a file with the containers
|
---|
31 | //
|
---|
32 | // Needed arguments are retrieved from the file "marsconfig".
|
---|
33 | // A typical config file looks like this:
|
---|
34 | // inpath: /data/MAGIC/Period015/rootdata/2004_03_21/
|
---|
35 | // outpath: /data/MAGIC/Period015/calibdata/2004_03_21/
|
---|
36 | // pedfile001: 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 loops over the pedestal file using the class MJPedestal
|
---|
45 | //
|
---|
46 | /////////////////////////////////////////////////////////////////////////////
|
---|
47 |
|
---|
48 | void stdPed()
|
---|
49 | {
|
---|
50 | // turn of colors for logging to a file
|
---|
51 | gLog.SetNoColors();
|
---|
52 |
|
---|
53 | // Get configuration from the "marsconfig" configuration file.
|
---|
54 | TEnv env("marsconfig");
|
---|
55 |
|
---|
56 | // Here we get the input and output directory paths from the configuration
|
---|
57 | // file
|
---|
58 | const char* inpath = env.GetValue("inpath",".");
|
---|
59 | const char* outpath = env.GetValue("outpath",".");
|
---|
60 |
|
---|
61 | //
|
---|
62 | // Choose the signal Extractor:
|
---|
63 | //
|
---|
64 | // MExtractFixedWindowPeakSearch extractor;
|
---|
65 | // MExtractSlidingWindow extractor;
|
---|
66 | MExtractFixedWindow extractor;
|
---|
67 |
|
---|
68 | //
|
---|
69 | // Set Ranges or Windows
|
---|
70 | //
|
---|
71 | extractor.SetRange(3,14,3,14);
|
---|
72 | // extractor.SetWindows(8,8);
|
---|
73 |
|
---|
74 | //
|
---|
75 | // Choose the arrival time Extractor:
|
---|
76 | //
|
---|
77 | // MExtractTimeHighestIntegral timeext;
|
---|
78 | MExtractTimeFastSpline timeext;
|
---|
79 | //
|
---|
80 | // Set Ranges or Windows
|
---|
81 | //
|
---|
82 | timeext.SetRange(2,12,4,14);
|
---|
83 |
|
---|
84 | // Get all pedestal files to process
|
---|
85 | // You can specify up to 999 files in the marsconfig file
|
---|
86 | // all files are concatenated and processed as one single file.
|
---|
87 | MRunIter pruns;
|
---|
88 | char str[11];
|
---|
89 | for( Int_t i = 1 ; i<1000; i++)
|
---|
90 | {
|
---|
91 | sprintf( str, "pedfile%03d", i);
|
---|
92 | Int_t prun = env.GetValue( str, 0);
|
---|
93 | if( prun == 0)
|
---|
94 | break;
|
---|
95 | pruns.AddRun(prun,inpath);
|
---|
96 | }
|
---|
97 |
|
---|
98 | gStyle->SetOptStat(1);
|
---|
99 | gStyle->SetOptFit();
|
---|
100 |
|
---|
101 | // We do not use any display here.
|
---|
102 | MStatusDisplay *display = new MStatusDisplay;
|
---|
103 | display->SetUpdateTime(3000);
|
---|
104 | display->Resize(850,700);
|
---|
105 |
|
---|
106 | /************************/
|
---|
107 | /* PEDESTAL COMPUTATION */
|
---|
108 | /************************/
|
---|
109 |
|
---|
110 | MCalibrationQECam qecam;
|
---|
111 | MBadPixelsCam badcam;
|
---|
112 | MGeomCamMagic geomcam;
|
---|
113 | MGeomApply geomapl;
|
---|
114 | //
|
---|
115 | // If you want to exclude pixels from the beginning, read
|
---|
116 | // an ascii-file with the corr. pixel numbers (see MBadPixelsCam)
|
---|
117 | //
|
---|
118 | // badcam.AsciiRead("badpixels.dat");
|
---|
119 |
|
---|
120 | MJPedestal pedloop;
|
---|
121 | pedloop.SetExtractor(&extractor);
|
---|
122 | pedloop.SetInput(&pruns);
|
---|
123 | pedloop.SetOutputPath(outpath);
|
---|
124 | pedloop.SetDisplay(display);
|
---|
125 | pedloop.SetBadPixels(badcam);
|
---|
126 |
|
---|
127 | if (!pedloop.Process())
|
---|
128 | return;
|
---|
129 |
|
---|
130 | }
|
---|
131 |
|
---|
132 |
|
---|