| 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-2003
|
|---|
| 21 | !
|
|---|
| 22 | !
|
|---|
| 23 | \* ======================================================================== */
|
|---|
| 24 |
|
|---|
| 25 | void calibration(TString pedname="../../Mars-0.8.2/20031102_02399_P_Unavailable_E.root",
|
|---|
| 26 | TString calname="../../Mars-0.8.2/20031102_02400_D_Flip500Hz_E.root")
|
|---|
| 27 | {
|
|---|
| 28 |
|
|---|
| 29 | //
|
|---|
| 30 | // Create a empty Parameter List and an empty Task List
|
|---|
| 31 | // The tasklist is identified in the eventloop by its name
|
|---|
| 32 | //
|
|---|
| 33 | MParList plist;
|
|---|
| 34 |
|
|---|
| 35 | MTaskList tlist;
|
|---|
| 36 | plist.AddToList(&tlist);
|
|---|
| 37 |
|
|---|
| 38 | //
|
|---|
| 39 | // Now setup the tasks and tasklist for the pedestals:
|
|---|
| 40 | // ---------------------------------------------------
|
|---|
| 41 | //
|
|---|
| 42 |
|
|---|
| 43 | MReadMarsFile read("Events", pedname);
|
|---|
| 44 | read.DisableAutoScheme();
|
|---|
| 45 |
|
|---|
| 46 | MGeomApply geomapl;
|
|---|
| 47 | MPedCalcPedRun pedcalc;
|
|---|
| 48 | MGeomCamMagic geomcam;
|
|---|
| 49 | MPedestalCam pedcam;
|
|---|
| 50 |
|
|---|
| 51 | tlist.AddToList(&read);
|
|---|
| 52 | tlist.AddToList(&geomapl);
|
|---|
| 53 | tlist.AddToList(&pedcalc);
|
|---|
| 54 |
|
|---|
| 55 | plist.AddToList(&pedcam);
|
|---|
| 56 |
|
|---|
| 57 | MHCamEvent hist("Pedestal");
|
|---|
| 58 | hist.SetType(0);
|
|---|
| 59 | plist.AddToList(&hist);
|
|---|
| 60 | MFillH fill(&hist, "MPedestalCam");
|
|---|
| 61 |
|
|---|
| 62 | tlist.AddToList(&fill);
|
|---|
| 63 |
|
|---|
| 64 | // MStatusDisplay *d1 = new MStatusDisplay;
|
|---|
| 65 |
|
|---|
| 66 | // Set update time to 3s
|
|---|
| 67 | // d1->SetUpdateTime(3000);
|
|---|
| 68 |
|
|---|
| 69 | //
|
|---|
| 70 | // Create and setup the eventloop
|
|---|
| 71 | //
|
|---|
| 72 | MEvtLoop evtloop;
|
|---|
| 73 | evtloop.SetParList(&plist);
|
|---|
| 74 | // evtloop.SetDisplay(d1);
|
|---|
| 75 |
|
|---|
| 76 | //
|
|---|
| 77 | // Execute first analysis
|
|---|
| 78 | //
|
|---|
| 79 | if (!evtloop.Eventloop())
|
|---|
| 80 | return;
|
|---|
| 81 |
|
|---|
| 82 | tlist.PrintStatistics();
|
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 | //
|
|---|
| 86 | // Create a empty Parameter List and an empty Task List
|
|---|
| 87 | //
|
|---|
| 88 | MParList plist2;
|
|---|
| 89 |
|
|---|
| 90 | MTaskList tlist2;
|
|---|
| 91 | plist2.AddToList(&tlist2);
|
|---|
| 92 |
|
|---|
| 93 |
|
|---|
| 94 | plist2.AddToList((MPedestalCam*)plist.FindObject("MPedestalCam"));
|
|---|
| 95 |
|
|---|
| 96 | // MGeomApply geomapl2;
|
|---|
| 97 | tlist2.AddToList(&geomapl);
|
|---|
| 98 |
|
|---|
| 99 | //
|
|---|
| 100 | // Now setup the new tasks and tasklist for the calibration
|
|---|
| 101 | // ---------------------------------------------------
|
|---|
| 102 | //
|
|---|
| 103 |
|
|---|
| 104 | MReadMarsFile read2("Events", calname);
|
|---|
| 105 | read2.DisableAutoScheme();
|
|---|
| 106 |
|
|---|
| 107 | MCalibrationCalc calcalc;
|
|---|
| 108 | // calcalc.SetSkipTFits();
|
|---|
| 109 |
|
|---|
| 110 | plist2.AddToList(&geomcam);
|
|---|
| 111 |
|
|---|
| 112 | //
|
|---|
| 113 | // As long, as we don't have digital modules,
|
|---|
| 114 | // we have to set the color of the pulser LED by hand
|
|---|
| 115 | //
|
|---|
| 116 | calcalc.SetPulserColor(MCalibrationCalc::kEBlue);
|
|---|
| 117 |
|
|---|
| 118 | tlist2.AddToList(&read2);
|
|---|
| 119 | tlist2.AddToList(&calcalc);
|
|---|
| 120 |
|
|---|
| 121 | MHCamEvent hist2;
|
|---|
| 122 | hist2.SetType(8);
|
|---|
| 123 | plist2.AddToList(&hist2);
|
|---|
| 124 | MFillH fill2("MHCamEvent", "MCalibrationCam");
|
|---|
| 125 | tlist2.AddToList(&fill2);
|
|---|
| 126 |
|
|---|
| 127 | //
|
|---|
| 128 | // Create and setup the eventloop
|
|---|
| 129 | //
|
|---|
| 130 | MEvtLoop evtloop2;
|
|---|
| 131 | evtloop2.SetParList(&plist2);
|
|---|
| 132 |
|
|---|
| 133 | //
|
|---|
| 134 | // Execute second analysis
|
|---|
| 135 | //
|
|---|
| 136 | if (!evtloop2.Eventloop())
|
|---|
| 137 | return;
|
|---|
| 138 |
|
|---|
| 139 | tlist2.PrintStatistics();
|
|---|
| 140 |
|
|---|
| 141 | //
|
|---|
| 142 | // just one example how to get the plots of individual pixels
|
|---|
| 143 | //
|
|---|
| 144 | MCalibrationCam *cam = plist2.FindObject("MCalibrationCam");
|
|---|
| 145 | cam.Print();
|
|---|
| 146 |
|
|---|
| 147 | Int_t pixnr;
|
|---|
| 148 |
|
|---|
| 149 | while (1)
|
|---|
| 150 | {
|
|---|
| 151 |
|
|---|
| 152 | cout << "Which pixel number do you want to display? (Press 0 to exit)" << endl;
|
|---|
| 153 | cin >> pixnr;
|
|---|
| 154 | if (pixnr == 0)
|
|---|
| 155 | break;
|
|---|
| 156 |
|
|---|
| 157 | if (pixnr >= 577)
|
|---|
| 158 | break;
|
|---|
| 159 |
|
|---|
| 160 | MCalibrationPix *pix = cam->GetCalibrationPix(pixnr);
|
|---|
| 161 | pix->Draw();
|
|---|
| 162 |
|
|---|
| 163 | }
|
|---|
| 164 |
|
|---|
| 165 | //
|
|---|
| 166 | // Here we are confronted to a serious bug in ROOT:
|
|---|
| 167 | // If we do not apply the next command, gPad will get
|
|---|
| 168 | // screwed up completely: (Thanks to tbretz for finding out
|
|---|
| 169 | // the reason during several hours!!!)
|
|---|
| 170 | //
|
|---|
| 171 | gROOT->GetListOfCanvases()->Delete();
|
|---|
| 172 |
|
|---|
| 173 | MHCamEvent &h = *(MHCamEvent*)plist2->FindObject("MHCamEvent");
|
|---|
| 174 | MHCamera &disp0 = *h.GetHistByName();
|
|---|
| 175 | MHCamera disp1 (geomcam, "MCalibrationCam;q", "Fitted Mean Charges");
|
|---|
| 176 | MHCamera disp2 (geomcam, "MCalibrationCam;errq", "Error of Fitted Mean Charges");
|
|---|
| 177 | MHCamera disp3 (geomcam, "MCalibrationCam;sigmaq", "Sigma of Fitted Mean Charges");
|
|---|
| 178 | MHCamera disp4 (geomcam, "MCalibrationCam;errsigmaq", "Error of Sigma of Fitted Mean Charges");
|
|---|
| 179 | MHCamera disp5 (geomcam, "MCalibrationCam;probq", "Probability of Fit");
|
|---|
| 180 | MHCamera disp6 (geomcam, "MCalibrationCam;t", "Arrival Times");
|
|---|
| 181 | MHCamera disp7 (geomcam, "MCalibrationCam;sigmat", "Sigma of Arrival Times");
|
|---|
| 182 | MHCamera disp8 (geomcam, "MCalibrationCam;probt", "Probability of Time Fit");
|
|---|
| 183 | MHCamera disp9 (geomcam, "MCalibrationCam;ped", "Pedestals");
|
|---|
| 184 | MHCamera disp10 (geomcam, "MCalibrationCam;pedrms", "Pedestal RMS");
|
|---|
| 185 | MHCamera disp11 (geomcam, "MCalibrationCam;rq", "Reduced Charges");
|
|---|
| 186 | MHCamera disp12 (geomcam, "MCalibrationCam;rsigma", "Reduced Sigmas");
|
|---|
| 187 | MHCamera disp13 (geomcam, "MCalibrationCam;phe", "Nr. of Phe's (F-Factor Method)");
|
|---|
| 188 | MHCamera disp14 (geomcam, "MCalibrationCam;convphe", "Conversion Factor (F-Factor Method)");
|
|---|
| 189 | MHCamera disp15 (geomcam, "MCalibrationCam;photons", "Nr. of Photons (Blind Pixel Method)");
|
|---|
| 190 | MHCamera disp16 (geomcam, "MCalibrationCam;convphot", "Conversion Factor (Blind Pixel Method)");
|
|---|
| 191 |
|
|---|
| 192 | disp1.SetCamContent(*cam, 0);
|
|---|
| 193 | disp2.SetCamContent(*cam, 1);
|
|---|
| 194 | disp3.SetCamContent(*cam, 2);
|
|---|
| 195 | disp4.SetCamContent(*cam, 3);
|
|---|
| 196 | disp5.SetCamContent(*cam, 4);
|
|---|
| 197 | disp6.SetCamContent(*cam, 5);
|
|---|
| 198 | disp7.SetCamContent(*cam, 6);
|
|---|
| 199 | disp8.SetCamContent(*cam, 7);
|
|---|
| 200 | disp9.SetCamContent(*cam, 8);
|
|---|
| 201 | disp10.SetCamContent(*cam, 9);
|
|---|
| 202 | disp11.SetCamContent(*cam, 10);
|
|---|
| 203 | disp12.SetCamContent(*cam, 11);
|
|---|
| 204 | disp13.SetCamContent(*cam, 12);
|
|---|
| 205 | disp14.SetCamContent(*cam, 13);
|
|---|
| 206 | disp15.SetCamContent(*cam, 14);
|
|---|
| 207 | disp16.SetCamContent(*cam, 15);
|
|---|
| 208 |
|
|---|
| 209 |
|
|---|
| 210 | disp1.SetYTitle("Q [FADC counts]");
|
|---|
| 211 | disp2.SetYTitle("\\Delta Q [FADC counts]");
|
|---|
| 212 | disp3.SetYTitle("\\sigma_{Q} [FADC counts]");
|
|---|
| 213 | disp4.SetYTitle("\\Delta {\\sigma_{Q}} [FADC counts]");
|
|---|
| 214 | disp5.SetYTitle("P [au]");
|
|---|
| 215 | disp6.SetYTitle("T [FADC slices]");
|
|---|
| 216 | disp7.SetYTitle("\\Delta T [FADC slices]");
|
|---|
| 217 | disp8.SetYTitle("P [au]");
|
|---|
| 218 | disp9.SetYTitle("P [FADC counts/ slice ]");
|
|---|
| 219 | disp10.SetYTitle("RMS_{P} [FADC counts / slice ]");
|
|---|
| 220 | disp11.SetYTitle("Q [FADC counts]");
|
|---|
| 221 | disp12.SetYTitle("\\sigma^2_{Q} - RMS^2_{P} [FADC counts^2]");
|
|---|
| 222 | disp13.SetYTitle("Nr Phe's");
|
|---|
| 223 | disp14.SetYTitle("Conversion Factor [Phe/FADC count]");
|
|---|
| 224 | disp15.SetYTitle("Nr Photons");
|
|---|
| 225 | disp16.SetYTitle("Conversion Factor [Ph/FADC count]");
|
|---|
| 226 |
|
|---|
| 227 | MStatusDisplay *d2 = new MStatusDisplay;
|
|---|
| 228 |
|
|---|
| 229 | // Set update time to 1s
|
|---|
| 230 | d2->SetUpdateTime(1000);
|
|---|
| 231 |
|
|---|
| 232 | TCanvas *c1 = &d2->AddTab("Charges Mean");
|
|---|
| 233 | c1->Divide(2, 2);
|
|---|
| 234 |
|
|---|
| 235 | TObject *obj;
|
|---|
| 236 |
|
|---|
| 237 | c1->cd(1);
|
|---|
| 238 | gStyle->SetOptStat(1111);
|
|---|
| 239 | obj=disp1.DrawCopy("hist");
|
|---|
| 240 |
|
|---|
| 241 | c1->cd(3);
|
|---|
| 242 | gPad->SetBorderMode(0);
|
|---|
| 243 | obj->Draw();
|
|---|
| 244 |
|
|---|
| 245 | c1->cd(2);
|
|---|
| 246 | gStyle->SetOptStat(1101);
|
|---|
| 247 | obj=disp2.DrawCopy("hist");
|
|---|
| 248 |
|
|---|
| 249 | c1->cd(4);
|
|---|
| 250 | gPad->SetBorderMode(0);
|
|---|
| 251 | obj->Draw();
|
|---|
| 252 |
|
|---|
| 253 | TCanvas *c11 = &d2->AddTab("Charges Sigma");
|
|---|
| 254 | c11->Divide(2, 2);
|
|---|
| 255 |
|
|---|
| 256 | c11->cd(1);
|
|---|
| 257 | gStyle->SetOptStat(1101);
|
|---|
| 258 | obj=disp3.DrawCopy("hist");
|
|---|
| 259 |
|
|---|
| 260 | c11->cd(3);
|
|---|
| 261 | gPad->SetBorderMode(0);
|
|---|
| 262 | obj->Draw();
|
|---|
| 263 |
|
|---|
| 264 | c11->cd(2);
|
|---|
| 265 | gStyle->SetOptStat(1101);
|
|---|
| 266 | obj=disp4.DrawCopy("hist");
|
|---|
| 267 |
|
|---|
| 268 | c11->cd(4);
|
|---|
| 269 | gPad->SetBorderMode(0);
|
|---|
| 270 | obj->Draw();
|
|---|
| 271 |
|
|---|
| 272 |
|
|---|
| 273 | TCanvas *c12 = &d2->AddTab("Fit Prob.");
|
|---|
| 274 | c12->Divide(1, 2);
|
|---|
| 275 |
|
|---|
| 276 | c12->cd(1);
|
|---|
| 277 | gStyle->SetOptStat(1101);
|
|---|
| 278 | obj=disp5.DrawCopy("hist");
|
|---|
| 279 |
|
|---|
| 280 | c12->cd(2);
|
|---|
| 281 | gPad->SetBorderMode(0);
|
|---|
| 282 | obj->Draw();
|
|---|
| 283 |
|
|---|
| 284 | TCanvas *c2 = &d2->AddTab("Fitted Times");
|
|---|
| 285 | c2->Divide(3, 2);
|
|---|
| 286 |
|
|---|
| 287 | c2->cd(1);
|
|---|
| 288 | gStyle->SetOptStat(1111);
|
|---|
| 289 | obj=disp6.DrawCopy("hist");
|
|---|
| 290 |
|
|---|
| 291 | c2->cd(4);
|
|---|
| 292 | obj->Draw();
|
|---|
| 293 |
|
|---|
| 294 | c2->cd(2);
|
|---|
| 295 | gStyle->SetOptStat(1101);
|
|---|
| 296 | obj=disp7.DrawCopy("hist");
|
|---|
| 297 |
|
|---|
| 298 | c2->cd(5);
|
|---|
| 299 | obj->Draw();
|
|---|
| 300 |
|
|---|
| 301 | c2->cd(3);
|
|---|
| 302 | gStyle->SetOptStat(1101);
|
|---|
| 303 | obj=disp8.DrawCopy("hist");
|
|---|
| 304 |
|
|---|
| 305 | c2->cd(6);
|
|---|
| 306 | obj->Draw();
|
|---|
| 307 |
|
|---|
| 308 | TCanvas *c3 = &d2->AddTab("Pedestals");
|
|---|
| 309 | c3->Divide(2, 2);
|
|---|
| 310 |
|
|---|
| 311 | c3->cd(1);
|
|---|
| 312 | gStyle->SetOptStat(1111);
|
|---|
| 313 | obj=disp9.DrawCopy("hist");
|
|---|
| 314 |
|
|---|
| 315 | c3->cd(3);
|
|---|
| 316 | obj->Draw();
|
|---|
| 317 |
|
|---|
| 318 | c3->cd(2);
|
|---|
| 319 | gStyle->SetOptStat(1111);
|
|---|
| 320 | obj=disp10.DrawCopy("hist");
|
|---|
| 321 |
|
|---|
| 322 | c3->cd(4);
|
|---|
| 323 | obj->Draw();
|
|---|
| 324 |
|
|---|
| 325 | TCanvas *c4 = &d2->AddTab("Reduced Charges");
|
|---|
| 326 | c4->Divide(2, 2);
|
|---|
| 327 |
|
|---|
| 328 | c4->cd(1);
|
|---|
| 329 | gStyle->SetOptStat(1111);
|
|---|
| 330 | obj=disp11.DrawCopy("hist");
|
|---|
| 331 |
|
|---|
| 332 | c4->cd(3);
|
|---|
| 333 | obj->Draw();
|
|---|
| 334 |
|
|---|
| 335 | c4->cd(2);
|
|---|
| 336 | gStyle->SetOptStat(1101);
|
|---|
| 337 | obj=disp12.DrawCopy("hist");
|
|---|
| 338 |
|
|---|
| 339 | c4->cd(4);
|
|---|
| 340 | obj->Draw();
|
|---|
| 341 |
|
|---|
| 342 | TCanvas *c5 = &d2->AddTab("F-Factor Method");
|
|---|
| 343 | c5->Divide(2, 2);
|
|---|
| 344 |
|
|---|
| 345 | c5->cd(1);
|
|---|
| 346 | gStyle->SetOptStat(1111);
|
|---|
| 347 | obj=disp13.DrawCopy("hist");
|
|---|
| 348 |
|
|---|
| 349 | c5->cd(3);
|
|---|
| 350 | obj->Draw();
|
|---|
| 351 |
|
|---|
| 352 | c5->cd(2);
|
|---|
| 353 | gStyle->SetOptStat(1101);
|
|---|
| 354 | obj=disp14.DrawCopy("hist");
|
|---|
| 355 |
|
|---|
| 356 | c5->cd(4);
|
|---|
| 357 | obj->Draw();
|
|---|
| 358 |
|
|---|
| 359 | TCanvas *c6 = &d2->AddTab("Blind Pixel Method");
|
|---|
| 360 | c6->Divide(2, 2);
|
|---|
| 361 |
|
|---|
| 362 | c6->cd(1);
|
|---|
| 363 | gStyle->SetOptStat(1111);
|
|---|
| 364 | obj=disp15.DrawCopy("hist");
|
|---|
| 365 |
|
|---|
| 366 | c6->cd(3);
|
|---|
| 367 | obj->Draw();
|
|---|
| 368 |
|
|---|
| 369 | c6->cd(2);
|
|---|
| 370 | gStyle->SetOptStat(1101);
|
|---|
| 371 | obj=disp16.DrawCopy("hist");
|
|---|
| 372 |
|
|---|
| 373 | c6->cd(4);
|
|---|
| 374 | obj->Draw();
|
|---|
| 375 |
|
|---|
| 376 |
|
|---|
| 377 | #endif
|
|---|
| 378 |
|
|---|
| 379 | }
|
|---|
| 380 |
|
|---|