| 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 | // MExtractedSignalBlindPixel | 
|---|
| 28 | // | 
|---|
| 29 | // The storage container of the extracted signal of the calibration Blind Pixel(s). | 
|---|
| 30 | // Additionally, the number of saturated Slices are stored. | 
|---|
| 31 | // There is place for various blind pixels set into the camera in  July. Default | 
|---|
| 32 | // is one blind pixel. | 
|---|
| 33 | // | 
|---|
| 34 | // Default values for the extracted signals are: gkSignalInitializer | 
|---|
| 35 | // | 
|---|
| 36 | ///////////////////////////////////////////////////////////////////////////// | 
|---|
| 37 | #include "MExtractedSignalBlindPixel.h" | 
|---|
| 38 |  | 
|---|
| 39 | #include "MLog.h" | 
|---|
| 40 | #include "MLogManip.h" | 
|---|
| 41 |  | 
|---|
| 42 | ClassImp(MExtractedSignalBlindPixel); | 
|---|
| 43 |  | 
|---|
| 44 | using namespace std; | 
|---|
| 45 |  | 
|---|
| 46 | const Int_t MExtractedSignalBlindPixel::gkSignalInitializer = 99999; | 
|---|
| 47 | // ------------------------------------------------------------------------ | 
|---|
| 48 | // | 
|---|
| 49 | // | 
|---|
| 50 | // Sets: | 
|---|
| 51 | // - the dimenstion of fBlindPixelIdx to 1 | 
|---|
| 52 | // - the dimenstion of fExtractedSignal to 1 | 
|---|
| 53 | // - the dimenstion of fNumSaturated to 1 | 
|---|
| 54 | // - the dimenstion of fPed. to 1; | 
|---|
| 55 | // - the dimenstion of fPedErr. to 1; | 
|---|
| 56 | // - the dimenstion of fPedRms. to 1; | 
|---|
| 57 | // - the dimenstion of fPedRmsErr. to 1; | 
|---|
| 58 | // | 
|---|
| 59 | // Calls: | 
|---|
| 60 | // - Clear() | 
|---|
| 61 | // | 
|---|
| 62 | MExtractedSignalBlindPixel::MExtractedSignalBlindPixel(const char* name, const char* title) | 
|---|
| 63 | { | 
|---|
| 64 |  | 
|---|
| 65 | fName  = name  ? name  : "MExtractedSignalBlindPixel"; | 
|---|
| 66 | fTitle = title ? title : "Container of the Extracted Signals"; | 
|---|
| 67 |  | 
|---|
| 68 | fBlindPixelIdx.Set(1); | 
|---|
| 69 | fExtractedSignal.Set(1); | 
|---|
| 70 | fNumSaturated.Set(1); | 
|---|
| 71 |  | 
|---|
| 72 | fPed.Set(1); | 
|---|
| 73 | fPedErr.Set(1); | 
|---|
| 74 | fPedRms.Set(1); | 
|---|
| 75 | fPedRmsErr.Set(1); | 
|---|
| 76 |  | 
|---|
| 77 | Clear(); | 
|---|
| 78 | } | 
|---|
| 79 |  | 
|---|
| 80 | // ------------------------------------------------------------------------ | 
|---|
| 81 | // | 
|---|
| 82 | // Set values of: | 
|---|
| 83 | // - fNumSaturated | 
|---|
| 84 | // - fExtractedSignal | 
|---|
| 85 | // to gkSignalInitializer | 
|---|
| 86 | // | 
|---|
| 87 | void MExtractedSignalBlindPixel::Clear(Option_t *o) | 
|---|
| 88 | { | 
|---|
| 89 |  | 
|---|
| 90 | for (Int_t i=0;i<fBlindPixelIdx.GetSize();i++) | 
|---|
| 91 | { | 
|---|
| 92 | fNumSaturated   .AddAt(gkSignalInitializer,i); | 
|---|
| 93 | fExtractedSignal.AddAt(gkSignalInitializer,i); | 
|---|
| 94 | } | 
|---|
| 95 | } | 
|---|
| 96 |  | 
|---|
| 97 | // ------------------------------------------------------------------------ | 
|---|
| 98 | // | 
|---|
| 99 | // Set number num of used FADC slices, starting from (including) first | 
|---|
| 100 | // | 
|---|
| 101 | void MExtractedSignalBlindPixel::SetUsedFADCSlices(const Byte_t first, const Byte_t num) | 
|---|
| 102 | { | 
|---|
| 103 | fFirst          = first; | 
|---|
| 104 | fNumFADCSamples = num; | 
|---|
| 105 | } | 
|---|
| 106 |  | 
|---|
| 107 | // -------------------------------------------------------------------------------------------- | 
|---|
| 108 | // | 
|---|
| 109 | // Returns true, if fExtractedSignal is greater or equal 0 and smaller than gkSignalInitializer | 
|---|
| 110 | // | 
|---|
| 111 | Bool_t MExtractedSignalBlindPixel::IsValid( const Int_t i ) const | 
|---|
| 112 | { | 
|---|
| 113 | return fExtractedSignal.At(i) >= 0 && fExtractedSignal.At(i) <  gkSignalInitializer; | 
|---|
| 114 | } | 
|---|
| 115 |  | 
|---|
| 116 | // -------------------------------------------------------------------------------------------- | 
|---|
| 117 | // | 
|---|
| 118 | // Prints for all stored blind pixels the ID, the signal and the number of saturated slices | 
|---|
| 119 | // | 
|---|
| 120 | void MExtractedSignalBlindPixel::Print(Option_t *o) const | 
|---|
| 121 | { | 
|---|
| 122 |  | 
|---|
| 123 | for (Int_t i=0;i<fBlindPixelIdx.GetSize();i++) | 
|---|
| 124 | { | 
|---|
| 125 |  | 
|---|
| 126 | *fLog << "Blind Pixel ID: " << fBlindPixelIdx.At(i) | 
|---|
| 127 | << ": Signal: " << fExtractedSignal.At(i) | 
|---|
| 128 | << " Saturated Slices: " <<  fNumSaturated.At(i) | 
|---|
| 129 | << endl; | 
|---|
| 130 | } | 
|---|
| 131 | } | 
|---|
| 132 |  | 
|---|
| 133 | // ------------------------------------------------------------------------------------ | 
|---|
| 134 | // | 
|---|
| 135 | // Returns true if the extraction type. Available are: kAmplitude, kIntegral and kFilter | 
|---|
| 136 | // The flags kIntegral and kFilter may be set both. | 
|---|
| 137 | // | 
|---|
| 138 | Bool_t MExtractedSignalBlindPixel::IsExtractionType( const MExtractBlindPixel::ExtractionType_t typ ) | 
|---|
| 139 | { | 
|---|
| 140 |  | 
|---|
| 141 | return TESTBIT( fExtractionType, typ ); | 
|---|
| 142 |  | 
|---|
| 143 | } | 
|---|