Changeset 7380 for trunk/MagicSoft
- Timestamp:
- 10/01/05 19:37:29 (19 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r7378 r7380 18 18 19 19 -*-*- END OF LINE -*-*- 20 21 2005/10/01 Thomas Bretz 22 23 * mjobs/MDataSet.[h,cc]: 24 - implemented two new options for constructor allowing to 25 change the default path to image data and sequence files 26 - fixed some typos 27 28 * mjobs/MSequence.[h,cc]: 29 - implemented new light condition "day" for completeness 30 31 * ganymed.cc: 32 - implemented twonew options --ind and --ins 33 34 20 35 21 36 2005/10/01 -
trunk/MagicSoft/Mars/NEWS
r7379 r7380 2 2 3 3 *** Version <cvs> 4 5 - ganymed: Implemented two new options which allow 6 to overwrite the default path to search for the sequence files 7 --ins=/magic/sequences 8 and where to search for the image data 9 --ind=/magic/data/star 4 10 5 11 -
trunk/MagicSoft/Mars/ganymed.cc
r7286 r7380 63 63 gLog << " --n=[n] Analysis number" << endl; 64 64 gLog << " --out=path Path to write the all output to [def=local path]" << endl; 65 gLog << " --ind=path Path to data/star files [default=datacenter path]" << endl; 66 gLog << " --ins=path Path to sequence files [default=datacenter path]" << endl; 65 67 gLog << " --outf=filename Filename for output file (eg. status display)" << endl; 66 68 gLog << " --sum[=filename] Enable writing of summary file (events after cut0)" << endl; … … 127 129 const TString kOutpath = arg.GetStringAndRemove("--out=", "."); 128 130 const TString kOutfile = arg.GetStringAndRemove("--outf=", ""); 131 const TString kPathDataFiles = arg.GetStringAndRemove("--ind=", ""); 132 const TString kPathSequences = arg.GetStringAndRemove("--ins=", ""); 129 133 const Bool_t kWriteSummary = arg.HasOnlyAndRemove("--sum"); 130 134 const TString kNameSummary = arg.GetStringAndRemove("--sum="); … … 180 184 // Setup sequence and check its validity 181 185 // 182 MDataSet seq(kSequences );186 MDataSet seq(kSequences, kPathSequences, kPathDataFiles); 183 187 if (kNumAnalysis>=0) 184 188 seq.SetNumAnalysis(kNumAnalysis); -
trunk/MagicSoft/Mars/mjobs/MDataSet.cc
r7358 r7380 96 96 using namespace std; 97 97 98 const TString MDataSet::fgCatalog = "/magic/datacenter/setup/magic_favorites.edb"; 99 const TString MDataSet::fgPathDataFiles = "/magic/data/star"; 100 const TString MDataSet::fgPathSequences = "/magic/sequences"; 101 98 102 // -------------------------------------------------------------------------- 99 103 // … … 151 155 // The entries are sorted by filename. 152 156 // 153 void MDataSet::ResolveSequences(TEnv &env, const TArrayI &num, TList &list ) const157 void MDataSet::ResolveSequences(TEnv &env, const TArrayI &num, TList &list, const TString &sequences, const TString &data) const 154 158 { 155 159 for (int i=0; i<num.GetSize(); i++) … … 158 162 TString dir = env.GetValue(Form("Sequence%08d.Dir", num[i]), ""); 159 163 164 // Set default sequence file and dir name 165 if (name.IsNull()) 166 name = Form("%s%04d/sequence%08d.txt", sequences.Data(), num[i]/10000, num[i]); 167 if (dir.IsNull()) 168 dir = Form("%s%04d/%08d", data.Data(), num[i]/10000, num[i]); 169 160 170 gSystem->ExpandPathName(name); 161 171 gSystem->ExpandPathName(dir); 162 163 // Set default sequence file and dir name164 if (name.IsNull())165 name = Form("/magic/sequences/%04d/sequence%08d.txt", num[i]/10000, num[i]);166 if (dir.IsNull())167 dir = Form("/magic/data/star/%04d/%08d", num[i]/10000, num[i]);168 172 169 173 if (gSystem->AccessPathName(name, kFileExists)) … … 185 189 // Read the file fname as setup file for the sequence. 186 190 // 187 MDataSet::MDataSet(const char *fname )191 MDataSet::MDataSet(const char *fname, TString sequences, TString data) 188 192 { 189 193 fName = fname; … … 191 195 const char *expname = gSystem->ExpandPathName(fname); 192 196 193 fTitle = Form("Sequences contained in file %s", expname); 197 fTitle = Form("Dataset contained in file %s", expname); 198 199 const Bool_t access = !gSystem->AccessPathName(expname, kFileExists); 200 if (!access) 201 gLog << err << "ERROR - Dataset file " << expname << " not accessible!" << endl; 194 202 195 203 TEnv env(expname); 196 204 delete [] expname; 197 205 206 fNumAnalysis = env.GetValue("AnalysisNumber", -1); 207 198 208 TString str; 199 200 fNumAnalysis = env.GetValue("AnalysisNumber", -1); 201 202 str = env.GetValue("SequencesOn", ""); 209 str = env.GetValue("SequencesOn", ""); 203 210 Split(str, fNumSequencesOn); 204 211 str = env.GetValue("SequencesOff", ""); 205 212 Split(str, fNumSequencesOff); 206 213 207 ResolveSequences(env, fNumSequencesOn, fSequencesOn); 208 ResolveSequences(env, fNumSequencesOff, fSequencesOff); 209 214 SetupDefaultPath(sequences, fgPathSequences); 215 SetupDefaultPath(data, fgPathDataFiles); 216 217 ResolveSequences(env, fNumSequencesOn, fSequencesOn, sequences, data); 218 ResolveSequences(env, fNumSequencesOff, fSequencesOff, sequences, data); 210 219 211 220 fNameSource = env.GetValue("SourceName", ""); 212 fCatalog = env.GetValue("Catalog", "~/Software/data/magic_favorites.edb");221 fCatalog = env.GetValue("Catalog", fgCatalog); 213 222 fIsWobbleMode = env.GetValue("WobbleMode", kFALSE); 214 215 //Print(); 216 /* 217 GetFileNames(env, fSequencesOn); 218 GetFileNames(env, fSequencesOff); 219 */ 223 fComment = env.GetValue("Comment", ""); 220 224 } 221 225 … … 226 230 void MDataSet::PrintFile(const TObject &obj) 227 231 { 228 const Bool_t access = !gSystem->AccessPathName(obj.GetName(), kFileExists) && !gSystem->AccessPathName(obj.GetTitle(), kFileExists) ? '+' : '-'; 229 gLog << " " << (access?"+":"-") << " " << obj.GetName() << " <" << obj.GetTitle() << ">" << endl; 232 const Char_t access = 233 !gSystem->AccessPathName(obj.GetName(), kFileExists) && 234 !gSystem->AccessPathName(obj.GetTitle(), kFileExists) ? '+' : '-'; 235 236 gLog << " " << access << " " << obj.GetName() << " <" << obj.GetTitle() << ">" << endl; 230 237 } 231 238 … … 242 249 return; 243 250 } 244 gLog << "Analysis Number: " << fNumAnalysis<< endl;245 gLog << "Sequences 251 gLog << "AnalysisNumber: " << fNumAnalysis << endl << endl; 252 gLog << "SequencesOn: "; 246 253 for (int i=0; i<fNumSequencesOn.GetSize(); i++) 247 254 gLog << " " << fNumSequencesOn[i]; 248 255 gLog << endl; 249 gLog << "Sequences 256 gLog << "SequencesOff: "; 250 257 for (int i=0; i<fNumSequencesOff.GetSize(); i++) 251 258 gLog << " " << fNumSequencesOff[i]; 252 gLog << endl ;259 gLog << endl << endl; 253 260 254 261 gLog << "SourceName: " << fNameSource << endl; 255 gLog << "Catalog: " << fCatalog << endl; 256 257 gLog << "WobbleMode: " << (fIsWobbleMode?"On":"Off") << endl; 258 259 if (!TString(o).Contains("files", TString::kIgnoreCase)) 262 gLog << "Catalog: " << fCatalog << endl; 263 264 gLog << "WobbleMode: " << (fIsWobbleMode?"On":"Off") << endl << endl; 265 266 gLog << "Comment: " << fComment << endl; 267 268 if (TString(o).Contains("files", TString::kIgnoreCase)) 269 { 270 TObject *obj=0; 271 272 gLog << endl; 273 gLog << "On-Data Files:" << endl; 274 TIter NextOn(&fSequencesOn); 275 while ((obj=NextOn())) 276 PrintFile(*obj); 277 278 gLog << endl; 279 gLog << "Off-Data Files:" << endl; 280 TIter NextOff(&fSequencesOff); 281 while ((obj=NextOff())) 282 PrintFile(*obj); 283 260 284 return; 261 262 TObject *obj=0; 263 264 gLog << endl; 265 gLog << "On-Data Files:" << endl; 266 TIter NextOn(&fSequencesOn); 267 while ((obj=NextOn())) 268 PrintFile(*obj); 269 270 gLog << endl; 271 gLog << "Off-Data Files:" << endl; 272 TIter NextOff(&fSequencesOff); 273 while ((obj=NextOff())) 274 PrintFile(*obj); 285 } 275 286 } 276 287 … … 481 492 return kTRUE; 482 493 } 494 495 // -------------------------------------------------------------------------- 496 // 497 // Calls ReplaceAll(old, news) for all Dir-entries 498 // 499 void MDataSet::ReplaceDir(TList &list, const TString &old, const TString &news) const 500 { 501 TIter Next(&list); 502 TNamed *name = 0; 503 while ((name=(TNamed*)Next())) 504 { 505 TString dir = name->GetTitle(); 506 dir.ReplaceAll(old, news); 507 name->SetTitle(dir); 508 } 509 } 510 511 // -------------------------------------------------------------------------- 512 // 513 // Calls ReplaceAll(old, news) for all File-entries 514 // 515 void MDataSet::ReplaceFile(TList &list, const TString &old, const TString &news) const 516 { 517 TIter Next(&list); 518 TNamed *name = 0; 519 while ((name=(TNamed*)Next())) 520 { 521 TString file = name->GetName(); 522 file.ReplaceAll(old, news); 523 name->SetName(file); 524 } 525 } -
trunk/MagicSoft/Mars/mjobs/MDataSet.h
r7142 r7380 19 19 { 20 20 private: 21 static const TString fgCatalog; //! Default Catalog path 22 static const TString fgPathDataFiles; //! Default path to data files 23 static const TString fgPathSequences; //! Default path to sequences 24 21 25 UInt_t fNumAnalysis; // Analysis number (artificial) 22 26 … … 30 34 TString fCatalog; // edb catalog (magic_favourites.edb) 31 35 36 TString fComment; // Comment from DS file 37 32 38 Bool_t fIsWobbleMode; // Wobble Mode for this dataset? 33 39 34 40 void Split(TString &runs, TArrayI &data) const; 35 void ResolveSequences(TEnv &env, const TArrayI &num, TList &list ) const;41 void ResolveSequences(TEnv &env, const TArrayI &num, TList &list, const TString &sequences, const TString &data) const; 36 42 static void PrintFile(const TObject &obj); 43 44 void ReplaceDir(TList &list, const TString &old, const TString &news) const; 45 void ReplaceFile(TList &list, const TString &old, const TString &news) const; 46 47 void SetupDefaultPath(TString &path, const TString &def) const 48 { 49 if (path.IsNull()) 50 path = def; 51 if (!path.EndsWith("/")) 52 path += "/"; 53 } 37 54 38 55 public: 39 56 MDataSet() : fNumAnalysis((UInt_t)-1) { } 40 MDataSet(const char *fname );57 MDataSet(const char *fname, TString sequences="", TString data=""); 41 58 42 59 // Getter … … 71 88 Bool_t AddFilesOff(TChain &read) const; 72 89 90 void ReplaceDir(const TString &old, const TString &news) 91 { 92 ReplaceDir(fSequencesOn, old, news); 93 ReplaceDir(fSequencesOff, old, news); 94 } 95 96 void ReplaceFile(const TString &old, const TString &news) 97 { 98 ReplaceFile(fSequencesOn, old, news); 99 ReplaceFile(fSequencesOff, old, news); 100 } 101 73 102 // TObject 74 103 void Print(Option_t *o="") const; -
trunk/MagicSoft/Mars/mjobs/MSequence.cc
r7358 r7380 337 337 if (!str.CompareTo("Moon", TString::kIgnoreCase)) 338 338 return kMoon; 339 340 gLog << warn << "MSequence: LightCondition-tag not n/a, nomoon, twilight or moon." << endl; 339 if (!str.CompareTo("Day", TString::kIgnoreCase)) 340 return kDay; 341 342 gLog << warn << "MSequence: LightCondition-tag not n/a, nomoon, twilight, moon or day." << endl; 341 343 return kNA; 342 344 } … … 353 355 354 356 fTitle = Form("Sequence contained in file %s", expname); 357 358 const Bool_t access = !gSystem->AccessPathName(expname, kFileExists); 359 if (!access) 360 gLog << err << "ERROR - Dataset file " << expname << " not accessible!" << endl; 355 361 356 362 TEnv env(expname); … … 414 420 case kTwilight: gLog << "Twilight" << endl; break; 415 421 case kMoon: gLog << "Moon" << endl; break; 422 case kDay: gLog << "Day" << endl; break; 416 423 } 417 424 gLog << "Start: " << fStart << endl; -
trunk/MagicSoft/Mars/mjobs/MSequence.h
r6906 r7380 19 19 { 20 20 public: 21 enum LightCondition_t { kNA, kNoMoon, kTwilight, kMoon };21 enum LightCondition_t { kNA, kNoMoon, kTwilight, kMoon, kDay }; 22 22 enum FileType_t { 23 23 kRawDat, kRawPed, kRawCal, kRawAll,
Note:
See TracChangeset
for help on using the changeset viewer.