| 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): Sabrina Stark 12/2003 <mailto:lstark@particle.phys.ethz.ch>
|
|---|
| 19 | !
|
|---|
| 20 | ! Copyright: MAGIC Software Development, 2000-2003
|
|---|
| 21 | !
|
|---|
| 22 | !
|
|---|
| 23 | \* ======================================================================== */
|
|---|
| 24 |
|
|---|
| 25 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 26 | // //
|
|---|
| 27 | // MPedestalWorkaround //
|
|---|
| 28 | // //
|
|---|
| 29 | // This class contains the function to store the pedestal value and the //
|
|---|
| 30 | // RMS of the pedestal in units of photons. //
|
|---|
| 31 | // //
|
|---|
| 32 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 33 | #include "MPedestalWorkaround.h"
|
|---|
| 34 |
|
|---|
| 35 | #include <stdio.h>
|
|---|
| 36 | #include "MLog.h"
|
|---|
| 37 | #include "MLogManip.h"
|
|---|
| 38 | #include "MParList.h"
|
|---|
| 39 | #include "MGeomCam.h"
|
|---|
| 40 |
|
|---|
| 41 | #include "MPedestalCam.h"
|
|---|
| 42 | #include "MPedestalPix.h"
|
|---|
| 43 | #include "MPedPhotCam.h"
|
|---|
| 44 |
|
|---|
| 45 | using namespace std;
|
|---|
| 46 |
|
|---|
| 47 | ClassImp(MPedestalWorkaround);
|
|---|
| 48 |
|
|---|
| 49 | MPedestalWorkaround::MPedestalWorkaround(const char *name, const char *title)
|
|---|
| 50 | {
|
|---|
| 51 | fName = name ? name : "MPedestalWorkaround";
|
|---|
| 52 | fTitle = title ? title : "Storage of pedestal values and RMS in units of photons";
|
|---|
| 53 |
|
|---|
| 54 | }
|
|---|
| 55 |
|
|---|
| 56 | // ------------------------------------------------------------------------
|
|---|
| 57 | //
|
|---|
| 58 |
|
|---|
| 59 | Int_t MPedestalWorkaround::PreProcess(MParList *pList)
|
|---|
| 60 | {
|
|---|
| 61 | fPed = (MPedestalCam*)pList->FindObject("MPedestalCam");
|
|---|
| 62 | if (!fPed)
|
|---|
| 63 | {
|
|---|
| 64 | *fLog << err << "MPedestalCam not found... aborting." << endl;
|
|---|
| 65 | return kFALSE;
|
|---|
| 66 | }
|
|---|
| 67 | fPedPhot = (MPedPhotCam*)pList->FindObject("MPedPhotCam");
|
|---|
| 68 | if (!fPedPhot)
|
|---|
| 69 | {
|
|---|
| 70 | *fLog << err << "MPedPhotCam not found... aborting." << endl;
|
|---|
| 71 | return kFALSE;
|
|---|
| 72 | }
|
|---|
| 73 | fCam = (MGeomCam*)pList->FindObject("MGeomCam");
|
|---|
| 74 | if (!fCam)
|
|---|
| 75 | {
|
|---|
| 76 | *fLog << err << "MGeomCam not found (no geometry information available)... aborting." << endl;
|
|---|
| 77 | return kFALSE;
|
|---|
| 78 | }
|
|---|
| 79 |
|
|---|
| 80 | return kTRUE;
|
|---|
| 81 | }
|
|---|
| 82 |
|
|---|
| 83 | // ------------------------------------------------------------------------
|
|---|
| 84 | //
|
|---|
| 85 | Int_t MPedestalWorkaround::Process()
|
|---|
| 86 | {
|
|---|
| 87 |
|
|---|
| 88 | UInt_t imaxnumpix = fCam->GetNumPixels();
|
|---|
| 89 |
|
|---|
| 90 | for (UInt_t i=0; i<imaxnumpix; i++)
|
|---|
| 91 | {
|
|---|
| 92 | Int_t type = 0;
|
|---|
| 93 | Double_t val;
|
|---|
| 94 | Float_t valout;
|
|---|
| 95 | fPedPhot->GetPixelContent( val, i, *fCam, type);
|
|---|
| 96 | valout = (*fPed)[i].GetPedestal();
|
|---|
| 97 | (*fPed)[i].SetPedestal(val);
|
|---|
| 98 | *fLog << "i, val, valout : " << i <<", "<< val<<", " << valout << endl;
|
|---|
| 99 | type = 1;
|
|---|
| 100 | fPedPhot->GetPixelContent( val, i, *fCam, type);
|
|---|
| 101 | valout = (*fPed)[i].GetPedestalRms();
|
|---|
| 102 | (*fPed)[i].SetPedestalRms(val);
|
|---|
| 103 | *fLog << "RMS : i, val, valout : " << i <<", "<< val<<", " << valout << endl;
|
|---|
| 104 | }
|
|---|
| 105 |
|
|---|
| 106 |
|
|---|
| 107 | return kTRUE;
|
|---|
| 108 | }
|
|---|
| 109 |
|
|---|
| 110 | Int_t MPedestalWorkaround::PostProcess()
|
|---|
| 111 | {
|
|---|
| 112 | return kTRUE;
|
|---|
| 113 | }
|
|---|
| 114 |
|
|---|