- Timestamp:
- 07/17/08 16:08:04 (16 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r9005 r9006 71 71 - added telescope number to rules 72 72 73 * datacenter/macros/buildsequenceentries.C: 74 - the building is now based on the file-id (run*1000+file) 75 and it is only done for a single telescope 76 - added telescope number as srgument 77 - added fPriority to SequenceProcessStatus 78 - added fTelescopeNumber to the Sequence table 79 - the sequence number is still idetical to the first run-number 80 - changed reading of resource file such that the telescope 81 number can be given for each subsection 82 83 * datacenter/macros/doexclusions.C: 84 - many simplifications 85 - use telescope number as argument 86 - simplified and improved 73 87 74 88 -
trunk/MagicSoft/Mars/datacenter/macros/buildsequenceentries.C
r8968 r9006 159 159 UInt_t fMax; 160 160 161 static UInt_t GetId(const TString &str) 162 { 163 const Ssiz_t dot = str.First('.'); 164 165 const UInt_t run = str.Atoi(); 166 const UInt_t sub = dot<0 ? 0 : atoi(str.Data()+dot+1); 167 168 return run*1000+sub; 169 } 170 161 171 void Init(const TObjArray &arr, Int_t idx=0) 162 172 { … … 179 189 case 2: fRegexp1 = TPRegexp(Form("^%s$", str.Data())); break; 180 190 case 3: fRegexp2 = TPRegexp(Form("^%s$", str.Data())); break; 181 case 4: fMin = str.Atoi(); break;182 case 5: fMax = str.Atoi(); break;191 case 4: fMin = GetId(str); break; 192 case 5: fMax = GetId(str); break; 183 193 } 184 194 } 185 //cout << endl;186 195 } 187 196 … … 257 266 TString fPathSequences; 258 267 268 Int_t fTelescopeNumber; 269 259 270 TMap fMap; 260 271 TList fListRegexp; … … 286 297 const TString runtime = 287 298 "SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))), "; 288 //"SUM(if(TIME_TO_SEC(fRunStop)-TIME_TO_SEC(fRunStart)<0," 289 //" TIME_TO_SEC(fRunStop)-TIME_TO_SEC(fRunStart)+24*60*60," 290 //" TIME_TO_SEC(fRunStop)-TIME_TO_SEC(fRunStart))), "; 291 292 const TString where = Form("(fRunNumber BETWEEN %d AND %d) AND fExcludedFDAKEY=1", 293 from, to); 299 300 const TString where = Form("(fRunNumber*1000+fFileNumber BETWEEN %d AND %d) " 301 "AND fTelescopeNumber=%d AND fExcludedFDAKEY=1", 302 from, to, fTelescopeNumber); 294 303 295 304 TString query; … … 359 368 } 360 369 361 const TString set = Form("fSequenceFirst=%d ", from);370 const TString set = Form("fSequenceFirst=%d, fTelescopeNumber=%d ", from/1000, fTelescopeNumber); 362 371 363 372 TString query1; 364 373 query1 += set; 365 query1 += Form(",fSequenceLast=%d,", to );374 query1 += Form(",fSequenceLast=%d,", to/1000); 366 375 query1 += Form(" fSourceKEY=%s,", (*row)[0]); 367 376 query1 += Form(" fProjectKEY=%s,", (*row)[1]); … … 400 409 } 401 410 402 if (!Insert("SequenceProcessStatus", set)) 411 TString prio = set; 412 prio += Form(", fPriority=%d ", from/1000); 413 if (!Insert("SequenceProcessStatus", prio)) 403 414 { 404 415 cout << "ERROR - Could not insert Sequence into SequenceProcessStatus." << endl; … … 458 469 Int_t CheckSequence(Int_t runstart, Int_t runstop) 459 470 { 460 const char *fmt1 = "SELECT fRunNumber FROM RunData WHERE";461 const char *fmt2 = "AND fExcludedFDAKEY=1 AND (fRunTypeKEY BETWEEN 2 AND 4) ORDER BY fRunNumber";462 463 const TString query1 = Form("%s f SequenceFirst=%d %s", fmt1, runstart, fmt2);464 const TString query2 = Form("%s f RunNumber BETWEEN %d AND %d %s", fmt1, runstart, runstop, fmt2);471 const char *fmt1 = "SELECT fRunNumber*1000+fFileNumber AS Id FROM RunData WHERE"; 472 const char *fmt2 = "AND fExcludedFDAKEY=1 AND (fRunTypeKEY BETWEEN 2 AND 4) ORDER BY Id"; 473 474 const TString query1 = Form("%s fTelescopeNumber=%d AND fSequenceFirst=%d %s", fmt1, fTelescopeNumber, runstart/1000, fTelescopeNumber, fmt2); 475 const TString query2 = Form("%s fTelescopeNumber=%d AND fRunNumber*1000+fFileNumber BETWEEN %d AND %d %s", fmt1, fTelescopeNumber, runstart, runstop, fmt2); 465 476 466 477 TSQLResult *res1 = Query(query1); … … 499 510 TString query= 500 511 Form("SELECT fSequenceFirst FROM RunData " 501 " WHERE fRunNumber BETWEEN %d AND %d AND "502 " f SequenceFirst>0 AND "512 " WHERE fRunNumber*1000+fFileNumber BETWEEN %d AND %d AND " 513 " fTelescopeNumber=%d AND fSequenceFirst>0 AND " 503 514 " fExcludedFDAKEY=1 AND (fRunTypeKEY BETWEEN 2 AND 4)" 504 " GROUP BY fSequenceFirst", runstart, runstop);515 " GROUP BY fSequenceFirst", fTelescopeNumber, runstart, runstop); 505 516 506 517 TSQLResult *res = Query(query); … … 554 565 Bool_t ReadResources(const char *fname) 555 566 { 556 TPRegexp regexp("^\\[.*\\]$"); 567 // Check for the section header 568 TPRegexp regexp("^\\[(Transition|Regexp):?[0-9 ]*\\]$"); 569 // Check if section header contains a number 570 TPRegexp regnum("[0-9]"); 571 // Check if section header contains the telescope number 572 TPRegexp regtel(Form("[^0-9]0*%d[^0-9]", fTelescopeNumber)); 557 573 558 574 ifstream fin(fname); … … 579 595 continue; 580 596 581 if (txt[0]=='[' && section!=2)597 if (txt[0]=='['/* && section!=2*/) 582 598 { 583 //cout << txt << endl; 584 section = 0; 585 if (txt(regexp)=="[Transition]") 586 section = 1; 587 if (txt(regexp)=="[Regexp]") 588 section = 2; 589 continue; 599 TString sec = txt(regexp); 600 if (!sec.IsNull()) 601 { 602 section = 0; 603 604 // Skip sections with the wrong telescope number 605 if (!sec(regnum).IsNull() && !sec(regtel).IsNull()) 606 continue; 607 608 // Check which section we are in 609 if (sec.BeginsWith("[Transition")) 610 section = 1; 611 if (sec.BeginsWith("[Regexp]")) 612 section = 2; 613 continue; 614 } 615 616 if (section!=2) 617 { 618 cout << "WARNING - Line starts with [ but we are not in the Regexp section." << endl; 619 cout << txt << endl; 620 continue; 621 } 590 622 } 623 591 624 592 625 TObjArray *arr = txt.Tokenize(" "); … … 705 738 { 706 739 return Form("SELECT RunData.f%sKEY, f%sName FROM RunData " 707 "LEFT JOIN %s ON RunData.f%sKEY=%s.f%sKEY " 708 "WHERE %s GROUP BY f%sName", 709 col, col, col, col, col, col, cond, col); 740 "LEFT JOIN %s USING (f%sKEY) WHERE %s GROUP BY f%sName", 741 col, col, col, col, cond, col); 710 742 } 711 743 … … 864 896 // Request data necessary to split block into sequences 865 897 const TString query= 866 Form("SELECT fRunNumber , fRunTypeKEY, fRunStart, fRunStop"898 Form("SELECT fRunNumber*1000+fFileNumber AS Id, fRunTypeKEY, fRunStart, fRunStop" 867 899 " FROM RunData " 868 " WHERE fRunNumber BETWEEN %d AND %d AND "900 " WHERE fRunNumber*1000+fFileNumber BETWEEN %d AND %d AND " 869 901 " fExcludedFDAKEY=1 AND (fRunTypeKEY BETWEEN 2 AND 4)" 870 " ORDER BY fRunNumber", runstart, runstop);902 " ORDER BY Id", runstart, runstop); 871 903 872 904 // Send query … … 1084 1116 1085 1117 public: 1086 SequenceBuild(TEnv &env) : MSQLMagic(env) 1087 { 1088 cout << "buildsequences" << endl; 1089 cout << "--------------" << endl; 1090 cout << endl; 1091 cout << "Connected to " << GetName() << endl; 1092 1118 SequenceBuild(Int_t tel=1, const char *rc="sql.rc") : MSQLMagic(rc), fTelescopeNumber(tel) 1119 { 1093 1120 fListRegexp.SetOwner(); 1094 1121 … … 1097 1124 return; 1098 1125 } 1099 SequenceBuild() 1126 1127 SequenceBuild(TEnv &env, Int_t tel=1) : MSQLMagic(env), fTelescopeNumber(tel) 1128 { 1129 fListRegexp.SetOwner(); 1130 1131 // FIXME: THIS IS NOT YET HANDLED 1132 if (ReadResources("resources/sequences.rc")) 1133 return; 1134 } 1135 ~SequenceBuild() 1100 1136 { 1101 1137 fMap.DeleteAll(); … … 1113 1149 const TString cond = 1114 1150 Form("(fRunStart>ADDDATE(\"%s\", INTERVAL -1 DAY) AND fRunStart<\"%s\") " 1115 "AND fExcludedFDAKEY=1 AND fRunTypeKEY BETWEEN 2 AND 4 ", 1116 day.Data(), day.Data()); 1151 "AND fExcludedFDAKEY=1 AND fRunTypeKEY BETWEEN 2 AND 4 " 1152 "AND fTelescopeNumber=%d ", 1153 day.Data(), day.Data(), fTelescopeNumber); 1117 1154 1118 1155 //query all sources observed in this night … … 1128 1165 // Setup query to get all values from the database, 1129 1166 // that are relevant for building sequences 1130 TString query("SELECT fRunNumber , fRunTypeKEY, ");1167 TString query("SELECT fRunNumber*1000+fFileNumber AS Id, fRunTypeKEY, "); 1131 1168 query += elts; 1132 1169 query += ", "; … … 1142 1179 query += mapkey->GetName(); 1143 1180 } 1144 query += Form(" FROM RunData WHERE %s ORDER BY fRunNumber", cond.Data());1181 query += Form(" FROM RunData WHERE %s ORDER BY Id", cond.Data()); 1145 1182 1146 1183 TSQLResult *res = Query(query); … … 1176 1213 ClassImp(SequenceBuild); 1177 1214 1178 int buildsequenceentries(TString day, TString datapath, TString sequpath, Bool_t dummy=kTRUE)1215 int buildsequenceentries(TString day, TString datapath, TString sequpath, Int_t tel=1, Bool_t dummy=kTRUE) 1179 1216 { 1180 TEnv env("sql.rc"); 1181 1182 SequenceBuild serv(env); 1217 SequenceBuild serv(tel, "sql.rc"); 1183 1218 if (!serv.IsConnected()) 1184 1219 { … … 1186 1221 return 0; 1187 1222 } 1223 1224 cout << "buildsequenceentries" << endl; 1225 cout << "--------------------" << endl; 1226 cout << endl; 1227 cout << "Connected to " << serv.GetName() << endl; 1228 if (!datapath.IsNull()) 1229 cout << "DataPath: " << datapath << endl; 1230 if (!sequpath.IsNull()) 1231 cout << "SeqPath: " << sequpath << endl; 1232 cout << "Day: " << day << endl; 1233 cout << "Telescope: " << tel << endl; 1234 cout << endl; 1188 1235 1189 1236 serv.SetIsDummy(dummy); … … 1196 1243 // Build Sequences for all Nights 1197 1244 // 1198 int buildsequenceentries(TString datapath, TString sequpath, Bool_t dummy=kTRUE)1245 int buildsequenceentries(TString datapath, TString sequpath, Int_t tel=1, Bool_t dummy=kTRUE) 1199 1246 { 1200 TEnv env("sql.rc"); 1201 1202 SequenceBuild serv(env); 1247 SequenceBuild serv(tel, "sql.rc"); 1203 1248 if (!serv.IsConnected()) 1204 1249 { … … 1206 1251 return 0; 1207 1252 } 1253 1254 cout << "buildsequenceentries" << endl; 1255 cout << "--------------------" << endl; 1256 cout << endl; 1257 cout << "Connected to " << serv.GetName() << endl; 1258 cout << "DataPath: " << datapath << endl; 1259 cout << "SeqPath: " << sequpath << endl; 1260 cout << "Telescope: " << tel << endl; 1261 cout << endl; 1208 1262 1209 1263 serv.SetIsDummy(dummy); … … 1213 1267 } 1214 1268 1215 int buildsequenceentries( Bool_t dummy=kTRUE)1269 int buildsequenceentries(Int_t tel=1, Bool_t dummy=kTRUE) 1216 1270 { 1217 return buildsequenceentries("", "", dummy);1271 return buildsequenceentries("", "", tel, dummy); 1218 1272 } 1219 1273 1220 int buildsequenceentries(TString day, Bool_t dummy=kTRUE)1274 int buildsequenceentries(TString day, Int_t tel=1, Bool_t dummy=kTRUE) 1221 1275 { 1222 return buildsequenceentries(day, "", "", dummy);1276 return buildsequenceentries(day, "", "", tel, dummy); 1223 1277 } -
trunk/MagicSoft/Mars/datacenter/macros/doexclusions.C
r7777 r9006 59 59 #include <iostream> 60 60 #include <iomanip> 61 #include <fstream> 62 63 #include <MSQLServer.h> 61 62 #include <TEnv.h> 63 #include <TSystem.h> 64 64 65 #include <TSQLRow.h> 65 66 #include <TSQLResult.h> 66 67 67 #include <TEnv.h> 68 #include <TSystem.h> 68 #include "MSQLMagic.h" 69 69 70 70 using namespace std; 71 71 72 72 //get minimum or maximum runnumber of the runs of a night 73 int GetRunNumber(MSQLServer &serv, TString date, TString value)73 int GetRunNumber(MSQLServer &serv, Int_t tel, TString date, TString cmd) 74 74 { 75 TString query(Form("SELECT %s(fRunNumber) FROM RunData ", value.Data())); 75 TString query; 76 query = Form("SELECT %s(fRunNumber) FROM RunData ", cmd.Data()); 77 query += Form("WHERE fTelescopeNumber=%d", tel); 76 78 77 79 if (date!="NULL") 78 80 { 79 81 TString day=date+" 13:00:00"; 80 query+=Form(" WHERE (fRunStart>ADDDATE(\"%s\", INTERVAL -1 DAY) AND fRunStart<\"%s\")", 81 day.Data(), day.Data()); 82 } 83 84 cout << "query: " << query << endl; 82 query += Form(" AND (fRunStart>ADDDATE(\"%s\", INTERVAL -1 DAY) AND fRunStart<\"%s\")", 83 day.Data(), day.Data()); 84 } 85 85 86 86 TSQLResult *res = serv.Query(query); 87 87 if (!res) 88 88 { 89 cout << "E rror - could not get run#" << endl;89 cout << "ERROR - Could not get " << cmd << " fRunNumber." << endl; 90 90 return -1; 91 91 } 92 92 93 93 TSQLRow *row =res->Next(); 94 cout << (void*)row << endl;95 94 if (TString((*row)[0]).IsNull()) 96 95 { 97 cout << "No run available for this date"<< endl;96 cout << "No run available for " << date << endl; 98 97 delete res; 99 98 return 0; 100 99 } 101 100 delete res; 101 102 102 return atoi((*row)[0]); 103 103 } 104 104 105 //get part of a query (left join of tables) 106 TString GetJoin(TString table) 105 int doexclusions(Int_t startrun, Int_t stoprun, Int_t tel=1, TString date="NULL", Bool_t dummy=kTRUE) 107 106 { 108 TString query(Form("left join %s ON RunData.f%sKEY=%s.f%sKEY ", 109 table.Data(), table.Data(), table.Data(), table.Data())); 110 return query; 111 } 112 113 int doexclusions(Int_t startrun, Int_t stoprun, TString date="NULL") 114 { 115 TEnv env("sql.rc"); 116 TEnv rc("automatic-exclusions.rc"); 117 118 MSQLServer serv(env); 107 MSQLMagic serv("sql.rc"); 119 108 if (!serv.IsConnected()) 120 109 { … … 123 112 } 124 113 114 // Open rc files with exclusions 115 TEnv rc("resources/exclusions.rc"); 116 117 // Some information for the user 125 118 cout << "doexclusions" << endl; 126 119 cout << "------------" << endl; 127 120 cout << endl; 128 121 cout << "Connected to " << serv.GetName() << endl; 129 130 //if neither start- nor stoprun is given, the minimum and maximum runnumber 131 // is queried from the database to do the exclusions for all runs 132 // if a night is given for all runs of this night 122 cout << "Date: " << date << endl; 123 124 serv.SetIsDummy(dummy); 125 126 // if neither start- nor stoprun is given, the minimum and maximum 127 // runnumber is queried from the database to do the exclusions for 128 // all runs if a night is given for all runs of this night 133 129 if (startrun==0 && stoprun==0) 134 130 { 135 startrun=GetRunNumber(serv, date, "min"); 136 stoprun=GetRunNumber(serv, date, "max"); 137 } 131 startrun = GetRunNumber(serv, tel, date, "MIN"); 132 stoprun = GetRunNumber(serv, tel, date, "MAX"); 133 } 134 135 cout << "Start Run: " << startrun << endl; 136 cout << "Stop Run: " << stoprun << endl; 137 138 138 //check format of start- and stoprun 139 139 if (startrun<0 || stoprun<0) 140 140 { 141 cout << " wrong format of runno" << endl;141 cout << "ERROR - Startrun<0 or stoprun<0." << endl; 142 142 return 2; 143 143 } 144 144 145 //if no run for date is available, GetRunNumber() returns 0 145 146 if (startrun==0 || stoprun==0) 146 147 return 1; 147 148 148 //get the condition for the runnumber range 149 TString runcond(Form("AND fRunNumber BETWEEN %d AND %d ", startrun, stoprun)); 150 151 //get exclusions-reasons (stored in the table ExcludedFDA) from the database 152 //the exclusions which can be done automatically are marked with the flag fExcludedFDAAutomatic='yes' 153 //and with an importance (one run may be excluded for several reasons, 154 //the reason is chosen according to the importance) 155 TString query="SELECT fExcludedFDAKEY from ExcludedFDA where fExcludedFDAAutomatic='yes'"; 156 TSQLResult *res = serv.Query(query); 149 // Get exclusions-reasons (stored in the table ExcludedFDA) from the DB 150 TSQLResult *res = serv.Query("SELECT fExcludedFDAKEY, fExcludedFDAName " 151 "FROM ExcludedFDA " 152 "ORDER BY fExcludedFDAImportance ASC"); 157 153 if (!res) 158 {159 cout << "Error - could not do any automatic excludes." << endl;160 154 return 2; 161 }162 155 163 156 //update the exclusion-reasons for all runs … … 165 158 while ((row = res->Next())) 166 159 { 167 //read in values from the resource file automatic-exclusions (explanation see above) 168 TString key=(*row)[0]; 169 TString column=rc.GetValue("key"+key+".Column", ""); 170 TString join1=rc.GetValue("key"+key+".Join1", ""); 171 TString join2=rc.GetValue("key"+key+".Join2", ""); 172 TString border=rc.GetValue("key"+key+".SpecialRunCond", ""); 173 174 //get importance of exclusion-reason from database 175 TString query(Form("SELECT fExcludedFDAImportance from ExcludedFDA where fExcludedFDAKEY=%s ", key.Data())); 176 TSQLResult *res2 = serv.Query(query); 160 // check the key (NULL means "No exclusion") 161 const TString key = (*row)[0]; 162 if (key.IsNull()) 163 continue; 164 165 // Get the corresponding condition from the file 166 const TString cond = rc.GetValue("key"+key, ""); 167 if (cond.IsNull()) 168 continue; 169 170 // Get all files to be excluded 171 TString query2 = "SELECT fRunNumber, fFileNumber FROM RunData "; 172 query2 += serv.GetJoins("RunData", query2+cond); 173 174 query2 += Form("WHERE (%s) ", cond.Data()); 175 query2 += Form("AND fRunNumber BETWEEN %d AND %d ", startrun, stoprun); 176 query2 += Form("AND fTelescopeNumber=%d", tel); 177 178 TSQLResult *res2 = serv.Query(query2); 177 179 if (!res2) 178 {179 cout << "Error - could not get importance." << endl;180 180 return 2; 181 } 182 183 TSQLRow *row2=res2->Next(); 184 Int_t newimp=atoi((*row2)[0]); 185 delete res2; 186 187 //get current importance from database 188 //for the runs which match the exclusion-reason 189 query="SELECT fRunNumber, fExcludedFDAImportance "; 190 if (!column.IsNull()) 191 query+=Form(", %s", column.Data()); 192 if (!join1.IsNull()) 193 query+=Form(", f%sName", join1.Data()); 194 if (!join2.IsNull()) 195 query+=Form(", f%sName", join2.Data()); 196 query +=" FROM RunData "; 197 query +=GetJoin("ExcludedFDA"); 198 if (!join1.IsNull()) 199 query+=GetJoin(join1.Data()); 200 if (!join2.IsNull()) 201 query+=GetJoin(join2.Data()); 202 query +=Form("WHERE (%s) ", rc.GetValue("key"+key+".Cond", "")); 203 if (!border.IsNull()) 204 query+=Form(" AND fRunNumber BETWEEN IF(%s>%d, %d, %s) AND IF (%s<%d, %s, %d) ", 205 border.Data(), startrun, startrun, border.Data(), 206 border.Data(), stoprun, border.Data(), stoprun); 207 else 208 query +=runcond; 209 210 cout << query << endl; 211 212 res2 = serv.Query(query); 213 if (!res2) 214 { 215 cout << "Error - no runs to exclude" << endl; 216 return 2; 217 } 218 219 //compare new and old importance 220 //change or keep the exclusion-reason accordingly 181 182 // Update exlcusion for file 183 TSQLRow *row2=0; 221 184 while ((row2 = res2->Next())) 222 185 { 223 if (TString((*row2)[1]).IsNull() || atoi((*row2)[1])>newimp) 224 { 225 //change exclusion-reason 226 TString query(Form("UPDATE RunData SET fExcludedFDAKEY=%s WHERE fRunNumber=%s", 227 key.Data(), (*row2)[0])); 228 cout << "QU: " << query << endl; 229 TSQLResult *res3 = serv.Query(query); 230 if (!res3) 231 { 232 cout << "Error - could not insert exclusion" << endl; 233 return 2; 234 } 235 delete res3; 236 continue; 237 } 238 //keep exclusion-reason 239 cout << "run#: " << (*row2)[0] << " reason for exclusion is still the same" << endl; 186 TString vars(Form("fExcludedFDAKEY=%s", key.Data())); 187 TString where(Form("fRunNumber=%s AND fFileNumber=%s", (*row2)[0], (*row2)[1])); 188 189 if (serv.Update("RunData", vars, where)==kFALSE) 190 return 2; 191 192 cout << "File M" << tel << ":" << (*row2)[0] << "/" << setw(3) << setfill('0') << (*row2)[1] << " excluded due to: " << (*row)[1] << "." << endl; 240 193 } 194 241 195 delete res2; 242 196 } 243 197 delete res; 198 244 199 return 1; 245 200 } 246 201 247 202 //run doexclusions for one night 248 int doexclusions(TString date="NULL" )203 int doexclusions(TString date="NULL", Int_t tel=1, Bool_t dummy=kTRUE) 249 204 { 250 return doexclusions(0, 0, date);205 return doexclusions(0, 0, tel, date, dummy); 251 206 } -
trunk/MagicSoft/Mars/datacenter/macros/filldotrun.C
r8996 r9006 133 133 } 134 134 135 cout << " V" << version << " " << flush; 135 if (version >= 200805190) 136 { 137 strng.ReadLine(fin); 138 if (!strng.BeginsWith("Telescope M")) 139 { 140 cout << "WARNING - Line 3 doesn't start with 'Telescope M'." << endl; 141 cout << strng << endl; 142 } 143 } 144 145 if (version >= 200411130) 146 { 147 strng.ReadLine(fin); 148 if (strng[0]!='#') 149 { 150 cout << "WARNING - '#' expected." << endl; 151 cout << strng << endl; 152 } 153 } 154 155 cout << " * V" << version << " " << endl; 136 156 137 157 Int_t cnt=0; … … 146 166 if (strng[0]!='M') 147 167 { 148 cout << " First character is not an M." << endl;168 cout << "WARNING - First character is not an M." << endl; 149 169 cout << strng << endl; 150 170 strng.ReadLine(fin); … … 153 173 if (strng[1]!='1') 154 174 { 155 cout << " Only MAGIC 1 implemented so far." << endl;175 cout << "WARNING - Only MAGIC 1 implemented so far." << endl; 156 176 cout << strng << endl; 157 177 strng.ReadLine(fin); … … 176 196 { 177 197 strng.ReadLine(fin); 178 cout << "Runnumber == 0" << endl; 198 cout << "WARNING - Runnumber == 0" << endl; 199 cout << strng << endl; 179 200 continue; 180 201 } … … 187 208 } 188 209 189 TString where = Form("((fTelescopeNumber=%d AND fFileNumber=%d) OR" 190 "(ISNULL(fTelescopeNumber) AND ISNULL(fFileNumber)))", 210 TString where = Form("fTelescopeNumber=%d AND fFileNumber=%d", 191 211 telnumber, filenumber); 192 if (serv.ExistStr("fRunNumber", "RunData", strng, where))212 if (serv.ExistStr("fRunNumber", "RunData", Form("%d", runnumber), where)) 193 213 { 194 214 // FIXME: Maybe we can implement a switch to update mode? 195 cout << " Entry M" << telnumber << ":" << runnumber << "/" << filenumber << " already existing... skipped." << endl;215 cout << "WARNING - Entry M" << telnumber << ":" << runnumber << "/" << filenumber << " already existing... skipped." << endl; 196 216 strng.ReadLine(fin); 197 217 continue; … … 569 589 return -1; 570 590 571 TString query2=Form("fRunNumber=%d, fTimingCorrection='1970-01-01 00:00:00', fCompmux='1970-01-01 00:00:00'", 572 runnumber); 591 TString query2=Form("fTelescopeNumber=%d, fRunNumber=%d, fFileNumber=%d, " 592 "fPriority=%d, fTimingCorrection='1970-01-01 00:00:00', fCompmux='1970-01-01 00:00:00'", 593 telnumber, runnumber, filenumber, runnumber); 573 594 if (testflagkey==3) 574 595 query2+=" , fDataCheckDone='1970-01-01 00:00:00'"; … … 580 601 581 602 return cnt; 582 583 603 } 584 604 585 605 // This tool will work from Period017 (2004_05_17) on... 586 int filldotrun(const TString path="/ data/MAGIC/Period018/ccdata", Bool_t dummy=kTRUE)606 int filldotrun(const TString path="/home/lapalma/transfer/ccdata", Bool_t dummy=kTRUE) 587 607 { 588 608 MSQLMagic serv("sql.rc"); … … 592 612 return 0; 593 613 } 614 594 615 cout << "filldotrun" << endl; 595 616 cout << "----------" << endl; … … 617 638 break; 618 639 619 cout << name(TRegexp("CC_.*.run", kFALSE)) << flush;640 cout << " * " << name(TRegexp("CC_.*.run", kFALSE)) << endl; 620 641 Int_t n = insert(serv, dummy, name); 621 cout << " <" << n << "> " << (dummy?"DUMMY":"") << endl;642 cout << " <" << n << "> " << (dummy?"DUMMY":"") << endl; 622 643 623 644 if (n<0)
Note:
See TracChangeset
for help on using the changeset viewer.