| 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, 02/2004 <mailto:tbretz@astro.uni.wuerzburg.de>
|
|---|
| 19 | !
|
|---|
| 20 | ! Copyright: MAGIC Software Development, 2000-2004
|
|---|
| 21 | !
|
|---|
| 22 | !
|
|---|
| 23 | \* ======================================================================== */
|
|---|
| 24 |
|
|---|
| 25 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 26 | //
|
|---|
| 27 | // MBadPixelsCalc
|
|---|
| 28 | //
|
|---|
| 29 | //
|
|---|
| 30 | // The job of the task is to determin bad pixels event-wise. This must be
|
|---|
| 31 | // redone for each event. This particular task is for what is explained
|
|---|
| 32 | // below.
|
|---|
| 33 | // New algorithms may enter new tasks.
|
|---|
| 34 | //
|
|---|
| 35 | //
|
|---|
| 36 | // Check the pedestal RMS of every pixel with respect to the mean
|
|---|
| 37 | // pedestal RMS of the camera (Sigmabar).
|
|---|
| 38 | //
|
|---|
| 39 | // The pixels can be set as blind if the pedestalRMS is too big or 0.
|
|---|
| 40 | //
|
|---|
| 41 | // If you don't want to use this option set the PedestalLevel<=0;
|
|---|
| 42 | //
|
|---|
| 43 | // MBadPixelsCalc calc;
|
|---|
| 44 | // calc.SetPedestalLevel(-1);
|
|---|
| 45 | //
|
|---|
| 46 | //
|
|---|
| 47 | // Input Containers:
|
|---|
| 48 | // [MPedPhotCam]
|
|---|
| 49 | // [MGeomCam]
|
|---|
| 50 | // [MSigmabar]
|
|---|
| 51 | //
|
|---|
| 52 | // Output Containers:
|
|---|
| 53 | // MBadPixles
|
|---|
| 54 | //
|
|---|
| 55 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 56 | #include "MBadPixelsCalc.h"
|
|---|
| 57 |
|
|---|
| 58 | #include "MLog.h"
|
|---|
| 59 | #include "MLogManip.h"
|
|---|
| 60 |
|
|---|
| 61 | #include "MParList.h"
|
|---|
| 62 |
|
|---|
| 63 | #include "MGeomCam.h"
|
|---|
| 64 | #include "MSigmabar.h"
|
|---|
| 65 |
|
|---|
| 66 | #include "MPedPhotCam.h"
|
|---|
| 67 | #include "MPedPhotPix.h"
|
|---|
| 68 |
|
|---|
| 69 | #include "MBadPixelsCam.h"
|
|---|
| 70 | #include "MBadPixelsPix.h"
|
|---|
| 71 |
|
|---|
| 72 | ClassImp(MBadPixelsCalc);
|
|---|
| 73 |
|
|---|
| 74 | using namespace std;
|
|---|
| 75 |
|
|---|
| 76 | static const TString gsDefName = "MBadPixelsCalc";
|
|---|
| 77 | static const TString gsDefTitle = "Find hot spots (star, broken pixels, etc)";
|
|---|
| 78 |
|
|---|
| 79 | // --------------------------------------------------------------------------
|
|---|
| 80 | //
|
|---|
| 81 | // Default constructor.
|
|---|
| 82 | //
|
|---|
| 83 | MBadPixelsCalc::MBadPixelsCalc(const char *name, const char *title)
|
|---|
| 84 | : fPedestalLevel(3)
|
|---|
| 85 | {
|
|---|
| 86 | fName = name ? name : gsDefName.Data();
|
|---|
| 87 | fTitle = title ? title : gsDefTitle.Data();
|
|---|
| 88 | }
|
|---|
| 89 |
|
|---|
| 90 | // --------------------------------------------------------------------------
|
|---|
| 91 | //
|
|---|
| 92 | //
|
|---|
| 93 | Int_t MBadPixelsCalc::PreProcess (MParList *pList)
|
|---|
| 94 | {
|
|---|
| 95 | fBadPixels = (MBadPixelsCam*)pList->FindCreateObj(AddSerialNumber("MBadPixelsCam"));
|
|---|
| 96 | if (!fBadPixels)
|
|---|
| 97 | return kFALSE;
|
|---|
| 98 |
|
|---|
| 99 | if (fPedestalLevel>0)
|
|---|
| 100 | {
|
|---|
| 101 | fPedPhotCam = (MPedPhotCam*)pList->FindObject(AddSerialNumber("MPedPhotCam"));
|
|---|
| 102 | if (!fPedPhotCam)
|
|---|
| 103 | {
|
|---|
| 104 | *fLog << err << "MPedPhotCam not found... aborting." << endl;
|
|---|
| 105 | return kFALSE;
|
|---|
| 106 | }
|
|---|
| 107 |
|
|---|
| 108 | fGeomCam = (MGeomCam*)pList->FindObject(AddSerialNumber("MGeomCam"));
|
|---|
| 109 | if (!fGeomCam)
|
|---|
| 110 | {
|
|---|
| 111 | *fLog << err << "MGeomCam not found... aborting." << endl;
|
|---|
| 112 | return kFALSE;
|
|---|
| 113 | }
|
|---|
| 114 |
|
|---|
| 115 | fSigmabar = (MSigmabar*)pList->FindObject(AddSerialNumber("MSigmabar"));
|
|---|
| 116 | if (!fSigmabar)
|
|---|
| 117 | {
|
|---|
| 118 | *fLog << err << "MSigmabar not found... aborting." << endl;
|
|---|
| 119 | return kFALSE;
|
|---|
| 120 | }
|
|---|
| 121 | }
|
|---|
| 122 | return kTRUE;
|
|---|
| 123 | }
|
|---|
| 124 |
|
|---|
| 125 | // --------------------------------------------------------------------------
|
|---|
| 126 | //
|
|---|
| 127 | // Check the pedestal RMS of every pixel with respect to the mean pedestal RMS
|
|---|
| 128 | // of the camera (Sigmabar).
|
|---|
| 129 | //
|
|---|
| 130 | // The pixels can be set as blind if the pedestalRMS is too big or 0.
|
|---|
| 131 | //
|
|---|
| 132 | // If you don't want to use this option set the PedestalLevel<=0;
|
|---|
| 133 | //
|
|---|
| 134 | // MBadPixelsCalc calc;
|
|---|
| 135 | // calc.SetPedestalLevel(-1);
|
|---|
| 136 | //
|
|---|
| 137 | void MBadPixelsCalc::CheckPedestalRMS() const
|
|---|
| 138 | {
|
|---|
| 139 | const Int_t entries = fPedPhotCam->GetSize();
|
|---|
| 140 |
|
|---|
| 141 | const Float_t meanPedRMS = fSigmabar->GetSigmabar();
|
|---|
| 142 |
|
|---|
| 143 | for (Int_t i=0; i<entries; i++)
|
|---|
| 144 | {
|
|---|
| 145 | //
|
|---|
| 146 | // get pixel as entry from list
|
|---|
| 147 | //
|
|---|
| 148 | const Double_t nratio = fGeomCam->GetPixRatio(i);
|
|---|
| 149 | const Double_t pixPedRms = (*fPedPhotCam)[i].GetRms();
|
|---|
| 150 |
|
|---|
| 151 | if (pixPedRms*nratio > fPedestalLevel * meanPedRMS || pixPedRms == 0)
|
|---|
| 152 | (*fBadPixels)[i].SetUnsuitable(MBadPixelsPix::kUnsuitableEvt);
|
|---|
| 153 | }
|
|---|
| 154 | }
|
|---|
| 155 | // --------------------------------------------------------------------------
|
|---|
| 156 | //
|
|---|
| 157 | //
|
|---|
| 158 | Int_t MBadPixelsCalc::Process()
|
|---|
| 159 | {
|
|---|
| 160 | if (fPedestalLevel>0)
|
|---|
| 161 | CheckPedestalRMS();
|
|---|
| 162 |
|
|---|
| 163 | return kTRUE;
|
|---|
| 164 | }
|
|---|