- Timestamp:
- 01/11/07 14:56:24 (18 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r8243 r8244 25 25 * mbase/MLogManip.h: 26 26 - encapsulated an include in ifdefs 27 28 * mhcalib/MHCalibrationCam.cc, mhcalib/MHCalibrationChargeCam.cc: 29 - updated log-output 30 31 * mhflux/MHEnergyEst.cc: 32 - replaced difficult to see green by blue 33 34 * mjobs/MDataSet.[h,cc]: 35 - added datat members for path of sequences and path of data files 36 to be able to store overwritten defaults 37 - check completeness of dataset files 38 - store a MSequence object in the list instead of the name and dir 39 (this is necessary to have all important information for a dataset 40 file, including the sequence number! - available) 41 - some changes to the output 42 - allow to print a perfect copy of the read dataset file to the console 43 just from the contents of the object 44 45 * mjobs/MJStar.cc: 46 - updated to use MSequence::GetFileName instead of MSequence:GetName 47 48 * mjobs/MSequence.[h,cc]: 49 - keep filename and datapath in header, this has some advantages 50 for sanity checks 51 - many improvements of sanity checking in case of missing or 52 unaccessible files 53 - Fixed "lightConditions" (was "LightCondition") 54 - Fixed "No_Moon" (was "NoMoon") 55 - allow to set the data path as second argument in the constructor 56 - implemented a check whether the sequence file is complete 57 58 * mjobs/MJCut.[h,cc]: 59 - added some code (still commented out) to display the excess rate 60 - with the other changes we can now store the original dataset in 61 the output 62 63 * mjoptim/MJOptimize.cc: 64 - Keep the sequence files in the file list instead of just the 65 filename and the directory 66 67 * mjtrain/MJTrainDisp.cc: 68 - use return value of MDataSet::AddFilesOn/Off for a sanity check 27 69 28 70 -
trunk/MagicSoft/Mars/mjobs/MDataSet.cc
r8221 r8244 87 87 #include "MRead.h" 88 88 #include "MJob.h" 89 #include "MEnv.h" 89 90 #include "MAstro.h" 90 91 #include "MDirIter.h" … … 155 156 // The entries are sorted by filename. 156 157 // 157 void MDataSet::ResolveSequences(TEnv &env, const TArrayI &num, TList &list, const TString &sequences, const TString &data) const 158 { 158 void MDataSet::ResolveSequences(TEnv &env, const TArrayI &num, TList &list) const 159 { 160 TString sequences = fPathSequences; 161 TString data = fPathDataFiles; 162 159 163 for (int i=0; i<num.GetSize(); i++) 160 164 { … … 168 172 dir = Form("%s%04d/%08d", data.Data(), num[i]/10000, num[i]); 169 173 170 gSystem->ExpandPathName(name); 171 gSystem->ExpandPathName(dir); 172 173 if (gSystem->AccessPathName(name, kFileExists)) 174 gLog << warn << "WARNING - Sequence file '" << name << "' doesn't exist." << endl; 175 176 if (gSystem->AccessPathName(dir, kFileExists)) 177 gLog << warn << "WARNING - Directory '" << dir << "' doesn't exist." << endl; 178 179 list.Add(new TNamed(name, dir)); 174 // FIXME: The sequence number from the sequence file is assigned!!! 175 MSequence *seq = new MSequence(name, dir); 176 177 if (seq->IsValid() && seq->GetSequence()!=(UInt_t)num[i]) 178 *fLog << warn << "WARNING - Sequence number " << num[i] << " in dataset file doesn't match sequence number " << seq->GetSequence() << " in sequence file!" << endl; 179 180 list.Add(seq); 180 181 } 181 182 … … 204 205 gLog << err << "ERROR - Dataset file " << expname << " not accessible!" << endl; 205 206 206 TEnv env(expname);207 MEnv env(expname); 207 208 delete [] expname; 208 209 … … 218 219 SetupDefaultPath(data, fgPathDataFiles); 219 220 220 ResolveSequences(env, fNumSequencesOn, fSequencesOn, sequences, data); 221 ResolveSequences(env, fNumSequencesOff, fSequencesOff, sequences, data); 221 fPathSequences = sequences; 222 fPathDataFiles = data; 223 224 ResolveSequences(env, fNumSequencesOn, fSequencesOn); 225 ResolveSequences(env, fNumSequencesOff, fSequencesOff); 222 226 223 227 fNameSource = env.GetValue("SourceName", ""); … … 228 232 fNameSource = fNameSource.Strip(TString::kBoth); 229 233 fCatalog = fCatalog.Strip(TString::kBoth); 234 235 if (env.GetNumUntouched()>0) 236 { 237 gLog << warn << "WARNING - At least one resource in the dataset-file has not been touched!" << endl; 238 env.PrintUntouched(); 239 } 230 240 } 231 241 … … 234 244 // Return '+' if both can be accessed, '-' otherwise. 235 245 // 236 void MDataSet::PrintFile(const TObject &obj)246 void MDataSet::PrintFile(const MSequence &seq) 237 247 { 238 248 const Char_t access = 239 !gSystem->AccessPathName( obj.GetName(), kFileExists) &&240 !gSystem->AccessPathName( obj.GetTitle(), kFileExists) ? '+' : '-';241 242 gLog << " " << access << " " << obj.GetName() << " <" << obj.GetTitle() << ">" << endl;249 !gSystem->AccessPathName(seq.GetFileName(), kFileExists) && 250 !gSystem->AccessPathName(seq.GetDataPath(), kFileExists) ? '+' : '-'; 251 252 gLog << "# " << access << " " << seq.GetFileName() << " <" << seq.GetDataPath() << ">" << endl; 243 253 } 244 254 … … 272 282 gLog << "Comment: " << fComment << endl; 273 283 284 if (fSequencesOn.GetEntries()>0) 285 gLog << endl; 286 287 TIter NextOn(&fSequencesOn); 288 TIter NextOff(&fSequencesOff); 289 MSequence *seq=0; 290 while ((seq=(MSequence*)NextOn())) 291 { 292 gLog << "Sequence" << Form("%08d", seq->GetSequence()) << ".File: " << seq->GetFileName() << endl; 293 gLog << "Sequence" << Form("%08d", seq->GetSequence()) << ".Dir: " << seq->GetDataPath() << endl; 294 } 295 if (fSequencesOff.GetEntries()>0) 296 gLog << endl; 297 while ((seq=(MSequence*)NextOff())) 298 { 299 gLog << "Sequence" << Form("%08d", seq->GetSequence()) << ".File: " << seq->GetFileName() << endl; 300 gLog << "Sequence" << Form("%08d", seq->GetSequence()) << ".Dir: " << seq->GetDataPath() << endl; 301 } 302 274 303 if (TString(o).Contains("files", TString::kIgnoreCase)) 275 304 { 276 TObject *obj=0;277 278 305 gLog << endl; 279 gLog << " On-Data Files:" << endl;280 TIter NextOn(&fSequencesOn);281 while (( obj=NextOn()))282 PrintFile(* obj);306 gLog << "# On-Data Files:" << endl; 307 NextOn.Reset(); 308 while ((seq=(MSequence*)NextOn())) 309 PrintFile(*seq); 283 310 284 311 gLog << endl; 285 gLog << " Off-Data Files:" << endl;286 TIter NextOff(&fSequencesOff);287 while (( obj=NextOff()))288 PrintFile(* obj);312 gLog << "# Off-Data Files:" << endl; 313 NextOff.Reset(); 314 while ((seq=(MSequence*)NextOff())) 315 PrintFile(*seq); 289 316 290 317 return; … … 300 327 { 301 328 TIter Next(const_cast<TList*>(&list)); 302 TObject *o=0; 303 304 while ((o=Next())) 305 { 306 MSequence seq(o->GetName()); 307 if (!seq.IsValid()) 329 330 MSequence *seq=0; 331 while ((seq=(MSequence*)Next())) 332 { 333 if (!seq->IsValid()) 308 334 { 309 gLog << warn;310 gLog << " WARNING- MDataSet::AddSequencesFromList: Sequence invalid!" << endl;311 gLog << " + File: " << o->GetName() << endl;312 gLog << " + Dir: " << o->GetTitle() << endl;335 gLog << err; 336 gLog << "ERROR - MDataSet::AddSequencesFromList: Sequence invalid!" << endl; 337 gLog << " + File: " << seq->GetFileName() << endl; 338 gLog << " + Dir: " << seq->GetDataPath() << endl; 313 339 return kFALSE; 314 340 } 315 341 316 const TString dir(o->GetTitle()); 317 if (seq.SetupDatRuns(files, MSequence::kImages, dir.IsNull() ? 0 : dir.Data())<=0) 342 if (seq->SetupDatRuns(files, MSequence::kImages)<=0) 318 343 return kFALSE; 319 344 } -
trunk/MagicSoft/Mars/mjobs/MDataSet.h
r7492 r8244 14 14 class MRead; 15 15 class MDirIter; 16 class MSequence; 16 17 class MPointingPos; 17 18 … … 24 25 25 26 UInt_t fNumAnalysis; // Analysis number (artificial) 27 28 TString fPathSequences; 29 TString fPathDataFiles; 26 30 27 31 TArrayI fNumSequencesOn; // number of on-sequences … … 39 43 40 44 void Split(TString &runs, TArrayI &data) const; 41 void ResolveSequences(TEnv &env, const TArrayI &num, TList &list , const TString &sequences, const TString &data) const;42 static void PrintFile(const TObject&obj);45 void ResolveSequences(TEnv &env, const TArrayI &num, TList &list/*, const TString &sequences, const TString &data*/) const; 46 static void PrintFile(const MSequence &obj); 43 47 44 48 void ReplaceDir(TList &list, const TString &old, const TString &news) const; -
trunk/MagicSoft/Mars/mjobs/MJCut.cc
r8222 r8244 62 62 #include "MWriteRootFile.h" 63 63 64 // Filter 65 //#include "MFDataMember.h" 66 64 67 // Fit signal environment 65 68 #include "../mhflux/MAlphaFitter.h" … … 270 273 // analysis number num, see GetOutputFile() 271 274 // 272 Bool_t MJCut::WriteResult(const MParList &plist, UInt_t num) const275 Bool_t MJCut::WriteResult(const MParList &plist, const MDataSet &set) const 273 276 { 274 277 TObjArray arr; … … 286 289 arr.Add((TObject*)(&halpha->GetAlphaFitter())); 287 290 291 // Save also the dataset 292 arr.Add(const_cast<MDataSet*>(&set)); 293 294 const Int_t num = set.GetNumAnalysis(); 288 295 const TString fname(fNameOutput.IsNull() ? Form("ganymed%08d.root", num) : fNameOutput.Data()); 289 296 … … 577 584 578 585 // Initialize default binnings 579 MBinning bins1(18, 0, 90, "BinningAlpha", "lin"); 580 MBinning bins2(15, 10, 1e6 , "BinningSize", "log"); 581 MBinning bins3(67, -0.005, 0.665, "BinningTheta", "asin"); 586 MBinning bins1( 18, 0, 90, "BinningAlpha", "lin"); 587 MBinning bins2( 15, 10, 1e6 , "BinningSize", "log"); 588 MBinning bins3( 67, -0.005, 0.665, "BinningTheta", "asin"); 589 //MBinning binsT(150, 0, 150, "BinningDeltaT", "lin"); 582 590 MBinning bins4("BinningFalseSource"); 583 591 MBinning bins5("BinningWidth"); … … 597 605 plist.AddToList(&bins9); 598 606 plist.AddToList(&bins0); 599 //plist.AddToList(&bins a);607 //plist.AddToList(&binsT); 600 608 601 609 // -------------------------------------------------------------------------------- … … 662 670 MFillH fill6a("MHImgParOffPost [MHImagePar]", "MImagePar", "FillImgParPost"); 663 671 MFillH fill7a("MHNewParOffPost [MHNewImagePar]", "MNewImagePar", "FillNewParPost"); 672 //MFillH fill9a("MHEffOffTime [MHEffectiveOnTime]", "MTime", "FillEffOnTime"); 664 673 fill1a.SetNameTab("PreCut"); 665 674 fill2a.SetNameTab("PostCut"); … … 669 678 fill6a.SetNameTab("ImgPar"); 670 679 fill7a.SetNameTab("NewPar"); 680 //fill9a.SetNameTab("EffOffT"); 681 682 //MFDataMember fbin("Bin.fVal", '>', 0); 683 //fill9a.SetFilter(&fbin); 671 684 672 685 MPrint print2("MEffectiveOnTime"); … … 722 735 } 723 736 if (!fWriteOnly) 737 { 724 738 tlist2.AddToList(&falpha); 739 /* if (!fIsMonteCarlo) 740 { 741 tlist2.AddToList(&fbin); 742 tlist2.AddToList(&fill9a); 743 } */ 744 } 725 745 tlist2.AddToList(&cont3); 726 746 if (write1) … … 810 830 MFillH fill6b("MHImgParOnPost [MHImagePar]", "MImagePar", "FillImgParPost"); 811 831 MFillH fill7b("MHNewParOnPost [MHNewImagePar]", "MNewImagePar", "FillNewParPost"); 832 //MFillH fill9b("MHEffOnTime [MHEffectiveOnTime]", "MTime", "FillEffOnTime"); 812 833 fill1b.SetNameTab("PreCut"); 813 834 fill2b.SetNameTab("PostCut"); … … 817 838 fill6b.SetNameTab("ImgPar"); 818 839 fill7b.SetNameTab("NewPar"); 840 //fill9b.SetNameTab("EffOnT"); 819 841 fill1b.SetDrawOption(set.HasOffSequences()||fIsWobble?"same":""); 820 842 fill2b.SetDrawOption(set.HasOffSequences()||fIsWobble?"same":""); … … 824 846 fill6b.SetDrawOption(set.HasOffSequences()||fIsWobble?"same":""); 825 847 fill7b.SetDrawOption(set.HasOffSequences()||fIsWobble?"same":""); 848 849 //fill9b.SetFilter(&fbin); 826 850 827 851 /* … … 891 915 } 892 916 tlist2.Replace(&falpha2); 917 //if (!fIsMonteCarlo) 918 // tlist2.Replace(&fill9b); 893 919 if (!fIsWobble || !fNameHist.IsNull()) 894 920 tlist2.Replace(&ffs2); … … 925 951 // FIXME: Perform fit and plot energy dependant alpha plots 926 952 // and fit result to new tabs! 927 if (!WriteResult(plist, set .GetNumAnalysis()))953 if (!WriteResult(plist, set)) 928 954 return kFALSE; 929 955 -
trunk/MagicSoft/Mars/mjobs/MJCut.h
r7753 r8244 42 42 void SetupWriter(MWriteRootFile *write, const char *name) const; 43 43 Bool_t WriteTasks(UInt_t num, TObjArray &cont) const; 44 Bool_t WriteResult(const MParList &plist, UInt_t num) const;44 Bool_t WriteResult(const MParList &plist, const MDataSet &set) const; 45 45 MHAlpha *CreateNewHist(MParList &plist, const char *name="") const; 46 46 MH *CreateNewHistFS(MParList &plist, const char *name="") const; -
trunk/MagicSoft/Mars/mjobs/MJStar.cc
r8220 r8244 136 136 fLog->Separator(GetDescriptor()); 137 137 *fLog << "Calculate image parameters of sequence "; 138 *fLog << fSequence.Get Name() << endl;138 *fLog << fSequence.GetFileName() << endl; 139 139 *fLog << endl; 140 140 -
trunk/MagicSoft/Mars/mjobs/MSequence.cc
r8224 r8244 130 130 #include "MLogManip.h" 131 131 132 #include "MEnv.h" 132 133 #include "MJob.h" 133 134 #include "MAstro.h" … … 202 203 { 203 204 TString d(path); 205 if (d.IsNull()) 206 d = fDataPath; 204 207 205 208 const Bool_t def = d.IsNull(); … … 207 210 // For this particular case we assume that the files are added one by 208 211 // one without wildcards. 209 const Int_t n0 212 const Int_t n0 = iter.GetNumEntries(); 210 213 211 214 // Setup path … … 291 294 } 292 295 296 // Check existance and accessibility of file 297 MDirIter file(d, n, 0); 298 TString name = file(); 299 gSystem->ExpandPathName(name); 300 if (gSystem->AccessPathName(name, kFileExists)) 301 { 302 *fLog << err; 303 *fLog << "ERROR - File " << d << n << " not accessible!" << endl; 304 return 0; 305 } 306 if (!file().IsNull()) 307 { 308 *fLog << err; 309 *fLog << "ERROR - Searching for file " << d << n << " gave more than one result!" << endl; 310 return 0; 311 } 312 293 313 // Add Path/File to TIter 294 314 iter.AddDirectory(d, n, 0); … … 358 378 MSequence::LightCondition_t MSequence::ReadLightCondition(TEnv &env) const 359 379 { 360 TString str = env.GetValue("LightCondition ", "n/a");380 TString str = env.GetValue("LightConditions", "n/a"); 361 381 if (!str.CompareTo("n/a", TString::kIgnoreCase)) 362 382 return kNA; 363 if (!str.CompareTo("No Moon", TString::kIgnoreCase))383 if (!str.CompareTo("No_Moon", TString::kIgnoreCase)) 364 384 return kNoMoon; 365 385 if (!str.CompareTo("Twilight", TString::kIgnoreCase)) … … 370 390 return kDay; 371 391 372 gLog << warn << "MSequence: LightCondition-tag not n/a, nomoon, twilight, moon or day." << endl; 392 gLog << warn; 393 gLog << "WARNING - in " << fFileName << ":" << endl; 394 gLog << " LightCondition-tag is '" << str << "' but must be n/a, no_moon, twilight, moon or day." << endl; 373 395 return kNA; 374 396 } … … 378 400 // Read the file fname as setup file for the sequence. 379 401 // 380 MSequence::MSequence(const char *fname )402 MSequence::MSequence(const char *fname, const char *path) 381 403 { 382 404 fName = fname; 383 384 const char *expname = gSystem->ExpandPathName(fname); 385 386 fTitle = Form("Sequence contained in file %s", expname); 387 388 const Bool_t access = !gSystem->AccessPathName(expname, kFileExists); 389 if (!access) 390 gLog << err << "ERROR - Dataset file " << expname << " not accessible!" << endl; 391 392 TEnv env(expname); 393 delete [] expname; 394 395 TString str; 396 397 fSequence = env.GetValue("Sequence", -1); 405 fTitle = path; 406 407 fFileName = fname; 408 fDataPath = path; 409 410 gSystem->ExpandPathName(fName); 411 gSystem->ExpandPathName(fTitle); 412 413 const Bool_t rc1 = gSystem->AccessPathName(fName, kFileExists); 414 const Bool_t rc2 = gSystem->AccessPathName(fTitle, kFileExists); 415 416 if (rc1) 417 gLog << err << "ERROR - Sequence file '" << fName << "' doesn't exist." << endl; 418 if (rc2) 419 gLog << err << "ERROR - Directory '" << fTitle << "' doesn't exist." << endl; 420 421 MEnv env(fName); 422 423 fSequence = env.GetValue("Sequence", -1); 424 if (rc1 || rc2) 425 fSequence = (UInt_t)-1; 426 398 427 fLastRun = env.GetValue("LastRun", -1); 399 428 fNumEvents = env.GetValue("NumEvents", -1); … … 402 431 fLightCondition = ReadLightCondition(env); 403 432 433 TString str; 404 434 str = env.GetValue("Start", ""); 405 435 fStart.SetSqlDateTime(str); … … 426 456 GetFileNames(env, fPedRuns); 427 457 GetFileNames(env, fDatRuns); 458 459 // Dummies: 460 env.GetValue("ZdMin", 0); 461 env.GetValue("ZdMax", 0); 462 env.GetValue("L1TriggerTable", 0); 463 env.GetValue("L2TriggerTable", 0); 464 465 if (env.GetNumUntouched()>0) 466 { 467 gLog << warn << "WARNING - At least one resource in the dataset-file has not been touched!" << endl; 468 env.PrintUntouched(); 469 } 428 470 } 429 471 … … 437 479 if (!IsValid()) 438 480 { 439 gLog << "Sequence: " << f Name << " <invalid>" << endl;481 gLog << "Sequence: " << fFileName << " <invalid>" << endl; 440 482 return; 441 483 } … … 475 517 gLog << " " << fDatRuns[i]; 476 518 gLog << endl; 519 520 if (!fDataPath.IsNull()) 521 gLog << endl << "DataPath: " << fDataPath << endl; 477 522 } 478 523 … … 480 525 // 481 526 // Add all ped runs from the sequence to MDirIter. 482 // If path==0 the standard path of the data-center is assumed. 527 // If path==0 fDataPath is used instead. If it is also empty 528 // the standard path of the data-center is assumed. 483 529 // If you have the runs locally use path="." 484 530 // Using raw=kTRUE you get correspodning raw-files setup. 485 531 // Return the number of files added. 532 // 486 533 UInt_t MSequence::SetupPedRuns(MDirIter &iter, const char *path, Bool_t raw) const 487 534 { … … 492 539 // 493 540 // Add all data runs from the sequence to MDirIter. 494 // If path==0 the standard path of the data-center is assumed. 541 // If path==0 fDataPath is used instead. If it is also empty 542 // the standard path of the data-center is assumed. 495 543 // If you have the runs locally use path="." 496 544 // Using raw=kTRUE you get correspodning raw-files setup. … … 505 553 // 506 554 // Add all runs from the sequence to MDirIter. 507 // If path==0 the standard path of the data-center is assumed. 555 // If path==0 fDataPath is used instead. If it is also empty 556 // the standard path of the data-center is assumed. 508 557 // If you have the runs locally use path="." 509 558 // Using raw=kTRUE you get correspodning raw-files setup. … … 518 567 // 519 568 // Add all calibration runs from the sequence to MDirIter. 520 // If path==0 the standard path of the data-center is assumed. 569 // If path==0 fDataPath is used instead. If it is also empty 570 // the standard path of the data-center is assumed. 521 571 // If you have the runs locally use path="." 522 572 // Using raw=kTRUE you get correspodning raw-files setup. … … 531 581 // 532 582 // Add all data runs from the sequence to MDirIter. 533 // If path==0 the standard path of the data-center is assumed. 583 // If path==0 fDataPath is used instead. If it is also empty 584 // the standard path of the data-center is assumed. 534 585 // If you have the runs locally use path="." 535 586 // Using raw=kTRUE you get correspodning raw-files setup. -
trunk/MagicSoft/Mars/mjoptim/MJOptimize.cc
r8223 r8244 236 236 //------------------------------------------------------------------------ 237 237 // 238 // Add seq eunces from list to reader238 // Add sequences from list to reader 239 239 // 240 240 Bool_t MJOptimize::AddSequences(MRead &read, TList &list) const … … 243 243 244 244 TIter Next(&list); 245 TObject *o=0; 246 while ((o=Next())) 247 { 248 MSequence seq(o->GetName()); 249 if (!seq.IsValid()) 245 MSequence *seq=0; 246 while ((seq=(MSequence*)Next())) 247 { 248 if (!seq->IsValid()) 250 249 return kFALSE; 251 if (seq .SetupDatRuns(files, o->GetTitle(), "I")<=0)250 if (seq->SetupDatRuns(files)<=0) 252 251 return kFALSE; 253 252 } … … 264 263 void MJOptimize::AddSequenceOn(const char *fname, const char *dir) 265 264 { 266 fNamesOn.Add(new TNamed(fname, dir));265 fNamesOn.Add(new MSequence(fname, dir)); 267 266 } 268 267 … … 275 274 void MJOptimize::AddSequenceOff(const char *fname, const char *dir) 276 275 { 277 fNamesOff.Add(new TNamed(fname, dir));276 fNamesOff.Add(new MSequence(fname, dir)); 278 277 } 279 278 -
trunk/MagicSoft/Mars/mjtrain/MJTrainDisp.cc
r7749 r8244 109 109 readtst.DisableAutoScheme(); 110 110 111 set.AddFilesOn(readtrn); 112 set.AddFilesOff(readtst); 111 if (!set.AddFilesOn(readtrn)) 112 return kFALSE; 113 if (!set.AddFilesOff(readtst)) 114 return kFALSE; 113 115 114 116 // ----------------------- Setup Matrix ------------------
Note:
See TracChangeset
for help on using the changeset viewer.