Changeset 9015 for trunk/MagicSoft/Mars/mjobs/MSequence.cc
- Timestamp:
- 07/19/08 12:55:42 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mjobs/MSequence.cc
r9012 r9015 47 47 // Sequence: 31015 48 48 // 49 // # Observation Period (not needed )50 // Period: 1849 // # Observation Period (not needed, calculated from Night) 50 // # Period: 18 51 51 // 52 52 // # Date of sunrise of the observation night - necessary if the path … … 74 74 // # Total number of data-events in sequence (not needed) 75 75 // NumEvents: 250914 76 // 77 // # Brightest light condition of the contained runs (not needed) 78 // LightCondition: Twilight 76 79 // 77 80 // # Whether this is MC data or not (necessary in case of MCs if … … 661 664 fLastRun = GetEnvValue2(env, prefix, "LastRun", -1); 662 665 fNumEvents = GetEnvValue2(env, prefix, "NumEvents", -1); 663 fPeriod = GetEnvValue2(env, prefix, "Period", -1);664 666 665 667 TString str; 666 str = GetEnvValue2(env, prefix, "LightCondition s", "n/a");668 str = GetEnvValue2(env, prefix, "LightCondition", "n/a"); 667 669 fLightCondition = GetLightCondition(str); 668 670 … … 673 675 str += " 00:00:00"; 674 676 fNight.SetSqlDateTime(str); 677 678 fPeriod = fNight.GetMagicPeriod(); 675 679 676 680 fProject = GetEnvValue2(env, prefix, "Project", ""); … … 688 692 689 693 // Dummies: 694 env.Touch("Period"); 690 695 env.Touch("ZdMin"); 691 696 env.Touch("ZdMax"); … … 700 705 } 701 706 707 // -------------------------------------------------------------------------- 708 // 709 // Create a sequence from the database, e.g. 710 // 711 // TString mysql = "mysql://MAGIC:password@vela/MyMagic"; 712 // Int_t sequence = 100002; 713 // Int_t telescope = 1; 714 // 715 // MSequence seq(mysql, sequence, telescope); 716 // 717 // For more details see MSequenceSQL. 718 // 702 719 MSequence::MSequence(const char *fname, UInt_t seq, UShort_t tel) 703 720 { … … 705 722 } 706 723 724 // -------------------------------------------------------------------------- 725 // 726 // Some helper functions for the comparison functions 727 // 707 728 static int operator==(const TArrayI &a, const TArrayI &b) 708 729 { 709 return a.GetSize()==b.GetSize() ? 710 memcmp(a.GetArray(), b.GetArray(), a.GetSize()*sizeof(Int_t))==0 : 711 false; 712 } 713 714 static int IsNull(const TArrayI &a) 715 { 716 if (a.GetSize()==0) 717 return true; 718 719 return a.GetSize()==0 ? true : a==TArrayI(a.GetSize()); 730 return a.GetSize()==b.GetSize() && 731 memcmp(a.GetArray(), b.GetArray(), a.GetSize()*sizeof(Int_t)); 720 732 } 721 733 722 734 static int IsNull(const TArrayI &a, const TArrayI &b) 723 735 { 724 return IsNull(a) && IsNull(b); 725 } 726 727 Bool_t MSequence::IsSimilar(const MSequence &s) const 736 return a==TArrayI(a.GetSize()) && b==TArrayI(b.GetSize()); 737 } 738 739 static int Check(const TArrayI &a, const TArrayI &b) 740 { 741 return a==b || IsNull(a, b); 742 } 743 744 // -------------------------------------------------------------------------- 745 // 746 // Here we test all things mandatory for a sequence: 747 // fTelescope 748 // fSequence 749 // fNight 750 // fMonteCarlo 751 // fCalRuns 752 // fCalRunsSub 753 // fPedRuns 754 // fPedRunsSub 755 // fDatRuns 756 // fDatRunsSub 757 // fExclRuns 758 // fExclRunsSub 759 // 760 Bool_t MSequence::IsCompatible(const MSequence &s) const 728 761 { 729 762 return // Mandatory 730 fTelescope==s.fTelescope && fSequence==s.fSequence && 731 fNight==s.fNight 732 && fLightCondition==s.fLightCondition && 733 734 fMonteCarlo==s.fMonteCarlo && 735 736 (fRunsSub ==s.fRunsSub || IsNull(fRunsSub, s.fRunsSub)) && 737 (fCalRunsSub ==s.fCalRunsSub || IsNull(fCalRunsSub, s.fCalRunsSub)) && 738 (fPedRunsSub ==s.fPedRunsSub || IsNull(fPedRunsSub, s.fPedRunsSub)) && 739 (fDatRunsSub ==s.fDatRunsSub || IsNull(fDatRunsSub, s.fDatRunsSub)) && 740 (fExclRunsSub==s.fExclRunsSub || IsNull(fExclRunsSub, s.fExclRunsSub)) 741 ; 742 } 743 763 fTelescope == s.fTelescope && 764 fSequence == s.fSequence && 765 fNight == s.fNight && 766 767 fMonteCarlo == s.fMonteCarlo && 768 769 fCalRuns == s.fCalRuns && 770 fPedRuns == s.fPedRuns && 771 fDatRuns == s.fDatRuns && 772 fExclRuns == s.fExclRuns && 773 774 Check(fCalRunsSub, s.fCalRunsSub) && 775 Check(fPedRunsSub, s.fPedRunsSub) && 776 Check(fDatRunsSub, s.fDatRunsSub) && 777 Check(fExclRunsSub, s.fExclRunsSub); 778 } 779 780 // -------------------------------------------------------------------------- 781 // 782 // Here we test whether all values of a sequence are identical 783 // IsCompaticle(s) 784 // fStart 785 // fLastRun 786 // fNumEvents 787 // fPeriod 788 // fProject 789 // fSource 790 // fRuns 791 // fHvSettings 792 // fTriggerTable 793 // fLightCondition 794 // fRuns 795 // fRunsSub 796 // 797 Bool_t MSequence::operator==(const MSequence &s) const 798 { 799 return IsCompatible(s) && 800 // Unnecessary 801 fStart == s.fStart && 802 fLastRun == s.fLastRun && 803 fNumEvents == s.fNumEvents && 804 fPeriod == s.fPeriod && 805 fProject == s.fProject && 806 fSource == s.fSource && 807 fRuns == s.fRuns && 808 fHvSettings == s.fHvSettings && 809 fTriggerTable == s.fTriggerTable && 810 fLightCondition == s.fLightCondition && 811 Check(fRunsSub, s.fRunsSub); 812 } 813 814 // -------------------------------------------------------------------------- 815 // 816 // Check whether the sequence has also identical source, i.e. 817 // the sequence filepath and the datapath in addition to operator== 818 // 744 819 Bool_t MSequence::IsIdentical(const MSequence &s) const 745 820 { 746 return IsSimilar(s) && 747 // Unnecessary 748 fStart==s.fStart && fLastRun==s.fLastRun && 749 fNumEvents==s.fNumEvents && fPeriod==s.fPeriod && 750 fProject==s.fProject && fSource==s.fSource && 751 /*fTriggerTable==s.fTriggerTable &&*/ fHvSettings==s.fHvSettings; 752 } 753 754 Bool_t MSequence::operator==(const MSequence &s) const 755 { 756 return IsIdentical(s) && 821 return *this==s && 757 822 // Obsolete 758 823 fDataPath==s.fDataPath && fFileName==s.fFileName; … … 981 1046 out << pre << "Night: " << fNight.GetStringFmt("%Y-%m-%d") << endl; 982 1047 out << endl; 983 out << pre << "LightCondition s: ";1048 out << pre << "LightCondition: "; 984 1049 switch (fLightCondition) 985 1050 { … … 1018 1083 else 1019 1084 { 1085 // FIXME: This needs more check! 1086 // Could we make "Runs" an automatic summary of all runs? 1087 // Should we add a check forbidding the same run in 1088 // Cal/Ped/Data? What about the Exclude? 1020 1089 str += PrintRuns(out, pre, "Runs: ", fRuns, fRunsSub); 1021 1090 /*str +=*/ PrintRuns(out, pre, "CalRuns: ", fCalRuns, fCalRunsSub); … … 1196 1265 f = &fCalRunsSub; 1197 1266 break; 1267 case 'X': 1268 r = &fExclRuns; 1269 f = &fExclRunsSub; 1270 break; 1198 1271 default: 1199 1272 r = &fRuns; … … 1204 1277 AddEntry(run, file, *r, *f); 1205 1278 1206 MJob::SortArray(fExclRuns); 1207 } 1208 1209 // -------------------------------------------------------------------------- 1210 // 1211 // Exclude this run (i.e. add it to fExclRuns) 1212 // 1213 void MSequence::ExcludeFile(UInt_t run, UInt_t file/*, Bool_t force*/) 1214 { 1215 // if (force && IsExcluded(run, file)) 1216 // return; 1217 1218 AddEntry(run, file, fExclRuns, fExclRunsSub); 1219 1220 MJob::SortArray(fExclRuns); 1279 SortArrays(*r, *f); 1221 1280 } 1222 1281 … … 1268 1327 fNight.SetSqlDateTime(night); 1269 1328 1270 fPeriod = MAstro::GetMagicPeriod(fNight.GetMjd());1329 fPeriod = fNight.GetMagicPeriod(); 1271 1330 } 1272 1331
Note:
See TracChangeset
for help on using the changeset viewer.