| 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   11/2003 <mailto:markus@ifae.es> | 
|---|
| 19 | ! | 
|---|
| 20 | !   Copyright: MAGIC Software Development, 2000-2004 | 
|---|
| 21 | ! | 
|---|
| 22 | ! | 
|---|
| 23 | \* ======================================================================== */ | 
|---|
| 24 |  | 
|---|
| 25 | ///////////////////////////////////////////////////////////////////////////// | 
|---|
| 26 | // | 
|---|
| 27 | // MCalibrationCam | 
|---|
| 28 | // | 
|---|
| 29 | // Base class for Camera Calibration results. | 
|---|
| 30 | // | 
|---|
| 31 | // Contains TOrdCollections for the following objects: | 
|---|
| 32 | // - fPixels:         Array of classes derived from MCalibrationPix, one entry | 
|---|
| 33 | //                    per pixel. Has to be created | 
|---|
| 34 | // - fAverageAreas:   Array of classes derived from MCalibrationPix, one entry | 
|---|
| 35 | //                    per pixel AREA. Has to be created | 
|---|
| 36 | // - fAverageSectors: Array of classes derived from MCalibrationPix, one entry | 
|---|
| 37 | //                    per camera SECTOR. Has to be created | 
|---|
| 38 | // | 
|---|
| 39 | // - fAverageBadAreas: Array of classes derived from MBadPixelsPix, one entry | 
|---|
| 40 | //                     per pixel AREA. Is created automatically. | 
|---|
| 41 | // - fAverageBadSectors: Array of classes derived from MBadPixelsPix, one entry | 
|---|
| 42 | //                    per camera SECTOR. Is created automatically. | 
|---|
| 43 | // | 
|---|
| 44 | // Previous Class Versions haven't been commented by the author! | 
|---|
| 45 | // | 
|---|
| 46 | // Class Version 6: | 
|---|
| 47 | // ---------------- | 
|---|
| 48 | //  + added fRunNumber | 
|---|
| 49 | // | 
|---|
| 50 | // All TOrdCollections have to enlarged by the corresponding calls to (e.g. in MGeomApply): | 
|---|
| 51 | // - InitSize() | 
|---|
| 52 | // - InitAverageAreas() | 
|---|
| 53 | // - InitAverageSectors() | 
|---|
| 54 | // | 
|---|
| 55 | ///////////////////////////////////////////////////////////////////////////// | 
|---|
| 56 | #include "MCalibrationCam.h" | 
|---|
| 57 |  | 
|---|
| 58 | #include <TOrdCollection.h> | 
|---|
| 59 |  | 
|---|
| 60 | #include "MGeomCam.h" | 
|---|
| 61 | #include "MGeomPix.h" | 
|---|
| 62 |  | 
|---|
| 63 | #include "MBadPixelsCam.h" | 
|---|
| 64 | #include "MBadPixelsPix.h" | 
|---|
| 65 |  | 
|---|
| 66 | #include "MCalibrationPix.h" | 
|---|
| 67 |  | 
|---|
| 68 | #include "MLog.h" | 
|---|
| 69 | #include "MLogManip.h" | 
|---|
| 70 |  | 
|---|
| 71 | ClassImp(MCalibrationCam); | 
|---|
| 72 |  | 
|---|
| 73 | using namespace std; | 
|---|
| 74 |  | 
|---|
| 75 | const Int_t MCalibrationCam::gkNumPulserColors = 4; | 
|---|
| 76 |  | 
|---|
| 77 | // -------------------------------------------------------------------------- | 
|---|
| 78 | // | 
|---|
| 79 | // Default constructor. | 
|---|
| 80 | // | 
|---|
| 81 | // Set the following pointer to NULL: | 
|---|
| 82 | // - fPixels | 
|---|
| 83 | // - fAverageAreas | 
|---|
| 84 | // - fAverageSectors | 
|---|
| 85 | // | 
|---|
| 86 | // Initializes: | 
|---|
| 87 | // - fPulserColor to kNONE | 
|---|
| 88 | // - fNumHiGainFADCSlices to 0. | 
|---|
| 89 | // - fNumLoGainFADCSlices to 0. | 
|---|
| 90 | // | 
|---|
| 91 | // Creates a TOrdCollection of MBadPixelsPix containers for the TOrdCollection's: | 
|---|
| 92 | // - fAverageBadAreas | 
|---|
| 93 | // - fAverageBadSectors | 
|---|
| 94 | // all initialized to 1 entry | 
|---|
| 95 | // | 
|---|
| 96 | // Later, a call to InitAverageAreas() and InitAverageSectors() (or Init()) | 
|---|
| 97 | // has to be performed in order to get the dimension correctly. | 
|---|
| 98 | // | 
|---|
| 99 | MCalibrationCam::MCalibrationCam(const char *name, const char *title) | 
|---|
| 100 | : fRunNumber(-1), fPulserColor(kNONE) | 
|---|
| 101 | { | 
|---|
| 102 |  | 
|---|
| 103 | fPixels = new TOrdCollection; | 
|---|
| 104 | fPixels->SetOwner(); | 
|---|
| 105 |  | 
|---|
| 106 | fAverageAreas = new TOrdCollection; | 
|---|
| 107 | fAverageAreas->SetOwner(); | 
|---|
| 108 |  | 
|---|
| 109 | fAverageSectors = new TOrdCollection; | 
|---|
| 110 | fAverageSectors->SetOwner(); | 
|---|
| 111 |  | 
|---|
| 112 | fAverageBadAreas = new TOrdCollection; | 
|---|
| 113 | fAverageBadAreas->SetOwner(); | 
|---|
| 114 |  | 
|---|
| 115 | fAverageBadSectors = new TOrdCollection; | 
|---|
| 116 | fAverageBadSectors->SetOwner(); | 
|---|
| 117 |  | 
|---|
| 118 | fNumHiGainFADCSlices.Set(1); | 
|---|
| 119 | fNumLoGainFADCSlices.Set(1); | 
|---|
| 120 | } | 
|---|
| 121 |  | 
|---|
| 122 | // -------------------------------------------------------------------------- | 
|---|
| 123 | // | 
|---|
| 124 | // Deletes the following TOrdCollection's of MCalibrationPix containers (if exist): | 
|---|
| 125 | // - fPixels | 
|---|
| 126 | // - fAverageAreas | 
|---|
| 127 | // - fAverageSectors | 
|---|
| 128 | // | 
|---|
| 129 | // Deletes the following TOrdCollection's of MBadPixelsPix containers (if exist): | 
|---|
| 130 | // - fAverageBadAreas | 
|---|
| 131 | // - fAverageBadSectors | 
|---|
| 132 | // | 
|---|
| 133 | MCalibrationCam::~MCalibrationCam() | 
|---|
| 134 | { | 
|---|
| 135 |  | 
|---|
| 136 | // | 
|---|
| 137 | // delete fPixels should delete all Objects stored inside | 
|---|
| 138 | // | 
|---|
| 139 | if (fPixels) | 
|---|
| 140 | delete fPixels; | 
|---|
| 141 |  | 
|---|
| 142 | if (fAverageAreas) | 
|---|
| 143 | delete fAverageAreas; | 
|---|
| 144 |  | 
|---|
| 145 | if (fAverageSectors) | 
|---|
| 146 | delete fAverageSectors; | 
|---|
| 147 |  | 
|---|
| 148 | if (fAverageBadAreas) | 
|---|
| 149 | delete fAverageBadAreas; | 
|---|
| 150 |  | 
|---|
| 151 | if (fAverageBadSectors) | 
|---|
| 152 | delete fAverageBadSectors; | 
|---|
| 153 |  | 
|---|
| 154 | } | 
|---|
| 155 |  | 
|---|
| 156 | // -------------------------------------- | 
|---|
| 157 | // | 
|---|
| 158 | // Calls the ForEach macro for the TOrdCollection fPixels with the argument Clear() | 
|---|
| 159 | // | 
|---|
| 160 | // Loops over the fAverageAreas, calling the function Clear() for | 
|---|
| 161 | // every entry in: | 
|---|
| 162 | // - fAverageAreas | 
|---|
| 163 | // - fAverageBadAreas | 
|---|
| 164 | // | 
|---|
| 165 | // Loops over the fAverageSectors, calling the function Clear() for | 
|---|
| 166 | // every entry in: | 
|---|
| 167 | // - fAverageSectors | 
|---|
| 168 | // - fAverageBadSectors | 
|---|
| 169 | // | 
|---|
| 170 | void MCalibrationCam::Clear(Option_t *o) | 
|---|
| 171 | { | 
|---|
| 172 |  | 
|---|
| 173 | {  fPixels        ->ForEach(TObject, Clear)();  } | 
|---|
| 174 | {  fAverageAreas  ->ForEach(TObject, Clear)();  } | 
|---|
| 175 | {  fAverageSectors->ForEach(TObject, Clear)();  } | 
|---|
| 176 |  | 
|---|
| 177 | return; | 
|---|
| 178 | } | 
|---|
| 179 |  | 
|---|
| 180 | // -------------------------------------------------------------------------- | 
|---|
| 181 | // | 
|---|
| 182 | // Copy 'constructor' | 
|---|
| 183 | // | 
|---|
| 184 | void MCalibrationCam::Copy(TObject& object) const | 
|---|
| 185 | { | 
|---|
| 186 |  | 
|---|
| 187 | MCalibrationCam &calib = (MCalibrationCam&)object; | 
|---|
| 188 |  | 
|---|
| 189 | MParContainer::Copy(calib); | 
|---|
| 190 |  | 
|---|
| 191 | calib.fPulserColor = fPulserColor; | 
|---|
| 192 |  | 
|---|
| 193 | const Int_t n = GetSize(); | 
|---|
| 194 | if (n != 0) | 
|---|
| 195 | { | 
|---|
| 196 | calib.InitSize(n); | 
|---|
| 197 | for (int i=0; i<n; i++) | 
|---|
| 198 | (*this)[i].Copy(calib[i]); | 
|---|
| 199 | } | 
|---|
| 200 |  | 
|---|
| 201 | const Int_t n2 = GetAverageAreas(); | 
|---|
| 202 | if (n2 != 0) | 
|---|
| 203 | { | 
|---|
| 204 | calib.InitAverageAreas(n2); | 
|---|
| 205 | for (int i=0; i<n2; i++) | 
|---|
| 206 | { | 
|---|
| 207 | GetAverageArea   (i).Copy(calib.GetAverageArea(i)); | 
|---|
| 208 | GetAverageBadArea(i).Copy(calib.GetAverageBadArea(i)); | 
|---|
| 209 | calib.fNumUnsuitable      [i] = fNumUnsuitable[i]; | 
|---|
| 210 | calib.fNumUnreliable      [i] = fNumUnreliable[i]; | 
|---|
| 211 | calib.fNumHiGainFADCSlices[i] = fNumHiGainFADCSlices[i]; | 
|---|
| 212 | calib.fNumLoGainFADCSlices[i] = fNumLoGainFADCSlices[i]; | 
|---|
| 213 | } | 
|---|
| 214 | } | 
|---|
| 215 |  | 
|---|
| 216 | const Int_t n3 = GetAverageSectors(); | 
|---|
| 217 | if (n3 != 0) | 
|---|
| 218 | { | 
|---|
| 219 | calib.InitAverageSectors(n3); | 
|---|
| 220 | for (int i=0; i<n3; i++) | 
|---|
| 221 | { | 
|---|
| 222 | GetAverageSector   (i).Copy(calib.GetAverageSector(i)); | 
|---|
| 223 | GetAverageBadSector(i).Copy(calib.GetAverageBadSector(i)); | 
|---|
| 224 | } | 
|---|
| 225 | } | 
|---|
| 226 | } | 
|---|
| 227 |  | 
|---|
| 228 | // ------------------------------------------------------------------- | 
|---|
| 229 | // | 
|---|
| 230 | // Initialize the objects inside the TOrdCollection using the | 
|---|
| 231 | // virtual function Add(). | 
|---|
| 232 | // | 
|---|
| 233 | // | 
|---|
| 234 | // InitSize can only increase the size, but not shrink. | 
|---|
| 235 | // | 
|---|
| 236 | // It can be called more than one time. New Containers are | 
|---|
| 237 | // added only from the current size to the argument i. | 
|---|
| 238 | // | 
|---|
| 239 | void MCalibrationCam::InitSize(const UInt_t i) | 
|---|
| 240 | { | 
|---|
| 241 |  | 
|---|
| 242 | const UInt_t save = GetSize(); | 
|---|
| 243 |  | 
|---|
| 244 | if (i==save) | 
|---|
| 245 | return; | 
|---|
| 246 |  | 
|---|
| 247 | if (i>save) | 
|---|
| 248 | Add(save,i); | 
|---|
| 249 | } | 
|---|
| 250 |  | 
|---|
| 251 | void MCalibrationCam::Add(const UInt_t a, const UInt_t b) | 
|---|
| 252 | { | 
|---|
| 253 | for (UInt_t i=a; i<b; i++) | 
|---|
| 254 | fPixels->AddAt(new MCalibrationPix,i); | 
|---|
| 255 | } | 
|---|
| 256 |  | 
|---|
| 257 | void MCalibrationCam::AddArea(const UInt_t a, const UInt_t b) | 
|---|
| 258 | { | 
|---|
| 259 | for (UInt_t i=a; i<b; i++) | 
|---|
| 260 | fAverageAreas->AddAt(new MCalibrationPix,i); | 
|---|
| 261 | } | 
|---|
| 262 |  | 
|---|
| 263 | void MCalibrationCam::AddSector(const UInt_t a, const UInt_t b) | 
|---|
| 264 | { | 
|---|
| 265 | for (UInt_t i=a; i<b; i++) | 
|---|
| 266 | fAverageSectors->AddAt(new MCalibrationPix,i); | 
|---|
| 267 | } | 
|---|
| 268 |  | 
|---|
| 269 |  | 
|---|
| 270 | // ------------------------------------------------------------------- | 
|---|
| 271 | // | 
|---|
| 272 | // Initialize the objects inside the TOrdCollections | 
|---|
| 273 | // - fAverageAreas | 
|---|
| 274 | // - fAverageBadAreas | 
|---|
| 275 | // using the virtual function Add(). | 
|---|
| 276 | // | 
|---|
| 277 | // InitSize can only increase the size, but not shrink. | 
|---|
| 278 | // | 
|---|
| 279 | // It can be called more than one time. New Containers are | 
|---|
| 280 | // added only from the current size to the argument i. | 
|---|
| 281 | // | 
|---|
| 282 | void MCalibrationCam::InitAverageAreas(const UInt_t i) | 
|---|
| 283 | { | 
|---|
| 284 |  | 
|---|
| 285 | const UInt_t save = GetAverageAreas(); | 
|---|
| 286 |  | 
|---|
| 287 | if (i==save) | 
|---|
| 288 | return; | 
|---|
| 289 |  | 
|---|
| 290 | fNumUnsuitable.Set(i); | 
|---|
| 291 | fNumUnreliable.Set(i); | 
|---|
| 292 | fNumHiGainFADCSlices.Set(i); | 
|---|
| 293 | fNumLoGainFADCSlices.Set(i); | 
|---|
| 294 |  | 
|---|
| 295 | if (i < save) | 
|---|
| 296 | return; | 
|---|
| 297 |  | 
|---|
| 298 | for (UInt_t j=save; j<i; j++) | 
|---|
| 299 | fAverageBadAreas->AddAt(new MBadPixelsPix,j); | 
|---|
| 300 |  | 
|---|
| 301 | AddArea(save,i); | 
|---|
| 302 |  | 
|---|
| 303 | for (UInt_t j=save; j<i; j++) | 
|---|
| 304 | GetAverageArea(j).SetPixId(j); | 
|---|
| 305 |  | 
|---|
| 306 | } | 
|---|
| 307 |  | 
|---|
| 308 | // ------------------------------------------------------------------- | 
|---|
| 309 | // | 
|---|
| 310 | // Initialize the objects inside the TOrdCollections | 
|---|
| 311 | // - fAverageSectors | 
|---|
| 312 | // - fAverageBadSectors | 
|---|
| 313 | // using the virtual function Add(). | 
|---|
| 314 | // | 
|---|
| 315 | // InitSize can only increase the size, but not shrink. | 
|---|
| 316 | // | 
|---|
| 317 | // It can be called more than one time. New Containers are | 
|---|
| 318 | // added only from the current size to the argument i. | 
|---|
| 319 | // | 
|---|
| 320 | void MCalibrationCam::InitAverageSectors(const UInt_t i) | 
|---|
| 321 | { | 
|---|
| 322 |  | 
|---|
| 323 | const UInt_t save = GetAverageSectors(); | 
|---|
| 324 |  | 
|---|
| 325 | if (i==save) | 
|---|
| 326 | return; | 
|---|
| 327 |  | 
|---|
| 328 | if (i < save) | 
|---|
| 329 | return; | 
|---|
| 330 |  | 
|---|
| 331 | for (UInt_t j=save; j<i; j++) | 
|---|
| 332 | fAverageBadSectors->AddAt(new MBadPixelsPix,j); | 
|---|
| 333 |  | 
|---|
| 334 | AddSector(save,i); | 
|---|
| 335 |  | 
|---|
| 336 | for (UInt_t j=save; j<i; j++) | 
|---|
| 337 | GetAverageSector(j).SetPixId(j); | 
|---|
| 338 | } | 
|---|
| 339 |  | 
|---|
| 340 | // ------------------------------------------------------------------- | 
|---|
| 341 | // | 
|---|
| 342 | // Calls: | 
|---|
| 343 | // - InitSize() | 
|---|
| 344 | // - InitAverageAreas() | 
|---|
| 345 | // - InitAverageSectors() | 
|---|
| 346 | // | 
|---|
| 347 | void MCalibrationCam::Init(const MGeomCam &geom) | 
|---|
| 348 | { | 
|---|
| 349 | InitSize          (geom.GetNumPixels() ); | 
|---|
| 350 | InitAverageAreas  (geom.GetNumAreas()  ); | 
|---|
| 351 | InitAverageSectors(geom.GetNumSectors()); | 
|---|
| 352 | } | 
|---|
| 353 |  | 
|---|
| 354 | // -------------------------------------------------------------------------- | 
|---|
| 355 | // | 
|---|
| 356 | // Returns the number of un-suitable pixels per area index and -1 if | 
|---|
| 357 | // the area index exceeds the initialized array. | 
|---|
| 358 | // | 
|---|
| 359 | const Int_t MCalibrationCam::GetNumUnsuitable( const Int_t  aidx ) const | 
|---|
| 360 | { | 
|---|
| 361 | if (aidx < 0) | 
|---|
| 362 | { | 
|---|
| 363 | Int_t num = 0; | 
|---|
| 364 | for (Int_t i=0;i<fNumUnsuitable.GetSize();i++) | 
|---|
| 365 | num += fNumUnsuitable[i]; | 
|---|
| 366 | return num; | 
|---|
| 367 | } | 
|---|
| 368 |  | 
|---|
| 369 | return aidx > fNumUnsuitable.GetSize() ? -1 : fNumUnsuitable[aidx]; | 
|---|
| 370 | } | 
|---|
| 371 |  | 
|---|
| 372 | // -------------------------------------------------------------------------- | 
|---|
| 373 | // | 
|---|
| 374 | // Returns the number of un-reliable pixels per area index and -1 if | 
|---|
| 375 | // the area index exceeds the initialized array. | 
|---|
| 376 | // | 
|---|
| 377 | const Int_t MCalibrationCam::GetNumUnreliable( const Int_t  aidx ) const | 
|---|
| 378 | { | 
|---|
| 379 | if (aidx < 0) | 
|---|
| 380 | { | 
|---|
| 381 | Int_t num = 0; | 
|---|
| 382 | for (Int_t i=0;i<fNumUnreliable.GetSize();i++) | 
|---|
| 383 | num += fNumUnreliable[i]; | 
|---|
| 384 | return num; | 
|---|
| 385 | } | 
|---|
| 386 |  | 
|---|
| 387 | return aidx > fNumUnreliable.GetSize() ? -1 : fNumUnreliable[aidx]; | 
|---|
| 388 | } | 
|---|
| 389 |  | 
|---|
| 390 | // -------------------------------------------------------------------------- | 
|---|
| 391 | // | 
|---|
| 392 | // Returns the mean number of High-Gain FADC slices per area index and -1 if | 
|---|
| 393 | // the area index exceeds the initialized array. | 
|---|
| 394 | // | 
|---|
| 395 | const Float_t MCalibrationCam::GetNumHiGainFADCSlices( const Int_t  aidx ) const | 
|---|
| 396 | { | 
|---|
| 397 | if (aidx < 0) | 
|---|
| 398 | return -1; | 
|---|
| 399 |  | 
|---|
| 400 | return aidx > fNumHiGainFADCSlices.GetSize() ? -1 : fNumHiGainFADCSlices[aidx]; | 
|---|
| 401 | } | 
|---|
| 402 |  | 
|---|
| 403 | // -------------------------------------------------------------------------- | 
|---|
| 404 | // | 
|---|
| 405 | // Returns the mean number of Low-Gain FADC slices per area index and -1 if | 
|---|
| 406 | // the area index exceeds the initialized array. | 
|---|
| 407 | // | 
|---|
| 408 | const Float_t MCalibrationCam::GetNumLoGainFADCSlices( const Int_t  aidx ) const | 
|---|
| 409 | { | 
|---|
| 410 | if (aidx < 0) | 
|---|
| 411 | return -1; | 
|---|
| 412 |  | 
|---|
| 413 | return aidx > fNumLoGainFADCSlices.GetSize() ? -1 : fNumLoGainFADCSlices[aidx]; | 
|---|
| 414 | } | 
|---|
| 415 |  | 
|---|
| 416 |  | 
|---|
| 417 |  | 
|---|
| 418 | // -------------------------------------------------------------------------- | 
|---|
| 419 | // | 
|---|
| 420 | // Returns the current size of the TOrdCollection fAverageAreas | 
|---|
| 421 | // independently if the MCalibrationPix is filled with values or not. | 
|---|
| 422 | // | 
|---|
| 423 | const Int_t MCalibrationCam::GetAverageAreas() const | 
|---|
| 424 | { | 
|---|
| 425 | return fAverageAreas->GetSize(); | 
|---|
| 426 | } | 
|---|
| 427 |  | 
|---|
| 428 | // -------------------------------------------------------------------------- | 
|---|
| 429 | // | 
|---|
| 430 | // Returns the current size of the TOrdCollection fAverageSectors | 
|---|
| 431 | // independently if the MCalibrationPix is filled with values or not. | 
|---|
| 432 | // | 
|---|
| 433 | const Int_t MCalibrationCam::GetAverageSectors() const | 
|---|
| 434 | { | 
|---|
| 435 | return fAverageSectors->GetSize(); | 
|---|
| 436 | } | 
|---|
| 437 |  | 
|---|
| 438 |  | 
|---|
| 439 | // -------------------------------------------------------------------------- | 
|---|
| 440 | // | 
|---|
| 441 | // Get i-th pixel (pixel number) | 
|---|
| 442 | // | 
|---|
| 443 | MCalibrationPix &MCalibrationCam::operator[](UInt_t i) | 
|---|
| 444 | { | 
|---|
| 445 | return *static_cast<MCalibrationPix*>(fPixels->At(i)); | 
|---|
| 446 | } | 
|---|
| 447 |  | 
|---|
| 448 | // -------------------------------------------------------------------------- | 
|---|
| 449 | // | 
|---|
| 450 | // Get i-th pixel (pixel number) | 
|---|
| 451 | // | 
|---|
| 452 | const MCalibrationPix &MCalibrationCam::operator[](UInt_t i) const | 
|---|
| 453 | { | 
|---|
| 454 | return *static_cast<MCalibrationPix*>(fPixels->At(i)); | 
|---|
| 455 | } | 
|---|
| 456 |  | 
|---|
| 457 | // -------------------------------------------------------------------------- | 
|---|
| 458 | // | 
|---|
| 459 | // Returns the current size of the TOrdCollection fPixels | 
|---|
| 460 | // independently if the MCalibrationPix is filled with values or not. | 
|---|
| 461 | // | 
|---|
| 462 | const Int_t MCalibrationCam::GetSize() const | 
|---|
| 463 | { | 
|---|
| 464 | return fPixels->GetSize(); | 
|---|
| 465 | } | 
|---|
| 466 |  | 
|---|
| 467 | // -------------------------------------------------------------------------- | 
|---|
| 468 | // | 
|---|
| 469 | // Get i-th average pixel (area number) | 
|---|
| 470 | // | 
|---|
| 471 | MCalibrationPix &MCalibrationCam::GetAverageArea(const UInt_t i) | 
|---|
| 472 | { | 
|---|
| 473 | return *static_cast<MCalibrationPix*>(fAverageAreas->At(i)); | 
|---|
| 474 | } | 
|---|
| 475 |  | 
|---|
| 476 | // -------------------------------------------------------------------------- | 
|---|
| 477 | // | 
|---|
| 478 | // Get i-th average pixel (area number) | 
|---|
| 479 | // | 
|---|
| 480 | const MCalibrationPix &MCalibrationCam::GetAverageArea(const UInt_t i) const | 
|---|
| 481 | { | 
|---|
| 482 | return *static_cast<MCalibrationPix*>(fAverageAreas->At(i)); | 
|---|
| 483 | } | 
|---|
| 484 |  | 
|---|
| 485 | // -------------------------------------------------------------------------- | 
|---|
| 486 | // | 
|---|
| 487 | // Get i-th average pixel (sector number) | 
|---|
| 488 | // | 
|---|
| 489 | MCalibrationPix &MCalibrationCam::GetAverageSector(const UInt_t i) | 
|---|
| 490 | { | 
|---|
| 491 | return *static_cast<MCalibrationPix*>(fAverageSectors->At(i)); | 
|---|
| 492 | } | 
|---|
| 493 |  | 
|---|
| 494 | // -------------------------------------------------------------------------- | 
|---|
| 495 | // | 
|---|
| 496 | // Get i-th average pixel (sector number) | 
|---|
| 497 | // | 
|---|
| 498 | const MCalibrationPix &MCalibrationCam::GetAverageSector(const UInt_t i) const | 
|---|
| 499 | { | 
|---|
| 500 | return *static_cast<MCalibrationPix*>(fAverageSectors->At(i)); | 
|---|
| 501 | } | 
|---|
| 502 |  | 
|---|
| 503 | // -------------------------------------------------------------------------- | 
|---|
| 504 | // | 
|---|
| 505 | // Get i-th average pixel (area number) | 
|---|
| 506 | // | 
|---|
| 507 | MBadPixelsPix &MCalibrationCam::GetAverageBadArea(const UInt_t i) | 
|---|
| 508 | { | 
|---|
| 509 | return *static_cast<MBadPixelsPix*>(fAverageBadAreas->At(i)); | 
|---|
| 510 | } | 
|---|
| 511 |  | 
|---|
| 512 | // -------------------------------------------------------------------------- | 
|---|
| 513 | // | 
|---|
| 514 | // Get i-th average pixel (area number) | 
|---|
| 515 | // | 
|---|
| 516 | const MBadPixelsPix &MCalibrationCam::GetAverageBadArea(const UInt_t i) const | 
|---|
| 517 | { | 
|---|
| 518 | return *static_cast<MBadPixelsPix*>(fAverageBadAreas->At(i)); | 
|---|
| 519 | } | 
|---|
| 520 |  | 
|---|
| 521 | // -------------------------------------------------------------------------- | 
|---|
| 522 | // | 
|---|
| 523 | // Get i-th average pixel (sector number) | 
|---|
| 524 | // | 
|---|
| 525 | MBadPixelsPix &MCalibrationCam::GetAverageBadSector(const UInt_t i) | 
|---|
| 526 | { | 
|---|
| 527 | return *static_cast<MBadPixelsPix*>(fAverageBadSectors->At(i)); | 
|---|
| 528 | } | 
|---|
| 529 |  | 
|---|
| 530 | // -------------------------------------------------------------------------- | 
|---|
| 531 | // | 
|---|
| 532 | // Get i-th average pixel (sector number) | 
|---|
| 533 | // | 
|---|
| 534 | const MBadPixelsPix &MCalibrationCam::GetAverageBadSector(const UInt_t i) const | 
|---|
| 535 | { | 
|---|
| 536 | return *static_cast<MBadPixelsPix*>(fAverageBadSectors->At(i)); | 
|---|
| 537 | } | 
|---|
| 538 |  | 
|---|
| 539 |  | 
|---|
| 540 |  | 
|---|
| 541 | // -------------------------------------------------------------------------- | 
|---|
| 542 | // | 
|---|
| 543 | // Dummy needed for compilation with MCamEvent | 
|---|
| 544 | // | 
|---|
| 545 | Bool_t MCalibrationCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const | 
|---|
| 546 | { | 
|---|
| 547 | return kTRUE; | 
|---|
| 548 | } | 
|---|
| 549 |  | 
|---|
| 550 |  | 
|---|
| 551 |  | 
|---|
| 552 | // -------------------------------------------------------------------------- | 
|---|
| 553 | // | 
|---|
| 554 | // Calls MCalibrationPix::DrawClone() | 
|---|
| 555 | // | 
|---|
| 556 | void MCalibrationCam::DrawPixelContent(Int_t idx) const | 
|---|
| 557 | { | 
|---|
| 558 | (*this)[idx].DrawClone(); | 
|---|
| 559 | } | 
|---|
| 560 |  | 
|---|
| 561 | void MCalibrationCam::SetNumHiGainFADCSlices( const Float_t i, const Int_t aidx) | 
|---|
| 562 | { | 
|---|
| 563 | if (aidx < 0) | 
|---|
| 564 | return; | 
|---|
| 565 |  | 
|---|
| 566 | if (aidx < fNumHiGainFADCSlices.GetSize()) | 
|---|
| 567 | fNumHiGainFADCSlices[aidx] = i; | 
|---|
| 568 | } | 
|---|
| 569 |  | 
|---|
| 570 | void MCalibrationCam::SetNumLoGainFADCSlices( const Float_t i, const Int_t aidx) | 
|---|
| 571 | { | 
|---|
| 572 | if (aidx < 0) | 
|---|
| 573 | return; | 
|---|
| 574 | if (aidx < fNumLoGainFADCSlices.GetSize()) | 
|---|
| 575 | fNumLoGainFADCSlices[aidx] = i; | 
|---|
| 576 | } | 
|---|
| 577 |  | 
|---|
| 578 | void MCalibrationCam::SetNumUnsuitable( const UInt_t i, const Int_t aidx) | 
|---|
| 579 | { | 
|---|
| 580 | if (aidx < 0) | 
|---|
| 581 | return; | 
|---|
| 582 |  | 
|---|
| 583 | if (aidx < fNumUnsuitable.GetSize()) | 
|---|
| 584 | fNumUnsuitable[aidx] = i; | 
|---|
| 585 | } | 
|---|
| 586 |  | 
|---|
| 587 | void MCalibrationCam::SetNumUnreliable( const UInt_t i, const Int_t aidx) | 
|---|
| 588 | { | 
|---|
| 589 | if (aidx < 0) | 
|---|
| 590 | return; | 
|---|
| 591 | if (aidx < fNumUnreliable.GetSize()) | 
|---|
| 592 | fNumUnreliable[aidx] = i; | 
|---|
| 593 | } | 
|---|
| 594 |  | 
|---|
| 595 | TString MCalibrationCam::GetPulserColorStr(PulserColor_t col) | 
|---|
| 596 | { | 
|---|
| 597 | TString str; | 
|---|
| 598 | switch (col) | 
|---|
| 599 | { | 
|---|
| 600 | case kCT1:   str += "CT1";      break; | 
|---|
| 601 | case kGREEN: str += "Green";    break; | 
|---|
| 602 | case kBLUE:  str += "Blue";     break; | 
|---|
| 603 | case kUV:    str += "UV";       break; | 
|---|
| 604 | case kNONE:  str += "None";     break; | 
|---|
| 605 | default:     str += "Unknown";  break; | 
|---|
| 606 | } | 
|---|
| 607 | str += " ("; | 
|---|
| 608 | str += (int)col; | 
|---|
| 609 | str += ")"; | 
|---|
| 610 | return str; | 
|---|
| 611 | } | 
|---|