| 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 02/2004 <mailto:markus@ifae.es>
|
|---|
| 19 | !
|
|---|
| 20 | ! Copyright: MAGIC Software Development, 2000-2004
|
|---|
| 21 | !
|
|---|
| 22 | \* ======================================================================== */
|
|---|
| 23 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 24 | // //
|
|---|
| 25 | // MCalibrationPix //
|
|---|
| 26 | // //
|
|---|
| 27 | // Base Storage container for a calibration pixel. Holds mean and sigmas,
|
|---|
| 28 | // their errors, the fit probability and the number of pickup events for
|
|---|
| 29 | // the high-gain and the low-gain derived values.
|
|---|
| 30 | //
|
|---|
| 31 | // Errors are stored internally as variances, but are returned and filled
|
|---|
| 32 | // as square root of the variances.
|
|---|
| 33 | //
|
|---|
| 34 | // Calls to GetMean(), GetMeanErr(), GetSigma(), GetSigmaErr(), GetProb() or
|
|---|
| 35 | // GetNumPickup() test first the bit kHiGainSaturation before returning
|
|---|
| 36 | // the high-gain or low-gain value, analogue for the corr. Setters.
|
|---|
| 37 | //
|
|---|
| 38 | // The three flags: kValid, kExcluded and kHiGainSaturation may be set.
|
|---|
| 39 | //
|
|---|
| 40 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 41 | #include "MCalibrationPix.h"
|
|---|
| 42 |
|
|---|
| 43 | ClassImp(MCalibrationPix);
|
|---|
| 44 |
|
|---|
| 45 | using namespace std;
|
|---|
| 46 |
|
|---|
| 47 | // --------------------------------------------------------------------------
|
|---|
| 48 | //
|
|---|
| 49 | // Default Constructor:
|
|---|
| 50 | //
|
|---|
| 51 | // Sets:
|
|---|
| 52 | // - fPixId to -1
|
|---|
| 53 | // - fFlags to 0
|
|---|
| 54 | //
|
|---|
| 55 | // Calls:
|
|---|
| 56 | // - Clear()
|
|---|
| 57 | //
|
|---|
| 58 | MCalibrationPix::MCalibrationPix(const char *name, const char *title)
|
|---|
| 59 | : fPixId(-1),
|
|---|
| 60 | fFlags(0)
|
|---|
| 61 | {
|
|---|
| 62 |
|
|---|
| 63 | fName = name ? name : "MCalibrationPix";
|
|---|
| 64 | fTitle = title ? title : "Container of the fit results of MHCalibrationPixs ";
|
|---|
| 65 |
|
|---|
| 66 | Clear();
|
|---|
| 67 |
|
|---|
| 68 | }
|
|---|
| 69 |
|
|---|
| 70 | // ------------------------------------------------------------------------
|
|---|
| 71 | //
|
|---|
| 72 | // Sets:
|
|---|
| 73 | // - all variables to -1
|
|---|
| 74 | // - all flags to kFALSE
|
|---|
| 75 | //
|
|---|
| 76 | void MCalibrationPix::Clear(Option_t *o)
|
|---|
| 77 | {
|
|---|
| 78 |
|
|---|
| 79 | fHiGainNumPickup = -1 ;
|
|---|
| 80 | fHiGainMean = -1.;
|
|---|
| 81 | fHiGainMeanVar = -1.;
|
|---|
| 82 | fHiGainProb = -1.;
|
|---|
| 83 | fHiGainSigma = -1.;
|
|---|
| 84 | fHiGainSigmaVar = -1.;
|
|---|
| 85 |
|
|---|
| 86 | fLoGainNumPickup = -1 ;
|
|---|
| 87 | fLoGainMean = -1.;
|
|---|
| 88 | fLoGainMeanVar = -1.;
|
|---|
| 89 | fLoGainProb = -1.;
|
|---|
| 90 | fLoGainSigma = -1.;
|
|---|
| 91 | fLoGainSigmaVar = -1.;
|
|---|
| 92 |
|
|---|
| 93 | SetHiGainSaturation ( kFALSE );
|
|---|
| 94 | SetExcluded ( kFALSE );
|
|---|
| 95 | SetValid ( kFALSE );
|
|---|
| 96 |
|
|---|
| 97 | }
|
|---|
| 98 |
|
|---|
| 99 | // --------------------------------------------------------------------------
|
|---|
| 100 | //
|
|---|
| 101 | // Set the Hi Gain Saturation Bit from outside
|
|---|
| 102 | //
|
|---|
| 103 | void MCalibrationPix::SetHiGainSaturation(Bool_t b)
|
|---|
| 104 | {
|
|---|
| 105 | b ? SETBIT(fFlags, kHiGainSaturation) : CLRBIT(fFlags, kHiGainSaturation);
|
|---|
| 106 | }
|
|---|
| 107 |
|
|---|
| 108 |
|
|---|
| 109 | // --------------------------------------------------------------------------
|
|---|
| 110 | //
|
|---|
| 111 | // Set the Excluded Bit from outside
|
|---|
| 112 | //
|
|---|
| 113 | void MCalibrationPix::SetExcluded(Bool_t b )
|
|---|
| 114 | {
|
|---|
| 115 | b ? SETBIT(fFlags, kExcluded) : CLRBIT(fFlags, kExcluded);
|
|---|
| 116 | }
|
|---|
| 117 |
|
|---|
| 118 | // --------------------------------------------------------------------------
|
|---|
| 119 | //
|
|---|
| 120 | // Set the Valid Bit from outside
|
|---|
| 121 | //
|
|---|
| 122 | void MCalibrationPix::SetValid(Bool_t b )
|
|---|
| 123 | {
|
|---|
| 124 | b ? SETBIT(fFlags, kValid) : CLRBIT(fFlags, kValid);
|
|---|
| 125 | }
|
|---|
| 126 |
|
|---|
| 127 | // --------------------------------------------------------------------------
|
|---|
| 128 | //
|
|---|
| 129 | // Get the High Gain Mean Error: Takes square root of fHiGainMeanVar
|
|---|
| 130 | //
|
|---|
| 131 | Float_t MCalibrationPix::GetHiGainMeanErr() const
|
|---|
| 132 | {
|
|---|
| 133 | return TMath::Sqrt(fHiGainMeanVar);
|
|---|
| 134 | }
|
|---|
| 135 |
|
|---|
| 136 | // --------------------------------------------------------------------------
|
|---|
| 137 | //
|
|---|
| 138 | // Get the High Gain Sigma Error: Takes square root of fHiGainSigmaVar
|
|---|
| 139 | //
|
|---|
| 140 | Float_t MCalibrationPix::GetHiGainSigmaErr() const
|
|---|
| 141 | {
|
|---|
| 142 | return TMath::Sqrt(fHiGainSigmaVar);
|
|---|
| 143 | }
|
|---|
| 144 |
|
|---|
| 145 | // --------------------------------------------------------------------------
|
|---|
| 146 | //
|
|---|
| 147 | // Get the Low Gain Mean Error: Takes square root of fHiGainMeanVar
|
|---|
| 148 | //
|
|---|
| 149 | Float_t MCalibrationPix::GetLoGainMeanErr() const
|
|---|
| 150 | {
|
|---|
| 151 | return TMath::Sqrt(fLoGainMeanVar);
|
|---|
| 152 | }
|
|---|
| 153 |
|
|---|
| 154 |
|
|---|
| 155 | // --------------------------------------------------------------------------
|
|---|
| 156 | //
|
|---|
| 157 | // Get the Low Gain Sigma Error: Takes square root of fHiGainSigmaVar
|
|---|
| 158 | //
|
|---|
| 159 | Float_t MCalibrationPix::GetLoGainSigmaErr() const
|
|---|
| 160 | {
|
|---|
| 161 | return TMath::Sqrt(fLoGainSigmaVar);
|
|---|
| 162 | }
|
|---|
| 163 |
|
|---|
| 164 | // --------------------------------------------------------------------------
|
|---|
| 165 | //
|
|---|
| 166 | // Test bit kHiGainSaturation
|
|---|
| 167 | //
|
|---|
| 168 | Bool_t MCalibrationPix::IsHiGainSaturation() const
|
|---|
| 169 | {
|
|---|
| 170 | return TESTBIT(fFlags,kHiGainSaturation);
|
|---|
| 171 | }
|
|---|
| 172 |
|
|---|
| 173 | // --------------------------------------------------------------------------
|
|---|
| 174 | //
|
|---|
| 175 | // Test bit kExcluded
|
|---|
| 176 | //
|
|---|
| 177 | Bool_t MCalibrationPix::IsExcluded() const
|
|---|
| 178 | {
|
|---|
| 179 | return TESTBIT(fFlags,kExcluded);
|
|---|
| 180 | }
|
|---|
| 181 |
|
|---|
| 182 | // --------------------------------------------------------------------------
|
|---|
| 183 | //
|
|---|
| 184 | // Test bit kValid
|
|---|
| 185 | //
|
|---|
| 186 | Bool_t MCalibrationPix::IsValid() const
|
|---|
| 187 | {
|
|---|
| 188 | return TESTBIT(fFlags,kValid);
|
|---|
| 189 | }
|
|---|
| 190 |
|
|---|