source: branches/Mars_use_drstimefiles/mcamera/MCameraDC.cc@ 18293

Last change on this file since 18293 was 9010, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 3.2 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): Thomas Bretz, 5/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2008
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// MCameraDC (PRELIMINARY)
28//
29//
30// Version 2:
31// ----------
32// + fStatus
33//
34//
35/////////////////////////////////////////////////////////////////////////////
36#include "MCameraDC.h"
37
38#include <TMath.h>
39
40#include "MLog.h"
41#include "MLogManip.h"
42
43ClassImp(MCameraDC);
44
45using namespace std;
46
47// --------------------------------------------------------------------------
48//
49// Default constructor.
50//
51MCameraDC::MCameraDC(Int_t size, const char *name, const char *title)
52 : fStatus(0), fArray(size)
53{
54 fName = name ? name : "MCameraDC";
55 fTitle = title ? title : "Storage container for the pixel currents";
56}
57
58// --------------------------------------------------------------------------
59//
60// Interprete a DC report context
61//
62Int_t MCameraDC::Interprete(TString &str, Int_t len)
63{
64 const char *pos = str.Data()+len;
65 const char *end = pos+577*4;
66
67 Int_t i=0;
68 while (pos<end)
69 {
70 Int_t c;
71 const Char_t hex[5] = { pos[0], pos[1], pos[2], pos[3], 0 };
72 pos += 4;
73
74 const Int_t nn=sscanf(hex, "%4x", &c);
75 if (nn!=1)
76 {
77 *fLog << warn << "WARNING - Reading hexadecimal DC information." << endl;
78 return kCONTINUE;
79 }
80
81 fArray[i++] = 0.001*c;
82 }
83
84 str.Remove(0, pos-str.Data()); // Remove DC currents
85 str=str.Strip(TString::kLeading);
86
87 return str.IsNull() ? kTRUE : kCONTINUE;
88}
89
90// --------------------------------------------------------------------------
91//
92// Print the dc currents
93//
94void MCameraDC::Print(Option_t *) const
95{
96 *fLog << all << underline << GetDescriptor() << endl;
97 for (int i=0; i<fArray.GetSize(); i++)
98 *fLog << " " << GetCurrent(i);
99 *fLog << endl;
100}
101
102// --------------------------------------------------------------------------
103//
104// Return the minimum dc current
105//
106Float_t MCameraDC::GetMin() const
107{
108 Float_t val = (UInt_t)-1;
109 for (int i=0; i<fArray.GetSize(); i++)
110 val = TMath::Min(val, GetCurrent(i));
111 return val;
112}
113
114// --------------------------------------------------------------------------
115//
116// Return the maximum dc current
117//
118Float_t MCameraDC::GetMax() const
119{
120 Float_t val = 0;
121 for (int i=0; i<fArray.GetSize(); i++)
122 val = TMath::Max(val, GetCurrent(i));
123 return val;
124}
Note: See TracBrowser for help on using the repository browser.