source: trunk/MagicSoft/Mars/mtemp/mwuerzburg/macros/singleCalib.C@ 5138

Last change on this file since 5138 was 4208, checked in by merck, 21 years ago
MMerck: First commit to CVS.
File size: 5.4 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): 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//
66static const Bool_t useTimes = kTRUE;
67//static const Bool_t useTimes = kFALSE;
68
69void singleCalib()
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 const char* inpath = "/data/MAGIC/Period016/rootdata2/2004_04_16";
85 const char* outpath = "/data/MAGIC/Period016/calibdata/2004_04_16";
86 Int_t prun = 22351;
87 Int_t crun = 22323;
88
89
90 //
91 // Choose the signal Extractor:
92 //
93 // MExtractFixedWindowPeakSearch extractor;
94 // MExtractSlidingWindow extractor;
95 MExtractFixedWindow extractor;
96
97 //
98 // Set Ranges or Windows
99 //
100 extractor.SetRange(3,14,3,14);
101 // extractor.SetWindows(8,8);
102
103 //
104 // Choose the arrival time Extractor:
105 //
106 // MExtractTimeHighestIntegral timeext;
107 MExtractTimeFastSpline timeext;
108 //
109 // Set Ranges or Windows
110 //
111 timeext.SetRange(2,12,4,14);
112
113 MRunIter pruns;
114 MRunIter cruns;
115
116 pruns.AddRun(prun,inpath);
117 cruns.AddRun(crun,inpath);
118
119 gLog << "Perestal Runs: " << pruns.GetRunsAsString() << " " << pruns.GetNumEntries() << endl;
120 gLog << "Calib Runs: " << cruns.GetRunsAsString() << " " << cruns.GetNumEntries() << endl;
121
122 gStyle->SetOptStat(1);
123 gStyle->SetOptFit();
124
125 MStatusDisplay *display = new MStatusDisplay;
126 display->SetUpdateTime(3000);
127 display->Resize(850,700);
128
129 MCalibrationQECam qecam;
130 MBadPixelsCam badcam;
131
132 //
133 // If you want to exclude pixels from the beginning, read
134 // an ascii-file with the corr. pixel numbers (see MBadPixelsCam)
135 //
136// badcam.AsciiRead("badpixels.dat");
137
138
139 /************************************/
140 /* LOOP1: READ PEDESTAL INFORMATION */
141 /************************************/
142 MJPedestal pedloop;
143 pedloop.SetInput(&pruns);
144 pedloop.SetOutputPath(outpath); // This is needed to read the pedestal container file
145
146 if (!pedloop.Process())
147 return;
148
149 /**********************************/
150 /* LOOP2: CALIBRATION COMPUTATION */
151 /**********************************/
152 MJCalibration calloop;
153
154 //
155 // If you want to calibrate the times as well, choose:
156 //
157 calloop.SetRelTimeCalibration(useTimes);
158 calloop.SetExtractor(&extractor);
159 calloop.SetTimeExtractor(&timeext);
160 calloop.SetInput(&cruns);
161 calloop.SetOutputPath(outpath);
162 calloop.SetDisplay(display);
163 calloop.SetQECam(qecam);
164 calloop.SetBadPixels(pedloop.GetBadPixels());
165
166// TObject::SetObjectStat(kTRUE);
167
168 calloop.Process(pedloop.GetPedestalCam());
169
170// gObjectTable->Print();
171
172}
173
174
Note: See TracBrowser for help on using the repository browser.