| 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 | fHSinglePheFADCSlices = new TH1I("HSinglePheFADCSlices","Summed FADC slices single phe events",30,0.5,30.5);
|
|---|
| 60 |
|
|---|
| 61 | Clear();
|
|---|
| 62 | }
|
|---|
| 63 |
|
|---|
| 64 | MCalibrationBlindPix::~MCalibrationBlindPix()
|
|---|
| 65 | {
|
|---|
| 66 | delete fHist;
|
|---|
| 67 | delete fHSinglePheFADCSlices;
|
|---|
| 68 | }
|
|---|
| 69 |
|
|---|
| 70 | // ------------------------------------------------------------------------
|
|---|
| 71 | //
|
|---|
| 72 | // Invalidate values
|
|---|
| 73 | //
|
|---|
| 74 | void MCalibrationBlindPix::Clear(Option_t *o)
|
|---|
| 75 | {
|
|---|
| 76 | fHist->Reset();
|
|---|
| 77 |
|
|---|
| 78 | fLambda = -1.;
|
|---|
| 79 | fMu0 = -1.;
|
|---|
| 80 | fMu1 = -1.;
|
|---|
| 81 | fSigma0 = -1.;
|
|---|
| 82 | fSigma1 = -1.;
|
|---|
| 83 | fErrLambda = -1.;
|
|---|
| 84 | fErrMu0 = -1.;
|
|---|
| 85 | fErrMu1 = -1.;
|
|---|
| 86 | fErrSigma0 = -1.;
|
|---|
| 87 | fErrSigma1 = -1.;
|
|---|
| 88 | fTime = -1.;
|
|---|
| 89 | fErrTime = -1;
|
|---|
| 90 |
|
|---|
| 91 | }
|
|---|
| 92 |
|
|---|
| 93 | Bool_t MCalibrationBlindPix::IsFitOK() const
|
|---|
| 94 | {
|
|---|
| 95 | return fHist->IsFitOK();
|
|---|
| 96 | }
|
|---|
| 97 |
|
|---|
| 98 | Bool_t MCalibrationBlindPix::FillCharge(const Float_t q)
|
|---|
| 99 | {
|
|---|
| 100 | return fHist->FillBlindPixelCharge(q);
|
|---|
| 101 | }
|
|---|
| 102 |
|
|---|
| 103 | Bool_t MCalibrationBlindPix::FillTime(const Float_t t)
|
|---|
| 104 | {
|
|---|
| 105 | return fHist->FillBlindPixelTime(t);
|
|---|
| 106 | }
|
|---|
| 107 |
|
|---|
| 108 | Bool_t MCalibrationBlindPix::FitCharge()
|
|---|
| 109 | {
|
|---|
| 110 |
|
|---|
| 111 | if (!fHist->FitSinglePhe())
|
|---|
| 112 | return kFALSE;
|
|---|
| 113 |
|
|---|
| 114 | fLambda = TMath::IsNaN(fHist->GetLambda()) ? -1. : fHist->GetLambda();
|
|---|
| 115 | fMu0 = TMath::IsNaN(fHist->GetMu0()) ? -1. : fHist->GetMu0();
|
|---|
| 116 | fMu1 = TMath::IsNaN(fHist->GetMu1()) ? -1. : fHist->GetMu1();
|
|---|
| 117 | fSigma0 = TMath::IsNaN(fHist->GetSigma0()) ? -1. : fHist->GetSigma0();
|
|---|
| 118 | fSigma1 = TMath::IsNaN(fHist->GetSigma1()) ? -1. : fHist->GetSigma1();
|
|---|
| 119 |
|
|---|
| 120 | fErrLambda = TMath::IsNaN(fHist->GetLambdaErr()) ? -1. : fHist->GetLambdaErr();
|
|---|
| 121 | fErrMu0 = TMath::IsNaN(fHist->GetMu0Err()) ? -1. : fHist->GetMu0Err();
|
|---|
| 122 | fErrMu1 = TMath::IsNaN(fHist->GetMu1Err()) ? -1. : fHist->GetMu1Err();
|
|---|
| 123 | fErrSigma0 = TMath::IsNaN(fHist->GetSigma0Err()) ? -1. : fHist->GetSigma0Err();
|
|---|
| 124 | fErrSigma1 = TMath::IsNaN(fHist->GetSigma1Err()) ? -1. : fHist->GetSigma1Err();
|
|---|
| 125 |
|
|---|
| 126 | return kTRUE;
|
|---|
| 127 | }
|
|---|
| 128 |
|
|---|
| 129 |
|
|---|
| 130 |
|
|---|
| 131 | Bool_t MCalibrationBlindPix::FitTime()
|
|---|
| 132 | {
|
|---|
| 133 |
|
|---|
| 134 | if(!fHist->FitTime())
|
|---|
| 135 | return kFALSE;
|
|---|
| 136 |
|
|---|
| 137 | fTime = fHist->GetMeanTime();
|
|---|
| 138 | fErrTime = fHist->GetMeanTimeErr();
|
|---|
| 139 |
|
|---|
| 140 | return kTRUE;
|
|---|
| 141 |
|
|---|
| 142 | }
|
|---|
| 143 |
|
|---|
| 144 | Bool_t MCalibrationBlindPix::CheckOscillations()
|
|---|
| 145 | {
|
|---|
| 146 | return fHist->CheckOscillations();
|
|---|
| 147 | }
|
|---|