Changeset 7459
- Timestamp:
- 01/10/06 13:44:29 (19 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r7458 r7459 18 18 19 19 -*-*- END OF LINE -*-*- 20 21 2006/01/10 Daniela Dorner 22 23 * datacenter/macros/buildsequenceentries.C, checkfileavail.C, 24 checkstardone.C, doexclusions.C, fillcalib.C, filldotraw.C, 25 filldotrbk.C, filldotrun.C, fillganymed.C, fillsignal.C, 26 fillsinope.C, fillstar.C, findcacofiles.C, getdolist.C, 27 insertcacofile.C, insertdataset.C, insertdate.C, 28 insertsequence.C, resetallruns.C, resetcolumn.C, setstatus.C, 29 setupdb.C, writesequencefile.C: 30 - updated and added documentation 31 32 33 20 34 2005/12/21 Thomas Bretz 21 35 … … 28 42 * mbase/MTime.[h,cc]: 29 43 - added algorithm to calculate week 30 44 31 45 32 46 -
trunk/MagicSoft/Mars/datacenter/macros/buildsequenceentries.C
r7395 r7459 30 30 // 31 31 // to group the runs of one night into sequences, this marco: 32 // - reads the runinformation of one night from the database 33 // - 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 // to the nearest (in time) calibration run 36 // - check if the runs with the same runtype have the same calibration script 37 // and the same trigger tables 32 // - reads the runinformation of one night from the database 33 // - 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 // to the nearest (in time) calibration run 36 // - check if the runs with the same runtype have the same calibration script 37 // and the same trigger tables 38 // if sequence is okay: 39 // - check if in the range of the runnumbers of this sequence other sequences 40 // exist in the database 41 // if there are no sequences, insert the new sequence, else: 42 // - delete overlaping sequences 43 // if there's only one sequence in the same runnumber range: 44 // - check if the new and the old sequence are identical 45 // if they are identical, do nothing, if not, delete the old sequence and 46 // insert the new one 47 // 48 // remark: deleting sequences includes the following steps: 49 // - delete entries from the tables Sequences, SequenceProcessStatus, 50 // Calibration and Star 51 // - updating the sequence number (fSequenceFirst) in the table RunData 52 // - remove the Sequence File, the calibrated data and the image files from 53 // the disk 54 // 55 // the macro can be executed either for all nights or for one single night 56 // .x buildsequenceentries.C+( "datapath", "sequpath", Bool_t dummy=kTRUE) 57 // .x buildsequenceentries.C+( "night", "datapath", "sequpath") 58 // 59 // the Bool_t dummy: 60 // kTRUE: dummy-mode, i.e. nothing is inserted into the database, but the 61 // commands, that would be executed are returned 62 // kFALSE: the information is inserted into the database and the files of 63 // removed sequences is deleted 64 // be careful with this option - for tests use always kTRUE 65 // 66 // TString datapath, TString sequpath: 67 // datapath: path, where the processed data is stored in the datacenter 68 // sequpath: path, where the sequence files are stored in the datacenter 69 // the datapath (standard: /magic/data/) and the sequencepath (standard: 70 // /magic/sequences) have to be given, that the sequence file, the 71 // calibrated data and the star files can be removed, when an old sequence 72 // has to be removed from the database 73 // 74 // If nothing failes 1 is returned. In the case of an error 0 is returned. 75 // This is needed for the scripts that execute the macro. 38 76 // 39 77 ///////////////////////////////////////////////////////////////////////////// … … 63 101 Bool_t DeleteSequence(MSQLServer &serv, TString datapath, TString sequpath, Int_t sequ, Bool_t dummy) 64 102 { 103 //queries to delete information from the database 65 104 TString query1(Form("DELETE FROM Calibration WHERE fSequenceFirst=%d", sequ)); 66 105 TString query2(Form("DELETE FROM Star WHERE fSequenceFirst=%d", sequ)); … … 69 108 TString query5(Form("DELETE FROM Sequences WHERE fSequenceFirst=%d AND fManuallyChangedKEY=1", sequ)); 70 109 110 //commands to delete files from the disk 71 111 TString fname(Form("%s/%04d/sequence%08d.txt", sequpath.Data(),sequ/10000, sequ)); 72 112 TString command(Form("rm -r %s/callisto/%04d/%08d/", datapath.Data(), sequ/10000, sequ)); … … 148 188 } 149 189 190 191 //check values, that can be different for different runtypes 150 192 Bool_t CheckRuns(MSQLServer &serv, Int_t from, Int_t to, Int_t type) 151 193 { … … 497 539 } 498 540 541 // 542 // Handling new sequence (checking runs; checking for old sequence; inserting sequence, if everything is okay) 543 // 499 544 Bool_t NewSequence(MSQLServer &serv, TString datapath, TString sequpath, Int_t from, Int_t to, TList &sequlist, Bool_t dummy) 500 545 { … … 564 609 } 565 610 611 // 612 // Build Sequences in range of runs 613 // 566 614 Bool_t Process(MSQLServer &serv, TString datapath, TString sequpath, Int_t from, Int_t to, TList &sequlist, Bool_t dummy) 567 615 { … … 735 783 736 784 785 // 786 // Build Sequences for the night given by TString day 787 // 737 788 int buildsequenceentries(TString day, TString datapath, TString sequpath, Bool_t dummy=kTRUE) 738 789 { … … 757 808 day.Data(), day.Data())); 758 809 810 //get all values from the database, that are relevant for building sequences 759 811 TString query(Form("SELECT fRunNumber, fSourceKEY, fProjectKEY, fHvSettingsKEY, fLightConditionsKEY, fDiscriminatorThresholdTableKEY, fTriggerDelayTableKEY FROM RunData WHERE %s AND fExcludedFDAKEY=1 order by fRunNumber", cond.Data())); 760 812 … … 763 815 return 0; 764 816 817 //build blocks of runs, which have the same values 818 //for each block the first and the last run are stored in a TExMap 819 //the values are checked with the help of an array of TStrings 765 820 TString keys[6]= { "NULL", "NULL", "NULL", "NULL", "NULL", "NULL" }; 766 821 TString stop = "NULL"; … … 795 850 796 851 keys[i-1]=value; 797 // hier einfuellen852 //fill values into TExMap 798 853 blocks.Add((ULong_t)blocks.GetSize(), (Long_t)runbegin, (Long_t)runend); 799 854 runstart=(*row)[0]; … … 806 861 } 807 862 808 // und hier einfuellen (letzter wert)863 //fill values into TExMap (last value) 809 864 runbegin=atoi(runstart.Data()); 810 865 runend=atoi(runstop.Data()); … … 812 867 813 868 869 //get list of current sequence of this night from the database and store it in sequlist 814 870 TList sequlist; 815 871 query=Form("SELECT fSequenceFirst FROM Sequences WHERE fManuallyChangedKEY=1 AND %s order by fSequenceFirst", 816 872 cond.Data()); 817 818 873 // cout << "Q: " << query << endl; 819 874 … … 833 888 Bool_t rc = kTRUE; 834 889 890 //build sequences in each block of runs 835 891 Long_t key, val; 836 892 TExMapIter nblocks(&blocks); … … 846 902 } 847 903 904 //newly build or remaining sequences are removed from sequlist while building sequences 905 //delete sequences that remained in the list 906 //this is necessary if e.g. all runs of one old sequence have been excluded in the meantime 848 907 TIter Next(&sequlist); 849 908 TObject *obj = 0; … … 858 917 } 859 918 860 919 // 920 // Build Sequences for all Nights 921 // 861 922 int buildsequenceentries(TString datapath, TString sequpath, Bool_t dummy=kTRUE) 862 923 { … … 870 931 } 871 932 933 //get all dates from the database 872 934 TString query="SELECT fDate FROM SequenceBuildStatus"; 873 935 … … 876 938 return 0; 877 939 940 //execute buildsequenceentries for all dates 878 941 TString date; 879 942 TSQLRow *row=0; -
trunk/MagicSoft/Mars/datacenter/macros/checkfileavail.C
r7457 r7459 28 28 // ================ 29 29 // 30 // check the availability of the files of one sequence: 31 // the script filesondisk has inserted the information (which files are on 32 // disk into the database) and with this macro this information is checked 33 // for the runs of one sequence 34 // 35 // executing the macro: 36 // .x checkfileavail.C+("sequencefile") 37 // the sequencefile (including path) has to be given, as the macro retrieves 38 // from there the runnumbers 39 // 40 // the macro returns 0, if a file is missing, and 1 if all files are there 41 // the return value is checked by the script, that executes the macro 42 // 43 // this macro is very similar to the macro checkstardone.C 44 // 30 45 ///////////////////////////////////////////////////////////////////////////// 31 46 … … 43 58 44 59 60 //check the value of a column for a run 61 //if a file is not available, the column contains nothing (NULL) - this value is returned 45 62 TString GetStatus(MSQLServer &serv, TEnv &rc, TString primary, TString table, TString column) 46 63 { … … 89 106 TEnv rc("steps.rc"); 90 107 108 //reading runnumbers from Sequencefile 91 109 TEnv sequ(sequencefile); 92 110 cout << "sequ file: " << sequencefile.Data() << endl; 93 111 TString runs; 94 112 runs = sequ.GetValue("Runs", ""); … … 100 118 } 101 119 102 cout << "sequ file: " << sequencefile.Data() << endl; 120 //getting runnumbers from database 121 //(not neccessary anymore -> can be changed) 103 122 TString query(Form("SELECT fRunNumber FROM RunData WHERE fRunNumber in (%s)", 104 123 runs.Data())); … … 108 127 cout << "Error - no run to check" << endl; 109 128 129 //check for each run the availability of files from the table RunProcessStatus 130 //the following columns have to be checked: 131 //fCCFileAvail, fCaCoFileAvail, fCaCoFileFound, fRawFileAvail, fTimingCorrection 132 //fTimingCorrection has to be checked, as only rawfiles with correct timing should be calibrated 110 133 TSQLRow *row=0; 111 134 while ((row = res->Next())) … … 113 136 TString runno=(*row)[0]; 114 137 cout << "run#: " << runno << endl; 138 //if one value returns "" (i.e. column is NULL), 0 is returned 115 139 if (GetStatus(serv, rc, runno, "RunProcessStatus", "fCCFileAvail")=="" 116 140 || GetStatus(serv, rc, runno, "RunProcessStatus", "fCaCoFileAvail")=="" … … 121 145 return 0; 122 146 } 147 //if all values are okay (i.e. files are availabel), 1 is returned 123 148 return 1; 124 149 -
trunk/MagicSoft/Mars/datacenter/macros/checkstardone.C
r7112 r7459 28 28 // =============== 29 29 // 30 // check the availability of the star files for one sequence: 31 // if star has been executed successfully, this information has been inserted 32 // into the database (SequenceProcessStatus) with this macro this information 33 // is checked 34 // 35 // executing the macro: 36 // .x checkstardone.C+("sequencenumber") 37 // 38 // the macro returns 0, if for the sequence star is not done, and 1 if star 39 // has been done 40 // the return value is checked by the script, that executes the macro 41 // 42 // this macro is very similar to the macro checkfileavail.C 43 // 30 44 ///////////////////////////////////////////////////////////////////////////// 31 45 … … 43 57 44 58 59 //check the value of a column for a sequence 45 60 TString GetStatus(MSQLServer &serv, TEnv &rc, TString primary, TString table, TString column) 46 61 { … … 55 70 if (!res) 56 71 { 57 cout << "Error - no runto check" << endl;72 cout << "Error - no sequence to check" << endl; 58 73 return ""; 59 74 } … … 84 99 TEnv rc("steps.rc"); 85 100 101 //check if fStar not NULL for sequence 86 102 if (GetStatus(serv, rc, datasetno, "SequenceProcessStatus", "fStar")=="") 87 103 return 0; -
trunk/MagicSoft/Mars/datacenter/macros/doexclusions.C
r7112 r7459 29 29 // ============== 30 30 // 31 // this macro sets the ExcludedFDA flag for runs, that can be excluded 32 // automatically 33 // the information which runs have to be excluded is retrieved from the 34 // resource file automatic-exclusions.rc 35 // 36 // the macro can be executed either for a night or for a range of runnumbers 37 // or for all nights 38 // .x doexclusions.C+("night") 39 // .x doexclusions.C+(startrun,stoprun) 40 // .x doexclusions.C+ 41 // 42 // resource file: automatic-exclustions.rc 43 // for each exclusion-reason there is one block of 6 lines in this file: 44 // example for one exclusion-reason: 45 // #NumEventsSmaller10: (name of exclusion) 46 // key15.Column: fNumEvents (name of the affected column) 47 // #key15.Join1: (name of column that has to 48 // #key15.Join2: be joined) 49 // key15.Cond: fNumEvents between 2 and 9 (condition that fulfils exclusion) 50 // #key15.SpecialRunCond: (special condition, if exclusion 51 // is needed only for certain runs) 52 // if a value is not needed for an exclusion (like the joins and the special 53 // condition in this example), the line is commented out 54 // 31 55 ///////////////////////////////////////////////////////////////////////////// 32 56 #include <iostream> … … 43 67 using namespace std; 44 68 69 //get minimum or maximum runnumber of the runs of a night 45 70 int GetRunNumber(MSQLServer &serv, TString date, TString value) 46 71 { … … 75 100 } 76 101 102 //get part of a query (left join of tables) 77 103 TString GetJoin(TString table) 78 104 { … … 99 125 cout << "Connected to " << serv.GetName() << endl; 100 126 127 //if neither start- nor stoprun is given, the minimum and maximum runnumber 128 // is queried from the database to do the exclusions for all runs 129 // if a night is given for all runs of this night 101 130 if (startrun==0 && stoprun==0) 102 131 { … … 104 133 stoprun=GetRunNumber(serv, date, "max"); 105 134 } 135 //check format of start- and stoprun 106 136 if (startrun<0 || stoprun<0) 107 137 { … … 112 142 return 1; 113 143 144 //get the condition for the runnumber range 114 145 TString runcond(Form("AND fRunNumber BETWEEN %d AND %d ", startrun, stoprun)); 115 146 147 //get exclusions-reasons (stored in the table ExcludedFDA) from the database 148 //the exclusions which can be done automatically are marked with the flag fExcludedFDAAutomatic='yes' 149 //and with an importance (one run may be excluded for several reasons, 150 //the reason is chosen according to the importance) 116 151 TString query="SELECT fExcludedFDAKEY from ExcludedFDA where fExcludedFDAAutomatic='yes'"; 117 152 TSQLResult *res = serv.Query(query); … … 122 157 } 123 158 159 //update the exclusion-reasons for all runs 124 160 TSQLRow *row=0; 125 161 while ((row = res->Next())) 126 162 { 163 //read in values from the resource file automatic-exclusions (explanation see above) 127 164 TString key=(*row)[0]; 128 165 TString column=rc.GetValue("key"+key+".Column", ""); … … 131 168 TString border=rc.GetValue("key"+key+".SpecialRunCond", ""); 132 169 170 //get importance of exclusion-reason from database 133 171 TString query(Form("SELECT fExcludedFDAImportance from ExcludedFDA where fExcludedFDAKEY=%s ", key.Data())); 134 172 TSQLResult *res = serv.Query(query); … … 143 181 delete res; 144 182 183 //get current importance from database 184 //for the runs which match the exclusion-reason 145 185 query="SELECT fRunNumber, fExcludedFDAImportance "; 146 186 if (!column.IsNull()) … … 173 213 } 174 214 215 //compare new and old importance 216 //change or keep the exclusion-reason accordingly 175 217 while ((row2 = res->Next())) 176 218 { 177 219 if (TString((*row2)[1]).IsNull() || atoi((*row2)[1])>newimp) 178 220 { 221 //change exclusion-reason 179 222 TString query(Form("UPDATE RunData SET fExcludedFDAKEY=%s WHERE fRunNumber=%s", 180 223 key.Data(), (*row2)[0])); … … 189 232 continue; 190 233 } 234 //keep exclusion-reason 191 235 cout << "run#: " << (*row2)[0] << " reason for exclusion is still the same" << endl; 192 236 } … … 197 241 } 198 242 243 //run doexclusions for one night 199 244 int doexclusions(TString date="NULL") 200 245 { -
trunk/MagicSoft/Mars/datacenter/macros/fillcalib.C
r7363 r7459 34 34 // From this file the MBadPixelsCam and the MGeomCam is extracted. If 35 35 // the geometry isn't found MGeomCamMagic is used as a default. 36 // The bad pixel information and other information, extracted from the status 37 // display, is inserted into the database in the table Calibration, which 38 // stores the results from the calibration. 39 // The corresponding sequence number is extracted from the filename... 40 // FIXME: MSeqeuence should be stored in the calib-file? 36 41 // 37 42 // Usage: 38 // .x fillcalib.C("/data/MAGIC/Period014/calib00000.root", kTRUE)43 // .x fillcalib.C("/magic/data/callisto/0004/00047421/calib00047421.root", kTRUE) 39 44 // 40 45 // The second argument is the 'dummy-mode'. If it is kTRUE dummy-mode is 41 46 // switched on and nothing will be written into the database. This is usefull 42 47 // for tests. 43 //44 // The corresponding sequence number is extracted from the filename...45 // FIXME: MSeqeuence should be stored in the calib-file?46 48 // 47 49 // The macro can also be run without ACLiC but this is a lot slower... … … 106 108 int Process(MSQLServer &serv, TString fname, Bool_t dummy) 107 109 { 110 //getting number of unsuitable, unreliable and isolated pixel 108 111 MBadPixelsCam badpix; 109 112 … … 234 237 cout << " Mean Conv outer: " << meanconvouter << endl; 235 238 239 //inserting or updating the information in the database 236 240 TString query; 237 241 if (!ExistStr(serv, "fSequenceFirst", "Calibration", seq)) -
trunk/MagicSoft/Mars/datacenter/macros/filldotraw.C
r7325 r7459 72 72 using namespace std; 73 73 74 //get key for a magic number 74 75 Int_t MagicNumber(MSQLServer &serv, const MRawRunHeader &h) 75 76 { … … 137 138 MRawRunHeader h; 138 139 140 //read header either from root or from raw file 139 141 if (fname.EndsWith(".root")) 140 142 ReadRoot(fname, &h); … … 148 150 } 149 151 152 //get key for the magic number 150 153 const Int_t key = MagicNumber(serv, h); 151 154 if (key<0) … … 204 207 cout << endl; 205 208 209 //get date for the run to build path of the file 206 210 TString query(Form("SELECT DATE_FORMAT(ADDDATE(fRunStart, Interval 13 HOUR), '%%Y/%%m/%%d') FROM RunData WHERE fRunNumber=%d", 207 211 runno)); … … 239 243 } 240 244 245 //check if there's only one file with this runno 241 246 if (count!=1) 242 247 { -
trunk/MagicSoft/Mars/datacenter/macros/filldotrbk.C
r7112 r7459 32 32 // 33 33 // Usage: 34 // .x filldotrbk.C("/ data/MAGIC/Period014", kTRUE)35 // 36 // While the first argument is the directory in which all subdirectories where37 // searche s for CC_*.rbk files. All these files were analysed and the runbook34 // .x filldotrbk.C("/magic/subsystemdata/cc/", kTRUE) 35 // 36 // The first argument is the directory in which all subdirectories are 37 // searched for CC_*.rbk files. All these files are analysed and the runbook 38 38 // entries will be put into the DB, eg: 39 // "/data/MAGIC" would do it for all data 40 // "/data/MAGIC/Period019/ccdata" would do it for one Period 41 // "/data/MAGIC/Period019/ccdata/2004_05_17" would do it for a single day 42 // "/data/MAGIC/Period019/ccdata/file.rbk" would do it for a single file 39 // "/magic/subsystemdata/cc" would do it for all data 40 // "/magic/subsystemdata/cc/2005" for one year 41 // "/magic/subsystemdata/cc/2005/11" for one month 42 // "/magic/subsystemdata/cc/2005/11/11" for a single day 43 // "/magic/subsystemdata/cc/2005/11/11/file.rbk" for a single file 43 44 // 44 45 // The second argument is the 'dummy-mode'. If it is kTRUE dummy-mode is … … 46 47 // for tests. 47 48 // 48 // Before an antry is added its existance is checked... if it is addedalready49 // i t is ignored.49 // Before an entry is added, its existance is checked... if it is already 50 // in the database, it is ignored. 50 51 // 51 52 // The macro can also be run without ACLiC but this is a lot slower... … … 96 97 } 97 98 } 98 99 99 delete res; 100 101 100 return rc; 102 101 } … … 105 104 { 106 105 106 //check if entry is already in database 107 107 if (ExistStr(serv, "fRunBookDate", "RunBook", date)) 108 108 return 0; … … 116 116 entry.Remove(i--); 117 117 118 //insert entry into the database 118 119 TString query("INSERT RunBook (fRunBookDate, fRunBookText) VALUES (\""); 119 120 query += date; … … 178 179 } 179 180 */ 181 182 //skip run statistics from old runbooks 180 183 if (entry.Contains("MAGIC ELECTRONIC RUNBOOK") || 181 184 entry.Contains("DATA RUN STATISTICS") || … … 220 223 cout << endl; 221 224 225 //get all runbook files in path 222 226 if (path.EndsWith(".rbk")) 223 227 return process(serv, dummy, path); 224 228 229 //fill entries for each runbook file 225 230 MDirIter Next(path, "CC_*.rbk", -1); 226 231 while (1) -
trunk/MagicSoft/Mars/datacenter/macros/filldotrun.C
r7394 r7459 46 46 // searches for CC_*.run files. All these files were analysed and the run 47 47 // info will be put into the DB, eg: 48 // "/data/MAGIC" would do it for all data 49 // "/data/MAGIC/Period019/ccdata" would do it for one Period 50 // "/data/MAGIC/Period019/ccdata/2004_05_17" would do it for a single day 51 // "/data/MAGIC/Period019/ccdata/file.run" would do it for a single file 48 // "/magic/subsystemdata/cc" would do it for all data 49 // "/magic/subsystemdata/cc/2005" for one year 50 // "/magic/subsystemdata/cc/2005/11" for one month 51 // "/magic/subsystemdata/cc/2005/11/11" for a single day 52 // "/magic/subsystemdata/cc/2005/11/11/file.run" for a single file 52 53 // 53 54 // The second argument is the 'dummy-mode'. If it is kTRUE dummy-mode is … … 104 105 } 105 106 107 //get key for the value 108 // if value is not existing, insert value and get key 106 109 Int_t QueryNameKEY(MSQLServer &serv, Bool_t dummy, const char *col, const char *name, Bool_t insert=kTRUE) 107 110 { … … 125 128 return -1; 126 129 130 //insert new value 127 131 query = Form("INSERT %s (f%sName) VALUES (\"%s\");", col, col, name); 128 132 -
trunk/MagicSoft/Mars/datacenter/macros/fillganymed.C
r7333 r7459 30 30 // This macro is used to read the ganymed-output files. 31 31 // These files are automatically called ganymed00000.root. 32 // From MAlphaFitter and the Status Display the results from ganymed are 33 // extracted an inserted into the database, where they are stored in the table 34 // Ganymed. 35 // The dataset number is extracted from the filename. 36 // 37 // Usage: 38 // .x fillganymed.C("/magic/data/ganymed/0000/0001/ganmymed0001.root", kTRUE) 39 // 40 // The second argument is the 'dummy-mode'. If it is kTRUE dummy-mode is 41 // switched on and nothing will be written into the database. This is usefull 42 // for tests. 43 // 44 // Remark: Running it from the commandline looks like this: 45 // root -q -l -b fillganymed.C+\(\"filename\"\,kFALSE\) 2>&1 | tee file.log 32 46 // 33 47 // Make sure, that database and password are corretly set in a resource … … 96 110 } 97 111 112 //get excess, signal, background events and the scale factor from MAlphaFitter 98 113 MAlphaFitter *fit; 99 114 file.GetObject("MAlphaFitter", fit); … … 113 128 TString scale = Form("%5.2f", f); 114 129 130 //get effective ontime from the status display 115 131 MStatusArray arr; 116 132 if (arr.Read()<=0) … … 130 146 Int_t tm = (Int_t)vstime->Integral(); 131 147 148 //get dataset number from filename 132 149 TString dataset = fname(TRegexp("ganymed[0-9]+[.]root$")); 133 150 if (dataset.IsNull()) … … 135 152 cout << "WARNING - Could get dataset# from filename: " << fname << endl; 136 153 return 0; 137 }138 154 139 155 Int_t ds = atoi(dataset.Data()+8); … … 152 168 153 169 170 //build query, insert information into the DB 171 //if entry is already existing: update query 172 //else: insert query 154 173 TString query; 155 174 if (!ExistStr(serv, "fDataSetNumber", "Ganymed", ds)) … … 212 231 cout << endl; 213 232 233 //process file 214 234 return Process(serv, fname, dummy); 215 235 } -
trunk/MagicSoft/Mars/datacenter/macros/fillsignal.C
r7428 r7459 32 32 // signal00000.root. 33 33 // 34 // From this file the Mean PedRms for the inner and outer camera is extracted. 34 // From this file the mean pedrms, the mean signal and the pulse position 35 // for the inner and outer camera is extracted and inserted into the database 36 // in the table Calibration, where the results of callisto are stored. 37 // The sequence number is extracted from the filename. 35 38 // 36 39 // Usage: 37 // .x fillsignal.C("/ data/MAGIC/Period014/signal00000.root", kTRUE)40 // .x fillsignal.C("/magic/data/callisto/0004/00047421/signal00047421.root", kTRUE) 38 41 // 39 42 // The second argument is the 'dummy-mode'. If it is kTRUE dummy-mode is … … 171 174 rmspul = TMath::Nint(rmspul*100)/100.; 172 175 176 //get sequence number from the filename 173 177 TString sequence = fname(TRegexp("signal[0-9]+[.]root$")); 174 178 if (sequence.IsNull()) … … 205 209 cout << " Rms extracted PulsePos " << rmsextpulpos << endl; 206 210 211 //build query and insert information into the database 212 // here only a update query is built, as this macro is exexuted after 213 // the macro fillcalib.C in the script fillcallisto 214 // and so the table Calibration is always updated 207 215 TString query = Form("UPDATE Calibration SET " 208 216 " fMeanPedRmsInner=%s, fMeanPedRmsOuter=%s, " … … 248 256 cout << endl; 249 257 258 //process file 250 259 return Process(serv, fname, dummy); 251 260 } -
trunk/MagicSoft/Mars/datacenter/macros/fillsinope.C
r7265 r7459 30 30 // 31 31 // This macro is used to read the sinope output files sinope*.txt 32 // For each run sinope is run twice: once for the data events and once for the 33 // calibration events. The pulse position and height is checked. The output is 34 // stored in a sinope*.root and a sinope*.txt file. The files for data events 35 // are marked with -dat and the ones for calibration events with -cal. 36 // From the txt files the result is extracted and inserted into the database 37 // in the table DataCheck, which stores the datacheck results. 38 // As the column names in the database differ only by the addition 'Interlaced' 39 // which is given to columns corresponding to the calibration events, the 40 // files can be processed with the same function. 32 41 // 33 42 // Usage: … … 87 96 TEnv env(fname); 88 97 98 //build query 89 99 TString query="UPDATE DataCheck SET "; 90 100 101 //array with part of column names 91 102 TString values[9] = { "Events" , "HasSignal" , "HasPedestal" , "PositionSignal" , "PositionFWHM" , "PositionAsym" , "HeightSignal" , "HeightFWHM" , "HeightAsym" }; 92 103 104 //get values from the file add them to query 93 105 TString str; 94 106 for (Int_t i=0 ; i<9 ; i++) … … 118 130 119 131 cout << "Q: " << query << endl; 132 //insert information into db 120 133 TSQLResult *res = serv.Query(query); 121 134 if (!res) … … 146 159 cout << endl; 147 160 161 //get date of run from database 148 162 TString query(Form("SELECT DATE_FORMAT(ADDDATE(fRunStart, Interval 13 HOUR), '%%Y/%%m/%%d') FROM RunData WHERE fRunNumber=%d", 149 163 runno)); … … 162 176 delete res; 163 177 178 //insert entry for the run into the database in the table DataCheck, if it is not yet existing 164 179 if (!ExistStr(serv, "fRunNumber", "DataCheck", Form("%d", runno))) 165 180 { 166 181 query=Form("INSERT DataCheck SET fRunNumber=%d", runno); 167 182 168 cout << "U:" << query << endl;169 183 res = serv.Query(query); 170 184 if (!res) … … 175 189 } 176 190 191 //get filenames of sinope output files 177 192 TString fname(Form("%s/sinope/%s/sinope-dat%08d.txt", 178 193 datapath.Data(), date.Data(), runno)); … … 183 198 184 199 Int_t rc=0; 200 //process dat-file 185 201 rc=Process(serv, fname, runno, kFALSE, dummy); 186 202 if (rc==0) 187 203 return rc; 188 204 205 //process cal-file 189 206 rc=Process(serv, fnamecal, runno, kTRUE, dummy); 190 207 return rc; -
trunk/MagicSoft/Mars/datacenter/macros/fillstar.C
r7405 r7459 30 30 // 31 31 // This macro is used to read the star-output files. 32 // These files are automatically called star00000.root. 32 // These files are automatically called star00000000.root. 33 // From these files the muon parameters (psf, muon number, ratio, muon rate), 34 // the rate, the number of islands, the effective ontime, the maximum 35 // humidity and a parameter describing the inhomogeneity are extracted from 36 // the status display. 37 // The sequence number is extracted from the filename. 38 // 39 // Usage: 40 // .x fillstar.C("/magic/data/star/0004/00047421/star00047421.root", kTRUE) 41 // 42 // The second argument is the 'dummy-mode'. If it is kTRUE dummy-mode is 43 // switched on and nothing will be written into the database. This is usefull 44 // for tests. 45 // 46 // The macro can also be run without ACLiC but this is a lot slower... 47 // 48 // Remark: Running it from the commandline looks like this: 49 // root -q -l -b fillstar.C+\(\"filename\"\,kFALSE\) 2>&1 | tee fillstar.log 33 50 // 34 51 // Make sure, that database and password are corretly set in a resource -
trunk/MagicSoft/Mars/datacenter/macros/findcacofiles.C
r7232 r7459 25 25 ///////////////////////////////////////////////////////////////////////////// 26 26 // 27 // FindCaCoFiles.C27 // findcacofiles.C 28 28 // =============== 29 // 30 // Macro to get from the database the number of the runs, for which no caco 31 // file is available. 32 // 33 // Sometimes the DAQ aborts a run and starts itself a new one. In this cases 34 // there's the camera controll doesn't start a new file, as the command to 35 // start a new run was not sent by the central control. So the caco 36 // information is stored in the previous caco file, which has a different 37 // runnumber. To be able to merpp the information into the calibrated data 38 // file, the runnumber of the file containing the information has to be found. 39 // This is done by a script. 40 // findcacofiles.C produces the input for this script. It queries from the 41 // database, for which runs no caco file with the same runnumber is available 42 // and writes the runnumbers into an txt file. 43 // 44 // Usage: 45 // .x findcacofiles.C+("date", "logpath") 46 // date and logpath are needed only for the output file 47 // 48 // Make sure, that database and password are corretly set in a resource 49 // file called sql.rc and the resource file is found. 50 // 51 // Returns 0 in case of failure and 1 in case of success. 29 52 // 30 53 ///////////////////////////////////////////////////////////////////////////// … … 60 83 cout << endl; 61 84 85 //get runnumbers from database 62 86 TString query="SELECT RunProcessStatus.fRunNumber FROM RunProcessStatus "; 63 87 query+=" LEFT JOIN RunData on RunData.fRunNumber=RunProcessStatus.fRunNumber "; … … 72 96 } 73 97 98 //create output file 74 99 TString filename(Form("%s/findcacofiles-%s.txt", logpath.Data(), date.Data())); 75 100 ofstream fout(filename, ios::app); … … 80 105 } 81 106 107 //write runnumbers into output file 82 108 TSQLRow *row=0; 83 109 while ((row = res->Next())) -
trunk/MagicSoft/Mars/datacenter/macros/getdolist.C
r7324 r7459 25 25 ///////////////////////////////////////////////////////////////////////////// 26 26 // 27 // GetDoList.C27 // getdolist.C 28 28 // =========== 29 // 30 // This macro is a key part of the automation concept. 31 // It queries from the database, for which dates/runs/sequences/datasets a 32 // certain step has to be done and writes the todo-files. 33 // 34 // Usage: 35 // .x getdolist.C+("table", "column", "date", "listpath") 36 // The first and second argument give the table and column in the database 37 // and specify like this the primary (date/run/sequenc/dataset) and the 38 // step. 39 // The third argument specifies the date, for which the macro has to be 40 // executed. This is currently not used in the automatic analysis. It was 41 // forseen to give the possibility to process the data night by night. By 42 // giving date='NULL' the macro is executed for all dates. 43 // The forth argument gives the path, where teh todo-file is stored. 44 // 45 // The macro needs apart from sql.rc the resource file steps.rc 46 // In this files the interdependencies of the analysis steps are given: To 47 // execute a certain step other steps have to be executed first and each 48 // step also influences othere steps - this information is stored in steps.rc 49 // example: 50 // To execute the calibration, all files have to be available on disk (needs). 51 // And if the calibration is done, fillcallisto and star can be executed 52 // (influences). 53 // 54 // Make sure, that database and password are corretly set in a resource 55 // file called sql.rc and the resource file is found. 56 // 57 // Returns 0 in case of failure and 1 in case of success. 29 58 // 30 59 ///////////////////////////////////////////////////////////////////////////// … … 64 93 TEnv rc("steps.rc"); 65 94 95 //read in needs 66 96 TString needs = rc.GetValue(table+"."+column+".Needs", ""); 67 97 cout << "Needs: " << needs << endl; 68 98 69 99 TList l; 70 71 100 while (!needs.IsNull()) 72 101 { … … 82 111 } 83 112 113 //build query 114 // this forms a query like e.g. 115 //SELECT SequenceProcessStatus.fSequenceFirst FROM SequenceProcessStatus 116 // WHERE ISNULL(fCallisto) 117 // AND NOT ISNULL(fAllFilesAvail) AND NOT ISNULL(fSequenceFileWritten) 118 //which would query all sequences for which Callisto has to be done. 84 119 TString query(Form("SELECT %s.%s FROM %s", 85 120 table.Data(), rc.GetValue(table+".Primary", ""), 86 121 table.Data())); 87 122 123 //get joins 124 //if a date is given, the tables, which contain the information about the 125 // date (given in step.rc as TimerTable), have to be joined 88 126 if (date!="NULL" && rc.GetValue(table+".TimerTable", "")!="") 89 127 query+=Form(" left join %s on %s.%s=%s.%s ", … … 99 137 query+=Form(" AND NOT ISNULL(%s)", o->GetName()); 100 138 139 //if a date is given another condition is added to the query 101 140 if (date!="NULL") 102 141 { … … 111 150 } 112 151 152 //to process the newest data first, the results are ordered descending by the primary 113 153 query+=Form(" ORDER BY %s.%s DESC ", table.Data(), rc.GetValue(table+".Primary", "")); 114 154 155 //this part of the query is needed, if there are more than 512 results and single 156 //todo files are written, as shell scripts have a limitation for arrays 157 // this is currently only the case, if runs are processed, i.e. for the table RunProcessStatus 115 158 if (table=="RunProcessStatus") 116 159 query+="LIMIT 0, 500"; … … 126 169 127 170 171 //write todo-file 172 //depending on the kind of step and primary, this looks different 173 //for steps, which do not take much time and can thus be executed 174 // for all data at once (e.g. buildsequenceentries) only one todo 175 // file is written 176 //for steps, which take quite long for one primary (e.g. calibration) 177 // or of which a large number has to be executed (e.g. datacheck) 178 // one todo-file per primary is written 128 179 TString filename; 129 180 TSQLRow *row=0; … … 137 188 { 138 189 filename=Form("%s/ToDo-%s-%s-%s.txt", listpath.Data(), table.Data(), column.Data(), (*row)[0]); 190 //remove file, if it is already existing 191 // this is needed, that the same step is not executed several times 139 192 gSystem->Unlink(filename); 140 193 ofstream fout(filename, ios::app); -
trunk/MagicSoft/Mars/datacenter/macros/insertcacofile.C
r7112 r7459 25 25 ///////////////////////////////////////////////////////////////////////////// 26 26 // 27 // InsertCaCoFiles.C27 // insertcacofiles.C 28 28 // ================= 29 // 30 // Macro to insert runnumber of the caco files, which contain the information 31 // for a run, for which no caco file is available. 32 // 33 // Sometimes the DAQ aborts a run and starts itself a new one. In this cases 34 // there's the camera controll doesn't start a new file, as the command to 35 // start a new run was not sent by the central control. So the caco 36 // information is stored in the previous caco file, which has a different 37 // runnumber. To be able to merpp the information into the calibrated data 38 // file, the runnumber of the file containing the information has to be found. 39 // This is done by a script. 40 // insertcacofiles.C inserts the runnumber of the file, that has been found, 41 // into the column CaCoFileFound. 42 // 43 // Usage: 44 // .x insertcacofile.C+("runnumber", "newrunnumber") 45 // The first is the runnumber of which the cacofile is missing, the second is 46 // the runnumber of the file in which the information probably can be found. 47 // 48 // Make sure, that database and password are corretly set in a resource 49 // file called sql.rc and the resource file is found. 50 // 51 // Returns 0 in case of failure and 1 in case of success. 29 52 // 30 53 ///////////////////////////////////////////////////////////////////////////// … … 42 65 43 66 using namespace std; 44 45 67 46 68 int insertcacofile(TString runnumber, TString newrunnumber) … … 60 82 cout << endl; 61 83 84 //get new runnumber 62 85 Int_t newrunno=atoi(newrunnumber.Data()); 86 //build query and insert information 63 87 TString query(Form("UPDATE RunProcessStatus SET fCaCoFileAvail=Now(), fCaCoFileFound=%d WHERE fRunNumber=%s ", 64 88 newrunno, runnumber.Data())); -
trunk/MagicSoft/Mars/datacenter/macros/insertdataset.C
r7336 r7459 25 25 ///////////////////////////////////////////////////////////////////////////// 26 26 // 27 // InsertDataset.C27 // insertdataset.C 28 28 // =============== 29 // 30 // This macro inserts datasets into the database. 31 // If a new dataset file has been stored in the dataset directory, the 32 // information file is read by a script and the information is inserted with 33 // this macro into the database in the tables DataSets and 34 // DataSetProcessStatus, where in the information about datasets is stored. 35 // 36 // Usage: 37 // .x insertdataset.C+("number","source,"wobble","comment",kTRUE) 38 // The first argument is the dataset number, the second is giving the source 39 // name, the third the observation mode (wobble/on-off), the fourth a comment 40 // about the dataset. This arguments are extracted by a script from the 41 // dataset file. 42 // The last argument is the 'dummy-mode'. If it is kTRUE dummy-mode is 43 // switched on and nothing will be written into the database. This is usefull 44 // for tests. 45 // 46 // Make sure, that database and password are corretly set in a resource 47 // file called sql.rc and the resource file is found. 48 // 49 // Returns 0 in case of failure and 1 in case of success. 29 50 // 30 51 ///////////////////////////////////////////////////////////////////////////// … … 59 80 } 60 81 82 //get key of a name 83 // insert value, if it is not yet existing 61 84 Int_t QueryNameKEY(MSQLServer &serv, Bool_t dummy, const char *col, const char *name, Bool_t insert=kTRUE) 62 85 { … … 121 144 cout << endl; 122 145 146 //get source key 123 147 Int_t sourcekey = QueryNameKEY(serv, dummy, "Source", source.Data(), kFALSE); 124 148 if (sourcekey<0) … … 131 155 cout << "no:" << number << endl; 132 156 157 //if dataset is not yet in database, insert the information 133 158 if (!ExistStr(serv, "fDataSetNumber", "DataSets", number.Data())) // Form("%d", number) 134 159 { … … 151 176 delete res; 152 177 153 178 //add also entry in the table DataSetProcessStatus 154 179 query=Form("INSERT DataSetProcessStatus SET fDataSetNumber='%s', " 155 180 " fDataSetInserted=Now() ", -
trunk/MagicSoft/Mars/datacenter/macros/insertdate.C
r7112 r7459 25 25 ///////////////////////////////////////////////////////////////////////////// 26 26 // 27 // InsertDate.C27 // insertdate.C 28 28 // ============ 29 // 30 // This macro is inserting a date into the table SequenceBuildStatus. 31 // It is executed by the script copyscript, which copies the slow control 32 // data to the appropriate directory and inserts the information into the 33 // database. 34 // 35 // Usage: 36 // .x insertdate.C+("date") 37 // 38 // Make sure, that database and password are corretly set in a resource 39 // file called sql.rc and the resource file is found. 40 // 41 // Returns 0 in case of failure and 1 in case of success. 29 42 // 30 43 ///////////////////////////////////////////////////////////////////////////// … … 79 92 cout << endl; 80 93 94 //insert entry for date into the table SequenceBuildStatus, 95 // if entry is not yet existing 81 96 if (!ExistStr(serv, "fDate", "SequenceBuildStatus", date)) 82 97 { -
trunk/MagicSoft/Mars/datacenter/macros/insertsequence.C
r7400 r7459 25 25 ///////////////////////////////////////////////////////////////////////////// 26 26 // 27 // InsertSequence.C27 // insertsequence.C 28 28 // ================ 29 // 30 // This macro inserts a sequence into the database. It extracts the 31 // information from a sequence file. 32 // This macro is not used by the automatic analysis. It is needed to insert 33 // manually built sequences into the database. 34 // 35 // Usage: 36 // .x insertsequence.C+("filename", kTRUE) 37 // The first argument is the filename of the manual written sequencefile. 38 // The second argument is the 'dummy-mode'. If it is kTRUE dummy-mode is 39 // switched on and nothing will be written into the database. This is usefull 40 // for tests. 41 // 42 // Make sure, that database and password are corretly set in a resource 43 // file called sql.rc and the resource file is found. 44 // 45 // Returns 0 in case of failure and 1 in case of success. 29 46 // 30 47 ///////////////////////////////////////////////////////////////////////////// … … 125 142 cout << endl; 126 143 144 //get sequence number from file 127 145 TString sequnum; 128 146 sequnum=sequ.GetValue("Sequence", ""); 129 147 Int_t seq=atoi(sequnum.Data()); 130 148 149 //get runs from sequence file 131 150 TString runs; 132 151 runs = sequ.GetValue("Runs", ""); … … 138 157 } 139 158 159 //get source key 140 160 TString sourcename = sequ.GetValue("Source", ""); 141 161 Int_t sourcekey = QueryNameKEY(serv, dummy, "Source", sourcename.Data()); 142 162 163 //get values for the sequence 143 164 TString query="SELECT max(fRunNumber), min(fRunStart), "; 144 165 query +="sum(time_to_sec(fRunStop)-time_to_sec(fRunStart)), "; … … 218 239 cout << " l2tt " << l2tt << endl; 219 240 241 //build queries 220 242 TString query1="INSERT Sequences SET fManuallyChangedKEY=2, "; 221 243 query1 +=Form("fSequenceFirst=%d, fSequenceLast=%s, " … … 232 254 l1tt.Data(), l2tt.Data()); 233 255 256 //the time of the column fSequenceFileWritten is set to 'not to be done' 234 257 TString query2=Form("INSERT SequenceProcessStatus SET " 235 258 "fSequenceFirst=%d, fSequenceFileWritten='1970-01-01 00:00:00'", -
trunk/MagicSoft/Mars/datacenter/macros/resetallruns.C
r7274 r7459 25 25 ///////////////////////////////////////////////////////////////////////////// 26 26 // 27 // ResetAllRuns.C27 // resetallruns.C 28 28 // ============== 29 // 30 // This macro resets the values of a column in the table RunProcessStatus. It 31 // is used by the script filesondisk to reset the values for the columns, 32 // which indicate the availability of the files. 33 // 34 // Usage: 35 // .x resetallrun.C+("filename", "column") 36 // The first argument is giving a file, in which a list of runs can be found 37 // for which the column will be set to Now() by this macro. The second 38 // argument is giving the column, which has to be reset. 39 // 40 // Make sure, that database and password are corretly set in a resource 41 // file called sql.rc and the resource file is found. 42 // 43 // Returns 0 in case of failure and 1 in case of success. 29 44 // 30 45 ///////////////////////////////////////////////////////////////////////////// … … 59 74 cout << endl; 60 75 76 //reset column to NULL 61 77 TString query(Form("UPDATE RunProcessStatus SET %s=NULL", 62 78 column.Data())); 79 //if the column is fCaCoFileAvail, reset also the column fCaCoFileFound 63 80 if (column.Contains("CaCo")) 64 81 query+=", fCaCoFileFound=NULL"; 65 66 82 67 83 cout << "q: " << query << endl; … … 76 92 77 93 94 //read in file 78 95 ifstream fin(filename); 79 96 if (!fin) … … 82 99 return 0; 83 100 } 84 85 101 while (1) 86 102 { 103 //get runnumber 87 104 TString runnumber; 88 105 runnumber.ReadLine(fin); … … 90 107 break; 91 108 109 //build query and set status for this run to Now() 92 110 TString query(Form("UPDATE RunProcessStatus SET %s=Now()", column.Data())); 93 111 -
trunk/MagicSoft/Mars/datacenter/macros/resetcolumn.C
r7232 r7459 25 25 ///////////////////////////////////////////////////////////////////////////// 26 26 // 27 // ResetColumn.C27 // resetcolumn.C 28 28 // ============= 29 29 // … … 34 34 // 35 35 // As arguments you have to give the column, the table and from which 36 // to which Date/Sequence/Run you want to reset the value.36 // to which Date/Sequence/Run/Dataset you want to reset the value. 37 37 // 38 38 // The last argument is the 'dummy-mode'. If it is kTRUE dummy-mode is … … 40 40 // for tests (i.e. if you want to see if the query is correct). 41 41 // 42 // usage:42 // Usage: 43 43 // .x resetcolumn.C("fStar","SequenceProcessStatus","45114","49329",kTRUE) 44 // 45 // Make sure, that database and password are corretly set in a resource 46 // file called sql.rc and the resource file is found. 47 // 48 // Returns 0 in case of failure and 1 in case of success. 44 49 // 45 50 ///////////////////////////////////////////////////////////////////////////// … … 77 82 78 83 TEnv rc("steps.rc"); 84 //get steps which are influenced by the step, which is resetted 79 85 TString influences = rc.GetValue(table+"."+column+".Influences", ""); 80 86 … … 97 103 } 98 104 105 //build query and reset columns 99 106 TString query(Form("Update %s SET %s=NULL ", table.Data(), column.Data())); 100 107 … … 112 119 } 113 120 114 115 121 TSQLResult *res = serv.Query(query); 116 122 if (!res) -
trunk/MagicSoft/Mars/datacenter/macros/setstatus.C
r7112 r7459 25 25 ///////////////////////////////////////////////////////////////////////////// 26 26 // 27 // SetStatus.C27 // setstatus.C 28 28 // =========== 29 // 30 // This macro is a key part of the automation concept. 31 // It sets the status for dates/runs/sequences/datasets in the database, if a 32 // certain step has been done. 33 // 34 // Usage: 35 // .x setstatus.C+("primary","table","column","value",kTRUE) 36 // The first argument is the primary (date/run/sequence/dataset), the second 37 // and third argument give the table and column of the step. The fourth 38 // column is giving the value, to which the column has to be set. The last 39 // argument is indicating if the columns of all influenced steps shall be 40 // reset to NULL. The default is kTRUE, which means, that the columns are 41 // reset. 42 // 43 // Make sure, that database and password are corretly set in a resource 44 // file called sql.rc and the resource file is found. 45 // 46 // Returns 0 in case of failure and 1 in case of success. 29 47 // 30 48 ///////////////////////////////////////////////////////////////////////////// … … 53 71 } 54 72 73 //some columns can't be reseted, this is given in steps.rc 55 74 TString reset=rc.GetValue(table+"."+column+".Reset", "no"); 56 75 if (reset.Contains("no")) … … 66 85 TString CheckDefault(MSQLServer &serv, TEnv &rc, TString primary, TString table, TString influence) 67 86 { 87 //check if the value in the database is the default 68 88 TString query(Form("SELECT %s FROM %s WHERE %s=%s", 69 89 influence.Data(), table.Data(), … … 97 117 cout << "set influenes for " << table << "." << column << endl; 98 118 119 //build query and set step and influences for the step 99 120 TString influences = rc.GetValue(table+"."+column+".Influences", ""); 100 121 … … 115 136 TString deflt = rc.GetValue(influence+".Default", ""); 116 137 138 //for some columns there may be a different default 139 // in the file steps.rc they are marked with Default: check 140 // in this case, the value in the database has to be checked 117 141 if (deflt=="check") 118 142 deflt=CheckDefault(serv, rc, primary, table, influence); 119 143 //if it is the default value (1970-01-01 00:00:00), nothing is inserted into the database 120 144 if (deflt=="yes") 121 145 continue; … … 125 149 126 150 query+=Form(" WHERE %s='%s'", rc.GetValue(table+".Primary", ""), primary.Data()); 127 128 // cout << "query: " << query << endl;129 151 130 152 TSQLResult *res = serv.Query(query); … … 153 175 TEnv rc("steps.rc"); 154 176 177 //if reset is needed and/or can be done, set new values 155 178 return !CheckReset(rc, table, column, value) ? 0 : SetInfluences(serv, rc, primary, table, column, value, resetall); 156 179 -
trunk/MagicSoft/Mars/datacenter/macros/setupdb.C
r7427 r7459 1 // This macro is a macro to create the Magic Database. 2 // It is kept up to date, if any changes in the database are made. 3 1 4 #include <iomanip.h> 2 5 /* -
trunk/MagicSoft/Mars/datacenter/macros/writesequencefile.C
r7259 r7459 29 29 // =================== 30 30 // 31 // reads the sequence information from the database 32 // and writes it into a txt file 31 // reads the sequence information from the database and writes it into a 32 // txt file 33 // 34 // Usage: 35 // .x writesequencefile.C+(sequno,"sequpath") 36 // 37 // Make sure, that database and password are corretly set in a resource 38 // file called sql.rc and the resource file is found. 39 // 40 // Returns 0 in case of failure and 1 in case of success. 33 41 // 34 42 ///////////////////////////////////////////////////////////////////////////// … … 257 265 return kFALSE; 258 266 267 //create sequence file 259 268 TString fname(Form("%s/%04d/sequence%08d.txt", sequpath.Data(), atoi(data[0])/10000, atoi(data[0]))); 260 269 cout << "Creating " << fname << "..." << flush; … … 267 276 } 268 277 278 //write information into file 269 279 fout << "Sequence: " << data[0] << endl; 270 280 fout << "Period: " << period << endl; … … 289 299 data[0])); 290 300 301 //write runs into sequence file 291 302 if (!GetAllRuns(serv, fout, query)) 292 303 return kFALSE; … … 327 338 cout << endl; 328 339 340 //get sequence information from database 329 341 TString query(Form("SELECT fSequenceFirst, fSequenceLast, fProjectKEY, fSourceKEY," 330 342 " fL1TriggerTableKEY, fL2TriggerTableKEY, fHvSettingsKEY, "
Note:
See TracChangeset
for help on using the changeset viewer.