| 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): Markus Meyer 04/2005 <mailto:meyer@astro.uni-wuerzburg.de> | 
|---|
| 19 | ! | 
|---|
| 20 | !   Copyright: MAGIC Software Development, 2000-2005 | 
|---|
| 21 | ! | 
|---|
| 22 | ! | 
|---|
| 23 | \* ======================================================================== */ | 
|---|
| 24 |  | 
|---|
| 25 | ///////////////////////////////////////////////////////////////////////////// | 
|---|
| 26 | // | 
|---|
| 27 | // MMuonSetup | 
|---|
| 28 | // | 
|---|
| 29 | // Storage Container for setup parameter for the muon analysis | 
|---|
| 30 | // | 
|---|
| 31 | // - margin | 
|---|
| 32 | // - ThresholdArcWidth | 
|---|
| 33 | // - ThresholdArcPhi | 
|---|
| 34 | // | 
|---|
| 35 | ///////////////////////////////////////////////////////////////////////////// | 
|---|
| 36 | #include "MMuonSetup.h" | 
|---|
| 37 |  | 
|---|
| 38 | #include <fstream> | 
|---|
| 39 |  | 
|---|
| 40 | #include "MLog.h" | 
|---|
| 41 |  | 
|---|
| 42 | using namespace std; | 
|---|
| 43 |  | 
|---|
| 44 | ClassImp(MMuonSetup); | 
|---|
| 45 |  | 
|---|
| 46 | // -------------------------------------------------------------------------- | 
|---|
| 47 | // | 
|---|
| 48 | // Default constructor. | 
|---|
| 49 | // | 
|---|
| 50 | MMuonSetup::MMuonSetup(const char *name, const char *title) | 
|---|
| 51 | : fMargin(0.2), fThresholdArcPhi(5), fThresholdArcWidth(2) | 
|---|
| 52 | { | 
|---|
| 53 | fName  = name  ? name  : "MMuonSetup"; | 
|---|
| 54 | fTitle = title ? title : "Muon calibration setup parameters"; | 
|---|
| 55 | } | 
|---|
| 56 |  | 
|---|
| 57 | // -------------------------------------------------------------------------- | 
|---|
| 58 | // | 
|---|
| 59 | // Read the setup from a TEnv, eg: | 
|---|
| 60 | //   MMuonSetup.Margin:            0.2 | 
|---|
| 61 | //   MMuonSetup.ThresholdArcPhi:   30 | 
|---|
| 62 | //   MMuonSetup.ThresholdArcWidth: 2 | 
|---|
| 63 | // | 
|---|
| 64 | Int_t MMuonSetup::ReadEnv(const TEnv &env, TString prefix, Bool_t print) | 
|---|
| 65 | { | 
|---|
| 66 | Bool_t rc = kFALSE; | 
|---|
| 67 | if (IsEnvDefined(env, prefix, "Margin", print)) | 
|---|
| 68 | { | 
|---|
| 69 | rc = kTRUE; | 
|---|
| 70 | fMargin = GetEnvValue(env, prefix, "Margin", fMargin); | 
|---|
| 71 | } | 
|---|
| 72 | if (IsEnvDefined(env, prefix, "ThresholdArcPhi", print)) | 
|---|
| 73 | { | 
|---|
| 74 | rc = kTRUE; | 
|---|
| 75 | fThresholdArcPhi = GetEnvValue(env, prefix, "ThresholdArcPhi", fThresholdArcPhi); | 
|---|
| 76 | } | 
|---|
| 77 | if (IsEnvDefined(env, prefix, "ThresholdArcWidth", print)) | 
|---|
| 78 | { | 
|---|
| 79 | rc = kTRUE; | 
|---|
| 80 | fThresholdArcWidth = GetEnvValue(env, prefix, "ThresholdArcWidth", fThresholdArcWidth); | 
|---|
| 81 | } | 
|---|
| 82 |  | 
|---|
| 83 | return rc; | 
|---|
| 84 | } | 
|---|