| 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 | // MExtractedSignalPINDiode | 
|---|
| 28 | // | 
|---|
| 29 | // This is the storage container to hold informations about the extracted signal | 
|---|
| 30 | // (offset) value of the calibration PIN Diode | 
|---|
| 31 | // | 
|---|
| 32 | ///////////////////////////////////////////////////////////////////////////// | 
|---|
| 33 | #include "MExtractedSignalPINDiode.h" | 
|---|
| 34 |  | 
|---|
| 35 | #include "MLog.h" | 
|---|
| 36 | #include "MLogManip.h" | 
|---|
| 37 |  | 
|---|
| 38 | ClassImp(MExtractedSignalPINDiode); | 
|---|
| 39 |  | 
|---|
| 40 | using namespace std; | 
|---|
| 41 | // ------------------------------------------------------------------------ | 
|---|
| 42 | // | 
|---|
| 43 | // MExtractedSignalPINDiode holds the extracted signal | 
|---|
| 44 | // of the FADC slices and its error. | 
|---|
| 45 | // | 
|---|
| 46 | // Additionally, the number of saturated Slices are stored. | 
|---|
| 47 | // | 
|---|
| 48 | // Default values for the extracted signals are: -1. | 
|---|
| 49 | // | 
|---|
| 50 | MExtractedSignalPINDiode::MExtractedSignalPINDiode(const char* name, const char* title) | 
|---|
| 51 | { | 
|---|
| 52 |  | 
|---|
| 53 | fName  = name  ? name  : "MExtractedSignalPINDiode"; | 
|---|
| 54 | fTitle = title ? title : "Container of the Extracted Signals"; | 
|---|
| 55 |  | 
|---|
| 56 | Clear(); | 
|---|
| 57 | } | 
|---|
| 58 |  | 
|---|
| 59 | // ------------------------------------------------------------------------ | 
|---|
| 60 | // | 
|---|
| 61 | // Invalidate values to -1. | 
|---|
| 62 | // | 
|---|
| 63 | void MExtractedSignalPINDiode::Clear(Option_t *o) | 
|---|
| 64 | { | 
|---|
| 65 |  | 
|---|
| 66 | fExtractedSignal          = -1.; | 
|---|
| 67 | fExtractedSignalErr       = -1.; | 
|---|
| 68 | fExtractedTime            = -1.; | 
|---|
| 69 | fExtractedTimeErr         = -1.; | 
|---|
| 70 | fExtractedSigma           = -1.; | 
|---|
| 71 | fExtractedSigmaErr        = -1.; | 
|---|
| 72 | fExtractedChi2            = -1.; | 
|---|
| 73 |  | 
|---|
| 74 | fSaturated  = kFALSE; | 
|---|
| 75 |  | 
|---|
| 76 | } | 
|---|
| 77 |  | 
|---|
| 78 | void MExtractedSignalPINDiode::SetUsedFADCSlices(const Byte_t first, const Byte_t num) | 
|---|
| 79 | { | 
|---|
| 80 | fFirst          = first; | 
|---|
| 81 | fNumFADCSamples = num; | 
|---|
| 82 | } | 
|---|
| 83 |  | 
|---|
| 84 |  | 
|---|
| 85 | void MExtractedSignalPINDiode::SetExtractedSignal(const Float_t sig, const Float_t sigerr) | 
|---|
| 86 | { | 
|---|
| 87 | fExtractedSignal    = sig; | 
|---|
| 88 | fExtractedSignalErr = sigerr; | 
|---|
| 89 | } | 
|---|
| 90 |  | 
|---|
| 91 | void MExtractedSignalPINDiode::SetExtractedSigma(const Float_t sig, const Float_t sigerr) | 
|---|
| 92 | { | 
|---|
| 93 | fExtractedSigma    = sig; | 
|---|
| 94 | fExtractedSigmaErr = sigerr; | 
|---|
| 95 | } | 
|---|
| 96 |  | 
|---|
| 97 | void MExtractedSignalPINDiode::SetExtractedTime(const Float_t sig, const Float_t sigerr) | 
|---|
| 98 | { | 
|---|
| 99 | fExtractedTime    = sig; | 
|---|
| 100 | fExtractedTimeErr = sigerr; | 
|---|
| 101 | } | 
|---|
| 102 |  | 
|---|
| 103 | Bool_t MExtractedSignalPINDiode::IsValid() const | 
|---|
| 104 | { | 
|---|
| 105 | if (fSaturated) | 
|---|
| 106 | return kFALSE; | 
|---|
| 107 |  | 
|---|
| 108 | return fExtractedSignal >= 0. || fExtractedSignalErr >= 0.; | 
|---|
| 109 | } | 
|---|
| 110 |  | 
|---|
| 111 | void MExtractedSignalPINDiode::Print(Option_t *o) const | 
|---|
| 112 | { | 
|---|
| 113 | *fLog << Form(" Signal: %4.2f+-%4.2f",fExtractedSignal,fExtractedSignalErr) | 
|---|
| 114 | << Form(" Arr.Time: %4.2f+-%4.2f",fExtractedTime,fExtractedTimeErr) | 
|---|
| 115 | << Form(" Sigma: %4.2f+-%4.2f",fExtractedSigma,fExtractedSigmaErr) | 
|---|
| 116 | << Form(" Chi2: %5.2f",fExtractedChi2) | 
|---|
| 117 | << Form(" Saturation: %s",fSaturated ? "yes" : "no") | 
|---|
| 118 | << endl; | 
|---|
| 119 | } | 
|---|