source: trunk/MagicSoft/Mars/mcalib/MCalibrationChargeBlindCam.cc@ 4672

Last change on this file since 4672 was 4671, checked in by gaug, 21 years ago
*** empty log message ***
File size: 4.7 KB
Line 
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 "MCalibrationCam.h"
46#include "MParContainer.h"
47
48ClassImp(MCalibrationChargeBlindCam);
49
50using namespace std;
51// --------------------------------------------------------------------------
52//
53// Default constructor.
54//
55// Initializes:
56// - fPulserColor to kNONE
57//
58// Creates a TClonesArray of MCalibrationChargeBlindPix containers for the TClonesArray's:
59// - fBlindPixels
60// all initialized to 1 entry
61//
62// Later, a call to InitSize()
63// has to be performed in order to get the dimension correctly.
64//
65MCalibrationChargeBlindCam::MCalibrationChargeBlindCam(UInt_t nblind,const char *name, const char *title)
66 : fNumBlindPixels(nblind),
67 fPulserColor(MCalibrationCam::kNONE),
68 fBlindPixels(nblind)
69{
70
71 fName = name ? name : "MCalibrationChargeBlindCam";
72 fTitle = title ? title : "Calibration Information of blinded pixels in camera";
73
74 //
75 // make sure that the destructor delete all contained objects
76 //
77 fBlindPixels.SetOwner();
78
79 for (UInt_t i=0; i<nblind; i++)
80 fBlindPixels[i] = new MCalibrationChargeBlindPix;
81
82}
83
84
85// --------------------------------------
86//
87// Calls the ForEach macro for the TClonesArray fBlindPixels with the argument Clear()
88//
89void MCalibrationChargeBlindCam::Clear(Option_t *o)
90{
91 fBlindPixels.ForEach(TObject, Clear)();
92}
93
94// -----------------------------------------------------
95//
96// copy 'constructor'
97//
98void MCalibrationChargeBlindCam::Copy(TObject& object) const
99{
100
101 MParContainer::Copy(object);
102
103 MCalibrationChargeBlindCam &calib = (MCalibrationChargeBlindCam&)object;
104 calib.fPulserColor = fPulserColor;
105 calib.fNumBlindPixels = fNumBlindPixels;
106
107 for (UInt_t i=0; i<fNumBlindPixels; i++)
108 {
109 calib.fBlindPixels[i] = new MCalibrationChargeBlindPix;
110 (*this)[i].Copy(calib[i]);
111 }
112}
113
114// --------------------------------------------------------------------------
115//
116// Get i-th blind pixel (pixel number)
117//
118MCalibrationChargeBlindPix &MCalibrationChargeBlindCam::operator[](UInt_t i)
119{
120 return *static_cast<MCalibrationChargeBlindPix*>(fBlindPixels.UncheckedAt(i));
121}
122
123// --------------------------------------------------------------------------
124//
125// Get i-th pixel (pixel number)
126//
127const MCalibrationChargeBlindPix &MCalibrationChargeBlindCam::operator[](UInt_t i) const
128{
129 return *static_cast<MCalibrationChargeBlindPix*>(fBlindPixels.UncheckedAt(i));
130}
131
132
133// --------------------------------------------------------------------------
134//
135// Print the results of the blind pixels
136//
137void MCalibrationChargeBlindCam::Print(Option_t *o) const
138{
139
140 fBlindPixels.Print();
141}
142
143// --------------------------------------------------------------------------
144//
145// Set color to this class and to the MCalibrationBlindPix's
146//
147void MCalibrationChargeBlindCam::SetColor ( const MCalibrationCam::PulserColor_t col )
148{
149
150 fPulserColor = col;
151 fBlindPixels.ForEach(MCalibrationChargeBlindPix, SetColor)(col);
152
153}
Note: See TracBrowser for help on using the repository browser.