| 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): Javier López , 7/2004 <mailto:jlopez@ifae.es>
|
|---|
| 19 | !
|
|---|
| 20 | ! Copyright: MAGIC Software Development, 2000-2004
|
|---|
| 21 | !
|
|---|
| 22 | !
|
|---|
| 23 | \* ======================================================================== */
|
|---|
| 24 |
|
|---|
| 25 | #include "MLiveTime.h"
|
|---|
| 26 |
|
|---|
| 27 | #include "MLog.h"
|
|---|
| 28 | #include "MLogManip.h"
|
|---|
| 29 |
|
|---|
| 30 | ClassImp(MLiveTime);
|
|---|
| 31 |
|
|---|
| 32 | using namespace std;
|
|---|
| 33 |
|
|---|
| 34 | MLiveTime::MLiveTime(UInt_t numberbins, const char *name, const char *title)
|
|---|
| 35 | {
|
|---|
| 36 |
|
|---|
| 37 | fName = name ? name : "MLiveTime";
|
|---|
| 38 | fTitle = title ? title : "Container to hold the live time for a certain time bin";
|
|---|
| 39 |
|
|---|
| 40 | Set(numberbins);
|
|---|
| 41 | }
|
|---|
| 42 |
|
|---|
| 43 | void MLiveTime::Set(UInt_t numberbins)
|
|---|
| 44 | {
|
|---|
| 45 | fNumberTimeBins = numberbins;
|
|---|
| 46 | fLiveTimeBin.Set(numberbins);
|
|---|
| 47 | fMeanRealTimeBin.Set(numberbins);
|
|---|
| 48 | fWidthRealTimeBin.Set(numberbins);
|
|---|
| 49 | }
|
|---|
| 50 |
|
|---|
| 51 | void MLiveTime::Print(const Option_t* o) const
|
|---|
| 52 | {
|
|---|
| 53 | TString opt = o;
|
|---|
| 54 |
|
|---|
| 55 | Double_t totalLiveTime = 0;
|
|---|
| 56 |
|
|---|
| 57 | if (opt.Contains("last", TString::kIgnoreCase))
|
|---|
| 58 | {
|
|---|
| 59 | *fLog << GetName() << ": Present real time bin " << setprecision(10) << fMeanRealTimeBin[fNumberTimeBins-1] << " +- " << setprecision(5) << fWidthRealTimeBin[fNumberTimeBins-1] << " [" << 2*fWidthRealTimeBin[fNumberTimeBins-1]*24*60*60 << " sec] MJD" << endl;
|
|---|
| 60 | *fLog << GetName() << ": Present live time " << fLiveTimeBin[fNumberTimeBins-1] << " sec" << endl;
|
|---|
| 61 | }
|
|---|
| 62 | else if (opt.Contains("all", TString::kIgnoreCase))
|
|---|
| 63 | {
|
|---|
| 64 | *fLog << GetName() << ": " << fNumberTimeBins << " time bins" << endl;
|
|---|
| 65 | for (UInt_t bin = 0; bin<fNumberTimeBins; bin++)
|
|---|
| 66 | {
|
|---|
| 67 | *fLog << GetName() << ": Present real time bin " << setprecision(10) << fMeanRealTimeBin[bin] << " +- " << setprecision(5) << fWidthRealTimeBin[bin] << " [" << 2*fWidthRealTimeBin[bin]*24*60*60 << " sec] MJD" << endl;
|
|---|
| 68 | *fLog << GetName() << ": Present live time " << fLiveTimeBin[bin] << " sec" << endl;
|
|---|
| 69 | totalLiveTime += fLiveTimeBin[bin];
|
|---|
| 70 | }
|
|---|
| 71 | *fLog << GetName() << ": Total live time " << totalLiveTime << " sec" << endl;
|
|---|
| 72 | }
|
|---|
| 73 | else
|
|---|
| 74 | *fLog << GetName() << warn << "::Print() Bad argument " << opt << endl;
|
|---|
| 75 | }
|
|---|