Changeset 7112 for trunk/MagicSoft/Mars/datacenter/macros
- Timestamp:
- 05/30/05 19:12:54 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/datacenter/macros
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/macros/buildsequenceentries.C
r7024 r7112 64 64 Bool_t DeleteSequences(MSQLServer &serv, TString cond) 65 65 { 66 TString query(Form("SELECT fSequenceFirst FROM MyMagic.Sequences"66 TString query(Form("SELECT fSequenceFirst FROM Sequences" 67 67 " WHERE %s AND fManuallyChangedKEY=1", cond.Data())); 68 68 … … 74 74 while ((row=res->Next())) 75 75 { 76 query = Form("DELETE FROM MyMagic.Calibration WHERE fSequenceFirst=%s", (*row)[0]);76 query = Form("DELETE FROM Calibration WHERE fSequenceFirst=%s", (*row)[0]); 77 77 78 78 TSQLResult *res = serv.Query(query); … … 81 81 delete res; 82 82 83 query = Form("DELETE FROM MyMagic.Star WHERE fSequenceFirst=%s", (*row)[0]);83 query = Form("DELETE FROM Star WHERE fSequenceFirst=%s", (*row)[0]); 84 84 85 85 TSQLResult *res = serv.Query(query); … … 88 88 delete res; 89 89 90 query = Form("DELETE FROM MyMagic.SequenceProcessStatus WHERE fSequenceFirst=%s", (*row)[0]);90 query = Form("DELETE FROM SequenceProcessStatus WHERE fSequenceFirst=%s", (*row)[0]); 91 91 92 92 res = serv.Query(query); … … 99 99 gSystem->Unlink(fname); 100 100 101 query = Form("UPDATE MyMagic.RunData SET fSequenceFirst=0 WHERE fSequenceFirst=%s", (*row)[0]);101 query = Form("UPDATE RunData SET fSequenceFirst=0 WHERE fSequenceFirst=%s", (*row)[0]); 102 102 103 103 res = serv.Query(query); … … 109 109 delete res; 110 110 111 query = Form("DELETE FROM MyMagic.Sequences WHERE %s AND fManuallyChangedKEY=1", cond.Data());111 query = Form("DELETE FROM Sequences WHERE %s AND fManuallyChangedKEY=1", cond.Data()); 112 112 res = serv.Query(query); 113 113 if (!res) … … 121 121 Int_t CheckOverlap(MSQLServer &serv, Int_t from, Int_t to) 122 122 { 123 TString query(Form("SELECT fSequenceFirst FROM MyMagic.Sequences WHERE"123 TString query(Form("SELECT fSequenceFirst FROM Sequences WHERE" 124 124 " (%d BETWEEN fSequenceFirst AND fSequenceLast) OR " 125 125 " (%d BETWEEN fSequenceFirst AND fSequenceLast)", from, to)); … … 173 173 " fProjectKEY, fHvSettingsKEY, fDiscriminatorThresholdTableKEY," 174 174 " fTriggerDelayTableKEY, fLightConditionsKEY, fTestFlagKEY" 175 " FROM MyMagic.RunData");175 " FROM RunData"); 176 176 query += Form(" WHERE fRunTypeKEY=%d AND fSourceKEY=%d AND fExcludedFDAKEY=1 AND (fRunNumber BETWEEN %d AND %d)" 177 177 " ORDER BY fRunNumber", type, src, from, to); … … 214 214 query += " MIN(fZenithDistance), MAX(fZenithDistance), "; 215 215 query += " MIN(fAzimuth), MAX(fAzimuth) "; 216 query += Form(" FROM MyMagic.RunData"216 query += Form(" FROM RunData" 217 217 " WHERE fRunTypeKEY=2 AND fSourceKEY=%d AND (fRunNumber BETWEEN %d AND %d) AND fExcludedFDAKEY=1", 218 218 src, from, to); … … 239 239 240 240 // ========== Request start time of sequence ========== 241 query = Form("SELECT fRunStart FROM MyMagic.RunData WHERE fRunNumber=%d AND fSourceKEY=%d AND fExcludedFDAKEY=1", from, src);241 query = Form("SELECT fRunStart FROM RunData WHERE fRunNumber=%d AND fSourceKEY=%d AND fExcludedFDAKEY=1", from, src); 242 242 243 243 res = serv.Query(query); … … 260 260 " fHvSettingsKEY, fDiscriminatorThresholdTableKEY," 261 261 " fTriggerDelayTableKEY, fLightConditionsKEY, fTestFlagKEY" 262 " FROM MyMagic.RunData"262 " FROM RunData" 263 263 " WHERE fRunTypeKEY=2 AND fSourceKEY=%d AND fExcludedFDAKEY=1 AND (fRunNumber BETWEEN %d AND %d)" 264 264 " LIMIT 1", src, from, to); … … 275 275 } 276 276 277 TString query1 = Form("INSERT MyMagic.Sequences SET"277 TString query1 = Form("INSERT Sequences SET" 278 278 " fSequenceFirst=%d," 279 279 " fSequenceLast=%d," … … 302 302 (*row)[7]); 303 303 304 TString query2 = Form("UPDATE MyMagic.RunData SET fSequenceFirst=%d WHERE"304 TString query2 = Form("UPDATE RunData SET fSequenceFirst=%d WHERE" 305 305 " (fRunNumber BETWEEN %d AND %d) AND" 306 306 " (fRunTypeKEY BETWEEN 2 AND 4) AND" … … 308 308 from, from, to, src, (*row)[3]); 309 309 310 TString query3 = Form("INSERT MyMagic.SequenceProcessStatus SET fSequenceFirst=%d ",310 TString query3 = Form("INSERT SequenceProcessStatus SET fSequenceFirst=%d ", 311 311 from); 312 312 delete res; … … 364 364 { 365 365 TString query(Form("SELECT fSourceKEY" 366 " FROM MyMagic.RunData"366 " FROM RunData" 367 367 " WHERE %s AND fExcludedFDAKEY=1 AND (fRunTypeKEY BETWEEN 2 AND 4) GROUP BY fSourceKEY", 368 368 cond.Data()) … … 392 392 393 393 TString query(Form("SELECT fRunNumber, fRunTypeKEY, fRunStart, fRunStop" 394 " FROM MyMagic.RunData"394 " FROM RunData" 395 395 " WHERE %s AND fSourceKEY=%d AND fExcludedFDAKEY=1 AND" 396 396 " (fRunTypeKEY BETWEEN 2 AND 4)" -
trunk/MagicSoft/Mars/datacenter/macros/checkfileavail.C
r6933 r7112 45 45 TString GetStatus(MSQLServer &serv, TEnv &rc, TString primary, TString table, TString column) 46 46 { 47 TString query(Form("SELECT %s FROM MyMagic.%s WHERE %s=%s",47 TString query(Form("SELECT %s FROM %s WHERE %s=%s", 48 48 column.Data(), table.Data(), 49 49 rc.GetValue(table+".Primary", ""), … … 90 90 91 91 cout << "sequ: " << sequenceno.Data() << endl; 92 TString query(Form("SELECT fRunNumber FROM MyMagic.RunData WHERE fSequenceFirst=%s",92 TString query(Form("SELECT fRunNumber FROM RunData WHERE fSequenceFirst=%s", 93 93 sequenceno.Data())); 94 94 -
trunk/MagicSoft/Mars/datacenter/macros/checkstardone.C
r7042 r7112 45 45 TString GetStatus(MSQLServer &serv, TEnv &rc, TString primary, TString table, TString column) 46 46 { 47 TString query(Form("SELECT %s FROM MyMagic.%s WHERE %s=%s",47 TString query(Form("SELECT %s FROM %s WHERE %s=%s", 48 48 column.Data(), table.Data(), 49 49 rc.GetValue(table+".Primary", ""), -
trunk/MagicSoft/Mars/datacenter/macros/doexclusions.C
r6933 r7112 45 45 int GetRunNumber(MSQLServer &serv, TString date, TString value) 46 46 { 47 TString query(Form("SELECT %s(fRunNumber) FROM MyMagic.RunData ", value.Data()));47 TString query(Form("SELECT %s(fRunNumber) FROM RunData ", value.Data())); 48 48 49 49 if (date!="NULL") … … 77 77 TString GetJoin(TString table) 78 78 { 79 TString query(Form("left join MyMagic.%s ON RunData.f%sKEY=%s.f%sKEY ",79 TString query(Form("left join %s ON RunData.f%sKEY=%s.f%sKEY ", 80 80 table.Data(), table.Data(), table.Data(), table.Data())); 81 81 return query; … … 114 114 TString runcond(Form("AND fRunNumber BETWEEN %d AND %d ", startrun, stoprun)); 115 115 116 TString query="SELECT fExcludedFDAKEY from MyMagic.ExcludedFDA where fExcludedFDAAutomatic='yes'";116 TString query="SELECT fExcludedFDAKEY from ExcludedFDA where fExcludedFDAAutomatic='yes'"; 117 117 TSQLResult *res = serv.Query(query); 118 118 if (!res) … … 131 131 TString border=rc.GetValue("key"+key+".SpecialRunCond", ""); 132 132 133 TString query(Form("SELECT fExcludedFDAImportance from MyMagic.ExcludedFDA where fExcludedFDAKEY=%s ", key.Data()));133 TString query(Form("SELECT fExcludedFDAImportance from ExcludedFDA where fExcludedFDAKEY=%s ", key.Data())); 134 134 TSQLResult *res = serv.Query(query); 135 135 if (!res) … … 150 150 if (!join2.IsNull()) 151 151 query+=Form(", f%sName", join2.Data()); 152 query +=" FROM MyMagic.RunData ";152 query +=" FROM RunData "; 153 153 query +=GetJoin("ExcludedFDA"); 154 154 if (!join1.IsNull()) … … 177 177 if (TString((*row2)[1]).IsNull() || atoi((*row2)[1])>newimp) 178 178 { 179 TString query(Form("UPDATE MyMagic.RunData SET fExcludedFDAKEY=%s WHERE fRunNumber=%s",179 TString query(Form("UPDATE RunData SET fExcludedFDAKEY=%s WHERE fRunNumber=%s", 180 180 key.Data(), (*row2)[0])); 181 181 cout << "QU: " << query << endl; -
trunk/MagicSoft/Mars/datacenter/macros/fillcalib.C
r7089 r7112 235 235 236 236 TString query; 237 if (!ExistStr(serv, "fSequenceFirst", " MyMagic.Calibration", seq))238 { 239 query = Form("INSERT MyMagic.Calibration SET"237 if (!ExistStr(serv, "fSequenceFirst", "Calibration", seq)) 238 { 239 query = Form("INSERT Calibration SET" 240 240 " fSequenceFirst=%d," 241 241 " fUnsuitableInner=%d, " … … 261 261 else 262 262 { 263 query = Form("UPDATE MyMagic.Calibration SET"263 query = Form("UPDATE Calibration SET" 264 264 " fUnsuitableInner=%d, " 265 265 " fUnsuitableOuter=%d, " -
trunk/MagicSoft/Mars/datacenter/macros/filldotrbk.C
r6933 r7112 105 105 { 106 106 107 if (ExistStr(serv, "fRunBookDate", " MyMagic.RunBook", date))107 if (ExistStr(serv, "fRunBookDate", "RunBook", date)) 108 108 return 0; 109 109 … … 116 116 entry.Remove(i--); 117 117 118 TString query("INSERT MyMagic.RunBook (fRunBookDate, fRunBookText) VALUES (\"");118 TString query("INSERT RunBook (fRunBookDate, fRunBookText) VALUES (\""); 119 119 query += date; 120 120 query += "\", \""; -
trunk/MagicSoft/Mars/datacenter/macros/filldotrun.C
r6970 r7112 107 107 TString query; 108 108 109 query = Form("SELECT f%sKEY FROM MyMagic.%s WHERE f%sName='%s'", col, col, col, name);109 query = Form("SELECT f%sKEY FROM %s WHERE f%sName='%s'", col, col, col, name); 110 110 TSQLResult *res = serv.Query(query); 111 111 if (!res) … … 124 124 return -1; 125 125 126 query = Form("INSERT MyMagic.%s (f%sName) VALUES (\"%s\");", col, col, name);126 query = Form("INSERT %s (f%sName) VALUES (\"%s\");", col, col, name); 127 127 128 128 if (dummy) … … 213 213 //cout << "RunNo: " << runnumber << " "; 214 214 215 if (ExistStr(serv, "fRunNumber", " MyMagic.RunData", strng.Data()))215 if (ExistStr(serv, "fRunNumber", "RunData", strng.Data())) 216 216 { 217 217 // FIXME: Maybe we can implement an switch to update mode? … … 528 528 //assemlbe the query that is needed to insert the values of this run 529 529 TString query; 530 query += "INSERT MyMagic.RunData SET ";530 query += "INSERT RunData SET "; 531 531 532 532 query += Form("fRunNumber=%d, ", runnumber); … … 573 573 574 574 //create entry in table RunProcessStatus for this runnumber 575 TString query2=Form("INSERT MyMagic.RunProcessStatus SET fRunNumber=%d, fTimingCorrection='1970-01-01 00:00:00'",575 TString query2=Form("INSERT RunProcessStatus SET fRunNumber=%d, fTimingCorrection='1970-01-01 00:00:00'", 576 576 runnumber); 577 577 res = serv.Query(query2); -
trunk/MagicSoft/Mars/datacenter/macros/fillsignal.C
r7084 r7112 128 128 cout << " Mean Ped RMS outer [phe] " << Form("%4.1f", meano) << endl; 129 129 130 TString query = Form("UPDATE MyMagic.Calibration SET fMeanPedRmsInner=%s, "130 TString query = Form("UPDATE Calibration SET fMeanPedRmsInner=%s, " 131 131 " fMeanPedRmsOuter=%s WHERE fSequenceFirst='%d' ", 132 132 meaninner.Data(), meanouter.Data(), seq); -
trunk/MagicSoft/Mars/datacenter/macros/fillstar.C
r7087 r7112 111 111 } 112 112 113 Float_t psf = (h1->Integral(5, 14) - 0.759)/0.027; 113 //spline 114 // Float_t psf = (h1->Integral(5, 14) - 0.818)/0.0276; 115 //df 116 Float_t psf = (h1->Integral(5, 14) - 0.736)/0.0276; 114 117 psf = TMath::Nint(psf*10)/10.; 115 118 TString PSF = Form("%5.1f", psf); … … 124 127 125 128 Float_t integral = h2->Integral(5, 14); 126 Float_t integralmc = -33.0*psf + 10517; 129 //spline 130 // Float_t integralmc = -36.06*psf + 11023; 131 //df 132 Float_t integralmc = -26.1*psf + 9750; 127 133 Float_t ratiodatamc = (integral/integralmc)*100; 128 134 TString ratio = Form("%5.1f", ratiodatamc); … … 171 177 172 178 TString query; 173 if (!ExistStr(serv, "fSequenceFirst", " MyMagic.Star", seq))174 { 175 query = Form("INSERT MyMagic.Star SET"179 if (!ExistStr(serv, "fSequenceFirst", "Star", seq)) 180 { 181 query = Form("INSERT Star SET" 176 182 " fSequenceFirst=%d," 177 183 " fMeanNumberIslands=%s, " … … 187 193 else 188 194 { 189 query = Form("UPDATE MyMagic.Star SET"195 query = Form("UPDATE Star SET" 190 196 " fMeanNumberIslands=%s, " 191 197 " fRatio=%s, " -
trunk/MagicSoft/Mars/datacenter/macros/findcacofiles.C
r6933 r7112 60 60 cout << endl; 61 61 62 TString query="SELECT fRunNumber FROM MyMagic.RunProcessStatus WHERE IsNull(fCaCoFileFound) ";62 TString query="SELECT fRunNumber FROM RunProcessStatus WHERE IsNull(fCaCoFileFound) "; 63 63 query+=" and fRunNumber > 10000 and not IsNull(fCCFileAvail)"; 64 64 -
trunk/MagicSoft/Mars/datacenter/macros/getdolist.C
r6933 r7112 81 81 } 82 82 83 TString query(Form("SELECT %s.%s FROM MyMagic.%s",83 TString query(Form("SELECT %s.%s FROM %s", 84 84 table.Data(), rc.GetValue(table+".Primary", ""), 85 85 table.Data())); 86 86 87 87 if (date!="NULL" && rc.GetValue(table+".TimerTable", "")!="") 88 query+=Form(" left join MyMagic.%s on %s.%s=%s.%s ",88 query+=Form(" left join %s on %s.%s=%s.%s ", 89 89 rc.GetValue(table+".TimerTable", ""), table.Data(), 90 90 rc.GetValue(table+".Primary", ""), -
trunk/MagicSoft/Mars/datacenter/macros/insertcacofile.C
r6933 r7112 61 61 62 62 Int_t newrunno=atoi(newrunnumber.Data()); 63 TString query(Form("UPDATE MyMagic.RunProcessStatus SET fCaCoFileAvail=Now(), fCaCoFileFound=%d WHERE fRunNumber=%s ",63 TString query(Form("UPDATE RunProcessStatus SET fCaCoFileAvail=Now(), fCaCoFileFound=%d WHERE fRunNumber=%s ", 64 64 newrunno, runnumber.Data())); 65 65 cout << "qu: " << query << endl; -
trunk/MagicSoft/Mars/datacenter/macros/insertdataset.C
r7037 r7112 63 63 TString query; 64 64 65 query = Form("SELECT f%sKEY FROM MyMagic.%s WHERE f%sName='%s'", col, col, col, name);65 query = Form("SELECT f%sKEY FROM %s WHERE f%sName='%s'", col, col, col, name); 66 66 TSQLResult *res = serv.Query(query); 67 67 if (!res) … … 80 80 return -1; 81 81 82 query = Form("INSERT MyMagic.%s (f%sName) VALUES (\"%s\");", col, col, name);82 query = Form("INSERT %s (f%sName) VALUES (\"%s\");", col, col, name); 83 83 84 84 if (dummy) … … 130 130 cout << "no:" << number << endl; 131 131 132 if (!ExistStr(serv, "fDataSetNumber", " MyMagic.DataSets", number.Data())) // Form("%d", number)132 if (!ExistStr(serv, "fDataSetNumber", "DataSets", number.Data())) // Form("%d", number) 133 133 { 134 TString query=Form("INSERT MyMagic.DataSets SET fDataSetNumber='%s', "134 TString query=Form("INSERT DataSets SET fDataSetNumber='%s', " 135 135 " fSourceKEY=%d, fWobble='%s' ", 136 136 number.Data(), sourcekey, wobble.Data()); … … 151 151 152 152 153 query=Form("INSERT MyMagic.DataSetProcessStatus SET fDataSetNumber='%s', "153 query=Form("INSERT DataSetProcessStatus SET fDataSetNumber='%s', " 154 154 " fDataSetInserted=Now() ", 155 155 number.Data()); -
trunk/MagicSoft/Mars/datacenter/macros/insertdate.C
r6933 r7112 79 79 cout << endl; 80 80 81 if (!ExistStr(serv, "fDate", " MyMagic.SequenceBuildStatus", date))81 if (!ExistStr(serv, "fDate", "SequenceBuildStatus", date)) 82 82 { 83 TString query(Form("INSERT MyMagic.SequenceBuildStatus SET fDate='%s', fCCFilled=Now() ",83 TString query(Form("INSERT SequenceBuildStatus SET fDate='%s', fCCFilled=Now() ", 84 84 date.Data())); 85 85 … … 96 96 cout << date << " already exists... do update. " << endl; 97 97 98 TString query="UPDATE MyMagic.SequenceBuildStatus SET fCCFilled=Now(), fExclusionsDone=NULL, ";98 TString query="UPDATE SequenceBuildStatus SET fCCFilled=Now(), fExclusionsDone=NULL, "; 99 99 query +=Form("fSequenceEntriesBuilt=NULL WHERE fDate='%s' ", date.Data()); 100 100 -
trunk/MagicSoft/Mars/datacenter/macros/plotdb.C
r7101 r7112 339 339 cout << endl; 340 340 341 serv.SelectDataBase("MyMagic");342 343 341 MStatusDisplay *d = new MStatusDisplay; 344 342 … … 366 364 cout << endl; 367 365 368 serv.SelectDataBase("MyMagic");369 370 366 MStatusDisplay *d = new MStatusDisplay; 371 367 -
trunk/MagicSoft/Mars/datacenter/macros/resetallruns.C
r6933 r7112 59 59 cout << endl; 60 60 61 TString query(Form("UPDATE MyMagic.RunProcessStatus SET %s=NULL",61 TString query(Form("UPDATE RunProcessStatus SET %s=NULL", 62 62 column.Data())); 63 63 if (column.Contains("CaCo")) … … 90 90 break; 91 91 92 TString query(Form("UPDATE MyMagic.RunProcessStatus SET %s=Now()", column.Data()));92 TString query(Form("UPDATE RunProcessStatus SET %s=Now()", column.Data())); 93 93 94 94 if (column.Contains("CaCo")) -
trunk/MagicSoft/Mars/datacenter/macros/resetcolumn.C
r7102 r7112 97 97 } 98 98 99 TString query(Form("Update MyMagic.%s SET %s=NULL ", table.Data(), column.Data()));99 TString query(Form("Update %s SET %s=NULL ", table.Data(), column.Data())); 100 100 101 101 TIter Next(&l); -
trunk/MagicSoft/Mars/datacenter/macros/setstatus.C
r6933 r7112 66 66 TString CheckDefault(MSQLServer &serv, TEnv &rc, TString primary, TString table, TString influence) 67 67 { 68 TString query(Form("SELECT %s FROM MyMagic.%s WHERE %s=%s",68 TString query(Form("SELECT %s FROM %s WHERE %s=%s", 69 69 influence.Data(), table.Data(), 70 70 rc.GetValue(table+".Primary", ""), primary.Data())); … … 99 99 TString influences = rc.GetValue(table+"."+column+".Influences", ""); 100 100 101 TString query(Form("UPDATE MyMagic.%s SET %s=%s",101 TString query(Form("UPDATE %s SET %s=%s", 102 102 table.Data(), column.Data(), value.Data())); 103 103 -
trunk/MagicSoft/Mars/datacenter/macros/writesequencefile.C
r6933 r7112 219 219 TString GetName(MSQLServer &serv, const char *col, const char *n) 220 220 { 221 TString query(Form("SELECT f%sName FROM MyMagic.%s WHERE f%sKEY=%s",221 TString query(Form("SELECT f%sName FROM %s WHERE f%sKEY=%s", 222 222 col, col, col, n)); 223 223 … … 283 283 284 284 TString query(Form("SELECT fRunNumber, fRunTypeKEY, fRunStart, fRunStop, fNumEvents" 285 " FROM MyMagic.RunData WHERE fSequenceFirst=%s AND fExcludedFDAKEY=1"285 " FROM RunData WHERE fSequenceFirst=%s AND fExcludedFDAKEY=1" 286 286 " ORDER BY fRunNumber", 287 287 data[0])); … … 328 328 " fL1TriggerTableKEY, fL2TriggerTableKEY, fHvSettingsKEY, " 329 329 " fLightConditionsKEY, fRunStart, fNumEvents" 330 " FROM MyMagic.Sequences WHERE fSequenceFirst=%d", sequno));330 " FROM Sequences WHERE fSequenceFirst=%d", sequno)); 331 331 TSQLResult *res = serv.Query(query); 332 332
Note:
See TracChangeset
for help on using the changeset viewer.