P.Gorbounov 1-5 November 2004 Updates: 10 Jan 2005 CBT-EC2 2004 e-logbook reader package ------------------------------------- History: 5 Nov 2004: Original release. Announced at the 16-Nov-2005 CBT-EC2 Analysis meeting. 10 Jan 2005: minor changes and bug fixes in the ReadSummary_t class. The Appendix with the class description is added to README. 0. Decription The original goal was to extract the Y-table height information from the CBT-EC2 electronic logbook and make this data available for reading from analysis codes (alignment, beam tracking etc). The main problem was the lack of standartization in the way the logbook data was entered. This was not an obstacle for a visual inspection, but in order to make the logbook computer-readable, a heavy manual editing was required. In the process of doing this, I decided to generalize the task and ended up with a self-contained C++ class RunSummary_t which can be used to acces any of ~30 different fields appearing in the logbook, plus a few derived items. Thus, the package can be used to store the run summary information in the appropriate data base. The e-logbook source files were taken from atllinux1-h6:/data0/logbooks/cbt2runsummary and edited into two plain text files: all.headers - one line (header) per run, with standardized values for such fields like run type and category, beam profile and, particularly, the shifter's commentary all.summaries - here the original run summary information, especially the comment line, is largely preserved and only a few fileds like Start/End time, Y1/Y2 and FEB temperatures are edited to make the style of numerical fields uniform. A lot of missing information has been added to these files from the hand-written logbook; obvious disrepancies and mistakes were fixed. The third input file, dictionary.txt, contains symbolic and numerical IDs for all these fields. The class itself is defined in the file h6elog.h. A stand-alone application for printing the logbook information is available as part of the package. Its installation is described in the next section. 1. Installation Create a local directory on your host and copy the tar-file /afs/cern.ch/user/p/petr/public/h6elog/h6elog.tgz (~200 KB) to this directory, then untar it with tar -xzf and install the application with make install The code will be compiled (it compiles and runs both with gcc 2.96 and 3.2.3) and a script ~/bin/h6elog will be created. Now you can delete the tar-file and use the logbook-printing application from any directory in your account. Alternatively, one can use the pre-installed AFS version by executing a script consisting of a single line: /afs/cern.ch/user/p/petr/public/h6elog/nr $* In that case, there is no need to copy the data files, but the execution will be slower because of reading over the network. The script's name can be any; let's assume it is "h6elog" All sources necessary for using h6log are in the same tar-file. 2. Usage Enter h6elog and get a brief help printout. The help prints the full pathname of the appication - it can be reduced to the script's name. Examples: h6elog 2000 will print the full logbook information about run 2000. h6elog dict will print the dictionary. This application is using numerical field IDs, to save the command line space. For example: h6elog all prints a full set of header fields, while h6elog all 1 5 3 6 37 will print the list of all runs, with only run type, run category, beam momentum and the comment per line, like: ... 4294 "Phys" "SP" "60" "point2=G x=0 y=-110 " 4295 "Phys" "SP" "60" "point2=G x=0 y=-110 " 4297 "Phys" "SP" "60" "point2=H x=0 y=-180 " 4298 "Phys" "SP" "60" "point2=H x=0 y=-180 " 4300 "Phys" "SP" "60" "point2=E x=+70 y=+80 " 4301 "Phys" "SP" "60" "point2=E x=+70 y=+80 " 4303 "Phys" "SP" "60" "point2=J x=+105 y=0" ... h3elog 37 will print only the Y1 value per run. 3. Further development The package is basically finished. Some futher work is needed to add several runs that were missing from the e-logbook and correct inconsistensies remaining in some fields (for example, I did not edit count rates and Bend9 fields at all, yet). I also want to add some redundancy for Y1- and Y2- values, by comparing the values in the summary and in the shifter's comment. The RunSummary_t constructor builds an index of the data files, so the initialization phase takes about a second. However, the data retrieval causes no overhead. I have no plans for further optimization. APPENDIX: Class RunSummary_t _____Constructor RunSummary_t(char *dir); dir: the pathname of the directory containing the files all.summaries, all.headers and dictionary.txt _____Methods int get(int runnum) ; To retrieve the run summary information for the run "runnum". Should be executed before accessing any info field for this run. The retrieved run becomes the 'current run' (see below). void print_summary() ; To print a detailed summary for the current run. NB: cout is used! string field(int k); Returns the string value of the field number "k". float Y1(); float Y2(); Y1/Y2 return numerical values of fields 37 and 38. Currently, the information is taken from the all.summaries only. It is planned to add the header comment information, for redundancy. -9999 is returned when no value was found. string SP(); SP returns the beam postion ID for runs in which this information is available. float beamMomentum(); Returns the numerical value of the beam momentum (or -9999). string daTime() {return this->field(0);} string runType() {return this->field(1);} string beamType() {return this->field(2);} string beamProfile() {return this->field(4);} string runCategory() {return this->field(5);} string comment() {return this->field(6);} char *key(string s) ; Returns the value of the field specified by symbolic name (see the field names in dictionary.txt). void pr_dict(); Prints the dictionary.