Changeset 8065
- Timestamp:
- 10/14/06 19:16:21 (18 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r8064 r8065 18 18 19 19 -*-*- END OF LINE -*-*- 20 21 2006/10/14 Thomas Bretz 22 23 * datacenter/macros/buildsequenceentries.C: 24 - fixed that in case of wobble sources always the project 25 and/or source name of the first run was assigned instead of 26 the new generaliyed wobble-source/-project name 27 28 * datacenter/scripts/dbchk: 29 - added some more checks 30 31 * datacenter/scripts/sourcefile: 32 - fixed the intgrep (didn't work with the colors in filldotraw) 33 34 * mastro/AstroIncl.h: 35 - added TArrayD 36 37 * mastro/MAstro.[h,cc]: 38 - added some functions around the sun and the moon 39 40 * mastro/MAstroCatalog.[h,cc]: 41 - check the epoch in Xephem catalog as numbe rnot as string 42 - added GetVisibilityCurve member function 43 - overwrote FindObject 44 - added MarkObject 45 46 * mastro/MObservatory.[h,cc]: 47 - added Tuorla observatory 48 - added member function to calculate sunrise and -set 49 50 * mbase/MTime.h: 51 - added a function to return Julian Date 52 53 * mhflux/MHCollectionArea.cc: 54 - some update in comments 55 56 * mhist/MHCamera.h: 57 - fixed a warning with root 5.13/04 58 59 * mmc/MMcRunHeader.cxx: 60 - initalize fImpactMax to -1 61 62 20 63 21 64 2006/10/13 Daniela Dorner -
trunk/MagicSoft/Mars/datacenter/macros/buildsequenceentries.C
r8010 r8065 259 259 TList fListRegexp; 260 260 261 /*262 TString GetKeyName(TString col, TString key)263 {264 col(TRegexp("^Elt")) = "";265 return QueryNameOfKey(col, key, kFALSE);266 }*/267 268 261 Int_t CheckTransition(TSQLResult &res, const TString *keys, TSQLRow &row, Int_t i) 269 262 { … … 330 323 delete res; 331 324 325 const TString elts = GetELTSource(where); 326 if (elts.IsNull()) 327 return kFALSE; 328 329 const TString eltp = GetELTProject(where); 330 if (eltp.IsNull()) 331 return kFALSE; 332 332 333 // ========== Request data of sequence ========== 333 query = Form("SELECT fSourceKEY, fProjectKEY, " 334 " fL1TriggerTableKEY, fL2TriggerTableKEY," 335 " fHvSettingsKEY, fDiscriminatorThresholdTableKEY," 336 " fTriggerDelayTableKEY, fObservationModeKEY " 337 " FROM RunData WHERE fRunTypeKEY=2 AND %s" 338 " LIMIT 1", where.Data()); 334 query = "SELECT "; 335 query += elts; 336 query += ", "; 337 query += eltp; 338 query += ", fL1TriggerTableKEY, fL2TriggerTableKEY," 339 " fHvSettingsKEY, fDiscriminatorThresholdTableKEY," 340 " fTriggerDelayTableKEY, fObservationModeKEY " 341 " FROM RunData WHERE fRunTypeKEY=2 AND "; 342 query += where; 343 query += " LIMIT 1"; 339 344 340 345 res = Query(query); … … 692 697 } 693 698 699 TString GetELTQuery(const char *col, const char *cond) const 700 { 701 return Form("SELECT RunData.f%sKEY, f%sName FROM RunData " 702 "LEFT JOIN %s ON RunData.f%sKEY=%s.f%sKEY " 703 "WHERE %s GROUP BY f%sName", 704 col, col, col, col, col, col, cond, col); 705 } 706 707 TString GetELTSource(const char *cond) 708 { 709 //query all sources observed in this night 710 TSQLResult *resx = Query(GetELTQuery("Source", cond)); 711 if (!resx) 712 return ""; 713 714 // In the case there is only a single source 715 // do not replace the source key by the ELT 716 if (resx->GetRowCount()==1) 717 return "fSourceKEY"; 718 719 TString elts = GetELT("Source", resx, "\\-?W[1-9][ abc]?$"); 720 delete resx; 721 722 return elts; 723 } 724 725 TString GetELTProject(const char *cond) 726 { 727 //query all project names observed in this night 728 TSQLResult *resx = Query(GetELTQuery("Project", cond)); 729 if (!resx) 730 return ""; 731 732 // In the case there is only a single project 733 // do not replace the project key by the ELT 734 if (resx->GetRowCount()==1) 735 return "fProjectKEY"; 736 737 TList regexp; 738 regexp.Add(new TObjString("\\-?W[1-9][abc]?$")); 739 regexp.Add(new TObjString("\\-W[0-9]\\.[0-9][0-9]\\+[0-9][0-9][0-9]$")); 740 741 TString eltp2 = GetELT("Project", resx, regexp); 742 delete resx; 743 regexp.Delete(); 744 745 return eltp2; 746 } 747 694 748 Bool_t HasAtLeastOne(TString src, TString chk) const 695 749 { … … 1042 1096 fMap.DeleteAll(); 1043 1097 } 1044 /* 1045 SequenceBuild(SequenceBuild &sb) : MSQLServer(sb) 1046 { 1047 fPathRawData = sb.fPathRawData; 1048 fPathSequences = sb.fPathSequences; 1049 }*/ 1098 1050 1099 void SetPathRawData(const char *path) { fPathRawData=path; } 1051 1100 void SetPathSequences(const char *path) { fPathSequences=path; } … … 1059 1108 const TString cond = 1060 1109 Form("(fRunStart>ADDDATE(\"%s\", INTERVAL -1 DAY) AND fRunStart<\"%s\") " 1061 "AND fExcludedFDAKEY=1 AND fRunTypeKEY BETWEEN 2 AND 4 " 1062 "ORDER BY fRunNumber", 1110 "AND fExcludedFDAKEY=1 AND fRunTypeKEY BETWEEN 2 AND 4 ", 1063 1111 day.Data(), day.Data()); 1064 1112 1065 1066 1067 1113 //query all sources observed in this night 1068 TString querys(Form("SELECT RunData.fSourceKEY, fSourceName FROM RunData " 1069 "LEFT JOIN Source ON RunData.fSourceKEY=Source.fSourceKEY " 1070 "WHERE %s", cond.Data())); 1071 TSQLResult *resx = Query(querys); 1072 if (!resx) 1073 return 2; 1074 TString elts = GetELT("Source", resx, "\\-?W[1-9][ abc]?$"); 1075 delete resx; 1114 const TString elts = GetELTSource(cond); 1115 if (elts.IsNull()) 1116 return 2; 1076 1117 1077 1118 //query all project names observed in this night 1078 TString queryp(Form("SELECT RunData.fProjectKEY, fProjectName FROM RunData " 1079 "LEFT JOIN Project ON RunData.fProjectKEY=Project.fProjectKEY " 1080 "WHERE %s", cond.Data())); 1081 resx = Query(queryp); 1082 if (!resx) 1083 return 2; 1084 1085 TList regexp; 1086 regexp.Add(new TObjString("\\-?W[1-9][abc]?$")); 1087 regexp.Add(new TObjString("\\-W[0-9]\\.[0-9][0-9]\\+[0-9][0-9][0-9]$")); 1088 TString eltp2 = GetELT("Project", resx, regexp); 1089 delete resx; 1090 regexp.Delete(); 1119 const TString eltp2 = GetELTProject(cond); 1120 if (elts.IsNull()) 1121 return 2; 1091 1122 1092 1123 // Setup query to get all values from the database, … … 1106 1137 query += mapkey->GetName(); 1107 1138 } 1108 query += Form(" FROM RunData WHERE %s ", cond.Data());1139 query += Form(" FROM RunData WHERE %s ORDER BY fRunNumber", cond.Data()); 1109 1140 1110 1141 TSQLResult *res = Query(query); -
trunk/MagicSoft/Mars/datacenter/scripts/dbchk
r8057 r8065 6 6 # directory where the sequence files are stored 7 7 sequencedir=/magic/sequences 8 callistodir=/magic/data/callisto 9 stardir=/magic/data/star 8 10 # access to the sql database 9 11 alias mymysql='mysql -s -u MAGIC -h hercules --password=d99swMT!' … … 17 19 # Cross check sequences in Sequence and other databases 18 20 # added switch which allows to correct for the problems immediatly 21 # unify the checks (especially 1b and 1c) 22 # for the sequences better use 0* instead of 0+ ? 19 23 20 24 21 25 # CHECK 1 22 echo Checking if all sequence s in Sequences have a corresponding sequence files26 echo Checking if all sequence files have a corresponding entry in Sequences 23 27 files=`find $sequencedir -type f` 24 28 for file in $files … … 27 31 if [ "$sequence" = "" ] 28 32 then 29 echo No sequence file: $ sequence33 echo No sequence file: $file 30 34 continue 31 35 fi … … 34 38 if ! [ "$sequence" = "$var" ] 35 39 then 36 echo Sequence-File $sequence exist but it is not in the db. 40 echo Sequence-File $sequence exist but it is not in Sequences. 41 continue 42 fi 43 done 44 45 # CHECK 1b (callisto) 46 echo Checking if all sequences in $callistodir have a corresponding sequence in Sequence 47 dirs=`find $callistodir -type d` 48 for dir in $dirs 49 do 50 sequence=`echo $file | sed -e "s/^.*\/0\+\([0-9]\+\)$/\1/"` 51 if [ "$sequence" = "" ] 52 then 53 echo Invalid directory: $dir 54 continue 55 fi 56 57 var=`echo SELECT fSequenceFirst FROM $db.Sequences WHERE fSequenceFirst=$sequence | mymysql` 58 if ! [ "$sequence" = "$var" ] 59 then 60 echo $dir exists but no corresponding sequence in Sequences. 61 continue 62 fi 63 done 64 65 # CHECK 1c (star) 66 echo Checking if all sequences in $stardir have a corresponding sequence in Sequence 67 dirs=`find $stardir -type d` 68 for dir in $dirs 69 do 70 sequence=`echo $file | sed -e "s/^.*\/0\+\([0-9]\+\)$/\1/"` 71 if [ "$sequence" = "" ] 72 then 73 echo Invalid directory: $dir 74 continue 75 fi 76 77 var=`echo SELECT fSequenceFirst FROM $db.Sequences WHERE fSequenceFirst=$sequence | mymysql` 78 if ! [ "$sequence" = "$var" ] 79 then 80 echo $dir exists but no corresponding sequence in Sequences. 37 81 continue 38 82 fi … … 40 84 41 85 # CHECK 2 42 echo Checking if all sequence files have a corresponding entry in Sequences86 echo Checking if all sequences in Sequences have a corresponding sequence files 43 87 sequences=`echo SELECT fSequenceFirst FROM $db.Sequences | mymysql` 44 88 for sequence in $sequences 45 89 do 46 var=`find $sequencedir - regex .*/sequence0+${sequence}\.txt$`90 var=`find $sequencedir -type f -regex .*/sequence0+${sequence}\.txt$` 47 91 if [ "$var" = "" ] 48 92 then -
trunk/MagicSoft/Mars/datacenter/scripts/sourcefile
r7994 r8065 114 114 115 115 116 # alias 117 alias 'intgrep'='grep -E ^\\\(int\\\)[0-9]+$ | sed -e s\/\(int\)\/\/' 116 # alias (we cannot check the beginning of the line due to 117 # color codes in filldotraw.C) 118 alias 'intgrep'='grep -E -o \\\(int\\\)[0-9]+$' 118 119 119 120 # in the following the functions, which are needed by several scripts, are
Note:
See TracChangeset
for help on using the changeset viewer.