| 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 | // | 
|---|
| 27 | // MCalibrationPedCam | 
|---|
| 28 | // | 
|---|
| 29 | // Hold the pedestal Calibration results obtained from MHPedestalCam of the camera: | 
|---|
| 30 | // | 
|---|
| 31 | // The calculated values (types of GetPixelContent) are: | 
|---|
| 32 | // | 
|---|
| 33 | // Fitted values: | 
|---|
| 34 | // ============== | 
|---|
| 35 | // | 
|---|
| 36 | // 0: Fitted Pedestal | 
|---|
| 37 | // 1: Error of fitted Pedestal | 
|---|
| 38 | // 2: Sigma of fitted Pedestal | 
|---|
| 39 | // 3: Error of Sigma of fitted Pedestal | 
|---|
| 40 | // | 
|---|
| 41 | // Useful variables derived from the fit results: | 
|---|
| 42 | // ============================================= | 
|---|
| 43 | // | 
|---|
| 44 | // 4: Returned probability of Gauss fit to Pedestal distribution | 
|---|
| 45 | // | 
|---|
| 46 | ///////////////////////////////////////////////////////////////////////////// | 
|---|
| 47 | #include "MCalibrationPedCam.h" | 
|---|
| 48 |  | 
|---|
| 49 | #include <TOrdCollection.h> | 
|---|
| 50 |  | 
|---|
| 51 | #include "MLog.h" | 
|---|
| 52 | #include "MLogManip.h" | 
|---|
| 53 |  | 
|---|
| 54 | #include "MGeomCam.h" | 
|---|
| 55 | #include "MGeomPix.h" | 
|---|
| 56 |  | 
|---|
| 57 | #include "MCalibrationPix.h" | 
|---|
| 58 |  | 
|---|
| 59 | ClassImp(MCalibrationPedCam); | 
|---|
| 60 |  | 
|---|
| 61 | using namespace std; | 
|---|
| 62 |  | 
|---|
| 63 | // -------------------------------------------------------------------------- | 
|---|
| 64 | // | 
|---|
| 65 | // Default constructor. | 
|---|
| 66 | // | 
|---|
| 67 | // Creates a TClonesArray of MCalibrationPix containers, initialized to 1 entry, destinated | 
|---|
| 68 | // to hold one container per pixel. Later, a call to MCalibrationRelTimeCam::InitSize() | 
|---|
| 69 | // has to be performed (in MGeomApply). | 
|---|
| 70 | // | 
|---|
| 71 | // Creates a TClonesArray of MCalibrationPix containers, initialized to 1 entry, destinated | 
|---|
| 72 | // to hold one container per pixel AREA. Later, a call to MCalibrationRelTimeCam::InitAreas() | 
|---|
| 73 | // has to be performed (in MGeomApply). | 
|---|
| 74 | // | 
|---|
| 75 | // Creates a TClonesArray of MCalibrationPix containers, initialized to 1 entry, destinated | 
|---|
| 76 | // to hold one container per camera SECTOR. Later, a call to MCalibrationRelTimeCam::InitSectors() | 
|---|
| 77 | // has to be performed (in MGeomApply). | 
|---|
| 78 | // | 
|---|
| 79 | MCalibrationPedCam::MCalibrationPedCam(const char *name, const char *title) | 
|---|
| 80 | { | 
|---|
| 81 | fName  = name  ? name  : "MCalibrationPedCam"; | 
|---|
| 82 | fTitle = title ? title : "Storage container for the Pedestal Calibration Results in the camera"; | 
|---|
| 83 |  | 
|---|
| 84 | } | 
|---|
| 85 |  | 
|---|
| 86 | // -------------------------------------------------------------------------- | 
|---|
| 87 | // | 
|---|
| 88 | // The calculated values (types of GetPixelContent) are: | 
|---|
| 89 | // | 
|---|
| 90 | // Fitted values: | 
|---|
| 91 | // ============== | 
|---|
| 92 | // | 
|---|
| 93 | // 0: Fitted Pedestal | 
|---|
| 94 | // 1: Error of fitted Pedestal | 
|---|
| 95 | // 2: Sigma of fitted Pedestal | 
|---|
| 96 | // 3: Error of Sigma of fitted Pedestal | 
|---|
| 97 | // | 
|---|
| 98 | // Useful variables derived from the fit results: | 
|---|
| 99 | // ============================================= | 
|---|
| 100 | // | 
|---|
| 101 | // 4: Returned probability of Gauss fit to Pedestal distribution | 
|---|
| 102 | // | 
|---|
| 103 | Bool_t MCalibrationPedCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const | 
|---|
| 104 | { | 
|---|
| 105 |  | 
|---|
| 106 | if (idx > GetSize()) | 
|---|
| 107 | return kFALSE; | 
|---|
| 108 |  | 
|---|
| 109 | Float_t area = cam[idx].GetA(); | 
|---|
| 110 |  | 
|---|
| 111 | if (area == 0) | 
|---|
| 112 | return kFALSE; | 
|---|
| 113 |  | 
|---|
| 114 | if ((*this)[idx].IsExcluded()) | 
|---|
| 115 | return kFALSE; | 
|---|
| 116 |  | 
|---|
| 117 | switch (type) | 
|---|
| 118 | { | 
|---|
| 119 | case 0: | 
|---|
| 120 | val = (*this)[idx].GetHiGainMean(); | 
|---|
| 121 | break; | 
|---|
| 122 | case 1: | 
|---|
| 123 | val = (*this)[idx].GetHiGainMeanErr(); | 
|---|
| 124 | break; | 
|---|
| 125 | case 2: | 
|---|
| 126 | val = (*this)[idx].GetHiGainSigma(); | 
|---|
| 127 | break; | 
|---|
| 128 | case 3: | 
|---|
| 129 | val = (*this)[idx].GetHiGainSigmaErr(); | 
|---|
| 130 | break; | 
|---|
| 131 | case 4: | 
|---|
| 132 | val = (*this)[idx].GetHiGainProb(); | 
|---|
| 133 | break; | 
|---|
| 134 | case 5: | 
|---|
| 135 | val = (*this)[idx].GetLoGainMean(); | 
|---|
| 136 | break; | 
|---|
| 137 | case 6: | 
|---|
| 138 | val = (*this)[idx].GetLoGainMeanErr(); | 
|---|
| 139 | break; | 
|---|
| 140 | case 7: | 
|---|
| 141 | val = (*this)[idx].GetLoGainSigma(); | 
|---|
| 142 | break; | 
|---|
| 143 | case 8: | 
|---|
| 144 | val = (*this)[idx].GetLoGainSigmaErr(); | 
|---|
| 145 | break; | 
|---|
| 146 | default: | 
|---|
| 147 | return kFALSE; | 
|---|
| 148 | } | 
|---|
| 149 |  | 
|---|
| 150 | return val!=-1.; | 
|---|
| 151 |  | 
|---|
| 152 | } | 
|---|