Changeset 6553 for trunk/MagicSoft/Mars/mjobs
- Timestamp:
- 02/16/05 19:53:21 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mjobs
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mjobs/MJPedestal.cc
r6502 r6553 802 802 tenv.SetDefault(fExtractor); 803 803 804 if (tenv.ReadEnv(*GetEnv(), GetEnvPrefix()+".ExtractSignal", GetEnvDebug() )==kERROR)804 if (tenv.ReadEnv(*GetEnv(), GetEnvPrefix()+".ExtractSignal", GetEnvDebug()>2)==kERROR) 805 805 return kFALSE; 806 806 -
trunk/MagicSoft/Mars/mjobs/MJob.cc
r6177 r6553 29 29 // A base class for jobs 30 30 // 31 // SetDebugEnv(0) // switch off debugging 32 // SetDebugEnv(1) // reserved 33 // SetDebugEnv(2) // print untouched resources after evtloop resources setup 34 // SetDebugEnv(3) // do 2) and debug setting env completely 35 // 31 36 ///////////////////////////////////////////////////////////////////////////// 32 37 #include "MJob.h" 33 38 34 #include <TEnv.h>39 #include "MEnv.h" 35 40 #include <TFile.h> 36 41 #include <TSystem.h> … … 54 59 // Sets fDataFlag to 0 55 60 // 56 MJob::MJob(const char *name, const char *title) : fEnv(0), f Overwrite(kFALSE), fMaxEvents(0)61 MJob::MJob(const char *name, const char *title) : fEnv(0), fEnvDebug(0), fOverwrite(kFALSE), fMaxEvents(0) 57 62 58 63 { … … 61 66 } 62 67 68 void MJob::ClearEnv() 69 { 70 if (fEnv && TestBit(kIsOwner)) 71 delete fEnv; 72 ResetBit(kIsOwner); 73 fEnv=0; 74 } 75 63 76 MJob::~MJob() 64 77 { 65 if (fEnv) 66 delete fEnv; 78 ClearEnv(); 67 79 } 68 80 69 81 Bool_t MJob::SetEnv(const char *env, const char *prefix) 70 82 { 71 if (fEnv) 72 { 73 delete fEnv; 74 fEnv = 0; 75 } 83 ClearEnv(); 76 84 77 85 const Bool_t fileexist = !gSystem->AccessPathName(env, kFileExists); … … 82 90 } 83 91 84 fEnv = new TEnv(env); 92 fEnv = new MEnv(env); 93 SetBit(kIsOwner); 85 94 86 95 fEnvPrefix = prefix; … … 94 103 } 95 104 105 void MJob::SetEnv(MEnv *env, const char *prefix) 106 { 107 ClearEnv(); 108 109 fEnv = env; 110 111 fEnvPrefix = prefix; 112 if (!prefix) 113 fEnvPrefix = fName.First(' ')>0 ? fName(0, fName.First(' ')) : fName; 114 115 if (fEnvPrefix.EndsWith(".")) 116 fEnvPrefix.Remove(fEnvPrefix.Length()-1); 117 } 118 96 119 void MJob::FixPath(TString &path) const 97 120 { … … 123 146 } 124 147 148 const TEnv *MJob::GetEnv() const 149 { 150 return static_cast<const TEnv *const>(fEnv); 151 } 152 125 153 Int_t MJob::GetEnv(const char *name, Int_t dflt) const 126 154 { … … 140 168 Bool_t MJob::HasEnv(const char *name) const 141 169 { 142 return IsEnvDefined(*fEnv, fEnvPrefix, name, fEnvDebug );//fEnv->Lookup(Form("%s%s", fEnvPrefix.Data(), name));170 return IsEnvDefined(*fEnv, fEnvPrefix, name, fEnvDebug>2);//fEnv->Lookup(Form("%s%s", fEnvPrefix.Data(), name)); 143 171 } 144 172 … … 163 191 SetMaxEvents(GetEnv("MaxEvents", fMaxEvents)); 164 192 SetOverwrite(GetEnv("Overwrite", fOverwrite)); 193 SetEnvDebug( GetEnv("EnvDebug", fEnvDebug)); 165 194 166 195 return CheckEnvLocal(); … … 172 201 return kTRUE; 173 202 174 return loop.ReadEnv(*fEnv, fEnvPrefix, fEnvDebug) ? kTRUE : kFALSE; 203 if (!loop.ReadEnv(*fEnv, fEnvPrefix, fEnvDebug>2)) 204 return kFALSE; 205 206 if (fEnvDebug>1) 207 fEnv->PrintUntouched(); 208 209 return kTRUE; 175 210 } 176 211 -
trunk/MagicSoft/Mars/mjobs/MJob.h
r6177 r6553 6 6 #endif 7 7 8 class TEnv;8 class MEnv; 9 9 class MEvtLoop; 10 10 … … 12 12 { 13 13 private: 14 enum { kIsOwner = BIT(14) }; 15 14 16 void FixPath(TString &path) const; 17 void ClearEnv(); 15 18 16 const TEnv *fEnv; // Resource file19 const MEnv *fEnv; // Resource file 17 20 TString fEnvPrefix; // Prefix for resources 18 Bool_tfEnvDebug; // Debug setup of resources21 Int_t fEnvDebug; // Debug setup of resources 19 22 20 23 protected: 21 22 24 TString fPathOut; // Directory to write output file to (eg. calib*.root) 23 25 TString fPathIn; // Directory to read output from (eg. calib*.root) … … 29 31 MSequence fSequence; // Sequence 30 32 31 const TEnv *GetEnv() const { return fEnv; } 33 const TEnv *GetEnv() const; 34 const MEnv *GetMEnv() const { return fEnv; } 32 35 const TString &GetEnvPrefix() const { return fEnvPrefix; } 33 Bool_t GetEnvDebug() const { return fEnvDebug; }36 Int_t GetEnvDebug() const { return fEnvDebug; } 34 37 35 38 Int_t GetEnv(const char *name, Int_t dflt) const; … … 40 43 Bool_t SetupEnv(MEvtLoop &loop) const; 41 44 Bool_t CheckEnv(); 45 void PrintUntouchedEnv() const; 42 46 virtual Bool_t CheckEnvLocal() { return kTRUE; } 43 47 … … 57 61 void SetOverwrite(Bool_t b=kTRUE) { fOverwrite=b; } 58 62 Bool_t SetEnv(const char *env, const char *prefix=0); 59 void SetEnvDebug(Bool_t b=kTRUE) { fEnvDebug=b; } 63 void SetEnv(MEnv *env, const char *prefix=0); 64 void SetEnvDebug(Int_t d=2) { fEnvDebug=d; } 60 65 61 66 void SetMaxEvents(Int_t max) { fMaxEvents = max; }
Note:
See TracChangeset
for help on using the changeset viewer.