| 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): Thomas Bretz  07/2011 <mailto:thomas.bretz@epfl.ch> | 
|---|
| 19 | ! | 
|---|
| 20 | !   Copyright: MAGIC Software Development, 2000-2013 | 
|---|
| 21 | ! | 
|---|
| 22 | ! | 
|---|
| 23 | \* ======================================================================== */ | 
|---|
| 24 |  | 
|---|
| 25 | /////////////////////////////////////////////////////////////////////// | 
|---|
| 26 | // | 
|---|
| 27 | // MHDrsCalibration | 
|---|
| 28 | // | 
|---|
| 29 | // This class contains a list of MHFadcPix. | 
|---|
| 30 | // | 
|---|
| 31 | /////////////////////////////////////////////////////////////////////// | 
|---|
| 32 | #include "MDrsCalibration.h" | 
|---|
| 33 |  | 
|---|
| 34 | #include <fstream> | 
|---|
| 35 | #include <sstream> | 
|---|
| 36 | #include <limits.h> | 
|---|
| 37 |  | 
|---|
| 38 | #include "MH.h" | 
|---|
| 39 |  | 
|---|
| 40 | #include "MLog.h" | 
|---|
| 41 | #include "MLogManip.h" | 
|---|
| 42 |  | 
|---|
| 43 | #include "MParList.h" | 
|---|
| 44 | #include "MGeomCam.h" | 
|---|
| 45 |  | 
|---|
| 46 | #include "MRawEvtData.h" | 
|---|
| 47 | #include "MRawRunHeader.h" | 
|---|
| 48 | #include "MHCamera.h" | 
|---|
| 49 |  | 
|---|
| 50 | #include <TH2.h> | 
|---|
| 51 |  | 
|---|
| 52 | ClassImp(MDrsCalibration); | 
|---|
| 53 |  | 
|---|
| 54 | using namespace std; | 
|---|
| 55 |  | 
|---|
| 56 | void MDrsCalibration::Plot() | 
|---|
| 57 | { | 
|---|
| 58 | TVirtualPad *pad = gPad ? gPad : MH::MakeDefCanvas(this); | 
|---|
| 59 | pad->SetBorderMode(0); | 
|---|
| 60 |  | 
|---|
| 61 | //AppendPad(); | 
|---|
| 62 |  | 
|---|
| 63 | pad->Divide(2,2); | 
|---|
| 64 |  | 
|---|
| 65 | MH::SetPalette(); | 
|---|
| 66 |  | 
|---|
| 67 | pad->cd(1); | 
|---|
| 68 | gPad->SetBorderMode(0); | 
|---|
| 69 | gPad->SetFrameBorderMode(0); | 
|---|
| 70 | gPad->SetRightMargin(0.15); | 
|---|
| 71 |  | 
|---|
| 72 | TH2F h1("Physcial", "Primary baseline (physical pipeline)", 1440, -0.5, 1439.5, 1024, -0.5, 1023.5); | 
|---|
| 73 | h1.SetStats(kFALSE); | 
|---|
| 74 | h1.SetXTitle("Pixel"); | 
|---|
| 75 | h1.SetYTitle("Cell"); | 
|---|
| 76 | h1.SetZTitle("mV"); | 
|---|
| 77 | h1.GetYaxis()->SetTitleOffset(1.2); | 
|---|
| 78 | h1.GetZaxis()->SetTitleOffset(1.2); | 
|---|
| 79 | for (int p=0; p<1440; p++) | 
|---|
| 80 | for (int c=0; c<1024; c++) | 
|---|
| 81 | h1.SetBinContent(p+1, c+1, fOffset[p*1024+c]); | 
|---|
| 82 | h1.Scale(125./fNumOffset/256); | 
|---|
| 83 | h1.DrawCopy("colz"); | 
|---|
| 84 |  | 
|---|
| 85 | pad->cd(2); | 
|---|
| 86 | gPad->SetBorderMode(0); | 
|---|
| 87 | gPad->SetFrameBorderMode(0); | 
|---|
| 88 | gPad->SetRightMargin(0.15); | 
|---|
| 89 |  | 
|---|
| 90 | TH2F h2("Gain", "Gain measurement (physcial pipeline)", 1440, -0.5, 1439.5, 1024, -0.5, 1023.5); | 
|---|
| 91 | h2.SetStats(kFALSE); | 
|---|
| 92 | h2.SetXTitle("Pixel"); | 
|---|
| 93 | h2.SetYTitle("Cell"); | 
|---|
| 94 | h2.SetZTitle("mV"); | 
|---|
| 95 | h2.GetYaxis()->SetTitleOffset(1.2); | 
|---|
| 96 | h2.GetZaxis()->SetTitleOffset(1.2); | 
|---|
| 97 | for (int p=0; p<1440; p++) | 
|---|
| 98 | for (int c=0; c<1024; c++) | 
|---|
| 99 | h2.SetBinContent(p+1, c+1, fGain[p*1024+c]); | 
|---|
| 100 | h2.Scale(125.*1953125/(fNumOffset*fNumGain)/256/1024); | 
|---|
| 101 | h2.DrawCopy("colz"); | 
|---|
| 102 |  | 
|---|
| 103 | pad->cd(3); | 
|---|
| 104 | gPad->SetBorderMode(0); | 
|---|
| 105 | gPad->SetFrameBorderMode(0); | 
|---|
| 106 | gPad->SetRightMargin(0.15); | 
|---|
| 107 |  | 
|---|
| 108 | TH2F h3("Logical", "Secondary baseline (logical pipeline)", 1440, -0.5, 1439.5, fRoi, -0.5, fRoi-0.5); | 
|---|
| 109 | h3.SetStats(kFALSE); | 
|---|
| 110 | h3.SetXTitle("Pixel"); | 
|---|
| 111 | h3.SetYTitle("Channel"); | 
|---|
| 112 | h3.SetZTitle("mV"); | 
|---|
| 113 | h3.GetYaxis()->SetTitleOffset(1.2); | 
|---|
| 114 | h3.GetZaxis()->SetTitleOffset(1.2); | 
|---|
| 115 | for (int p=0; p<1440; p++) | 
|---|
| 116 | for (int c=0; c<fRoi; c++) | 
|---|
| 117 | h3.SetBinContent(p+1, c+1, fTrgOff[p*fRoi+c]); | 
|---|
| 118 | h3.Scale(125./(fNumOffset*fNumTrgOff)/256); | 
|---|
| 119 | h3.GetYaxis()->SetRangeUser(4, fRoi-4); | 
|---|
| 120 | h3.DrawCopy("colz"); | 
|---|
| 121 |  | 
|---|
| 122 | pad->cd(4); | 
|---|
| 123 | gPad->SetFrameBorderMode(0); | 
|---|
| 124 | } | 
|---|