Changeset 7232 for trunk/MagicSoft/Mars/datacenter/macros
- Timestamp:
- 07/29/05 23:13:12 (19 years ago)
- Location:
- trunk/MagicSoft/Mars/datacenter/macros
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/macros/buildsequenceentries.C
r7215 r7232 31 31 // to group the runs of one night into sequences, this marco: 32 32 // - reads the runinformation of one night from the database 33 // - sorts the runs by source34 // - groups the runs to sequences such that each run belongs33 // - group the runs into sets of following runs with the same conditions 34 // - groups the runs in this sets to sequences such that each run belongs 35 35 // to the nearest (in time) calibration run 36 // 37 // apart from that the runs in one sequence must have the same 38 // hv-settings, trigger tables, light conditions, DT tables, 39 // trigger delay tables and testflag 36 // - check if the runs with the same runtype have the same calibration script 37 // and the same trigger tables 40 38 // 41 39 ///////////////////////////////////////////////////////////////////////////// … … 62 60 int debug = 0; 63 61 64 Bool_t DeleteSequence(MSQLServer &serv, Int_t sequ, Bool_t dummy)62 Bool_t DeleteSequence(MSQLServer &serv, TString datapath, TString sequpath, Int_t sequ, Bool_t dummy) 65 63 { 66 64 TString query1(Form("DELETE FROM Calibration WHERE fSequenceFirst=%d", sequ)); … … 70 68 TString query5(Form("DELETE FROM Sequences WHERE fSequenceFirst=%d AND fManuallyChangedKEY=1", sequ)); 71 69 72 TString fname(Form(" /mnt/stk01/sequences/%04d/sequence%08d.txt",sequ/10000, sequ));73 TString command(Form("rm -r /magic/data/callisto/%04d/%08d/", sequ/10000, sequ));74 TString command2(Form("rm -r /magic/data/star/%04d/%08d/", sequ/10000, sequ));70 TString fname(Form("%s/%04d/sequence%08d.txt", sequpath.Data(),sequ/10000, sequ)); 71 TString command(Form("rm -r %s/callisto/%04d/%08d/", datapath.Data(), sequ/10000, sequ)); 72 TString command2(Form("rm -r %s/star/%04d/%08d/", datapath.Data(), sequ/10000, sequ)); 75 73 76 74 if (dummy) … … 177 175 } 178 176 179 Bool_t CheckSequence(MSQLServer &serv, Int_t from, Int_t to, Bool_t dummy)177 Bool_t CheckSequence(MSQLServer &serv, TString datapath, TString sequpath, Int_t from, Int_t to, Bool_t dummy) 180 178 { 181 179 Bool_t rc=kFALSE; … … 213 211 { 214 212 cout << "deleting sequence " << sequences.At(i) << "... <" << i << ">" << endl; 215 if(!DeleteSequence(serv, sequences.At(i), dummy))213 if(!DeleteSequence(serv, datapath, sequpath, sequences.At(i), dummy)) 216 214 rc=kFALSE; 217 215 } … … 267 265 { 268 266 cout << "different sequsizes -> deleting sequence " << sequences.At(0) << endl; 269 return DeleteSequence(serv, sequences.At(0), dummy);267 return DeleteSequence(serv, datapath, sequpath, sequences.At(0), dummy); 270 268 } 271 269 … … 275 273 continue; 276 274 cout << "different runs -> deleting sequence " << sequences.At(0) << endl; 277 return DeleteSequence(serv, sequences.At(0), dummy);275 return DeleteSequence(serv, datapath, sequpath, sequences.At(0), dummy); 278 276 } 279 277 … … 405 403 } 406 404 407 Bool_t NewSequence(MSQLServer &serv, Int_t from, Int_t to, Bool_t dummy)405 Bool_t NewSequence(MSQLServer &serv, TString datapath, TString sequpath, Int_t from, Int_t to, Bool_t dummy) 408 406 { 409 407 cout << "Found Sequence (" << from << ", " << to << ") ... checking runs..." << flush; … … 429 427 cout << "checking Sequence..." << endl; 430 428 431 if (!CheckSequence(serv, from, to, dummy))429 if (!CheckSequence(serv, datapath, sequpath, from, to, dummy)) 432 430 { 433 431 cout << " inserting sequence not necessary" << endl; … … 446 444 } 447 445 448 Bool_t Process(MSQLServer &serv, Int_t from, Int_t to, Bool_t dummy)446 Bool_t Process(MSQLServer &serv, TString datapath, TString sequpath, Int_t from, Int_t to, Bool_t dummy) 449 447 { 450 448 … … 589 587 if (n!=-1) 590 588 { 591 if (!NewSequence(serv, start, last, dummy))589 if (!NewSequence(serv, datapath, sequpath, start, last, dummy)) 592 590 { 593 591 rc = kFALSE; … … 605 603 if (n!=-1 && start!=last) 606 604 { 607 if (!NewSequence(serv, start, last, dummy))605 if (!NewSequence(serv, datapath, sequpath, start, last, dummy)) 608 606 rc = kFALSE; 609 607 } … … 617 615 618 616 619 int buildsequenceentries(TString day, Bool_t dummy=kTRUE)617 int buildsequenceentries(TString day, TString datapath, TString sequpath, Bool_t dummy=kTRUE) 620 618 { 621 619 TEnv env("sql.rc"); … … 704 702 cout << endl << "datablock from " << runstart2 << " to " << runstop2 << endl; 705 703 706 if (!Process(serv, runstart2, runstop2, dummy))704 if (!Process(serv, datapath, sequpath, runstart2, runstop2, dummy)) 707 705 rc = kFALSE; 708 706 … … 712 710 713 711 714 int buildsequenceentries( )712 int buildsequenceentries(TString datapath, TString sequpath, Bool_t dummy=kTRUE) 715 713 { 716 714 TEnv env("sql.rc"); … … 733 731 { 734 732 cout << "date: " << (*row)[0] << endl; 735 buildsequenceentries((*row)[0] );733 buildsequenceentries((*row)[0], dummy); 736 734 } 737 735 -
trunk/MagicSoft/Mars/datacenter/macros/createdataset.C
r7167 r7232 27 27 // createdataset.C 28 28 // =============== 29 // 30 // this script is not run automatically 31 // the purpose of this script is to make it easier for people to write 32 // datasetfiles 33 // 34 // be careful with the path in this macro, if you use it for test-reasons! 29 35 // 30 36 ///////////////////////////////////////////////////////////////////////////// -
trunk/MagicSoft/Mars/datacenter/macros/findcacofiles.C
r7182 r7232 44 44 45 45 46 int findcacofiles(TString date )46 int findcacofiles(TString date, TString logpath) 47 47 { 48 48 TEnv env("sql.rc"); … … 72 72 } 73 73 74 Int_t idx = date.First('-'); 75 TString year = date(0, idx); 76 cout << "year: " << year << endl; 77 78 ofstream fout("/magic/datacenter/autologs/filesondisk/"+year+"/findcacofiles-"+date+".txt"); 74 TString filename(Form("%s/findcacofiles-%s.txt", logpath.Data(), date.Data())); 75 ofstream fout(filename, ios::app); 79 76 if (!fout) 80 77 { 81 cout << "ERROR - Cannot open file ."<< endl;82 return kFALSE;78 cout << "ERROR - Cannot open file " << filename << endl; 79 return 0; 83 80 } 84 TString runnumber=0; 81 85 82 TSQLRow *row=0; 86 83 while ((row = res->Next())) -
trunk/MagicSoft/Mars/datacenter/macros/getdolist.C
r7182 r7232 45 45 46 46 47 int getdolist(TString table, TString column, TString date )47 int getdolist(TString table, TString column, TString date, TString listpath) 48 48 { 49 49 TEnv env("sql.rc"); … … 118 118 return 0; 119 119 120 ofstream fout("/magic/datacenter/lists/ToDo-"+table+"-"+column+".txt", ios::app); 121 // ofstream fout("/data/MAGIC/datacenter/"+table+"-"+column+".txt", ios::app); 120 TString filename(Form("%s/ToDo%s-%s.txt", listpath.Data(), table.Data(), column.Data())); 121 ofstream fout(filename, ios::app); 122 if (!fout) 123 { 124 cout << "ERROR - Cannot open file " << filename << endl; 125 return 0; 126 } 122 127 123 128 TSQLRow *row=0; -
trunk/MagicSoft/Mars/datacenter/macros/resetcolumn.C
r7112 r7232 33 33 // for this step in the DB has to be reset. This can be done with this macro. 34 34 // 35 // As arguments you have to give the column, the table and thefrom which35 // As arguments you have to give the column, the table and from which 36 36 // to which Date/Sequence/Run you want to reset the value. 37 37 // -
trunk/MagicSoft/Mars/datacenter/macros/writesequencefile.C
r7168 r7232 233 233 } 234 234 235 Bool_t GetSequence(MSQLServer &serv, TSQLRow &data )235 Bool_t GetSequence(MSQLServer &serv, TSQLRow &data, TString sequpath) 236 236 { 237 237 UShort_t y; … … 257 257 return kFALSE; 258 258 259 TString fname(Form(" /mnt/stk01/sequences/%04d/sequence%08d.txt", atoi(data[0])/10000, atoi(data[0])));259 TString fname(Form("%s/sequences/%04d/sequence%08d.txt", sequpath.Data(), atoi(data[0])/10000, atoi(data[0]))); 260 260 cout << "Creating " << fname << "..." << flush; 261 261 … … 308 308 309 309 // This tool will work from Period017 (2004_05_17) on... 310 int writesequencefile(Int_t sequno )310 int writesequencefile(Int_t sequno, TString sequpath) 311 311 { 312 312 TEnv env("sql.rc"); … … 333 333 TSQLRow *row = 0; 334 334 while ((row = res->Next())) 335 if (!GetSequence(serv, *row ))335 if (!GetSequence(serv, *row, sequpath)) 336 336 return 0; 337 337
Note:
See TracChangeset
for help on using the changeset viewer.