- Timestamp:
- 06/13/05 09:57:28 (19 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Makefile
r7094 r7149 66 66 mranforest \ 67 67 mjobs \ 68 mjoptim \ 68 69 mtools \ 69 70 mmuon -
trunk/MagicSoft/Mars/manalysis/MEnergyEstimate.cc
r7004 r7149 39 39 // 40 40 // Output: 41 // MEnergyEst 41 // MEnergyEst [MParameterD] 42 42 // 43 43 ///////////////////////////////////////////////////////////////////////////// 44 44 #include "MEnergyEstimate.h" 45 46 #include "MParList.h"47 48 #include "MDataChain.h"49 #include "MParameters.h"50 51 #include "MLog.h"52 #include "MLogManip.h"53 45 54 46 ClassImp(MEnergyEstimate); … … 61 53 // 62 54 MEnergyEstimate::MEnergyEstimate(const char *name, const char *title) 63 : fData(0), fEnergy(0)55 : MParameterCalc("MMcEvt.fEnergy") 64 56 { 65 57 fName = name ? name : "MEnergyEstimate"; 66 58 fTitle = title ? title : "Task to estimate the energy by a rule"; 67 59 68 fData = new MDataChain("MMcEvt.fEnergy");60 SetNameParameter("MEnergyEst"); 69 61 } 70 71 // --------------------------------------------------------------------------72 //73 // delete fData74 //75 MEnergyEstimate::~MEnergyEstimate()76 {77 delete fData;78 }79 80 // --------------------------------------------------------------------------81 //82 // Delete fData. Initialize a new MDataChain with rule.83 // Returns if fData->IsValid()84 //85 Bool_t MEnergyEstimate::SetRule(const char *rule)86 {87 delete fData;88 fData = new MDataChain(rule);89 90 return fData->IsValid();91 }92 93 // --------------------------------------------------------------------------94 //95 // Forwards SetVariables to fData to allow optimizations.96 //97 void MEnergyEstimate::SetVariables(const TArrayD &arr)98 {99 fData->SetVariables(arr);100 }101 102 // --------------------------------------------------------------------------103 //104 // FindCreate "MEnergyEst"105 // PreProcess fData.106 //107 Int_t MEnergyEstimate::PreProcess(MParList *plist)108 {109 fEnergy = (MParameterD*)plist->FindCreateObj("MParameterD", "MEnergyEst");110 if (!fEnergy)111 return kFALSE;112 113 *fLog << inf << "Rule for energy estimation: " << fData->GetRule() << endl;114 115 if (!fData->PreProcess(plist))116 return kFALSE;117 118 return kTRUE;119 }120 121 // --------------------------------------------------------------------------122 //123 // Get value from fData and set it to fEnergy. SetReadyToSave for fEnergy.124 // Return kCONTINUE if value is NaN (Not a Number)125 //126 Int_t MEnergyEstimate::Process()127 {128 const Double_t val = fData->GetValue();129 if (TMath::IsNaN(val))130 return kCONTINUE;131 132 fEnergy->SetVal(val);133 fEnergy->SetReadyToSave();134 return kTRUE;135 }136 137 // --------------------------------------------------------------------------138 //139 // Print the rule used for energy estimation140 //141 void MEnergyEstimate::Print(Option_t *o) const142 {143 *fLog << all << GetDescriptor() << ":";144 if (!fData)145 *fLog << " <n/a>" << endl;146 else147 *fLog << endl << fData->GetRule() << endl;148 }149 150 // --------------------------------------------------------------------------151 //152 // Check for corresponding entries in resource file and setup filters.153 // Avoid trailing 0's!154 //155 // Example:156 // test.C:157 // MEnergyEstimate est("MyEstimator");158 //159 // test.rc:160 // MyEstimator.Rule: {0} + {1}161 // MyEstimator.0: log10(MHillas.fSize)162 // MyEstimator.1: 5.5163 //164 // For more details see MDataChain::ReadEnv165 //166 Int_t MEnergyEstimate::ReadEnv(const TEnv &env, TString prefix, Bool_t print)167 {168 MDataChain *f = new MDataChain;169 f->SetName(fName);170 171 const Bool_t rc = f->ReadEnv(env, prefix, print);172 if (rc!=kTRUE)173 {174 delete f;175 return rc;176 }177 178 delete fData;179 fData = f;180 181 if (!fData->IsValid())182 {183 *fLog << err << "MEnergyEst::ReadEnv - ERROR: Inavlid rule from resource file." << endl;184 return kERROR;185 }186 187 return kTRUE;188 } -
trunk/MagicSoft/Mars/manalysis/MEnergyEstimate.h
r6949 r7149 2 2 #define MARS_MEnergyEstimate 3 3 4 #ifndef MARS_M Task5 #include "M Task.h"4 #ifndef MARS_MParameterCalc 5 #include "MParameterCalc.h" 6 6 #endif 7 7 8 class MData; 9 class MParameterD; 10 11 class MEnergyEstimate : public MTask 8 class MEnergyEstimate : public MParameterCalc 12 9 { 13 private:14 MData *fData; //->15 MParameterD *fEnergy; //!16 17 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);18 19 10 public: 20 11 MEnergyEstimate(const char *name=NULL, const char *title=NULL); 21 ~MEnergyEstimate();22 23 Bool_t SetRule(const char *rule);24 25 Int_t PreProcess(MParList *plist);26 Int_t Process();27 28 void SetVariables(const TArrayD &);29 30 void Print(Option_t *o="") const; //*MENU*31 12 32 13 ClassDef(MEnergyEstimate, 1) // Task to estimate the energy by a rule -
trunk/MagicSoft/Mars/manalysis/Makefile
r6932 r7149 28 28 SRCFILES = MGeomApply.cc \ 29 29 MCameraData.cc \ 30 MParameterCalc.cc \ 30 31 MEnergyEstimate.cc \ 31 32 MMatrixLoop.cc \
Note:
See TracChangeset
for help on using the changeset viewer.