Changeset 4732 for trunk/MagicSoft/Mars/mjobs
- Timestamp:
- 08/25/04 17:30:31 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mjobs
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc
r4729 r4732 148 148 149 149 TObject *o = file.Get("ExtractSignal"); 150 if (!o)151 {152 *fLog << err << dbginf << "ERROR - Unable to read ExtractSignal from file " << fname << endl;153 return kFALSE;154 }155 if ( !o->InheritsFrom(MExtractor::Class()))150 // if (!o) 151 // { 152 // *fLog << err << dbginf << "ERROR - Unable to read ExtractSignal from file " << fname << endl; 153 // return kFALSE; 154 // } 155 if (o && !o->InheritsFrom(MExtractor::Class())) 156 156 { 157 157 *fLog << err << dbginf << "ERROR - ExtractSignal read from " << fname << " doesn't inherit from MExtractor!" << endl; 158 158 return kFALSE; 159 159 } 160 ext1 = (MTask*)o->Clone();160 ext1 = o ? (MTask*)o->Clone() : NULL; 161 161 162 162 o = file.Get("ExtractTime"); 163 if (!o)164 {165 *fLog << err << dbginf << "ERROR - Unable to read ExtractTime from file " << fname << endl;166 return kFALSE;167 }168 if ( !o->InheritsFrom(MExtractor::Class()))163 // if (!o) 164 // { 165 // *fLog << err << dbginf << "ERROR - Unable to read ExtractTime from file " << fname << endl; 166 // return kFALSE; 167 // } 168 if (o && !o->InheritsFrom(MExtractor::Class())) 169 169 { 170 170 *fLog << err << dbginf << "ERROR - ExtractTime read from " << fname << " doesn't inherit from MExtractor!" << endl; 171 171 return kFALSE; 172 172 } 173 ext2 = (MTask*)o->Clone(); 173 ext2 = o ? (MTask*)o->Clone() : NULL; 174 175 if (!ext1 && !ext2) 176 { 177 *fLog << err << dbginf << "ERROR - Neither ExtractSignal nor ExrtractTime found in " << fname << "!" << endl; 178 return kFALSE; 179 } 174 180 175 181 return kTRUE; … … 226 232 227 233 *fLog << all; 228 *fLog << "Extractors read from file" << endl; 229 *fLog << "=========================" << endl; 230 extractor1->Print(); 231 *fLog << endl; 232 extractor2->Print(); 233 *fLog << endl; 234 if (extractor1) 235 { 236 *fLog << underline << "Signal Extractor found in calibration file" << endl; 237 extractor1->Print(); 238 *fLog << endl; 239 } 240 else 241 *fLog << inf << "No Signal Extractor: ExtractSignal in file." << endl; 242 243 if (extractor2) 244 { 245 *fLog << underline << "Time Extractor found in calibration file" << endl; 246 extractor2->Print(); 247 *fLog << endl; 248 } 249 else 250 *fLog << inf << "No Time Extractor: ExtractTime in file." << endl; 234 251 235 252 // This is necessary for the case in which it is not in the files … … 302 319 tlist.AddToList(&pedlo); 303 320 tlist.AddToList(&fill0); 304 tlist.AddToList(&taskenv1); 305 tlist.AddToList(&taskenv2); 321 if (extractor1) 322 tlist.AddToList(&taskenv1); 323 if (extractor2) 324 tlist.AddToList(&taskenv2); 306 325 tlist.AddToList(&fill1); 307 326 tlist.AddToList(&calib); … … 320 339 evtloop.SetDisplay(fDisplay); 321 340 evtloop.SetLogStream(fLog); 322 if ( GetEnv())323 evtloop.ReadEnv(*GetEnv());341 if (!SetupEnv(evtloop)) 342 return kFALSE; 324 343 325 344 // Execute first analysis -
trunk/MagicSoft/Mars/mjobs/MJCalibration.cc
r4729 r4732 248 248 TString title = fDisplay->GetTitle(); 249 249 title += "-- Calibration "; 250 title += fSequence.IsValid() ? Form("calib%06d", fSequence.GetSequence()) : fRuns->GetRunsAsString();250 title += fSequence.IsValid() ? Form("calib%06d", fSequence.GetSequence()) : (const char*)fRuns->GetRunsAsString(); 251 251 title += " --"; 252 252 fDisplay->SetTitle(title); … … 1247 1247 Bool_t MJCalibration::CheckEnv() 1248 1248 { 1249 if (!MJob::CheckEnv())1250 return kFALSE;1251 1252 1249 TString col = GetEnv("Color", ""); 1253 1250 if (!col.IsNull()) … … 1269 1266 SetUsePINDiode(GetEnv("UsePINDiode", IsUsePINDiode())); 1270 1267 1271 return kTRUE;1268 return MJob::CheckEnv(); 1272 1269 } 1273 1270 … … 1557 1554 evtloop.SetDisplay(fDisplay); 1558 1555 evtloop.SetLogStream(fLog); 1559 if (GetEnv()) 1560 evtloop.ReadEnv(*GetEnv()); 1561 1562 //if (!WriteEventloop(evtloop)) 1563 // return kFALSE; 1556 if (!SetupEnv(evtloop)) 1557 return kFALSE; 1558 1559 if (!taskenv.GetTask() && !taskenv2.GetTask()) 1560 { 1561 *fLog << err << "ERROR - Neither ExtractSignal nor ExtractTime initializedor both '<dummy>'." << endl; 1562 return kFALSE; 1563 } 1564 1564 1565 1565 if (!WriteTasks(taskenv.GetTask(), taskenv2.GetTask())) … … 1738 1738 } 1739 1739 1740 if (t1 ->Write()<=0)1740 if (t1 && t1->Write()<=0) 1741 1741 { 1742 1742 *fLog << err << "Unable to write " << t1->GetName() << " to " << oname << endl; 1743 1743 return kFALSE; 1744 1744 } 1745 if (t2 ->Write()<=0)1745 if (t2 && t2->Write()<=0) 1746 1746 { 1747 1747 *fLog << err << "Unable to write " << t2->GetName() << " to " << oname << endl; -
trunk/MagicSoft/Mars/mjobs/MJPedestal.cc
r4729 r4732 460 460 } 461 461 */ 462 463 Bool_t MJPedestal::CheckEnv() 464 { 465 if (HasEnv("DataCheckDisplay")) 466 fDisplayType = GetEnv("DataCheckDisplay", kFALSE) ? kDataCheckDisplay : kNormalDisplay; 467 468 SetDataCheck(GetEnv("DataCheck", fDataCheck)); 469 SetOverwrite(GetEnv("Overwrite", fOverwrite)); 470 471 return MJob::CheckEnv(); 472 } 473 462 474 Bool_t MJPedestal::WriteResult() 463 475 { … … 617 629 evtloop.SetDisplay(fDisplay); 618 630 evtloop.SetLogStream(fLog); 619 if ( GetEnv())620 evtloop.ReadEnv(*GetEnv());631 if (!SetupEnv(evtloop)) 632 return kFALSE; 621 633 622 634 // if (!WriteEventloop(evtloop)) -
trunk/MagicSoft/Mars/mjobs/MJPedestal.h
r4729 r4732 61 61 void DisplayOutliers(TH1D *hist) const; 62 62 void FixDataCheckHist(TH1D *hist) const; 63 64 Bool_t CheckEnv(); 63 65 64 66 public: … … 78 80 void SetInput(MRunIter *iter) { fRuns = iter; } 79 81 80 void SetDataCheck(const Bool_t b=kTRUE) { fDataCheck = b; SetDataCheckDisplay(); }82 void SetDataCheck(const Bool_t b=kTRUE) { fDataCheck = b; b ? SetDataCheckDisplay() : SetNormalDisplay(); } 81 83 82 84 void SetDataCheckDisplay() { fDisplayType = kDataCheckDisplay; } -
trunk/MagicSoft/Mars/mjobs/MJob.cc
r4729 r4732 37 37 #include "MLog.h" 38 38 #include "MLogManip.h" 39 40 #include "MEvtLoop.h" 39 41 40 42 ClassImp(MJob); … … 77 79 fEnv = new TEnv(env); 78 80 79 f PrefixEnv= prefix;81 fEnvPrefix = prefix; 80 82 if (!prefix) 81 f PrefixEnv= fName.First(' ')>0 ? fName(0, fName.First(' ')) : fName;83 fEnvPrefix = fName.First(' ')>0 ? fName(0, fName.First(' ')) : fName; 82 84 83 if (f PrefixEnv.EndsWith("."))84 f PrefixEnv.Remove(fPrefixEnv.Length()-1);85 if (fEnvPrefix.EndsWith(".")) 86 fEnvPrefix.Remove(fEnvPrefix.Length()-1); 85 87 86 88 return kTRUE; … … 118 120 Int_t MJob::GetEnv(const char *name, Int_t dflt) const 119 121 { 120 return fEnv->GetValue(Form("%s%s", fPrefixEnv.Data(), name), dflt);122 return GetEnvValue(*fEnv, fEnvPrefix, name, dflt); // return fEnv->GetValue(Form("%s%s", fEnvPrefix.Data(), name), dflt); 121 123 } 122 124 123 125 Double_t MJob::GetEnv(const char *name, Double_t dflt) const 124 126 { 125 return fEnv->GetValue(Form("%s%s", fPrefixEnv.Data(), name), dflt);127 return GetEnvValue(*fEnv, fEnvPrefix, name, dflt); // return fEnv->GetValue(Form("%s%s", fEnvPrefix.Data(), name), dflt); 126 128 } 127 129 128 130 const char *MJob::GetEnv(const char *name, const char *dflt) const 129 131 { 130 return fEnv->GetValue(Form("%s%s", fPrefixEnv.Data(), name), dflt);132 return GetEnvValue(*fEnv, fEnvPrefix, name, dflt); //fEnv->GetValue(Form("%s%s", fEnvPrefix.Data(), name), dflt); 131 133 } 132 134 133 135 Bool_t MJob::HasEnv(const char *name) const 134 136 { 135 return fEnv->Lookup(Form("%s%s", fPrefixEnv.Data(), name));137 return IsEnvDefined(*fEnv, fEnvPrefix, name, fEnvDebug);//fEnv->Lookup(Form("%s%s", fEnvPrefix.Data(), name)); 136 138 } 137 139 138 140 Bool_t MJob::CheckEnv() 139 141 { 140 if (!fEnv)141 {142 *fLog << warn << "WARNING - " << GetDescriptor() << " CheckEnv called without further SetEnv!" << endl;143 return kFALSE;144 }145 146 142 TString p; 147 143 p = GetEnv("PathOut", ""); … … 162 158 return kTRUE; 163 159 } 160 161 Bool_t MJob::SetupEnv(MEvtLoop &loop) const 162 { 163 if (!fEnv) 164 return kTRUE; 165 166 return loop.ReadEnv(*fEnv, fEnvPrefix, fEnvDebug) ? kTRUE : kFALSE; 167 } -
trunk/MagicSoft/Mars/mjobs/MJob.h
r4729 r4732 7 7 8 8 class TEnv; 9 class MEvtLoop; 9 10 10 11 class MJob : public MParContainer … … 14 15 15 16 TEnv *fEnv; // Resource file 16 TString fPrefixEnv; // Prefix for resources 17 TString fEnvPrefix; // Prefix for resources 18 Bool_t fEnvDebug; // Debug setup of resources 17 19 18 20 protected: … … 27 29 MSequence fSequence; // Sequence 28 30 29 virtual Bool_t CheckEnv();30 31 TEnv *GetEnv() const { return fEnv; }32 31 Int_t GetEnv(const char *name, Int_t dflt) const; 33 32 Double_t GetEnv(const char *name, Double_t dflt) const; 34 33 const char *GetEnv(const char *name, const char *dflt) const; 35 34 Bool_t HasEnv(const char *name) const; 35 36 Bool_t SetupEnv(MEvtLoop &loop) const; 37 virtual Bool_t CheckEnv(); 36 38 37 39 public: … … 45 47 void SetOverwrite(Bool_t b=kTRUE) { fOverwrite=b; } 46 48 Bool_t SetEnv(const char *env, const char *prefix=0); 49 void SetEnvDebug(Bool_t b=kTRUE) { fEnvDebug=b; } 47 50 48 51 void SetMaxEvents(Int_t max) { fMaxEvents = max; } -
trunk/MagicSoft/Mars/mjobs/MSequence.cc
r4729 r4732 73 73 } 74 74 75 Int_t MSequence::SetupRuns(MDirIter &iter, const TArrayI &arr, const char *path ) const75 Int_t MSequence::SetupRuns(MDirIter &iter, const TArrayI &arr, const char *path, Bool_t raw) const 76 76 { 77 77 TString d(path); … … 80 80 if (d.IsNull()) 81 81 { 82 d = Form("/data/MAGIC/Period%03d/rootdata/", fPeriod); 82 d = Form("/data/MAGIC/Period%03d/", fPeriod); 83 d += raw ? "rawdata/" : "rootdata/"; 83 84 d += fNight.GetStringFmt("%Y_%m_%d"); 84 85 } … … 90 91 // Create file name 91 92 n = fNight.GetStringFmt("%Y%m%d_"); 92 n += Form("%05d_*_E.root", arr[i]); 93 n += Form("%05d_*_E", arr[i]); 94 n += raw ? ".raw" : ".root"; 93 95 94 96 // Add Path/File to TIter … … 182 184 // If path==0 the standard path of the data-center is assumed. 183 185 // If you have the runs locally use path="." 184 // Return the number of files added. 185 // 186 Int_t MSequence::SetupPedRuns(MDirIter &iter, const char *path) const 187 { 188 return SetupRuns(iter, fPedRuns, path); 186 // Using raw=kTRUE you get correspodning raw-files setup. 187 // Return the number of files added. 188 // 189 Int_t MSequence::SetupPedRuns(MDirIter &iter, const char *path, Bool_t raw) const 190 { 191 return SetupRuns(iter, fPedRuns, path, raw); 189 192 } 190 193 … … 194 197 // If path==0 the standard path of the data-center is assumed. 195 198 // If you have the runs locally use path="." 196 // Return the number of files added. 197 // 198 Int_t MSequence::SetupDatRuns(MDirIter &iter, const char *path) const 199 { 200 return SetupRuns(iter, fDatRuns, path); 199 // Using raw=kTRUE you get correspodning raw-files setup. 200 // Return the number of files added. 201 // 202 Int_t MSequence::SetupDatRuns(MDirIter &iter, const char *path, Bool_t raw) const 203 { 204 return SetupRuns(iter, fDatRuns, path, raw); 201 205 } 202 206 … … 206 210 // If path==0 the standard path of the data-center is assumed. 207 211 // If you have the runs locally use path="." 208 // Return the number of files added. 209 // 210 Int_t MSequence::SetupAllRuns(MDirIter &iter, const char *path) const 211 { 212 return SetupRuns(iter, fRuns, path); 212 // Using raw=kTRUE you get correspodning raw-files setup. 213 // Return the number of files added. 214 // 215 Int_t MSequence::SetupAllRuns(MDirIter &iter, const char *path, Bool_t raw) const 216 { 217 return SetupRuns(iter, fRuns, path, raw); 213 218 } 214 219 … … 218 223 // If path==0 the standard path of the data-center is assumed. 219 224 // If you have the runs locally use path="." 220 // Return the number of files added. 221 // 222 Int_t MSequence::SetupCalRuns(MDirIter &iter, const char *path) const 223 { 224 return SetupRuns(iter, fCalRuns, path); 225 } 225 // Using raw=kTRUE you get correspodning raw-files setup. 226 // Return the number of files added. 227 // 228 Int_t MSequence::SetupCalRuns(MDirIter &iter, const char *path, Bool_t raw) const 229 { 230 return SetupRuns(iter, fCalRuns, path, raw); 231 } -
trunk/MagicSoft/Mars/mjobs/MSequence.h
r4729 r4732 36 36 37 37 void Split(TString &runs, TArrayI &data) const; 38 Int_t SetupRuns(MDirIter &iter, const TArrayI &arr, const char *path ) const;38 Int_t SetupRuns(MDirIter &iter, const TArrayI &arr, const char *path, Bool_t raw=kFALSE) const; 39 39 40 40 public: … … 53 53 Bool_t IsValid() const { return fSequence!=(UInt_t)-1; } 54 54 55 Int_t SetupPedRuns(MDirIter &iter, const char *path=0 ) const;56 Int_t SetupDatRuns(MDirIter &iter, const char *path=0 ) const;57 Int_t SetupAllRuns(MDirIter &iter, const char *path=0 ) const;58 Int_t SetupCalRuns(MDirIter &iter, const char *path=0 ) const;55 Int_t SetupPedRuns(MDirIter &iter, const char *path=0, Bool_t raw=kFALSE) const; 56 Int_t SetupDatRuns(MDirIter &iter, const char *path=0, Bool_t raw=kFALSE) const; 57 Int_t SetupAllRuns(MDirIter &iter, const char *path=0, Bool_t raw=kFALSE) const; 58 Int_t SetupCalRuns(MDirIter &iter, const char *path=0, Bool_t raw=kFALSE) const; 59 59 60 60 Int_t GetNumAllRuns() const { return fRuns.GetSize(); }
Note:
See TracChangeset
for help on using the changeset viewer.