| 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): Wolfgang Wittek 03/2003 <mailto:wittek@mppmu.mpg.de>
|
|---|
| 19 | !
|
|---|
| 20 | ! Copyright: MAGIC Software Development, 2000-2004
|
|---|
| 21 | !
|
|---|
| 22 | !
|
|---|
| 23 | \* ======================================================================== */
|
|---|
| 24 |
|
|---|
| 25 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 26 | //
|
|---|
| 27 | // MNewImagePar
|
|---|
| 28 | //
|
|---|
| 29 | // Storage Container for new image parameters
|
|---|
| 30 | //
|
|---|
| 31 | // fLeakage1 ratio: (photons in most outer ring of pixels) over fSize
|
|---|
| 32 | // fLeakage2 ratio: (photons in the 2 outer rings of pixels) over fSize
|
|---|
| 33 | // fNumSaturatedPixels: number of pixels in which at least one slice
|
|---|
| 34 | // of the low gain FADC was saturated.
|
|---|
| 35 | //
|
|---|
| 36 | // Version 2:
|
|---|
| 37 | // ----------
|
|---|
| 38 | // - added fNumSaturatedPixels
|
|---|
| 39 | //
|
|---|
| 40 | // Version 3:
|
|---|
| 41 | // ----------
|
|---|
| 42 | // - added fNumHGSaturatedPixels
|
|---|
| 43 | //
|
|---|
| 44 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 45 | #include "MNewImagePar.h"
|
|---|
| 46 |
|
|---|
| 47 | #include <fstream>
|
|---|
| 48 |
|
|---|
| 49 | #include "MLog.h"
|
|---|
| 50 | #include "MLogManip.h"
|
|---|
| 51 |
|
|---|
| 52 | #include "MHillas.h"
|
|---|
| 53 |
|
|---|
| 54 | #include "MGeomCam.h"
|
|---|
| 55 | #include "MGeomPix.h"
|
|---|
| 56 |
|
|---|
| 57 | #include "MCerPhotEvt.h"
|
|---|
| 58 | #include "MCerPhotPix.h"
|
|---|
| 59 |
|
|---|
| 60 | ClassImp(MNewImagePar);
|
|---|
| 61 |
|
|---|
| 62 | using namespace std;
|
|---|
| 63 |
|
|---|
| 64 | // --------------------------------------------------------------------------
|
|---|
| 65 | //
|
|---|
| 66 | // Default constructor.
|
|---|
| 67 | //
|
|---|
| 68 | MNewImagePar::MNewImagePar(const char *name, const char *title)
|
|---|
| 69 | {
|
|---|
| 70 | fName = name ? name : "MNewImagePar";
|
|---|
| 71 | fTitle = title ? title : "New image parameters";
|
|---|
| 72 | }
|
|---|
| 73 |
|
|---|
| 74 | // --------------------------------------------------------------------------
|
|---|
| 75 | //
|
|---|
| 76 | void MNewImagePar::Reset()
|
|---|
| 77 | {
|
|---|
| 78 | fLeakage1 = -1;
|
|---|
| 79 | fLeakage2 = -1;
|
|---|
| 80 |
|
|---|
| 81 | fInnerLeakage1 = -1;
|
|---|
| 82 | fInnerLeakage2 = -1;
|
|---|
| 83 | fInnerSize = -1;
|
|---|
| 84 |
|
|---|
| 85 | fConc = -1;
|
|---|
| 86 | fConc1 = -1;
|
|---|
| 87 |
|
|---|
| 88 | fNumUsedPixels = -1;
|
|---|
| 89 | fNumCorePixels = -1;
|
|---|
| 90 |
|
|---|
| 91 | fNumSaturatedPixels = -1;
|
|---|
| 92 | fNumHGSaturatedPixels = -1;
|
|---|
| 93 | }
|
|---|
| 94 |
|
|---|
| 95 | // --------------------------------------------------------------------------
|
|---|
| 96 | //
|
|---|
| 97 | // Calculation of new image parameters
|
|---|
| 98 | //
|
|---|
| 99 | void MNewImagePar::Calc(const MGeomCam &geom, const MCerPhotEvt &evt,
|
|---|
| 100 | const MHillas &hillas)
|
|---|
| 101 | {
|
|---|
| 102 | fNumUsedPixels = 0;
|
|---|
| 103 | fNumCorePixels = 0;
|
|---|
| 104 |
|
|---|
| 105 | fNumSaturatedPixels = 0;
|
|---|
| 106 | fNumHGSaturatedPixels = 0;
|
|---|
| 107 |
|
|---|
| 108 | fInnerSize = 0;
|
|---|
| 109 |
|
|---|
| 110 | const UInt_t npixevt = evt.GetNumPixels();
|
|---|
| 111 |
|
|---|
| 112 | Double_t edgepix1 = 0;
|
|---|
| 113 | Double_t edgepix2 = 0;
|
|---|
| 114 |
|
|---|
| 115 | Double_t edgepixin1 = 0;
|
|---|
| 116 | Double_t edgepixin2 = 0;
|
|---|
| 117 |
|
|---|
| 118 | Float_t maxpix1 = 0; // [#phot]
|
|---|
| 119 | Float_t maxpix2 = 0; // [#phot]
|
|---|
| 120 |
|
|---|
| 121 | for (UInt_t i=0; i<npixevt; i++)
|
|---|
| 122 | {
|
|---|
| 123 | const MCerPhotPix &pix = evt[i];
|
|---|
| 124 |
|
|---|
| 125 | // count saturated pixels
|
|---|
| 126 | if (pix.IsPixelHGSaturated())
|
|---|
| 127 | fNumHGSaturatedPixels++;
|
|---|
| 128 | if (pix.IsPixelSaturated())
|
|---|
| 129 | fNumSaturatedPixels++;
|
|---|
| 130 |
|
|---|
| 131 | // skip unused pixels
|
|---|
| 132 | if (!pix.IsPixelUsed())
|
|---|
| 133 | continue;
|
|---|
| 134 |
|
|---|
| 135 | // count used and core pixels
|
|---|
| 136 | if (pix.IsPixelCore())
|
|---|
| 137 | fNumCorePixels++;
|
|---|
| 138 |
|
|---|
| 139 | // count used pixels
|
|---|
| 140 | fNumUsedPixels++;
|
|---|
| 141 |
|
|---|
| 142 | const Int_t pixid = pix.GetPixId();
|
|---|
| 143 |
|
|---|
| 144 | const MGeomPix &gpix = geom[pixid];
|
|---|
| 145 |
|
|---|
| 146 | Double_t nphot = pix.GetNumPhotons();
|
|---|
| 147 |
|
|---|
| 148 | //
|
|---|
| 149 | // count photons in outer rings of camera
|
|---|
| 150 | //
|
|---|
| 151 | if (gpix.IsInOutermostRing())
|
|---|
| 152 | edgepix1 += nphot;
|
|---|
| 153 | if (gpix.IsInOuterRing())
|
|---|
| 154 | edgepix2 += nphot;
|
|---|
| 155 |
|
|---|
| 156 | //
|
|---|
| 157 | // Now we are working on absolute values of nphot, which
|
|---|
| 158 | // must take pixel size into account
|
|---|
| 159 | //
|
|---|
| 160 | nphot *= geom.GetPixRatio(pixid);
|
|---|
| 161 |
|
|---|
| 162 | // count inner pixels: To dependent on MAGIC Camera --> FIXME
|
|---|
| 163 |
|
|---|
| 164 | if (pixid<397){
|
|---|
| 165 | fInnerSize += nphot;
|
|---|
| 166 | if(pixid>270){
|
|---|
| 167 | edgepixin2 += nphot;
|
|---|
| 168 | if(pixid>330)
|
|---|
| 169 | edgepixin1 += nphot;
|
|---|
| 170 | }
|
|---|
| 171 | }
|
|---|
| 172 |
|
|---|
| 173 | // Compute Concetration 1 -2
|
|---|
| 174 |
|
|---|
| 175 | if (nphot>maxpix1)
|
|---|
| 176 | {
|
|---|
| 177 | maxpix2 = maxpix1;
|
|---|
| 178 | maxpix1 = nphot; // [1]
|
|---|
| 179 | continue; // [1]
|
|---|
| 180 | }
|
|---|
| 181 |
|
|---|
| 182 | if (nphot>maxpix2)
|
|---|
| 183 | maxpix2 = nphot; // [1]
|
|---|
| 184 | }
|
|---|
| 185 |
|
|---|
| 186 | fInnerLeakage1 = edgepixin1 / fInnerSize;
|
|---|
| 187 | fInnerLeakage2 = edgepixin2 / fInnerSize;
|
|---|
| 188 | fLeakage1 = edgepix1 / hillas.GetSize();
|
|---|
| 189 | fLeakage2 = edgepix2 / hillas.GetSize();
|
|---|
| 190 |
|
|---|
| 191 | fConc = (maxpix1+maxpix2)/hillas.GetSize(); // [ratio]
|
|---|
| 192 | fConc1 = maxpix1/hillas.GetSize(); // [ratio]
|
|---|
| 193 |
|
|---|
| 194 | SetReadyToSave();
|
|---|
| 195 | }
|
|---|
| 196 |
|
|---|
| 197 | // --------------------------------------------------------------------------
|
|---|
| 198 | //
|
|---|
| 199 | void MNewImagePar::Print(Option_t *) const
|
|---|
| 200 | {
|
|---|
| 201 | *fLog << all;
|
|---|
| 202 | *fLog << "New Image Parameters (" << GetName() << ")" << endl;
|
|---|
| 203 | *fLog << " - Leakage1 [1] = " << fLeakage1 << endl;
|
|---|
| 204 | *fLog << " - Leakage2 [1] = " << fLeakage2 << endl;
|
|---|
| 205 | *fLog << " - Conc [1] = " << fConc << " (ratio)" << endl;
|
|---|
| 206 | *fLog << " - Conc1 [1] = " << fConc1 << " (ratio)" << endl;
|
|---|
| 207 | *fLog << " - Used Pixels [#] = " << fNumUsedPixels << " Pixels" << endl;
|
|---|
| 208 | *fLog << " - Core Pixels [#] = " << fNumCorePixels << " Pixels" << endl;
|
|---|
| 209 | *fLog << " - Sat. Pixels (HG) [#] = " << fNumHGSaturatedPixels << " Pixels" << endl;
|
|---|
| 210 | *fLog << " - Sat. Pixels (LG) [#] = " << fNumSaturatedPixels << " Pixels" << endl;
|
|---|
| 211 | }
|
|---|