| 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 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 26 | // //
|
|---|
| 27 | // MCalibrationChargePix //
|
|---|
| 28 | // //
|
|---|
| 29 | // Storage container to hold informations about the calibration values //
|
|---|
| 30 | // values of one Pixel (PMT). //
|
|---|
| 31 | // //
|
|---|
| 32 | // The following values are initialized to meaningful values:
|
|---|
| 33 | //
|
|---|
| 34 | // - The Electronic Rms to 1.5 per FADC slice
|
|---|
| 35 | // - The uncertainty about the Electronic RMS to 0.3 per slice
|
|---|
| 36 | // - The F-Factor is assumed to have been measured in Munich to 1.13 - 1.17.
|
|---|
| 37 | // with the Munich definition of the F-Factor, thus:
|
|---|
| 38 | // F = Sigma(Out)/Mean(Out) * Mean(In)/Sigma(In)
|
|---|
| 39 | // Mean F-Factor = 1.15
|
|---|
| 40 | // Error F-Factor = 0.02
|
|---|
| 41 | //
|
|---|
| 42 | // - Average QE: (email David Paneque, 14.2.04):
|
|---|
| 43 | //
|
|---|
| 44 | // The conversion factor that comes purely from QE folded to a Cherenkov
|
|---|
| 45 | // spectrum has to be multiplied by:
|
|---|
| 46 | // * Plexiglass window -->> 0.96 X 0.96
|
|---|
| 47 | // * PMT photoelectron collection efficiency -->> 0.9
|
|---|
| 48 | // * Light guides efficiency -->> 0.94
|
|---|
| 49 | //
|
|---|
| 50 | // Concerning the light guides effiency estimation... Daniel Ferenc
|
|---|
| 51 | // is preparing some work (simulations) to estimate it. Yet so far, he has
|
|---|
| 52 | // been busy with other stuff, and this work is still UNfinished.
|
|---|
| 53 | //
|
|---|
| 54 | // The estimation I did comes from:
|
|---|
| 55 | // 1) Reflectivity of light guide walls is 85 % (aluminum)
|
|---|
| 56 | // 2) At ZERO degree light incidence, 37% of the light hits such walls
|
|---|
| 57 | // (0.15X37%= 5.6% of light lost)
|
|---|
| 58 | // 3) When increasing the light incidence angle, more and more light hits
|
|---|
| 59 | // the walls.
|
|---|
| 60 | //
|
|---|
| 61 | // However, the loses due to larger amount of photons hitting the walls is more
|
|---|
| 62 | // or less counteracted by the fact that more and more photon trajectories cross
|
|---|
| 63 | // the PMT photocathode twice, increasing the effective sensitivity of the PMT.
|
|---|
| 64 | //
|
|---|
| 65 | // Jurgen Gebauer did some quick measurements about this issue. I attach a
|
|---|
| 66 | // plot. You can see that the angular dependence is (more or less) in agreement
|
|---|
| 67 | // with a CosTheta function (below 20-25 degrees),
|
|---|
| 68 | // which is the variation of teh entrance window cross section. So, in
|
|---|
| 69 | // first approximation, no loses when increasing light incidence angle;
|
|---|
| 70 | // and therefore, the factor 0.94.
|
|---|
| 71 | //
|
|---|
| 72 | // So, summarizing... I would propose the following conversion factors
|
|---|
| 73 | // (while working with CT1 cal box) in order to get the final number of photons
|
|---|
| 74 | // from the detected measured size in ADC counts.
|
|---|
| 75 | //
|
|---|
| 76 | // Nph = ADC * FmethodConversionFactor / ConvPhe-PhFactor
|
|---|
| 77 | //
|
|---|
| 78 | // FmethodConversionFactor ; measured for individual pmts
|
|---|
| 79 | //
|
|---|
| 80 | // ConvPhe-PhFactor = 0.98 * 0.23 * 0.90 * 0.94 * 0.96 * 0.96 = 0.18
|
|---|
| 81 | //
|
|---|
| 82 | // I would not apply any smearing of this factor (which we have in nature),
|
|---|
| 83 | // since we might be applying it to PMTs in the totally wrong direction.
|
|---|
| 84 | //
|
|---|
| 85 | //
|
|---|
| 86 | // Error of all variables are calculated by error-propagation. Note that internally,
|
|---|
| 87 | // all error variables contain Variances in order to save the CPU-intensive square rooting
|
|---|
| 88 | //
|
|---|
| 89 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 90 | #include "MCalibrationChargePix.h"
|
|---|
| 91 |
|
|---|
| 92 | #include "MLog.h"
|
|---|
| 93 | #include "MLogManip.h"
|
|---|
| 94 |
|
|---|
| 95 | #include "MBadPixelsPix.h"
|
|---|
| 96 |
|
|---|
| 97 | ClassImp(MCalibrationChargePix);
|
|---|
| 98 |
|
|---|
| 99 | using namespace std;
|
|---|
| 100 |
|
|---|
| 101 | const Float_t MCalibrationChargePix::gkElectronicPedRms = 1.5;
|
|---|
| 102 | const Float_t MCalibrationChargePix::gkElectronicPedRmsErr = 0.3;
|
|---|
| 103 | const Float_t MCalibrationChargePix::gkFFactor = 1.15;
|
|---|
| 104 | const Float_t MCalibrationChargePix::gkFFactorErr = 0.02;
|
|---|
| 105 |
|
|---|
| 106 | const Float_t MCalibrationChargePix::gkConversionHiLo = 10.;
|
|---|
| 107 | const Float_t MCalibrationChargePix::gkConversionHiLoErr = 2.5;
|
|---|
| 108 |
|
|---|
| 109 | const Float_t MCalibrationChargePix::fgChargeLimit = 3.;
|
|---|
| 110 | const Float_t MCalibrationChargePix::fgChargeErrLimit = 0.;
|
|---|
| 111 | const Float_t MCalibrationChargePix::fgChargeRelErrLimit = 1.;
|
|---|
| 112 | const Float_t MCalibrationChargePix::fgTimeLimit = 1.5;
|
|---|
| 113 | const Float_t MCalibrationChargePix::fgTimeErrLimit = 3.;
|
|---|
| 114 | const Float_t MCalibrationChargePix::fgPheFFactorMethodLimit = 5.;
|
|---|
| 115 | // --------------------------------------------------------------------------
|
|---|
| 116 | //
|
|---|
| 117 | // Default Constructor:
|
|---|
| 118 | //
|
|---|
| 119 | MCalibrationChargePix::MCalibrationChargePix(const char *name, const char *title)
|
|---|
| 120 | : fPixId(-1),
|
|---|
| 121 | fFlags(0)
|
|---|
| 122 | {
|
|---|
| 123 |
|
|---|
| 124 | fName = name ? name : "MCalibrationChargePix";
|
|---|
| 125 | fTitle = title ? title : "Container of the fit results of MHCalibrationChargePixs ";
|
|---|
| 126 |
|
|---|
| 127 | Clear();
|
|---|
| 128 |
|
|---|
| 129 | //
|
|---|
| 130 | // At the moment, we don't have a database, yet,
|
|---|
| 131 | // so we get it from the configuration file
|
|---|
| 132 | //
|
|---|
| 133 | SetConversionHiLo();
|
|---|
| 134 | SetConversionHiLoErr();
|
|---|
| 135 |
|
|---|
| 136 | SetChargeLimit();
|
|---|
| 137 | SetChargeErrLimit();
|
|---|
| 138 |
|
|---|
| 139 | SetChargeRelErrLimit();
|
|---|
| 140 | SetTimeLimit();
|
|---|
| 141 | SetTimeErrLimit();
|
|---|
| 142 | SetPheFFactorMethodLimit();
|
|---|
| 143 |
|
|---|
| 144 | }
|
|---|
| 145 |
|
|---|
| 146 | // ------------------------------------------------------------------------
|
|---|
| 147 | //
|
|---|
| 148 | // Invalidate values
|
|---|
| 149 | //
|
|---|
| 150 | void MCalibrationChargePix::Clear(Option_t *o)
|
|---|
| 151 | {
|
|---|
| 152 |
|
|---|
| 153 | SetHiGainSaturation ( kFALSE );
|
|---|
| 154 | SetLoGainSaturation ( kFALSE );
|
|---|
| 155 | SetHiGainFitted ( kFALSE );
|
|---|
| 156 | SetLoGainFitted ( kFALSE );
|
|---|
| 157 | SetExcluded ( kFALSE );
|
|---|
| 158 | SetBlindPixelMethodValid ( kFALSE );
|
|---|
| 159 | SetFFactorMethodValid ( kFALSE );
|
|---|
| 160 | SetPINDiodeMethodValid ( kFALSE );
|
|---|
| 161 | SetCombinedMethodValid ( kFALSE );
|
|---|
| 162 |
|
|---|
| 163 | fHiGainMeanCharge = -1.;
|
|---|
| 164 | fHiGainMeanChargeVar = -1.;
|
|---|
| 165 | fHiGainSigmaCharge = -1.;
|
|---|
| 166 | fHiGainSigmaChargeVar = -1.;
|
|---|
| 167 | fHiGainChargeProb = -1.;
|
|---|
| 168 |
|
|---|
| 169 | fLoGainMeanCharge = -1.;
|
|---|
| 170 | fLoGainMeanChargeVar = -1.;
|
|---|
| 171 | fLoGainSigmaCharge = -1.;
|
|---|
| 172 | fLoGainSigmaChargeVar = -1.;
|
|---|
| 173 | fLoGainChargeProb = -1.;
|
|---|
| 174 |
|
|---|
| 175 | fRSigmaCharge = -1.;
|
|---|
| 176 | fRSigmaChargeVar = -1.;
|
|---|
| 177 |
|
|---|
| 178 | fHiGainNumPickup = -1;
|
|---|
| 179 | fLoGainNumPickup = -1;
|
|---|
| 180 |
|
|---|
| 181 | fNumLoGainSamples = -1.;
|
|---|
| 182 |
|
|---|
| 183 | fPed = -1.;
|
|---|
| 184 | fPedRms = -1.;
|
|---|
| 185 | fPedVar = -1.;
|
|---|
| 186 |
|
|---|
| 187 | fLoGainPedRms = -1.;
|
|---|
| 188 | fLoGainPedRmsVar = -1.;
|
|---|
| 189 |
|
|---|
| 190 | fTimeFirstHiGain = 0 ;
|
|---|
| 191 | fTimeLastHiGain = 0 ;
|
|---|
| 192 | fTimeFirstLoGain = 0 ;
|
|---|
| 193 | fTimeLastLoGain = 0 ;
|
|---|
| 194 |
|
|---|
| 195 | fAbsTimeMean = -1.;
|
|---|
| 196 | fAbsTimeRms = -1.;
|
|---|
| 197 |
|
|---|
| 198 | fPheFFactorMethod = -1.;
|
|---|
| 199 | fPheFFactorMethodVar = -1.;
|
|---|
| 200 |
|
|---|
| 201 | fMeanConversionFFactorMethod = -1.;
|
|---|
| 202 | fMeanConversionBlindPixelMethod = -1.;
|
|---|
| 203 | fMeanConversionPINDiodeMethod = -1.;
|
|---|
| 204 | fMeanConversionCombinedMethod = -1.;
|
|---|
| 205 |
|
|---|
| 206 | fConversionFFactorMethodVar = -1.;
|
|---|
| 207 | fConversionBlindPixelMethodVar = -1.;
|
|---|
| 208 | fConversionPINDiodeMethodVar = -1.;
|
|---|
| 209 | fConversionCombinedMethodVar = -1.;
|
|---|
| 210 |
|
|---|
| 211 | fSigmaConversionFFactorMethod = -1.;
|
|---|
| 212 | fSigmaConversionBlindPixelMethod = -1.;
|
|---|
| 213 | fSigmaConversionPINDiodeMethod = -1.;
|
|---|
| 214 | fSigmaConversionCombinedMethod = -1.;
|
|---|
| 215 |
|
|---|
| 216 | fTotalFFactorFFactorMethod = -1.;
|
|---|
| 217 | fTotalFFactorBlindPixelMethod = -1.;
|
|---|
| 218 | fTotalFFactorPINDiodeMethod = -1.;
|
|---|
| 219 | fTotalFFactorCombinedMethod = -1.;
|
|---|
| 220 |
|
|---|
| 221 | }
|
|---|
| 222 |
|
|---|
| 223 |
|
|---|
| 224 | void MCalibrationChargePix::DefinePixId(Int_t i)
|
|---|
| 225 | {
|
|---|
| 226 | fPixId = i;
|
|---|
| 227 | }
|
|---|
| 228 |
|
|---|
| 229 |
|
|---|
| 230 | // --------------------------------------------------------------------------
|
|---|
| 231 | //
|
|---|
| 232 | // Set the pedestals from outside
|
|---|
| 233 | //
|
|---|
| 234 | void MCalibrationChargePix::SetPedestal(const Float_t ped, const Float_t pedrms, const Float_t pederr)
|
|---|
| 235 | {
|
|---|
| 236 |
|
|---|
| 237 | fPed = ped;
|
|---|
| 238 | fPedRms = pedrms;
|
|---|
| 239 | fPedVar = pederr*pederr;
|
|---|
| 240 | }
|
|---|
| 241 |
|
|---|
| 242 |
|
|---|
| 243 | void MCalibrationChargePix::SetMeanCharge( const Float_t f )
|
|---|
| 244 | {
|
|---|
| 245 | if (IsHiGainSaturation())
|
|---|
| 246 | fLoGainMeanCharge = f;
|
|---|
| 247 | else
|
|---|
| 248 | fHiGainMeanCharge = f;
|
|---|
| 249 | }
|
|---|
| 250 |
|
|---|
| 251 | void MCalibrationChargePix::SetMeanChargeErr( const Float_t f )
|
|---|
| 252 | {
|
|---|
| 253 | if (IsHiGainSaturation())
|
|---|
| 254 | fLoGainMeanChargeVar = f*f;
|
|---|
| 255 | else
|
|---|
| 256 | fHiGainMeanChargeVar = f*f;
|
|---|
| 257 |
|
|---|
| 258 | }
|
|---|
| 259 |
|
|---|
| 260 | void MCalibrationChargePix::SetSigmaCharge( const Float_t f )
|
|---|
| 261 | {
|
|---|
| 262 | if (IsHiGainSaturation())
|
|---|
| 263 | fLoGainSigmaCharge = f;
|
|---|
| 264 | else
|
|---|
| 265 | fHiGainSigmaCharge = f;
|
|---|
| 266 | }
|
|---|
| 267 |
|
|---|
| 268 |
|
|---|
| 269 | void MCalibrationChargePix::SetSigmaChargeErr( const Float_t f )
|
|---|
| 270 | {
|
|---|
| 271 | if (IsHiGainSaturation())
|
|---|
| 272 | fLoGainSigmaChargeVar = f*f;
|
|---|
| 273 | else
|
|---|
| 274 | fHiGainSigmaChargeVar = f*f;
|
|---|
| 275 |
|
|---|
| 276 | }
|
|---|
| 277 |
|
|---|
| 278 | // --------------------------------------------------------------------------
|
|---|
| 279 | //
|
|---|
| 280 | // Set the conversion factors from outside (only for MC)
|
|---|
| 281 | //
|
|---|
| 282 | void MCalibrationChargePix::SetConversionFFactorMethod(Float_t c, Float_t err, Float_t sig)
|
|---|
| 283 | {
|
|---|
| 284 | fMeanConversionFFactorMethod = c;
|
|---|
| 285 | fConversionFFactorMethodVar = err*err;
|
|---|
| 286 | fSigmaConversionFFactorMethod = sig;
|
|---|
| 287 | }
|
|---|
| 288 |
|
|---|
| 289 | // --------------------------------------------------------------------------
|
|---|
| 290 | //
|
|---|
| 291 | // Set the conversion factors from outside (only for MC)
|
|---|
| 292 | //
|
|---|
| 293 | void MCalibrationChargePix::SetConversionCombinedMethod(Float_t c, Float_t err, Float_t sig)
|
|---|
| 294 | {
|
|---|
| 295 | fMeanConversionCombinedMethod = c;
|
|---|
| 296 | fConversionCombinedMethodVar = err*err;
|
|---|
| 297 | fSigmaConversionCombinedMethod = sig;
|
|---|
| 298 | }
|
|---|
| 299 |
|
|---|
| 300 |
|
|---|
| 301 | // --------------------------------------------------------------------------
|
|---|
| 302 | //
|
|---|
| 303 | // Set the conversion factors from outside (only for MC)
|
|---|
| 304 | //
|
|---|
| 305 | void MCalibrationChargePix::SetConversionBlindPixelMethod(Float_t c, Float_t err, Float_t sig)
|
|---|
| 306 | {
|
|---|
| 307 | fMeanConversionBlindPixelMethod = c;
|
|---|
| 308 | fConversionBlindPixelMethodVar = err*err;
|
|---|
| 309 | fSigmaConversionBlindPixelMethod = sig;
|
|---|
| 310 | }
|
|---|
| 311 |
|
|---|
| 312 | // --------------------------------------------------------------------------
|
|---|
| 313 | //
|
|---|
| 314 | // Set the conversion factors from outside (only for MC)
|
|---|
| 315 | //
|
|---|
| 316 | void MCalibrationChargePix::SetConversionPINDiodeMethod(Float_t c, Float_t err, Float_t sig)
|
|---|
| 317 | {
|
|---|
| 318 | fMeanConversionPINDiodeMethod = c ;
|
|---|
| 319 | fConversionPINDiodeMethodVar = err*err;
|
|---|
| 320 | fSigmaConversionPINDiodeMethod = sig;
|
|---|
| 321 | }
|
|---|
| 322 |
|
|---|
| 323 | // --------------------------------------------------------------------------
|
|---|
| 324 | //
|
|---|
| 325 | // Set the Hi Gain Saturation Bit from outside
|
|---|
| 326 | //
|
|---|
| 327 | void MCalibrationChargePix::SetHiGainSaturation(Bool_t b)
|
|---|
| 328 | {
|
|---|
| 329 | b ? SETBIT(fFlags, kHiGainSaturation) : CLRBIT(fFlags, kHiGainSaturation);
|
|---|
| 330 | }
|
|---|
| 331 |
|
|---|
| 332 | // --------------------------------------------------------------------------
|
|---|
| 333 | //
|
|---|
| 334 | // Set the Lo Gain Saturation Bit from outside
|
|---|
| 335 | //
|
|---|
| 336 | void MCalibrationChargePix::SetLoGainSaturation(Bool_t b)
|
|---|
| 337 | {
|
|---|
| 338 | b ? SETBIT(fFlags, kLoGainSaturation) : CLRBIT(fFlags, kLoGainSaturation);
|
|---|
| 339 | }
|
|---|
| 340 |
|
|---|
| 341 | // --------------------------------------------------------------------------
|
|---|
| 342 | //
|
|---|
| 343 | // Set the Excluded Bit from outside
|
|---|
| 344 | //
|
|---|
| 345 | void MCalibrationChargePix::SetExcluded(Bool_t b )
|
|---|
| 346 | {
|
|---|
| 347 | b ? SETBIT(fFlags, kExcluded) : CLRBIT(fFlags, kExcluded);
|
|---|
| 348 | }
|
|---|
| 349 |
|
|---|
| 350 | // --------------------------------------------------------------------------
|
|---|
| 351 | //
|
|---|
| 352 | // Set the Fitted Bit from outside
|
|---|
| 353 | //
|
|---|
| 354 | void MCalibrationChargePix::SetHiGainFitted(Bool_t b )
|
|---|
| 355 | {
|
|---|
| 356 | b ? SETBIT(fFlags, kHiGainFitted) : CLRBIT(fFlags, kHiGainFitted);
|
|---|
| 357 | }
|
|---|
| 358 |
|
|---|
| 359 | // --------------------------------------------------------------------------
|
|---|
| 360 | //
|
|---|
| 361 | // Set the Fitted Bit from outside
|
|---|
| 362 | //
|
|---|
| 363 | void MCalibrationChargePix::SetLoGainFitted(const Bool_t b )
|
|---|
| 364 | {
|
|---|
| 365 | b ? SETBIT(fFlags, kLoGainFitted) : CLRBIT(fFlags, kLoGainFitted);
|
|---|
| 366 | }
|
|---|
| 367 |
|
|---|
| 368 | // --------------------------------------------------------------------------
|
|---|
| 369 | //
|
|---|
| 370 | // Set the Excluded Bit from outside
|
|---|
| 371 | //
|
|---|
| 372 | void MCalibrationChargePix::SetBlindPixelMethodValid(const Bool_t b )
|
|---|
| 373 | {
|
|---|
| 374 | b ? SETBIT(fFlags, kBlindPixelMethodValid) : CLRBIT(fFlags, kBlindPixelMethodValid);
|
|---|
| 375 | }
|
|---|
| 376 |
|
|---|
| 377 | // --------------------------------------------------------------------------
|
|---|
| 378 | //
|
|---|
| 379 | // Set the Excluded Bit from outside
|
|---|
| 380 | //
|
|---|
| 381 | void MCalibrationChargePix::SetFFactorMethodValid(const Bool_t b )
|
|---|
| 382 | {
|
|---|
| 383 | b ? SETBIT(fFlags, kFFactorMethodValid) : CLRBIT(fFlags, kFFactorMethodValid);
|
|---|
| 384 | }
|
|---|
| 385 |
|
|---|
| 386 | // --------------------------------------------------------------------------
|
|---|
| 387 | //
|
|---|
| 388 | // Set the Excluded Bit from outside
|
|---|
| 389 | //
|
|---|
| 390 | void MCalibrationChargePix::SetPINDiodeMethodValid(const Bool_t b )
|
|---|
| 391 | {
|
|---|
| 392 | b ? SETBIT(fFlags, kPINDiodeMethodValid) : CLRBIT(fFlags, kPINDiodeMethodValid);
|
|---|
| 393 | }
|
|---|
| 394 |
|
|---|
| 395 | // --------------------------------------------------------------------------
|
|---|
| 396 | //
|
|---|
| 397 | // Set the Excluded Bit from outside
|
|---|
| 398 | //
|
|---|
| 399 | void MCalibrationChargePix::SetCombinedMethodValid(const Bool_t b )
|
|---|
| 400 | {
|
|---|
| 401 | b ? SETBIT(fFlags, kCombinedMethodValid) : CLRBIT(fFlags, kCombinedMethodValid);
|
|---|
| 402 | }
|
|---|
| 403 |
|
|---|
| 404 | void MCalibrationChargePix::SetAbsTimeBordersHiGain(const Byte_t f, const Byte_t l)
|
|---|
| 405 | {
|
|---|
| 406 |
|
|---|
| 407 | fTimeFirstHiGain = f;
|
|---|
| 408 | fTimeLastHiGain = l;
|
|---|
| 409 |
|
|---|
| 410 | }
|
|---|
| 411 |
|
|---|
| 412 | void MCalibrationChargePix::SetAbsTimeBordersLoGain(const Byte_t f, const Byte_t l)
|
|---|
| 413 | {
|
|---|
| 414 | fTimeFirstLoGain = f;
|
|---|
| 415 | fTimeLastLoGain = l;
|
|---|
| 416 | }
|
|---|
| 417 |
|
|---|
| 418 | Float_t MCalibrationChargePix::GetPedRms() const
|
|---|
| 419 | {
|
|---|
| 420 | return IsHiGainSaturation() ? fLoGainPedRms : fPedRms;
|
|---|
| 421 | }
|
|---|
| 422 |
|
|---|
| 423 | Float_t MCalibrationChargePix::GetPedRmsErr() const
|
|---|
| 424 | {
|
|---|
| 425 | return IsHiGainSaturation() ? TMath::Sqrt(fLoGainPedRmsVar) : TMath::Sqrt(fPedVar)/2.;
|
|---|
| 426 | }
|
|---|
| 427 |
|
|---|
| 428 | Float_t MCalibrationChargePix::GetPedErr() const
|
|---|
| 429 | {
|
|---|
| 430 | return TMath::Sqrt(fPedVar);
|
|---|
| 431 | }
|
|---|
| 432 |
|
|---|
| 433 | Float_t MCalibrationChargePix::GetMeanCharge() const
|
|---|
| 434 | {
|
|---|
| 435 | return IsHiGainSaturation() ? GetLoGainMeanCharge() : GetHiGainMeanCharge() ;
|
|---|
| 436 | }
|
|---|
| 437 |
|
|---|
| 438 | Float_t MCalibrationChargePix::GetMeanChargeErr() const
|
|---|
| 439 | {
|
|---|
| 440 | return IsHiGainSaturation() ? GetLoGainMeanChargeErr() : GetHiGainMeanChargeErr() ;
|
|---|
| 441 | }
|
|---|
| 442 |
|
|---|
| 443 | Float_t MCalibrationChargePix::GetChargeProb() const
|
|---|
| 444 | {
|
|---|
| 445 | return IsHiGainSaturation() ? fLoGainChargeProb : fHiGainChargeProb ;
|
|---|
| 446 | }
|
|---|
| 447 |
|
|---|
| 448 | Float_t MCalibrationChargePix::GetSigmaCharge() const
|
|---|
| 449 | {
|
|---|
| 450 | return IsHiGainSaturation() ? GetLoGainSigmaCharge() : GetHiGainSigmaCharge() ;
|
|---|
| 451 | }
|
|---|
| 452 |
|
|---|
| 453 | Float_t MCalibrationChargePix::GetSigmaChargeErr() const
|
|---|
| 454 | {
|
|---|
| 455 | return IsHiGainSaturation() ? GetLoGainSigmaChargeErr() : GetHiGainSigmaChargeErr() ;
|
|---|
| 456 | }
|
|---|
| 457 |
|
|---|
| 458 | Float_t MCalibrationChargePix::GetHiGainMeanChargeErr() const
|
|---|
| 459 | {
|
|---|
| 460 | return TMath::Sqrt(fHiGainMeanChargeVar);
|
|---|
| 461 | }
|
|---|
| 462 |
|
|---|
| 463 | Float_t MCalibrationChargePix::GetLoGainMeanCharge() const
|
|---|
| 464 | {
|
|---|
| 465 | return fLoGainMeanCharge * fConversionHiLo;
|
|---|
| 466 | }
|
|---|
| 467 |
|
|---|
| 468 | Float_t MCalibrationChargePix::GetLoGainMeanChargeErr() const
|
|---|
| 469 | {
|
|---|
| 470 |
|
|---|
| 471 | const Float_t chargeRelVar = fLoGainMeanChargeVar
|
|---|
| 472 | /( fLoGainMeanCharge * fLoGainMeanCharge );
|
|---|
| 473 |
|
|---|
| 474 | const Float_t conversionRelVar = fConversionHiLoVar
|
|---|
| 475 | /( fConversionHiLo * fConversionHiLo );
|
|---|
| 476 |
|
|---|
| 477 | return TMath::Sqrt(chargeRelVar+conversionRelVar) * GetLoGainMeanCharge();
|
|---|
| 478 | }
|
|---|
| 479 |
|
|---|
| 480 | Float_t MCalibrationChargePix::GetLoGainSigmaCharge() const
|
|---|
| 481 | {
|
|---|
| 482 | return fLoGainSigmaCharge * fConversionHiLo;
|
|---|
| 483 | }
|
|---|
| 484 |
|
|---|
| 485 | Float_t MCalibrationChargePix::GetLoGainSigmaChargeErr() const
|
|---|
| 486 | {
|
|---|
| 487 |
|
|---|
| 488 | const Float_t sigmaRelVar = fLoGainSigmaChargeVar
|
|---|
| 489 | /( fLoGainSigmaCharge * fLoGainSigmaCharge );
|
|---|
| 490 |
|
|---|
| 491 | const Float_t conversionRelVar = fConversionHiLoVar
|
|---|
| 492 | /( fConversionHiLo * fConversionHiLo );
|
|---|
| 493 |
|
|---|
| 494 | return TMath::Sqrt(sigmaRelVar+conversionRelVar) * GetLoGainSigmaCharge();
|
|---|
| 495 | }
|
|---|
| 496 |
|
|---|
| 497 | Float_t MCalibrationChargePix::GetHiGainSigmaChargeErr() const
|
|---|
| 498 | {
|
|---|
| 499 | return TMath::Sqrt(fHiGainSigmaChargeVar);
|
|---|
| 500 | }
|
|---|
| 501 |
|
|---|
| 502 | Float_t MCalibrationChargePix::GetRSigmaCharge() const
|
|---|
| 503 | {
|
|---|
| 504 | return IsHiGainSaturation() ? fRSigmaCharge*fConversionHiLo : fRSigmaCharge ;
|
|---|
| 505 | }
|
|---|
| 506 |
|
|---|
| 507 | Float_t MCalibrationChargePix::GetRSigmaChargeErr() const
|
|---|
| 508 | {
|
|---|
| 509 | if (IsHiGainSaturation())
|
|---|
| 510 | {
|
|---|
| 511 | const Float_t rsigmaRelVar = fRSigmaChargeVar
|
|---|
| 512 | /( fRSigmaCharge * fRSigmaCharge );
|
|---|
| 513 | const Float_t conversionRelVar = fConversionHiLoVar
|
|---|
| 514 | /( fConversionHiLo * fConversionHiLo );
|
|---|
| 515 | return TMath::Sqrt(rsigmaRelVar+conversionRelVar) * GetRSigmaCharge();
|
|---|
| 516 | }
|
|---|
| 517 | else
|
|---|
| 518 | return TMath::Sqrt(fRSigmaChargeVar);
|
|---|
| 519 |
|
|---|
| 520 | }
|
|---|
| 521 |
|
|---|
| 522 | Float_t MCalibrationChargePix::GetConversionHiLoErr() const
|
|---|
| 523 | {
|
|---|
| 524 | if (fConversionHiLoVar < 0.)
|
|---|
| 525 | return -1.;
|
|---|
| 526 | return TMath::Sqrt(fConversionHiLoVar);
|
|---|
| 527 | }
|
|---|
| 528 |
|
|---|
| 529 | Float_t MCalibrationChargePix::GetPheFFactorMethodErr() const
|
|---|
| 530 | {
|
|---|
| 531 | if (fPheFFactorMethodVar < 0.)
|
|---|
| 532 | return -1.;
|
|---|
| 533 | return TMath::Sqrt(fPheFFactorMethodVar);
|
|---|
| 534 | }
|
|---|
| 535 |
|
|---|
| 536 | Float_t MCalibrationChargePix::GetConversionCombinedMethodErr() const
|
|---|
| 537 | {
|
|---|
| 538 | if (fConversionCombinedMethodVar < 0.)
|
|---|
| 539 | return -1.;
|
|---|
| 540 | return TMath::Sqrt(fConversionCombinedMethodVar);
|
|---|
| 541 | }
|
|---|
| 542 |
|
|---|
| 543 | Float_t MCalibrationChargePix::GetConversionPINDiodeMethodErr() const
|
|---|
| 544 | {
|
|---|
| 545 | if (fConversionPINDiodeMethodVar < 0.)
|
|---|
| 546 | return -1.;
|
|---|
| 547 | return TMath::Sqrt(fConversionPINDiodeMethodVar);
|
|---|
| 548 | }
|
|---|
| 549 |
|
|---|
| 550 | Float_t MCalibrationChargePix::GetConversionBlindPixelMethodErr() const
|
|---|
| 551 | {
|
|---|
| 552 | if (fConversionBlindPixelMethodVar < 0.)
|
|---|
| 553 | return -1.;
|
|---|
| 554 | return TMath::Sqrt(fConversionBlindPixelMethodVar);
|
|---|
| 555 | }
|
|---|
| 556 |
|
|---|
| 557 | Float_t MCalibrationChargePix::GetConversionFFactorMethodErr() const
|
|---|
| 558 | {
|
|---|
| 559 | if (fConversionFFactorMethodVar < 0.)
|
|---|
| 560 | return -1.;
|
|---|
| 561 | return TMath::Sqrt(fConversionFFactorMethodVar);
|
|---|
| 562 | }
|
|---|
| 563 |
|
|---|
| 564 | Float_t MCalibrationChargePix::GetTotalFFactorCombinedMethodErr() const
|
|---|
| 565 | {
|
|---|
| 566 | if (fTotalFFactorCombinedMethodVar < 0.)
|
|---|
| 567 | return -1.;
|
|---|
| 568 | return TMath::Sqrt(fTotalFFactorCombinedMethodVar);
|
|---|
| 569 | }
|
|---|
| 570 |
|
|---|
| 571 | Float_t MCalibrationChargePix::GetTotalFFactorPINDiodeMethodErr() const
|
|---|
| 572 | {
|
|---|
| 573 | if (fTotalFFactorPINDiodeMethodVar < 0.)
|
|---|
| 574 | return -1.;
|
|---|
| 575 | return TMath::Sqrt(fTotalFFactorPINDiodeMethodVar);
|
|---|
| 576 | }
|
|---|
| 577 |
|
|---|
| 578 | Float_t MCalibrationChargePix::GetTotalFFactorBlindPixelMethodErr() const
|
|---|
| 579 | {
|
|---|
| 580 | if (fTotalFFactorBlindPixelMethodVar < 0.)
|
|---|
| 581 | return -1.;
|
|---|
| 582 | return TMath::Sqrt(fTotalFFactorBlindPixelMethodVar);
|
|---|
| 583 | }
|
|---|
| 584 |
|
|---|
| 585 | Float_t MCalibrationChargePix::GetTotalFFactorFFactorMethodErr() const
|
|---|
| 586 | {
|
|---|
| 587 | if (fTotalFFactorFFactorMethodVar < 0.)
|
|---|
| 588 | return -1.;
|
|---|
| 589 | return TMath::Sqrt(fTotalFFactorFFactorMethodVar);
|
|---|
| 590 | }
|
|---|
| 591 |
|
|---|
| 592 | Bool_t MCalibrationChargePix::IsFitted() const
|
|---|
| 593 | {
|
|---|
| 594 | return IsHiGainSaturation() ? IsLoGainFitted() : IsHiGainFitted();
|
|---|
| 595 | }
|
|---|
| 596 |
|
|---|
| 597 | Bool_t MCalibrationChargePix::IsExcluded() const
|
|---|
| 598 | {
|
|---|
| 599 | return TESTBIT(fFlags,kExcluded);
|
|---|
| 600 | }
|
|---|
| 601 |
|
|---|
| 602 | Bool_t MCalibrationChargePix::IsHiGainSaturation() const
|
|---|
| 603 | {
|
|---|
| 604 | return TESTBIT(fFlags,kHiGainSaturation);
|
|---|
| 605 | }
|
|---|
| 606 |
|
|---|
| 607 | Bool_t MCalibrationChargePix::IsLoGainSaturation() const
|
|---|
| 608 | {
|
|---|
| 609 | return TESTBIT(fFlags,kLoGainSaturation);
|
|---|
| 610 | }
|
|---|
| 611 |
|
|---|
| 612 | Bool_t MCalibrationChargePix::IsHiGainFitted() const
|
|---|
| 613 | {
|
|---|
| 614 | return TESTBIT(fFlags, kHiGainFitted);
|
|---|
| 615 | }
|
|---|
| 616 |
|
|---|
| 617 | Bool_t MCalibrationChargePix::IsLoGainFitted() const
|
|---|
| 618 | {
|
|---|
| 619 | return TESTBIT(fFlags, kLoGainFitted);
|
|---|
| 620 | }
|
|---|
| 621 |
|
|---|
| 622 | Bool_t MCalibrationChargePix::IsBlindPixelMethodValid() const
|
|---|
| 623 | {
|
|---|
| 624 | return TESTBIT(fFlags, kBlindPixelMethodValid);
|
|---|
| 625 | }
|
|---|
| 626 |
|
|---|
| 627 | Bool_t MCalibrationChargePix::IsFFactorMethodValid() const
|
|---|
| 628 | {
|
|---|
| 629 | return TESTBIT(fFlags, kFFactorMethodValid);
|
|---|
| 630 | }
|
|---|
| 631 |
|
|---|
| 632 | Bool_t MCalibrationChargePix::IsPINDiodeMethodValid() const
|
|---|
| 633 | {
|
|---|
| 634 | return TESTBIT(fFlags, kPINDiodeMethodValid);
|
|---|
| 635 | }
|
|---|
| 636 |
|
|---|
| 637 | Bool_t MCalibrationChargePix::IsCombinedMethodValid() const
|
|---|
| 638 | {
|
|---|
| 639 | return TESTBIT(fFlags, kCombinedMethodValid);
|
|---|
| 640 | }
|
|---|
| 641 |
|
|---|
| 642 |
|
|---|
| 643 | //
|
|---|
| 644 | // The check return kTRUE if:
|
|---|
| 645 | //
|
|---|
| 646 | // 1) Pixel has a fitted charge greater than fChargeLimit*PedRMS
|
|---|
| 647 | // 2) Pixel has a fit error greater than fChargeVarLimit
|
|---|
| 648 | // 3) Pixel has a fitted charge greater its fChargeRelVarLimit times its charge error
|
|---|
| 649 | // 4) Pixel has a charge sigma bigger than its Pedestal RMS
|
|---|
| 650 | //
|
|---|
| 651 | void MCalibrationChargePix::CheckChargeValidity(MBadPixelsPix *bad)
|
|---|
| 652 | {
|
|---|
| 653 |
|
|---|
| 654 | if (GetMeanCharge() < fChargeLimit*GetPedRms())
|
|---|
| 655 | {
|
|---|
| 656 | *fLog << warn << "WARNING: Fitted Charge is smaller than "
|
|---|
| 657 | << fChargeLimit << " Pedestal RMS in Pixel " << fPixId << endl;
|
|---|
| 658 | bad->SetChargeIsPedestal();
|
|---|
| 659 | bad->SetUnsuitable(MBadPixelsPix::kUnsuitableRun);
|
|---|
| 660 | }
|
|---|
| 661 |
|
|---|
| 662 | const Float_t meanchargevar = IsHiGainSaturation() ? fLoGainMeanChargeVar : fHiGainMeanChargeVar;
|
|---|
| 663 |
|
|---|
| 664 | if (meanchargevar < fChargeVarLimit)
|
|---|
| 665 | {
|
|---|
| 666 | *fLog << warn << "WARNING: Variance of Fitted Charge is smaller than "
|
|---|
| 667 | << meanchargevar << " in Pixel " << fPixId << endl;
|
|---|
| 668 | bad->SetChargeErrNotValid();
|
|---|
| 669 | bad->SetUnsuitable(MBadPixelsPix::kUnsuitableRun);
|
|---|
| 670 | }
|
|---|
| 671 |
|
|---|
| 672 | if (GetMeanCharge()*GetMeanCharge() < fChargeRelVarLimit*meanchargevar)
|
|---|
| 673 | {
|
|---|
| 674 | *fLog << warn << "WARNING: Fitted Charge is smaller than "
|
|---|
| 675 | << TMath::Sqrt(fChargeRelVarLimit) << "* its error in Pixel " << fPixId << endl;
|
|---|
| 676 | bad->SetChargeRelErrNotValid();
|
|---|
| 677 | bad->SetUnsuitable(MBadPixelsPix::kUnsuitableRun);
|
|---|
| 678 | }
|
|---|
| 679 |
|
|---|
| 680 | if (GetSigmaCharge() < GetPedRms())
|
|---|
| 681 | {
|
|---|
| 682 | *fLog << warn << "WARNING: Sigma of Fitted Charge smaller than Pedestal RMS in Pixel "
|
|---|
| 683 | << fPixId << endl;
|
|---|
| 684 | bad->SetChargeSigmaNotValid();
|
|---|
| 685 | bad->SetUnsuitable(MBadPixelsPix::kUnsuitableRun);
|
|---|
| 686 | }
|
|---|
| 687 |
|
|---|
| 688 | }
|
|---|
| 689 |
|
|---|
| 690 | //
|
|---|
| 691 | // The check returns kTRUE if:
|
|---|
| 692 | //
|
|---|
| 693 | // The mean arrival time is at least 1.0 slices from the used edge slices
|
|---|
| 694 | //
|
|---|
| 695 | void MCalibrationChargePix::CheckTimeValidity(MBadPixelsPix *bad)
|
|---|
| 696 | {
|
|---|
| 697 |
|
|---|
| 698 | const Byte_t loweredge = IsHiGainSaturation() ? fTimeFirstLoGain : fTimeFirstHiGain;
|
|---|
| 699 | const Byte_t upperedge = IsHiGainSaturation() ? fTimeLastLoGain : fTimeLastHiGain;
|
|---|
| 700 |
|
|---|
| 701 | if ( fAbsTimeMean < (Float_t)loweredge+1)
|
|---|
| 702 | {
|
|---|
| 703 | *fLog << warn << "WARNING: Mean ArrivalTime in first extraction bin of the Pixel " << fPixId << endl;
|
|---|
| 704 | *fLog << fAbsTimeMean << " " << (Float_t)loweredge+1. << endl;
|
|---|
| 705 | bad->SetMeanTimeInFirstBin();
|
|---|
| 706 | bad->SetUnsuitable(MBadPixelsPix::kUnsuitableRun);
|
|---|
| 707 | }
|
|---|
| 708 |
|
|---|
| 709 | if ( fAbsTimeMean > (Float_t)upperedge-1)
|
|---|
| 710 | {
|
|---|
| 711 | *fLog << warn << "WARNING: Mean ArrivalTime in last extraction bin of the Pixel " << fPixId << endl;
|
|---|
| 712 | *fLog << fAbsTimeMean << " " << (Float_t)upperedge-1. << endl;
|
|---|
| 713 | bad->SetMeanTimeInLastBin();
|
|---|
| 714 | bad->SetUnsuitable(MBadPixelsPix::kUnsuitableRun);
|
|---|
| 715 | }
|
|---|
| 716 | }
|
|---|
| 717 |
|
|---|
| 718 | void MCalibrationChargePix::CalcLoGainPed()
|
|---|
| 719 | {
|
|---|
| 720 |
|
|---|
| 721 | Float_t pedRmsSquare = fPedRms * fPedRms;
|
|---|
| 722 | Float_t pedRmsSquareVar = fPedVar * pedRmsSquare; // fPedRmsErr = fPedErr/2.
|
|---|
| 723 |
|
|---|
| 724 | //
|
|---|
| 725 | // We do not know the Lo Gain Pedestal RMS, so we have to retrieve it
|
|---|
| 726 | // from the HI GAIN (all calculation per slice up to now):
|
|---|
| 727 | //
|
|---|
| 728 | // We extract the pure NSB contribution:
|
|---|
| 729 | //
|
|---|
| 730 | const Float_t elecRmsSquare = fElectronicPedRms * fElectronicPedRms;
|
|---|
| 731 | const Float_t elecRmsSquareVar = 4.*fElectronicPedRmsVar * elecRmsSquare;
|
|---|
| 732 |
|
|---|
| 733 | Float_t nsbSquare = pedRmsSquare - elecRmsSquare;
|
|---|
| 734 | Float_t nsbSquareRelVar = (pedRmsSquareVar + elecRmsSquareVar)
|
|---|
| 735 | / (nsbSquare * nsbSquare) ;
|
|---|
| 736 |
|
|---|
| 737 | if (nsbSquare < 0.)
|
|---|
| 738 | nsbSquare = 0.;
|
|---|
| 739 |
|
|---|
| 740 | //
|
|---|
| 741 | // Now, we divide the NSB by the conversion factor and
|
|---|
| 742 | // add it quadratically to the electronic noise
|
|---|
| 743 | //
|
|---|
| 744 | const Float_t conversionSquare = fConversionHiLo * fConversionHiLo;
|
|---|
| 745 | const Float_t convertedNsbSquare = nsbSquare / conversionSquare;
|
|---|
| 746 | const Float_t convertedNsbSquareVar = nsbSquareRelVar
|
|---|
| 747 | * convertedNsbSquare * convertedNsbSquare;
|
|---|
| 748 |
|
|---|
| 749 | pedRmsSquare = convertedNsbSquare + elecRmsSquare;
|
|---|
| 750 | pedRmsSquareVar = convertedNsbSquareVar + elecRmsSquareVar;
|
|---|
| 751 |
|
|---|
| 752 | fLoGainPedRms = TMath::Sqrt(pedRmsSquare);
|
|---|
| 753 | fLoGainPedRmsVar = 0.25 * pedRmsSquareVar / pedRmsSquare;
|
|---|
| 754 |
|
|---|
| 755 | }
|
|---|
| 756 |
|
|---|
| 757 | //
|
|---|
| 758 | //
|
|---|
| 759 | //
|
|---|
| 760 | Bool_t MCalibrationChargePix::CalcReducedSigma()
|
|---|
| 761 | {
|
|---|
| 762 |
|
|---|
| 763 | const Float_t sigmacharge = IsHiGainSaturation() ? fLoGainSigmaCharge : fHiGainSigmaCharge ;
|
|---|
| 764 | const Float_t sigmachargevar = IsHiGainSaturation() ? fLoGainSigmaChargeVar : fHiGainSigmaChargeVar;
|
|---|
| 765 |
|
|---|
| 766 | const Float_t sigmaSquare = sigmacharge * sigmacharge;
|
|---|
| 767 | const Float_t sigmaSquareVar = 4.* sigmachargevar * sigmaSquare;
|
|---|
| 768 |
|
|---|
| 769 | Float_t pedRmsSquare ;
|
|---|
| 770 | Float_t pedRmsSquareVar;
|
|---|
| 771 |
|
|---|
| 772 | if (IsHiGainSaturation())
|
|---|
| 773 | {
|
|---|
| 774 | pedRmsSquare = fLoGainPedRms * fLoGainPedRms;
|
|---|
| 775 | pedRmsSquareVar = 4.* fLoGainPedRmsVar * pedRmsSquare;
|
|---|
| 776 | }
|
|---|
| 777 | else
|
|---|
| 778 | {
|
|---|
| 779 | pedRmsSquare = fPedRms * fPedRms;
|
|---|
| 780 | pedRmsSquareVar = fPedVar * pedRmsSquare; // fPedRmsErr = fPedErr/2.
|
|---|
| 781 | }
|
|---|
| 782 | //
|
|---|
| 783 | // Calculate the reduced sigmas
|
|---|
| 784 | //
|
|---|
| 785 | const Float_t rsigmachargesquare = sigmaSquare - pedRmsSquare;
|
|---|
| 786 | if (rsigmachargesquare <= 0.)
|
|---|
| 787 | {
|
|---|
| 788 | *fLog << warn
|
|---|
| 789 | << "WARNING: Cannot calculate the reduced sigma: smaller than 0 in pixel "
|
|---|
| 790 | << fPixId << endl;
|
|---|
| 791 | return kFALSE;
|
|---|
| 792 | }
|
|---|
| 793 |
|
|---|
| 794 |
|
|---|
| 795 | fRSigmaCharge = TMath::Sqrt(rsigmachargesquare);
|
|---|
| 796 | fRSigmaChargeVar = 0.25 * (sigmaSquareVar + pedRmsSquareVar) / rsigmachargesquare;
|
|---|
| 797 |
|
|---|
| 798 | return kTRUE;
|
|---|
| 799 | }
|
|---|
| 800 |
|
|---|
| 801 | //
|
|---|
| 802 | // Calculate the number of photo-electrons after the F-Factor method
|
|---|
| 803 | // Calculate the errors of the F-Factor method
|
|---|
| 804 | //
|
|---|
| 805 | Bool_t MCalibrationChargePix::CalcFFactorMethod()
|
|---|
| 806 | {
|
|---|
| 807 |
|
|---|
| 808 | if (fRSigmaCharge < 0.)
|
|---|
| 809 | {
|
|---|
| 810 | SetFFactorMethodValid(kFALSE);
|
|---|
| 811 | return kFALSE;
|
|---|
| 812 | }
|
|---|
| 813 |
|
|---|
| 814 | const Float_t charge = IsHiGainSaturation() ? fLoGainMeanCharge : fHiGainMeanCharge ;
|
|---|
| 815 | const Float_t chargevar = IsHiGainSaturation() ? fLoGainMeanChargeVar : fHiGainMeanChargeVar;
|
|---|
| 816 |
|
|---|
| 817 | //
|
|---|
| 818 | // Square all variables in order to avoid applications of square root
|
|---|
| 819 | //
|
|---|
| 820 | // First the relative error squares
|
|---|
| 821 | //
|
|---|
| 822 | const Float_t chargeSquare = charge * charge;
|
|---|
| 823 | const Float_t chargeSquareRelVar = 4.* chargevar/ chargeSquare;
|
|---|
| 824 |
|
|---|
| 825 | const Float_t ffactorsquare = gkFFactor * gkFFactor;
|
|---|
| 826 | const Float_t ffactorsquareRelVar = 4.*gkFFactorErr * gkFFactorErr / ffactorsquare;
|
|---|
| 827 |
|
|---|
| 828 | const Float_t rsigmaSquare = fRSigmaCharge * fRSigmaCharge;
|
|---|
| 829 | const Float_t rsigmaSquareRelVar = 4.* fRSigmaChargeVar / rsigmaSquare;
|
|---|
| 830 |
|
|---|
| 831 | //
|
|---|
| 832 | // Calculate the number of phe's from the F-Factor method
|
|---|
| 833 | // (independent on Hi Gain or Lo Gain)
|
|---|
| 834 | //
|
|---|
| 835 | fPheFFactorMethod = ffactorsquare * chargeSquare / rsigmaSquare;
|
|---|
| 836 |
|
|---|
| 837 | if (fPheFFactorMethod < fPheFFactorMethodLimit)
|
|---|
| 838 | {
|
|---|
| 839 | SetFFactorMethodValid(kFALSE);
|
|---|
| 840 | return kFALSE;
|
|---|
| 841 | }
|
|---|
| 842 |
|
|---|
| 843 | //
|
|---|
| 844 | // Calculate the Error of Nphe
|
|---|
| 845 | //
|
|---|
| 846 | fPheFFactorMethodVar = (ffactorsquareRelVar + chargeSquareRelVar + rsigmaSquareRelVar)
|
|---|
| 847 | * fPheFFactorMethod * fPheFFactorMethod;
|
|---|
| 848 |
|
|---|
| 849 | SetFFactorMethodValid(kTRUE);
|
|---|
| 850 | return kTRUE;
|
|---|
| 851 | }
|
|---|
| 852 |
|
|---|
| 853 |
|
|---|
| 854 | void MCalibrationChargePix::ApplyLoGainConversion()
|
|---|
| 855 | {
|
|---|
| 856 |
|
|---|
| 857 | fElectronicPedRms = gkElectronicPedRms * TMath::Sqrt(fNumLoGainSamples);
|
|---|
| 858 | fElectronicPedRmsVar = gkElectronicPedRmsErr * gkElectronicPedRmsErr * fNumLoGainSamples;
|
|---|
| 859 |
|
|---|
| 860 | CalcLoGainPed();
|
|---|
| 861 | }
|
|---|
| 862 |
|
|---|
| 863 |
|
|---|