| 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, 5/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
 | 
|---|
| 19 | !   Author(s): Florian Goebel 11/2005 <mailto:fgoebel@mppmu.mpg.de>
 | 
|---|
| 20 | !
 | 
|---|
| 21 | !   Copyright: MAGIC Software Development, 2000-2006
 | 
|---|
| 22 | !
 | 
|---|
| 23 | !
 | 
|---|
| 24 | \* ======================================================================== */
 | 
|---|
| 25 | 
 | 
|---|
| 26 | /////////////////////////////////////////////////////////////////////////////
 | 
|---|
| 27 | //
 | 
|---|
| 28 | // MCameraTH
 | 
|---|
| 29 | //
 | 
|---|
| 30 | // Class Version 2:
 | 
|---|
| 31 | // ----------------
 | 
|---|
| 32 | //   + Bool_t  fIsValid; // fTH contains valid information
 | 
|---|
| 33 | //
 | 
|---|
| 34 | /////////////////////////////////////////////////////////////////////////////
 | 
|---|
| 35 | #include "MCameraTH.h"
 | 
|---|
| 36 | 
 | 
|---|
| 37 | #include <TMath.h>
 | 
|---|
| 38 | 
 | 
|---|
| 39 | #include "MLog.h"
 | 
|---|
| 40 | #include "MLogManip.h"
 | 
|---|
| 41 | 
 | 
|---|
| 42 | ClassImp(MCameraTH);
 | 
|---|
| 43 | 
 | 
|---|
| 44 | using namespace std;
 | 
|---|
| 45 | 
 | 
|---|
| 46 | // --------------------------------------------------------------------------
 | 
|---|
| 47 | //
 | 
|---|
| 48 | // Default constructor.
 | 
|---|
| 49 | //
 | 
|---|
| 50 | MCameraTH::MCameraTH(Int_t size, const char *name, const char *title)
 | 
|---|
| 51 |     : fTH(size), fIsValid(kTRUE)
 | 
|---|
| 52 | {
 | 
|---|
| 53 |     fName  = name  ? name  : "MCameraTH";
 | 
|---|
| 54 |     fTitle = title ? title : "Storage container for the pixel discriminator threshold";
 | 
|---|
| 55 | }
 | 
|---|
| 56 | 
 | 
|---|
| 57 | // --------------------------------------------------------------------------
 | 
|---|
| 58 | //
 | 
|---|
| 59 | // Print the discriminator thresholds
 | 
|---|
| 60 | //
 | 
|---|
| 61 | void MCameraTH::Print(Option_t *) const
 | 
|---|
| 62 | {
 | 
|---|
| 63 |     *fLog << all << underline << GetDescriptor() << endl;
 | 
|---|
| 64 |     for (int i=0; i<fTH.GetSize(); i++)
 | 
|---|
| 65 |         *fLog << " " << (int)fTH[i];
 | 
|---|
| 66 |     *fLog << endl;
 | 
|---|
| 67 | }
 | 
|---|
| 68 | 
 | 
|---|
| 69 | // --------------------------------------------------------------------------
 | 
|---|
| 70 | //
 | 
|---|
| 71 | // Return the discriminator thresholds
 | 
|---|
| 72 | //
 | 
|---|
| 73 | Byte_t MCameraTH::GetMin() const
 | 
|---|
| 74 | {
 | 
|---|
| 75 |     Byte_t val = 0xff;
 | 
|---|
| 76 |     for (int i=0; i<fTH.GetSize(); i++)
 | 
|---|
| 77 |         val = TMath::Min(val, fTH[i]);
 | 
|---|
| 78 |     return val;
 | 
|---|
| 79 | }
 | 
|---|
| 80 | 
 | 
|---|
| 81 | // --------------------------------------------------------------------------
 | 
|---|
| 82 | //
 | 
|---|
| 83 | // Return the discriminator thresholds
 | 
|---|
| 84 | //
 | 
|---|
| 85 | Byte_t MCameraTH::GetMax() const
 | 
|---|
| 86 | {
 | 
|---|
| 87 |     Byte_t val = 0;
 | 
|---|
| 88 |     for (int i=0; i<fTH.GetSize(); i++)
 | 
|---|
| 89 |         val = TMath::Max(val, fTH[i]);
 | 
|---|
| 90 |     return val;
 | 
|---|
| 91 | }
 | 
|---|