| 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, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
 | 
|---|
| 19 | !
 | 
|---|
| 20 | !   Copyright: MAGIC Software Development, 2000-2003
 | 
|---|
| 21 | !
 | 
|---|
| 22 | !
 | 
|---|
| 23 | \* ======================================================================== */
 | 
|---|
| 24 | 
 | 
|---|
| 25 | //////////////////////////////////////////////////////////////////////////////
 | 
|---|
| 26 | //
 | 
|---|
| 27 | //  MReportTrigger
 | 
|---|
| 28 | //
 | 
|---|
| 29 | // This is the class interpreting and storing the TRIGGER-REPORT information.
 | 
|---|
| 30 | //
 | 
|---|
| 31 | //////////////////////////////////////////////////////////////////////////////
 | 
|---|
| 32 | #include "MReportTrigger.h"
 | 
|---|
| 33 | 
 | 
|---|
| 34 | #include "MLogManip.h"
 | 
|---|
| 35 | 
 | 
|---|
| 36 | ClassImp(MReportTrigger);
 | 
|---|
| 37 | 
 | 
|---|
| 38 | using namespace std;
 | 
|---|
| 39 | 
 | 
|---|
| 40 | // --------------------------------------------------------------------------
 | 
|---|
| 41 | //
 | 
|---|
| 42 | // Default construtor. Initialize identifier to "TRIGGER-REPORT"
 | 
|---|
| 43 | //
 | 
|---|
| 44 | MReportTrigger::MReportTrigger() : MReport("TRIGGER-REPORT"), fPrescalerRates(19)
 | 
|---|
| 45 | {
 | 
|---|
| 46 |     fName  = "MReportTrigger";
 | 
|---|
| 47 |     fTitle = "Class for TRIGGER-REPORT information";
 | 
|---|
| 48 | }
 | 
|---|
| 49 | 
 | 
|---|
| 50 | // --------------------------------------------------------------------------
 | 
|---|
| 51 | //
 | 
|---|
| 52 | // Interprete the body of the TRIGGER-REPORT string
 | 
|---|
| 53 | //
 | 
|---|
| 54 | Int_t MReportTrigger::InterpreteBody(TString &str)
 | 
|---|
| 55 | {
 | 
|---|
| 56 |     str = str.Strip(TString::kLeading);
 | 
|---|
| 57 | 
 | 
|---|
| 58 |     const Int_t ws = str.First(' ');
 | 
|---|
| 59 |     if (ws<=0)
 | 
|---|
| 60 |     {
 | 
|---|
| 61 |         *fLog << warn << "WARNING - Cannot determin name of trigger table." << endl;
 | 
|---|
| 62 |         return kCONTINUE;
 | 
|---|
| 63 |     }
 | 
|---|
| 64 | 
 | 
|---|
| 65 |     TString tablename = str(0, ws);
 | 
|---|
| 66 |     str.Remove(0, ws);
 | 
|---|
| 67 | 
 | 
|---|
| 68 |     Int_t len, n;
 | 
|---|
| 69 | 
 | 
|---|
| 70 |     const char *pos = str.Data();
 | 
|---|
| 71 |     for (int i=0; i<19; i++)
 | 
|---|
| 72 |     {
 | 
|---|
| 73 |         n = sscanf(pos, " %f %n", &fPrescalerRates[i], &len);
 | 
|---|
| 74 |         if (n!=1)
 | 
|---|
| 75 |         {
 | 
|---|
| 76 |             *fLog << warn << "WARNING - Scaler Value #" << i << " missing." << endl;
 | 
|---|
| 77 |             return kCONTINUE;
 | 
|---|
| 78 |         }
 | 
|---|
| 79 |         pos += len;
 | 
|---|
| 80 |     }
 | 
|---|
| 81 |     n = sscanf(pos, " %f %f %n", &fL2BeforePrescaler, &fL2AfterPrescaler, &len);
 | 
|---|
| 82 |     if (n!=2)
 | 
|---|
| 83 |     {
 | 
|---|
| 84 |         *fLog << warn << "WARNING - Couldn't read Trigger rates." << endl;
 | 
|---|
| 85 |         return kFALSE;
 | 
|---|
| 86 |     }
 | 
|---|
| 87 |     pos += len;
 | 
|---|
| 88 |     for (int i=0; i<11; i++)
 | 
|---|
| 89 |     {
 | 
|---|
| 90 |         Float_t dummy;
 | 
|---|
| 91 |         n = sscanf(pos, " %f %n", &dummy/*fRates[i]*/, &len);
 | 
|---|
| 92 |         if (n!=1)
 | 
|---|
| 93 |         {
 | 
|---|
| 94 |             *fLog << warn << "WARNING - Rate #" << i << " missing." << endl;
 | 
|---|
| 95 |             return kFALSE;
 | 
|---|
| 96 |         }
 | 
|---|
| 97 |         pos += len;
 | 
|---|
| 98 |     }
 | 
|---|
| 99 |     str.Remove(0, pos-str.Data());
 | 
|---|
| 100 |     str.Strip(TString::kBoth);
 | 
|---|
| 101 | 
 | 
|---|
| 102 |     return str==(TString)"OVER" ? kTRUE : kCONTINUE;
 | 
|---|
| 103 | }
 | 
|---|