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 | // MReportRates
|
---|
28 | //
|
---|
29 | //////////////////////////////////////////////////////////////////////////////
|
---|
30 | #include "MReportRates.h"
|
---|
31 |
|
---|
32 | #include "fits.h"
|
---|
33 |
|
---|
34 | #include "MLogManip.h"
|
---|
35 |
|
---|
36 | ClassImp(MReportRates);
|
---|
37 |
|
---|
38 | using namespace std;
|
---|
39 |
|
---|
40 | // --------------------------------------------------------------------------
|
---|
41 | //
|
---|
42 | // Default construtor. Initialize identifier to "DRIVE-REPORT"
|
---|
43 | //
|
---|
44 | MReportRates::MReportRates() : MReport("RATES-REPORT"),
|
---|
45 | fTimeStamp(0), fOnTimeCounter(0), fTriggerCounter(0), fTriggerRate(0),
|
---|
46 | fElapsedTime(0), fElapsedOnTime(0)
|
---|
47 | {
|
---|
48 | fName = "MReportRates";
|
---|
49 | fTitle = "Class for DRIVE-REPORT information (raw telescope position)";
|
---|
50 |
|
---|
51 | memset(fBoardRate, 0, sizeof(Float_t)*40);
|
---|
52 | memset(fPatchRate, 0, sizeof(Float_t)*160);
|
---|
53 | }
|
---|
54 |
|
---|
55 | Bool_t MReportRates::SetupReadingFits(fits &file)
|
---|
56 | {
|
---|
57 | return
|
---|
58 | file.SetRefAddress("FTMtimeStamp", fTimeStamp) &&
|
---|
59 | file.SetRefAddress("OnTimeCounter", fOnTimeCounter) &&
|
---|
60 | file.SetRefAddress("TriggerCounter", fTriggerCounter) &&
|
---|
61 | file.SetRefAddress("TriggerRate", fTriggerRate) &&
|
---|
62 | file.SetPtrAddress("BoardRate", fBoardRate, 40) &&
|
---|
63 | file.SetPtrAddress("PatchRate", fPatchRate, 160) &&
|
---|
64 | file.SetRefAddress("ElapsedTime", fElapsedTime) &&
|
---|
65 | file.SetRefAddress("OnTime", fElapsedOnTime);
|
---|
66 | }
|
---|
67 |
|
---|
68 | Int_t MReportRates::InterpreteFits(const fits &fits)
|
---|
69 | {
|
---|
70 | if (fElapsedTime>0 || fElapsedOnTime>0)
|
---|
71 | return kTRUE;
|
---|
72 |
|
---|
73 | fElapsedTime = fTimeStamp*1e-6;
|
---|
74 | fElapsedOnTime = fOnTimeCounter*1e-6;
|
---|
75 | fTriggerRate = fTriggerCounter*1e6/fTimeStamp;
|
---|
76 |
|
---|
77 | return kTRUE;
|
---|
78 | }
|
---|
79 |
|
---|
80 | void MReportRates::Print(Option_t *o) const
|
---|
81 | {
|
---|
82 | *fLog << GetDescriptor() << ": Time=" << fTimeStamp << "/" << fElapsedTime << " OnTime=" << fOnTimeCounter << "/" << fElapsedOnTime << endl;
|
---|
83 | }
|
---|