source: branches/MarsMoreSimulationTruth/mreport/MReportTemperatures.cc

Last change on this file was 14935, checked in by tbretz, 12 years ago
Add changes necessary to remove fits completely from namespace std in MARS.
File size: 3.0 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, 02/2012 <mailto:thomas.bretz@epfl.ch>
19!
20! Copyright: MAGIC Software Development, 2000-2012
21!
22!
23\* ======================================================================== */
24
25//////////////////////////////////////////////////////////////////////////////
26//
27// MReportTemperatures
28//
29//////////////////////////////////////////////////////////////////////////////
30#include "MReportTemperatures.h"
31
32#include "fits.h"
33
34#include "MLogManip.h"
35
36ClassImp(MReportTemperatures);
37
38using namespace std;
39
40// --------------------------------------------------------------------------
41//
42// Default construtor. Initialize identifier to "DRIVE-REPORT"
43//
44MReportTemperatures::MReportTemperatures() : MReport("TEMPERATURES-REPORT"),
45 fTimeStamp(0)
46{
47 fName = "MReportTemperatures";
48 fTitle = "Class for DRIVE-REPORT information (raw telescope position)";
49
50 memset(fTempSensors, 0, sizeof(Float_t)*31);
51 memset(fTempCrate, 0, sizeof(Float_t)*8);
52 memset(fTempPS, 0, sizeof(Float_t)*8);
53 memset(fTempAux, 0, sizeof(Float_t)*4);
54 memset(fTempBack, 0, sizeof(Float_t)*4);
55 memset(fTempEthernet, 0, sizeof(Float_t)*4);
56}
57
58Bool_t MReportTemperatures::SetupReadingFits(fits &file)
59{
60 return
61 file.SetRefAddress("t", fTimeStamp) &&
62 file.SetPtrAddress("T_sens", fTempSensors, 31) &&
63 file.SetPtrAddress("T_crate", fTempCrate, 8) &&
64 file.SetPtrAddress("T_ps", fTempPS, 8) &&
65 file.SetPtrAddress("T_aux", fTempAux, 4) &&
66 file.SetPtrAddress("T_back", fTempBack, 4) &&
67 file.SetPtrAddress("T_eth", fTempEthernet, 4);
68}
69
70Int_t MReportTemperatures::InterpreteFits(const fits &fits)
71{
72 return kTRUE;
73}
74
75Float_t MReportTemperatures::GetTempMean() const
76{
77 Double_t avg = 0;
78 UInt_t num = 0;
79
80 for (int i=0; i<31; i++)
81 {
82 if (fTempSensors[i]==0)
83 continue;
84
85 avg += fTempSensors[i];
86 num++;
87 }
88
89 return avg/num;
90}
91
92Float_t MReportTemperatures::GetTempMedian() const
93{
94 Float_t dat[31];
95 UInt_t num = 0;
96
97 for (int i=0; i<31; i++)
98 {
99 if (fTempSensors[i]!=0)
100 dat[num++] = fTempSensors[i];
101 }
102
103 return TMath::Median(num, dat);
104}
105
106void MReportTemperatures::Print(Option_t *o) const
107{
108 *fLog << GetDescriptor() << ": Time=" << fTimeStamp << endl;
109}
Note: See TracBrowser for help on using the repository browser.