source: trunk/MagicSoft/Mars/macros/calibration.C@ 3906

Last change on this file since 3906 was 3906, checked in by gaug, 20 years ago
*** empty log message ***
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// calibration.C
27//
28// Needs as arguments the run number of a calibration file ("*_C_*.root") and
29// the run number of the corresponding pedestal file ("*_P_*.root").
30//
31// The TString inpath has to be set correctly.
32//
33// The macro searches for the pulser colour which corresponds to the calibration
34// run number. If the run number is smaller than 20000, pulser colour "CT1"
35// is assumed, otherwise, it searches for the strings "green", "blue", "uv" or
36// "ct1" in the filenames. If no colour or multiple colours are found, the
37// execution is aborted.
38//
39// The container MBadPixelsCam is created and followed during the execution of the
40// rest of the macro.
41//
42// A first loop over the pedestal file is performed using the class MJPedestal
43//
44// The container MCalibrationQECam is created and followed during the execution of the
45// rest of the macro.
46//
47// A loop over the calibration files is performed using the class MJCalibration.
48// The results are displayed using the MJCalibration::SetNormalDisplay() facility,
49// but other displays can easily be uncommented.
50// The call to MJCalibration skips the relative time calibration, which can be
51// uncommented as well.
52//
53// Last, a third loop is performed over the calibration file again in order to
54// "calibrate" it and test the resulting outcome.
55//
56/////////////////////////////////////////////////////////////////////////////
57//static const TString inpath = "/home/rootdata/Calib/2004_04_16/";
58static const TString inpath = "/mnt/Data/rootdata/CrabNebula/2003_12_01/";
59static const Int_t pedrun = 3340;
60static const Int_t calrun1 = 3341;
61static const Int_t calrun2 = 0;
62/*
63static const Int_t pedrun = 22265;
64static const Int_t calrun1 = 22300;
65static const Int_t calrun2 = 0;
66*/
67void calibration(const Int_t prun=pedrun, const Int_t crun1=calrun1, const Int_t crun2=calrun2)
68{
69
70 MExtractFixedWindowPeakSearch extractor;
71 extractor.SetRange(0,6,0,6);
72
73 /*
74 MExtractTimeSpline timeext;
75 timeext.SetRange(0,14,6,14);
76 */
77
78 MRunIter pruns;
79 MRunIter cruns;
80
81 pruns.AddRun(prun,inpath);
82
83 if (crun2==0)
84 cruns.AddRun(crun1,inpath);
85 else
86 cruns.AddRuns(crun1,crun2,inpath);
87
88 gStyle->SetOptStat(1);
89 gStyle->SetOptFit();
90
91 MStatusDisplay *display = new MStatusDisplay;
92 display->SetUpdateTime(3000);
93 display->Resize(850,700);
94
95 /************************************/
96 /* FIRST LOOP: PEDESTAL COMPUTATION */
97 /************************************/
98
99 MCalibrationQECam qecam;
100 MBadPixelsCam badcam;
101 MGeomCamMagic geomcam;
102 MGeomApply geomapl;
103 //
104 // If you want to exclude pixels from the beginning, read
105 // an ascii-file with the corr. pixel numbers (see MBadPixelsCam)
106 //
107 // badcam.AsciiRead("badpixels.dat");
108
109 MJPedestal pedloop;
110 pedloop.SetExtractor(&extractor);
111 pedloop.SetInput(&pruns);
112 pedloop.SetDisplay(display);
113 pedloop.SetBadPixels(badcam);
114
115 if (!pedloop.Process())
116 return;
117
118 /****************************************/
119 /* SECOND LOOP: CALIBRATION COMPUTATION */
120 /****************************************/
121
122 MJCalibration calloop;
123
124 //
125 // If you want to run the data-check on RAW DATA!!!, choose:
126 // calloop.SetDataCheck();
127 //
128 // If you want to see the data-check plots only, choose:
129 // calloop.SetDataCheckDisplay();
130 //
131 // For everything, you have ever dreamed of, choose:
132 // calloop.SetFullDisplay();
133
134 //
135 // If you want to calibrate the times as well, choose:
136 //
137 calloop.SetRelTimeCalibration();
138 calloop.SetExtractor(&extractor);
139 // calloop.SetArrivalTimeLevel(1);
140 // calloop.SetTimeExtractor(&timeext);
141 calloop.SetInput(&cruns);
142 calloop.SetDisplay(display);
143 calloop.SetQECam(qecam);
144 calloop.SetBadPixels(pedloop.GetBadPixels());
145 if (!calloop.Process(pedloop.GetPedestalCam()))
146 return;
147
148 /*
149 MCalibrationChargeCam &chargecam = calloop.GetCalibrationCam();
150 MLog juanlog;
151 juanlog.SetOutputFile("test.txt",1);
152 chargecam.SetLogStream(&juanlog);
153 chargecam.Print();
154 chargecam.SetLogStream(&gLog);
155 */
156
157 /********************************************************************/
158 /* THIRD LOOP: APPLY CALIBRATION TO THE CALIBRATION FILES FOR TESTS */
159 /********************************************************************/
160
161 MJExtractCalibTest testloop;
162
163 testloop.SetExtractor(&extractor);
164 testloop.SetInput(&cruns);
165 testloop.SetDisplay(display);
166 testloop.SetBadPixels(calloop.GetBadPixels());
167 if (!testloop.ProcessD(pedloop.GetPedestalCam(),calloop.GetCalibrationCam(),calloop.GetQECam()))
168 return;
169
170}
171
Note: See TracBrowser for help on using the repository browser.