| 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): Thomas Bretz  12/2000 <mailto:tbretz@astro.uni-wuerzburg.de> | 
|---|
| 19 | ! | 
|---|
| 20 | !   Copyright: MAGIC Software Development, 2000-2005 | 
|---|
| 21 | ! | 
|---|
| 22 | ! | 
|---|
| 23 | \* ======================================================================== */ | 
|---|
| 24 |  | 
|---|
| 25 |  | 
|---|
| 26 | ///////////////////////////////////////////////////////////////////////////// | 
|---|
| 27 | // | 
|---|
| 28 | // MSignalPix | 
|---|
| 29 | // | 
|---|
| 30 | // Storage container for the signal in a pixel in number of photons. | 
|---|
| 31 | // | 
|---|
| 32 | // NOTE: This container is NOT ment for I/O. Write it to a file on your | 
|---|
| 33 | //       own risk! | 
|---|
| 34 | // | 
|---|
| 35 | // fIsSaturated: boolean variable set to kTRUE whenever one or more of | 
|---|
| 36 | //               the low gain FADC slices of the pixel is in saturation. | 
|---|
| 37 | // | 
|---|
| 38 | // Version 2: | 
|---|
| 39 | // ---------- | 
|---|
| 40 | //  - added fIsSaturated | 
|---|
| 41 | // | 
|---|
| 42 | // Version 4: | 
|---|
| 43 | // ---------- | 
|---|
| 44 | //  - added fIsHGSaturated | 
|---|
| 45 | // | 
|---|
| 46 | // Version 5: | 
|---|
| 47 | // ---------- | 
|---|
| 48 | //  - added fIdxIsland | 
|---|
| 49 | // | 
|---|
| 50 | // Version 6: | 
|---|
| 51 | // ---------- | 
|---|
| 52 | //  - put the '!' into the comment line for | 
|---|
| 53 | //      Bool_t   fIsCore;        //! the pixel is a Core pixel -> kTRUE | 
|---|
| 54 | //      Short_t  fRing;          //! NT: number of analyzed rings around the core pixels, fRing>0 means: used, fRing= 0 means: unused, fRing= -1 means: unmapped (no possible to use in the calculation of the image parameters) | 
|---|
| 55 | //      Short_t  fIdxIsland;     //! the pixel is a Core pixel -> kTRUE | 
|---|
| 56 | //      Bool_t   fIsHGSaturated; //! the pixel's high gain is saturated | 
|---|
| 57 | //    This is a queick hack to gain storage space - the structure of | 
|---|
| 58 | //    the container for calibrated data will change soon. | 
|---|
| 59 | // | 
|---|
| 60 | // Version 7: | 
|---|
| 61 | // ---------- | 
|---|
| 62 | //  - removed '!' from fRing to allow the status 'Unmapped' to be stored | 
|---|
| 63 | //    after calibration (bad pixel treatment). This increases the file | 
|---|
| 64 | //    size of the calibrated data by roughly 0.5% | 
|---|
| 65 | // | 
|---|
| 66 | //////////////////////////////////////////////////////////////////////////// | 
|---|
| 67 | #include "MSignalPix.h" | 
|---|
| 68 |  | 
|---|
| 69 | #include "MLog.h" | 
|---|
| 70 |  | 
|---|
| 71 | ClassImp(MSignalPix); | 
|---|
| 72 |  | 
|---|
| 73 | using namespace std; | 
|---|
| 74 |  | 
|---|
| 75 | // -------------------------------------------------------------------------- | 
|---|
| 76 | // | 
|---|
| 77 | // Default constructor. The pixel is assumed as used and not a core pixel. | 
|---|
| 78 | // NT 29/04/2003: A pixel is considered used when fRing > 0. | 
|---|
| 79 | // | 
|---|
| 80 | MSignalPix::MSignalPix(Float_t phot, Float_t errphot) : | 
|---|
| 81 | fIsCore(kFALSE), fRing(1), fIdxIsland(-1), | 
|---|
| 82 | fPhot(phot), fErrPhot(errphot) | 
|---|
| 83 | { | 
|---|
| 84 | MMath::ReducePrecision(fPhot); | 
|---|
| 85 | MMath::ReducePrecision(fErrPhot); | 
|---|
| 86 | } | 
|---|
| 87 |  | 
|---|
| 88 | void MSignalPix::Clear(Option_t *o) | 
|---|
| 89 | { | 
|---|
| 90 | fIsCore     = kFALSE; | 
|---|
| 91 | fRing       =  1; | 
|---|
| 92 | fIdxIsland  = -1; | 
|---|
| 93 | fPhot       =  0; | 
|---|
| 94 | fErrPhot    =  0; | 
|---|
| 95 | } | 
|---|
| 96 |  | 
|---|
| 97 | // -------------------------------------------------------------------------- | 
|---|
| 98 | // | 
|---|
| 99 | //  Print information to gLog. | 
|---|
| 100 | // | 
|---|
| 101 | void MSignalPix::Print(Option_t *) const | 
|---|
| 102 | { | 
|---|
| 103 | gLog << GetDescriptor();// << " Pixel: "<< fPixId; | 
|---|
| 104 | switch (fRing) | 
|---|
| 105 | { | 
|---|
| 106 | case -1: | 
|---|
| 107 | gLog << "Unampped"; | 
|---|
| 108 | break; | 
|---|
| 109 | case 0: | 
|---|
| 110 | gLog << " Unused "; | 
|---|
| 111 | break; | 
|---|
| 112 | default: | 
|---|
| 113 | gLog << "  Used  "; | 
|---|
| 114 | break; | 
|---|
| 115 | } | 
|---|
| 116 | gLog << (fIsCore?" Core ":"      "); | 
|---|
| 117 | gLog << "Nphot= " << fPhot << " Error(Nphot)=" << fErrPhot << endl; | 
|---|
| 118 | } | 
|---|