| 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 07/2004 <mailto:markus@ifae.es>
|
|---|
| 19 | !
|
|---|
| 20 | ! Copyright: MAGIC Software Development, 2000-2004
|
|---|
| 21 | !
|
|---|
| 22 | !
|
|---|
| 23 | \* ======================================================================== */
|
|---|
| 24 |
|
|---|
| 25 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 26 | //
|
|---|
| 27 | // MCalibrationChargeBlindCam
|
|---|
| 28 | //
|
|---|
| 29 | // Base class for Blind Pixels Calibration results. Derived classes intialize
|
|---|
| 30 | // the actual values of the MCalibrationBlindPix's.
|
|---|
| 31 | //
|
|---|
| 32 | // Contains TClonesArrays for the following objects:
|
|---|
| 33 | // - fBlindPixels: Array of classes derived from MCalibrationChargeBlindPix, one entry
|
|---|
| 34 | // per blind pixel.
|
|---|
| 35 | //
|
|---|
| 36 | // All TClonesArrays have to enlarged by the corresponding calls to (e.g. in MGeomApply):
|
|---|
| 37 | // - InitSize()
|
|---|
| 38 | //
|
|---|
| 39 | // See also: MCalibrationChargeBlindCamOneOldStyle
|
|---|
| 40 | //
|
|---|
| 41 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 42 | #include "MCalibrationChargeBlindCam.h"
|
|---|
| 43 | #include "MCalibrationChargeBlindPix.h"
|
|---|
| 44 |
|
|---|
| 45 | #include "MParContainer.h"
|
|---|
| 46 |
|
|---|
| 47 | ClassImp(MCalibrationChargeBlindCam);
|
|---|
| 48 |
|
|---|
| 49 | using namespace std;
|
|---|
| 50 | // --------------------------------------------------------------------------
|
|---|
| 51 | //
|
|---|
| 52 | // Default constructor.
|
|---|
| 53 | //
|
|---|
| 54 | // Initializes:
|
|---|
| 55 | // - fPulserColor to kNONE
|
|---|
| 56 | //
|
|---|
| 57 | // Creates a TClonesArray of MCalibrationChargeBlindPix containers for the TClonesArray's:
|
|---|
| 58 | // - fBlindPixels
|
|---|
| 59 | // all initialized to 1 entry
|
|---|
| 60 | //
|
|---|
| 61 | // Later, a call to InitSize()
|
|---|
| 62 | // has to be performed in order to get the dimension correctly.
|
|---|
| 63 | //
|
|---|
| 64 | MCalibrationChargeBlindCam::MCalibrationChargeBlindCam(UInt_t nblind,const char *name, const char *title)
|
|---|
| 65 | : fNumBlindPixels(nblind),
|
|---|
| 66 | fPulserColor(MCalibrationCam::kNONE),
|
|---|
| 67 | fBlindPixels(nblind)
|
|---|
| 68 | {
|
|---|
| 69 |
|
|---|
| 70 | fName = name ? name : "MCalibrationChargeBlindCam";
|
|---|
| 71 | fTitle = title ? title : "Calibration Information of blinded pixels in camera";
|
|---|
| 72 |
|
|---|
| 73 | //
|
|---|
| 74 | // make sure that the destructor delete all contained objects
|
|---|
| 75 | //
|
|---|
| 76 | fBlindPixels.SetOwner();
|
|---|
| 77 |
|
|---|
| 78 | for (UInt_t i=0; i<nblind; i++)
|
|---|
| 79 | fBlindPixels[i] = new MCalibrationChargeBlindPix;
|
|---|
| 80 |
|
|---|
| 81 | }
|
|---|
| 82 |
|
|---|
| 83 |
|
|---|
| 84 | // --------------------------------------
|
|---|
| 85 | //
|
|---|
| 86 | // Calls the ForEach macro for the TClonesArray fBlindPixels with the argument Clear()
|
|---|
| 87 | //
|
|---|
| 88 | void MCalibrationChargeBlindCam::Clear(Option_t *o)
|
|---|
| 89 | {
|
|---|
| 90 | fBlindPixels.ForEach(TObject, Clear)();
|
|---|
| 91 | }
|
|---|
| 92 |
|
|---|
| 93 | // -----------------------------------------------------
|
|---|
| 94 | //
|
|---|
| 95 | // copy 'constructor'
|
|---|
| 96 | //
|
|---|
| 97 | void MCalibrationChargeBlindCam::Copy(TObject& object) const
|
|---|
| 98 | {
|
|---|
| 99 |
|
|---|
| 100 | MCalibrationChargeBlindCam &calib = (MCalibrationChargeBlindCam&)object;
|
|---|
| 101 | calib.fPulserColor = fPulserColor;
|
|---|
| 102 | calib.fNumBlindPixels = fNumBlindPixels;
|
|---|
| 103 |
|
|---|
| 104 | for (UInt_t i=0; i<fNumBlindPixels; i++)
|
|---|
| 105 | {
|
|---|
| 106 | calib.fBlindPixels[i] = new MCalibrationChargeBlindPix;
|
|---|
| 107 | (*this)[i].Copy(calib[i]);
|
|---|
| 108 | }
|
|---|
| 109 | }
|
|---|
| 110 |
|
|---|
| 111 | // --------------------------------------------------------------------------
|
|---|
| 112 | //
|
|---|
| 113 | // Get i-th blind pixel (pixel number)
|
|---|
| 114 | //
|
|---|
| 115 | MCalibrationChargeBlindPix &MCalibrationChargeBlindCam::operator[](UInt_t i)
|
|---|
| 116 | {
|
|---|
| 117 | return *static_cast<MCalibrationChargeBlindPix*>(fBlindPixels.UncheckedAt(i));
|
|---|
| 118 | }
|
|---|
| 119 |
|
|---|
| 120 | // --------------------------------------------------------------------------
|
|---|
| 121 | //
|
|---|
| 122 | // Get i-th pixel (pixel number)
|
|---|
| 123 | //
|
|---|
| 124 | const MCalibrationChargeBlindPix &MCalibrationChargeBlindCam::operator[](UInt_t i) const
|
|---|
| 125 | {
|
|---|
| 126 | return *static_cast<MCalibrationChargeBlindPix*>(fBlindPixels.UncheckedAt(i));
|
|---|
| 127 | }
|
|---|
| 128 |
|
|---|
| 129 |
|
|---|
| 130 | // --------------------------------------------------------------------------
|
|---|
| 131 | //
|
|---|
| 132 | // Print the results of the blind pixels
|
|---|
| 133 | //
|
|---|
| 134 | void MCalibrationChargeBlindCam::Print(Option_t *o) const
|
|---|
| 135 | {
|
|---|
| 136 |
|
|---|
| 137 | fBlindPixels.Print();
|
|---|
| 138 | }
|
|---|
| 139 |
|
|---|
| 140 | // --------------------------------------------------------------------------
|
|---|
| 141 | //
|
|---|
| 142 | // Set color to this class and to the MCalibrationBlindPix's
|
|---|
| 143 | //
|
|---|
| 144 | void MCalibrationChargeBlindCam::SetColor ( const MCalibrationCam::PulserColor_t col )
|
|---|
| 145 | {
|
|---|
| 146 |
|
|---|
| 147 | fPulserColor = col;
|
|---|
| 148 | fBlindPixels.ForEach(MCalibrationChargeBlindPix, SetColor)(col);
|
|---|
| 149 |
|
|---|
| 150 | }
|
|---|