| 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-2001
|
|---|
| 21 | !
|
|---|
| 22 | !
|
|---|
| 23 | \* ======================================================================== */
|
|---|
| 24 |
|
|---|
| 25 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 26 | // //
|
|---|
| 27 | // MCalibrationBlindPix //
|
|---|
| 28 | // //
|
|---|
| 29 | // This is the storage container to hold informations about the calibration//
|
|---|
| 30 | // blind pixel //
|
|---|
| 31 | // //
|
|---|
| 32 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 33 | #include "MCalibrationBlindPix.h"
|
|---|
| 34 | #include "MHCalibrationBlindPixel.h"
|
|---|
| 35 |
|
|---|
| 36 | #include <TH1.h>
|
|---|
| 37 |
|
|---|
| 38 | #include "MLog.h"
|
|---|
| 39 | #include "MLogManip.h"
|
|---|
| 40 |
|
|---|
| 41 | ClassImp(MCalibrationBlindPix);
|
|---|
| 42 |
|
|---|
| 43 | using namespace std;
|
|---|
| 44 | // --------------------------------------------------------------------------
|
|---|
| 45 | //
|
|---|
| 46 | // Default Constructor.
|
|---|
| 47 | //
|
|---|
| 48 | MCalibrationBlindPix::MCalibrationBlindPix(const char *name, const char *title)
|
|---|
| 49 | {
|
|---|
| 50 |
|
|---|
| 51 | fName = name ? name : "MCalibrationBlindPix";
|
|---|
| 52 | fTitle = title ? title : "Container of the MHCalibrationBlindPixel and the fit results";
|
|---|
| 53 |
|
|---|
| 54 | fHist = new MHCalibrationBlindPixel();
|
|---|
| 55 |
|
|---|
| 56 | if (!fHist)
|
|---|
| 57 | *fLog << warn << dbginf << " Could not create MHCalibrationBlindPixel " << endl;
|
|---|
| 58 |
|
|---|
| 59 | Clear();
|
|---|
| 60 | }
|
|---|
| 61 |
|
|---|
| 62 | MCalibrationBlindPix::~MCalibrationBlindPix()
|
|---|
| 63 | {
|
|---|
| 64 | delete fHist;
|
|---|
| 65 | }
|
|---|
| 66 |
|
|---|
| 67 | // ------------------------------------------------------------------------
|
|---|
| 68 | //
|
|---|
| 69 | // Invalidate values
|
|---|
| 70 | //
|
|---|
| 71 | void MCalibrationBlindPix::Clear(Option_t *o)
|
|---|
| 72 | {
|
|---|
| 73 | fHist->Reset();
|
|---|
| 74 |
|
|---|
| 75 | fLambda = -1.;
|
|---|
| 76 | fMu0 = -1.;
|
|---|
| 77 | fMu1 = -1.;
|
|---|
| 78 | fSigma0 = -1.;
|
|---|
| 79 | fSigma1 = -1.;
|
|---|
| 80 | fErrLambda = -1.;
|
|---|
| 81 | fErrMu0 = -1.;
|
|---|
| 82 | fErrMu1 = -1.;
|
|---|
| 83 | fErrSigma0 = -1.;
|
|---|
| 84 | fErrSigma1 = -1.;
|
|---|
| 85 | fTime = -1.;
|
|---|
| 86 | fErrTime = -1;
|
|---|
| 87 |
|
|---|
| 88 | }
|
|---|
| 89 |
|
|---|
| 90 | Bool_t MCalibrationBlindPix::IsFitOK() const
|
|---|
| 91 | {
|
|---|
| 92 | return fHist->IsFitOK();
|
|---|
| 93 | }
|
|---|
| 94 |
|
|---|
| 95 | Bool_t MCalibrationBlindPix::FillCharge(const Int_t q)
|
|---|
| 96 | {
|
|---|
| 97 | return fHist->FillBlindPixelCharge(q);
|
|---|
| 98 | }
|
|---|
| 99 |
|
|---|
| 100 | Bool_t MCalibrationBlindPix::FillTime(const Float_t t)
|
|---|
| 101 | {
|
|---|
| 102 | return fHist->FillBlindPixelTime(t);
|
|---|
| 103 | }
|
|---|
| 104 |
|
|---|
| 105 | Bool_t MCalibrationBlindPix::FitCharge()
|
|---|
| 106 | {
|
|---|
| 107 |
|
|---|
| 108 | if (!fHist->FitSinglePhe())
|
|---|
| 109 | return kFALSE;
|
|---|
| 110 |
|
|---|
| 111 | fLambda = TMath::IsNaN(fHist->GetLambda()) ? -1. : fHist->GetLambda();
|
|---|
| 112 | fMu0 = TMath::IsNaN(fHist->GetMu0()) ? -1. : fHist->GetMu0();
|
|---|
| 113 | fMu1 = TMath::IsNaN(fHist->GetMu1()) ? -1. : fHist->GetMu1();
|
|---|
| 114 | fSigma0 = TMath::IsNaN(fHist->GetSigma0()) ? -1. : fHist->GetSigma0();
|
|---|
| 115 | fSigma1 = TMath::IsNaN(fHist->GetSigma1()) ? -1. : fHist->GetSigma1();
|
|---|
| 116 |
|
|---|
| 117 | fErrLambda = TMath::IsNaN(fHist->GetLambdaErr()) ? -1. : fHist->GetLambdaErr();
|
|---|
| 118 | fErrMu0 = TMath::IsNaN(fHist->GetMu0Err()) ? -1. : fHist->GetMu0Err();
|
|---|
| 119 | fErrMu1 = TMath::IsNaN(fHist->GetMu1Err()) ? -1. : fHist->GetMu1Err();
|
|---|
| 120 | fErrSigma0 = TMath::IsNaN(fHist->GetSigma0Err()) ? -1. : fHist->GetSigma0Err();
|
|---|
| 121 | fErrSigma1 = TMath::IsNaN(fHist->GetSigma1Err()) ? -1. : fHist->GetSigma1Err();
|
|---|
| 122 |
|
|---|
| 123 | return kTRUE;
|
|---|
| 124 | }
|
|---|
| 125 |
|
|---|
| 126 |
|
|---|
| 127 |
|
|---|
| 128 | Bool_t MCalibrationBlindPix::FitTime()
|
|---|
| 129 | {
|
|---|
| 130 |
|
|---|
| 131 | if(!fHist->FitTime())
|
|---|
| 132 | return kFALSE;
|
|---|
| 133 |
|
|---|
| 134 | fTime = fHist->GetMeanTime();
|
|---|
| 135 | fErrTime = fHist->GetMeanTimeErr();
|
|---|
| 136 |
|
|---|
| 137 | return kTRUE;
|
|---|
| 138 |
|
|---|
| 139 | }
|
|---|
| 140 |
|
|---|
| 141 | Bool_t MCalibrationBlindPix::CheckOscillations()
|
|---|
| 142 | {
|
|---|
| 143 | return fHist->CheckOscillations();
|
|---|
| 144 | }
|
|---|