source: trunk/Mars/mcamera/MCameraRecTemp.cc@ 14922

Last change on this file since 14922 was 8955, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 3.4 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! 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// MCameraRecTemp
29//
30// Class Version 2:
31// ----------------
32// + Bool_t fIsValid; // fTD contains valid information
33//
34/////////////////////////////////////////////////////////////////////////////
35#include "MCameraRecTemp.h"
36
37#include <TMath.h>
38
39#include "MLog.h"
40#include "MLogManip.h"
41
42ClassImp(MCameraRecTemp);
43
44using namespace std;
45
46// --------------------------------------------------------------------------
47//
48// Default constructor.
49//
50MCameraRecTemp::MCameraRecTemp(Int_t size, const char *name, const char *title)
51 : fRecTemp(size), fIsValid(kTRUE)
52{
53 fName = name ? name : "MCameraRecTemp";
54 fTitle = title ? title : "Storage container for the receiver board temperatures";
55}
56
57// --------------------------------------------------------------------------
58//
59// Interprete the receiver board temperature part of the report
60//
61Bool_t MCameraRecTemp::InterpreteRecTemp(TString &str)
62{
63 Int_t len;
64 for (Int_t i=0; i<76; i++)
65 {
66 const Int_t n=sscanf(str.Data(), "%f %n", &fRecTemp[i], &len);
67 str.Remove(0, len);
68
69 if (n==1)
70 continue;
71
72 if (n==0 && i==0)
73 {
74 *fLog << inf << "Receiver Board Temperatures empty." << endl;
75 Invalidate();
76 break;
77 }
78
79 *fLog << warn << "WARNING - Reading Receiver Board Temperature information." << endl;
80 return kFALSE;
81 }
82
83 return kTRUE;
84}
85
86
87// --------------------------------------------------------------------------
88//
89// Print the dc currents
90//
91void MCameraRecTemp::Print(Option_t *) const
92{
93 *fLog << all << underline << GetDescriptor() << endl;
94 for (int i=0; i<fRecTemp.GetSize(); i++)
95 *fLog << " " << fRecTemp[i];
96 *fLog << endl;
97}
98
99// --------------------------------------------------------------------------
100//
101// Return the minimum receiver board temperature
102//
103Float_t MCameraRecTemp::GetMin() const
104{
105 Float_t val = FLT_MAX;
106 for (int i=0; i<fRecTemp.GetSize(); i++)
107 val = TMath::Min(val, fRecTemp[i]);
108 return val;
109}
110
111// --------------------------------------------------------------------------
112//
113// Return the maximum receiver board temperature
114//
115Float_t MCameraRecTemp::GetMax() const
116{
117 Float_t val = -FLT_MAX;
118 for (int i=0; i<fRecTemp.GetSize(); i++)
119 val = TMath::Max(val, fRecTemp[i]);
120 return val;
121}
Note: See TracBrowser for help on using the repository browser.